TlsCertificate.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using System.IO;
  5. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
  6. using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
  7. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.Crypto
  8. {
  9. /// <summary>Interface providing the functional representation of a single X.509 certificate.</summary>
  10. public interface TlsCertificate
  11. {
  12. /// <summary>Return an encryptor based on the public key in this certificate.</summary>
  13. /// <param name="tlsCertificateRole"><see cref="TlsCertificateRole"/></param>
  14. /// <returns>a <see cref="TlsEncryptor"/> based on this certificate's public key.</returns>
  15. /// <exception cref="IOException"/>
  16. TlsEncryptor CreateEncryptor(int tlsCertificateRole);
  17. /// <param name="signatureAlgorithm"><see cref="SignatureAlgorithm"/></param>
  18. /// <exception cref="IOException"/>
  19. TlsVerifier CreateVerifier(short signatureAlgorithm);
  20. /// <param name="signatureScheme"><see cref="SignatureScheme"/></param>
  21. /// <exception cref="IOException"/>
  22. TlsVerifier CreateVerifier(int signatureScheme);
  23. /// <exception cref="IOException"/>
  24. byte[] GetEncoded();
  25. /// <exception cref="IOException"/>
  26. byte[] GetExtension(DerObjectIdentifier extensionOid);
  27. BigInteger SerialNumber { get; }
  28. /// <returns>the OID of this certificate's 'signatureAlgorithm', as a string.</returns>
  29. string SigAlgOid { get; }
  30. /// <exception cref="IOException"/>
  31. Asn1Encodable GetSigAlgParams();
  32. /// <returns><see cref="SignatureAlgorithm"/></returns>
  33. /// <exception cref="IOException"/>
  34. short GetLegacySignatureAlgorithm();
  35. /// <param name="signatureAlgorithm"><see cref="SignatureAlgorithm"/></param>
  36. /// <returns>true if (and only if) this certificate can be used to verify the given signature algorithm.
  37. /// </returns>
  38. /// <exception cref="IOException"/>
  39. bool SupportsSignatureAlgorithm(short signatureAlgorithm);
  40. /// <exception cref="IOException"/>
  41. bool SupportsSignatureAlgorithmCA(short signatureAlgorithm);
  42. /// <param name="tlsCertificateRole"><see cref="TlsCertificateRole"/></param>
  43. /// <exception cref="IOException"/>
  44. TlsCertificate CheckUsageInRole(int tlsCertificateRole);
  45. }
  46. }
  47. #pragma warning restore
  48. #endif