BcTlsEd448Signer.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
  5. using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers;
  6. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.Crypto.Impl.BC
  7. {
  8. public class BcTlsEd448Signer
  9. : BcTlsSigner
  10. {
  11. public BcTlsEd448Signer(BcTlsCrypto crypto, Ed448PrivateKeyParameters privateKey)
  12. : base(crypto, privateKey)
  13. {
  14. }
  15. public override byte[] GenerateRawSignature(SignatureAndHashAlgorithm algorithm, byte[] hash)
  16. {
  17. throw new NotSupportedException();
  18. }
  19. public override TlsStreamSigner GetStreamSigner(SignatureAndHashAlgorithm algorithm)
  20. {
  21. if (algorithm == null || SignatureScheme.From(algorithm) != SignatureScheme.ed448)
  22. throw new InvalidOperationException("Invalid algorithm: " + algorithm);
  23. Ed448Signer signer = new Ed448Signer(TlsUtilities.EmptyBytes);
  24. signer.Init(true, m_privateKey);
  25. return new BcTlsStreamSigner(signer);
  26. }
  27. }
  28. }
  29. #pragma warning restore
  30. #endif