Asn1Signature.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using System.Collections;
  5. using System.IO;
  6. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
  7. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.CryptoPro;
  8. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Nist;
  9. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Oiw;
  10. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
  11. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.TeleTrust;
  12. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
  13. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X9;
  14. using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.IO;
  15. using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
  16. using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers;
  17. using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
  18. using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
  19. using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Collections;
  20. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Operators
  21. {
  22. internal class X509Utilities
  23. {
  24. private static readonly Asn1Null derNull = DerNull.Instance;
  25. private static readonly IDictionary algorithms = BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.CreateHashtable();
  26. private static readonly IDictionary exParams = BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.CreateHashtable();
  27. private static readonly ISet noParams = new HashSet();
  28. static X509Utilities()
  29. {
  30. algorithms.Add("MD2WITHRSAENCRYPTION", PkcsObjectIdentifiers.MD2WithRsaEncryption);
  31. algorithms.Add("MD2WITHRSA", PkcsObjectIdentifiers.MD2WithRsaEncryption);
  32. algorithms.Add("MD5WITHRSAENCRYPTION", PkcsObjectIdentifiers.MD5WithRsaEncryption);
  33. algorithms.Add("MD5WITHRSA", PkcsObjectIdentifiers.MD5WithRsaEncryption);
  34. algorithms.Add("SHA1WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha1WithRsaEncryption);
  35. algorithms.Add("SHA-1WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha1WithRsaEncryption);
  36. algorithms.Add("SHA1WITHRSA", PkcsObjectIdentifiers.Sha1WithRsaEncryption);
  37. algorithms.Add("SHA-1WITHRSA", PkcsObjectIdentifiers.Sha1WithRsaEncryption);
  38. algorithms.Add("SHA224WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha224WithRsaEncryption);
  39. algorithms.Add("SHA-224WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha224WithRsaEncryption);
  40. algorithms.Add("SHA224WITHRSA", PkcsObjectIdentifiers.Sha224WithRsaEncryption);
  41. algorithms.Add("SHA-224WITHRSA", PkcsObjectIdentifiers.Sha224WithRsaEncryption);
  42. algorithms.Add("SHA256WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha256WithRsaEncryption);
  43. algorithms.Add("SHA-256WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha256WithRsaEncryption);
  44. algorithms.Add("SHA256WITHRSA", PkcsObjectIdentifiers.Sha256WithRsaEncryption);
  45. algorithms.Add("SHA-256WITHRSA", PkcsObjectIdentifiers.Sha256WithRsaEncryption);
  46. algorithms.Add("SHA384WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha384WithRsaEncryption);
  47. algorithms.Add("SHA-384WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha384WithRsaEncryption);
  48. algorithms.Add("SHA384WITHRSA", PkcsObjectIdentifiers.Sha384WithRsaEncryption);
  49. algorithms.Add("SHA-384WITHRSA", PkcsObjectIdentifiers.Sha384WithRsaEncryption);
  50. algorithms.Add("SHA512WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha512WithRsaEncryption);
  51. algorithms.Add("SHA-512WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha512WithRsaEncryption);
  52. algorithms.Add("SHA512WITHRSA", PkcsObjectIdentifiers.Sha512WithRsaEncryption);
  53. algorithms.Add("SHA-512WITHRSA", PkcsObjectIdentifiers.Sha512WithRsaEncryption);
  54. algorithms.Add("SHA512(224)WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha512_224WithRSAEncryption);
  55. algorithms.Add("SHA-512(224)WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha512_224WithRSAEncryption);
  56. algorithms.Add("SHA512(224)WITHRSA", PkcsObjectIdentifiers.Sha512_224WithRSAEncryption);
  57. algorithms.Add("SHA-512(224)WITHRSA", PkcsObjectIdentifiers.Sha512_224WithRSAEncryption);
  58. algorithms.Add("SHA512(256)WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha512_256WithRSAEncryption);
  59. algorithms.Add("SHA-512(256)WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha512_256WithRSAEncryption);
  60. algorithms.Add("SHA512(256)WITHRSA", PkcsObjectIdentifiers.Sha512_256WithRSAEncryption);
  61. algorithms.Add("SHA-512(256)WITHRSA", PkcsObjectIdentifiers.Sha512_256WithRSAEncryption);
  62. algorithms.Add("SHA3-224WITHRSAENCRYPTION", NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_224);
  63. algorithms.Add("SHA3-256WITHRSAENCRYPTION", NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_256);
  64. algorithms.Add("SHA3-384WITHRSAENCRYPTION", NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_384);
  65. algorithms.Add("SHA3-512WITHRSAENCRYPTION", NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_512);
  66. algorithms.Add("SHA3-224WITHRSA", NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_224);
  67. algorithms.Add("SHA3-256WITHRSA", NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_256);
  68. algorithms.Add("SHA3-384WITHRSA", NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_384);
  69. algorithms.Add("SHA3-512WITHRSA", NistObjectIdentifiers.IdRsassaPkcs1V15WithSha3_512);
  70. algorithms.Add("SHA1WITHRSAANDMGF1", PkcsObjectIdentifiers.IdRsassaPss);
  71. algorithms.Add("SHA224WITHRSAANDMGF1", PkcsObjectIdentifiers.IdRsassaPss);
  72. algorithms.Add("SHA256WITHRSAANDMGF1", PkcsObjectIdentifiers.IdRsassaPss);
  73. algorithms.Add("SHA384WITHRSAANDMGF1", PkcsObjectIdentifiers.IdRsassaPss);
  74. algorithms.Add("SHA512WITHRSAANDMGF1", PkcsObjectIdentifiers.IdRsassaPss);
  75. algorithms.Add("RIPEMD160WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD160);
  76. algorithms.Add("RIPEMD160WITHRSA", TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD160);
  77. algorithms.Add("RIPEMD128WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD128);
  78. algorithms.Add("RIPEMD128WITHRSA", TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD128);
  79. algorithms.Add("RIPEMD256WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD256);
  80. algorithms.Add("RIPEMD256WITHRSA", TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD256);
  81. algorithms.Add("SHA1WITHDSA", X9ObjectIdentifiers.IdDsaWithSha1);
  82. algorithms.Add("DSAWITHSHA1", X9ObjectIdentifiers.IdDsaWithSha1);
  83. algorithms.Add("SHA224WITHDSA", NistObjectIdentifiers.DsaWithSha224);
  84. algorithms.Add("SHA256WITHDSA", NistObjectIdentifiers.DsaWithSha256);
  85. algorithms.Add("SHA384WITHDSA", NistObjectIdentifiers.DsaWithSha384);
  86. algorithms.Add("SHA512WITHDSA", NistObjectIdentifiers.DsaWithSha512);
  87. algorithms.Add("SHA1WITHECDSA", X9ObjectIdentifiers.ECDsaWithSha1);
  88. algorithms.Add("ECDSAWITHSHA1", X9ObjectIdentifiers.ECDsaWithSha1);
  89. algorithms.Add("SHA224WITHECDSA", X9ObjectIdentifiers.ECDsaWithSha224);
  90. algorithms.Add("SHA256WITHECDSA", X9ObjectIdentifiers.ECDsaWithSha256);
  91. algorithms.Add("SHA384WITHECDSA", X9ObjectIdentifiers.ECDsaWithSha384);
  92. algorithms.Add("SHA512WITHECDSA", X9ObjectIdentifiers.ECDsaWithSha512);
  93. algorithms.Add("GOST3411WITHGOST3410", CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x94);
  94. algorithms.Add("GOST3411WITHGOST3410-94", CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x94);
  95. algorithms.Add("GOST3411WITHECGOST3410", CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001);
  96. algorithms.Add("GOST3411WITHECGOST3410-2001", CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001);
  97. algorithms.Add("GOST3411WITHGOST3410-2001", CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001);
  98. //
  99. // According to RFC 3279, the ASN.1 encoding SHALL (id-dsa-with-sha1) or MUST (ecdsa-with-SHA*) omit the parameters field.
  100. // The parameters field SHALL be NULL for RSA based signature algorithms.
  101. //
  102. noParams.Add(X9ObjectIdentifiers.ECDsaWithSha1);
  103. noParams.Add(X9ObjectIdentifiers.ECDsaWithSha224);
  104. noParams.Add(X9ObjectIdentifiers.ECDsaWithSha256);
  105. noParams.Add(X9ObjectIdentifiers.ECDsaWithSha384);
  106. noParams.Add(X9ObjectIdentifiers.ECDsaWithSha512);
  107. noParams.Add(X9ObjectIdentifiers.IdDsaWithSha1);
  108. noParams.Add(OiwObjectIdentifiers.DsaWithSha1);
  109. noParams.Add(NistObjectIdentifiers.DsaWithSha224);
  110. noParams.Add(NistObjectIdentifiers.DsaWithSha256);
  111. noParams.Add(NistObjectIdentifiers.DsaWithSha384);
  112. noParams.Add(NistObjectIdentifiers.DsaWithSha512);
  113. //
  114. // RFC 4491
  115. //
  116. noParams.Add(CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x94);
  117. noParams.Add(CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001);
  118. //
  119. // explicit params
  120. //
  121. AlgorithmIdentifier sha1AlgId = new AlgorithmIdentifier(OiwObjectIdentifiers.IdSha1, DerNull.Instance);
  122. exParams.Add("SHA1WITHRSAANDMGF1", CreatePssParams(sha1AlgId, 20));
  123. AlgorithmIdentifier sha224AlgId = new AlgorithmIdentifier(NistObjectIdentifiers.IdSha224, DerNull.Instance);
  124. exParams.Add("SHA224WITHRSAANDMGF1", CreatePssParams(sha224AlgId, 28));
  125. AlgorithmIdentifier sha256AlgId = new AlgorithmIdentifier(NistObjectIdentifiers.IdSha256, DerNull.Instance);
  126. exParams.Add("SHA256WITHRSAANDMGF1", CreatePssParams(sha256AlgId, 32));
  127. AlgorithmIdentifier sha384AlgId = new AlgorithmIdentifier(NistObjectIdentifiers.IdSha384, DerNull.Instance);
  128. exParams.Add("SHA384WITHRSAANDMGF1", CreatePssParams(sha384AlgId, 48));
  129. AlgorithmIdentifier sha512AlgId = new AlgorithmIdentifier(NistObjectIdentifiers.IdSha512, DerNull.Instance);
  130. exParams.Add("SHA512WITHRSAANDMGF1", CreatePssParams(sha512AlgId, 64));
  131. }
  132. /**
  133. * Return the digest algorithm using one of the standard JCA string
  134. * representations rather than the algorithm identifier (if possible).
  135. */
  136. private static string GetDigestAlgName(
  137. DerObjectIdentifier digestAlgOID)
  138. {
  139. if (PkcsObjectIdentifiers.MD5.Equals(digestAlgOID))
  140. {
  141. return "MD5";
  142. }
  143. else if (OiwObjectIdentifiers.IdSha1.Equals(digestAlgOID))
  144. {
  145. return "SHA1";
  146. }
  147. else if (NistObjectIdentifiers.IdSha224.Equals(digestAlgOID))
  148. {
  149. return "SHA224";
  150. }
  151. else if (NistObjectIdentifiers.IdSha256.Equals(digestAlgOID))
  152. {
  153. return "SHA256";
  154. }
  155. else if (NistObjectIdentifiers.IdSha384.Equals(digestAlgOID))
  156. {
  157. return "SHA384";
  158. }
  159. else if (NistObjectIdentifiers.IdSha512.Equals(digestAlgOID))
  160. {
  161. return "SHA512";
  162. }
  163. else if (NistObjectIdentifiers.IdSha512_224.Equals(digestAlgOID))
  164. {
  165. return "SHA512(224)";
  166. }
  167. else if (NistObjectIdentifiers.IdSha512_256.Equals(digestAlgOID))
  168. {
  169. return "SHA512(256)";
  170. }
  171. else if (TeleTrusTObjectIdentifiers.RipeMD128.Equals(digestAlgOID))
  172. {
  173. return "RIPEMD128";
  174. }
  175. else if (TeleTrusTObjectIdentifiers.RipeMD160.Equals(digestAlgOID))
  176. {
  177. return "RIPEMD160";
  178. }
  179. else if (TeleTrusTObjectIdentifiers.RipeMD256.Equals(digestAlgOID))
  180. {
  181. return "RIPEMD256";
  182. }
  183. else if (CryptoProObjectIdentifiers.GostR3411.Equals(digestAlgOID))
  184. {
  185. return "GOST3411";
  186. }
  187. else
  188. {
  189. return digestAlgOID.Id;
  190. }
  191. }
  192. internal static string GetSignatureName(AlgorithmIdentifier sigAlgId)
  193. {
  194. Asn1Encodable parameters = sigAlgId.Parameters;
  195. if (parameters != null && !derNull.Equals(parameters))
  196. {
  197. if (sigAlgId.Algorithm.Equals(PkcsObjectIdentifiers.IdRsassaPss))
  198. {
  199. RsassaPssParameters rsaParams = RsassaPssParameters.GetInstance(parameters);
  200. return GetDigestAlgName(rsaParams.HashAlgorithm.Algorithm) + "withRSAandMGF1";
  201. }
  202. if (sigAlgId.Algorithm.Equals(X9ObjectIdentifiers.ECDsaWithSha2))
  203. {
  204. Asn1Sequence ecDsaParams = Asn1Sequence.GetInstance(parameters);
  205. return GetDigestAlgName((DerObjectIdentifier)ecDsaParams[0]) + "withECDSA";
  206. }
  207. }
  208. return sigAlgId.Algorithm.Id;
  209. }
  210. private static RsassaPssParameters CreatePssParams(
  211. AlgorithmIdentifier hashAlgId,
  212. int saltSize)
  213. {
  214. return new RsassaPssParameters(
  215. hashAlgId,
  216. new AlgorithmIdentifier(PkcsObjectIdentifiers.IdMgf1, hashAlgId),
  217. new DerInteger(saltSize),
  218. new DerInteger(1));
  219. }
  220. internal static DerObjectIdentifier GetAlgorithmOid(
  221. string algorithmName)
  222. {
  223. algorithmName = BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.ToUpperInvariant(algorithmName);
  224. if (algorithms.Contains(algorithmName))
  225. {
  226. return (DerObjectIdentifier) algorithms[algorithmName];
  227. }
  228. return new DerObjectIdentifier(algorithmName);
  229. }
  230. internal static AlgorithmIdentifier GetSigAlgID(
  231. DerObjectIdentifier sigOid,
  232. string algorithmName)
  233. {
  234. if (noParams.Contains(sigOid))
  235. {
  236. return new AlgorithmIdentifier(sigOid);
  237. }
  238. algorithmName = BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.ToUpperInvariant(algorithmName);
  239. if (exParams.Contains(algorithmName))
  240. {
  241. return new AlgorithmIdentifier(sigOid, (Asn1Encodable) exParams[algorithmName]);
  242. }
  243. return new AlgorithmIdentifier(sigOid, DerNull.Instance);
  244. }
  245. internal static IEnumerable GetAlgNames()
  246. {
  247. return new EnumerableProxy(algorithms.Keys);
  248. }
  249. }
  250. /// <summary>
  251. /// Calculator factory class for signature generation in ASN.1 based profiles that use an AlgorithmIdentifier to preserve
  252. /// signature algorithm details.
  253. /// </summary>
  254. public class Asn1SignatureFactory
  255. : ISignatureFactory
  256. {
  257. private readonly AlgorithmIdentifier algID;
  258. private readonly string algorithm;
  259. private readonly AsymmetricKeyParameter privateKey;
  260. private readonly SecureRandom random;
  261. /// <summary>
  262. /// Base constructor.
  263. /// </summary>
  264. /// <param name="algorithm">The name of the signature algorithm to use.</param>
  265. /// <param name="privateKey">The private key to be used in the signing operation.</param>
  266. public Asn1SignatureFactory (string algorithm, AsymmetricKeyParameter privateKey)
  267. : this(algorithm, privateKey, null)
  268. {
  269. }
  270. /// <summary>
  271. /// Constructor which also specifies a source of randomness to be used if one is required.
  272. /// </summary>
  273. /// <param name="algorithm">The name of the signature algorithm to use.</param>
  274. /// <param name="privateKey">The private key to be used in the signing operation.</param>
  275. /// <param name="random">The source of randomness to be used in signature calculation.</param>
  276. public Asn1SignatureFactory(string algorithm, AsymmetricKeyParameter privateKey, SecureRandom random)
  277. {
  278. if (algorithm == null)
  279. throw new ArgumentNullException("algorithm");
  280. if (privateKey == null)
  281. throw new ArgumentNullException("privateKey");
  282. if (!privateKey.IsPrivate)
  283. throw new ArgumentException("Key for signing must be private", "privateKey");
  284. DerObjectIdentifier sigOid = X509Utilities.GetAlgorithmOid(algorithm);
  285. this.algorithm = algorithm;
  286. this.privateKey = privateKey;
  287. this.random = random;
  288. this.algID = X509Utilities.GetSigAlgID(sigOid, algorithm);
  289. }
  290. public Object AlgorithmDetails
  291. {
  292. get { return this.algID; }
  293. }
  294. public IStreamCalculator CreateCalculator()
  295. {
  296. ISigner signer = SignerUtilities.InitSigner(algorithm, true, privateKey, random);
  297. return new DefaultSignatureCalculator(signer);
  298. }
  299. /// <summary>
  300. /// Allows enumeration of the signature names supported by the verifier provider.
  301. /// </summary>
  302. public static IEnumerable SignatureAlgNames
  303. {
  304. get { return X509Utilities.GetAlgNames(); }
  305. }
  306. }
  307. /// <summary>
  308. /// Verifier class for signature verification in ASN.1 based profiles that use an AlgorithmIdentifier to preserve
  309. /// signature algorithm details.
  310. /// </summary>
  311. public class Asn1VerifierFactory
  312. : IVerifierFactory
  313. {
  314. private readonly AlgorithmIdentifier algID;
  315. private readonly AsymmetricKeyParameter publicKey;
  316. /// <summary>
  317. /// Base constructor.
  318. /// </summary>
  319. /// <param name="algorithm">The name of the signature algorithm to use.</param>
  320. /// <param name="publicKey">The public key to be used in the verification operation.</param>
  321. public Asn1VerifierFactory(string algorithm, AsymmetricKeyParameter publicKey)
  322. {
  323. if (algorithm == null)
  324. throw new ArgumentNullException("algorithm");
  325. if (publicKey == null)
  326. throw new ArgumentNullException("publicKey");
  327. if (publicKey.IsPrivate)
  328. throw new ArgumentException("Key for verifying must be public", "publicKey");
  329. DerObjectIdentifier sigOid = X509Utilities.GetAlgorithmOid(algorithm);
  330. this.publicKey = publicKey;
  331. this.algID = X509Utilities.GetSigAlgID(sigOid, algorithm);
  332. }
  333. public Asn1VerifierFactory(AlgorithmIdentifier algorithm, AsymmetricKeyParameter publicKey)
  334. {
  335. this.publicKey = publicKey;
  336. this.algID = algorithm;
  337. }
  338. public Object AlgorithmDetails
  339. {
  340. get { return this.algID; }
  341. }
  342. public IStreamCalculator CreateCalculator()
  343. {
  344. ISigner verifier = SignerUtilities.InitSigner(X509Utilities.GetSignatureName(algID), false, publicKey, null);
  345. return new DefaultVerifierCalculator(verifier);
  346. }
  347. }
  348. /// <summary>
  349. /// Provider class which supports dynamic creation of signature verifiers.
  350. /// </summary>
  351. public class Asn1VerifierFactoryProvider: IVerifierFactoryProvider
  352. {
  353. private readonly AsymmetricKeyParameter publicKey;
  354. /// <summary>
  355. /// Base constructor - specify the public key to be used in verification.
  356. /// </summary>
  357. /// <param name="publicKey">The public key to be used in creating verifiers provided by this object.</param>
  358. public Asn1VerifierFactoryProvider(AsymmetricKeyParameter publicKey)
  359. {
  360. this.publicKey = publicKey;
  361. }
  362. public IVerifierFactory CreateVerifierFactory(Object algorithmDetails)
  363. {
  364. return new Asn1VerifierFactory((AlgorithmIdentifier)algorithmDetails, publicKey);
  365. }
  366. /// <summary>
  367. /// Allows enumeration of the signature names supported by the verifier provider.
  368. /// </summary>
  369. public IEnumerable SignatureAlgNames
  370. {
  371. get { return X509Utilities.GetAlgNames(); }
  372. }
  373. }
  374. }
  375. #pragma warning restore
  376. #endif