BcTlsSigner.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
  5. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.Crypto.Impl.BC
  6. {
  7. public abstract class BcTlsSigner
  8. : TlsSigner
  9. {
  10. protected readonly BcTlsCrypto m_crypto;
  11. protected readonly AsymmetricKeyParameter m_privateKey;
  12. protected BcTlsSigner(BcTlsCrypto crypto, AsymmetricKeyParameter privateKey)
  13. {
  14. if (crypto == null)
  15. throw new ArgumentNullException("crypto");
  16. if (privateKey == null)
  17. throw new ArgumentNullException("privateKey");
  18. if (!privateKey.IsPrivate)
  19. throw new ArgumentException("must be private", "privateKey");
  20. this.m_crypto = crypto;
  21. this.m_privateKey = privateKey;
  22. }
  23. public abstract byte[] GenerateRawSignature(SignatureAndHashAlgorithm algorithm, byte[] hash);
  24. public virtual TlsStreamSigner GetStreamSigner(SignatureAndHashAlgorithm algorithm)
  25. {
  26. return null;
  27. }
  28. }
  29. }
  30. #pragma warning restore
  31. #endif