TlsECDsaSigner.cs 876 B

123456789101112131415161718192021222324252627282930
  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.Crypto.Tls
  7. {
  8. public class TlsECDsaSigner
  9. : TlsDsaSigner
  10. {
  11. public override bool IsValidPublicKey(AsymmetricKeyParameter publicKey)
  12. {
  13. return publicKey is ECPublicKeyParameters;
  14. }
  15. protected override IDsa CreateDsaImpl(byte hashAlgorithm)
  16. {
  17. return new ECDsaSigner(new HMacDsaKCalculator(TlsUtilities.CreateHash(hashAlgorithm)));
  18. }
  19. protected override byte SignatureAlgorithm
  20. {
  21. get { return Tls.SignatureAlgorithm.ecdsa; }
  22. }
  23. }
  24. }
  25. #pragma warning restore
  26. #endif