コード例 #1
0
 static CmsSignedHelper()
 {
     Instance = new CmsSignedHelper();
     EncryptionECDsaWithSha1   = X9ObjectIdentifiers.ECDsaWithSha1.Id;
     EncryptionECDsaWithSha224 = X9ObjectIdentifiers.ECDsaWithSha224.Id;
     EncryptionECDsaWithSha256 = X9ObjectIdentifiers.ECDsaWithSha256.Id;
     EncryptionECDsaWithSha384 = X9ObjectIdentifiers.ECDsaWithSha384.Id;
     EncryptionECDsaWithSha512 = X9ObjectIdentifiers.ECDsaWithSha512.Id;
     encryptionAlgs            = Platform.CreateHashtable();
     digestAlgs    = Platform.CreateHashtable();
     digestAliases = Platform.CreateHashtable();
     noParams      = new HashSet();
     ecAlgorithms  = Platform.CreateHashtable();
     AddEntries(NistObjectIdentifiers.DsaWithSha224, "SHA224", "DSA");
     AddEntries(NistObjectIdentifiers.DsaWithSha256, "SHA256", "DSA");
     AddEntries(NistObjectIdentifiers.DsaWithSha384, "SHA384", "DSA");
     AddEntries(NistObjectIdentifiers.DsaWithSha512, "SHA512", "DSA");
     AddEntries(OiwObjectIdentifiers.DsaWithSha1, "SHA1", "DSA");
     AddEntries(OiwObjectIdentifiers.MD4WithRsa, "MD4", "RSA");
     AddEntries(OiwObjectIdentifiers.MD4WithRsaEncryption, "MD4", "RSA");
     AddEntries(OiwObjectIdentifiers.MD5WithRsa, "MD5", "RSA");
     AddEntries(OiwObjectIdentifiers.Sha1WithRsa, "SHA1", "RSA");
     AddEntries(PkcsObjectIdentifiers.MD2WithRsaEncryption, "MD2", "RSA");
     AddEntries(PkcsObjectIdentifiers.MD4WithRsaEncryption, "MD4", "RSA");
     AddEntries(PkcsObjectIdentifiers.MD5WithRsaEncryption, "MD5", "RSA");
     AddEntries(PkcsObjectIdentifiers.Sha1WithRsaEncryption, "SHA1", "RSA");
     AddEntries(PkcsObjectIdentifiers.Sha224WithRsaEncryption, "SHA224", "RSA");
     AddEntries(PkcsObjectIdentifiers.Sha256WithRsaEncryption, "SHA256", "RSA");
     AddEntries(PkcsObjectIdentifiers.Sha384WithRsaEncryption, "SHA384", "RSA");
     AddEntries(PkcsObjectIdentifiers.Sha512WithRsaEncryption, "SHA512", "RSA");
     AddEntries(X9ObjectIdentifiers.ECDsaWithSha1, "SHA1", "ECDSA");
     AddEntries(X9ObjectIdentifiers.ECDsaWithSha224, "SHA224", "ECDSA");
     AddEntries(X9ObjectIdentifiers.ECDsaWithSha256, "SHA256", "ECDSA");
     AddEntries(X9ObjectIdentifiers.ECDsaWithSha384, "SHA384", "ECDSA");
     AddEntries(X9ObjectIdentifiers.ECDsaWithSha512, "SHA512", "ECDSA");
     AddEntries(X9ObjectIdentifiers.IdDsaWithSha1, "SHA1", "DSA");
     AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_1, "SHA1", "ECDSA");
     AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_224, "SHA224", "ECDSA");
     AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_256, "SHA256", "ECDSA");
     AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_384, "SHA384", "ECDSA");
     AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_512, "SHA512", "ECDSA");
     AddEntries(EacObjectIdentifiers.id_TA_RSA_v1_5_SHA_1, "SHA1", "RSA");
     AddEntries(EacObjectIdentifiers.id_TA_RSA_v1_5_SHA_256, "SHA256", "RSA");
     AddEntries(EacObjectIdentifiers.id_TA_RSA_PSS_SHA_1, "SHA1", "RSAandMGF1");
     AddEntries(EacObjectIdentifiers.id_TA_RSA_PSS_SHA_256, "SHA256", "RSAandMGF1");
     encryptionAlgs.Add((object)X9ObjectIdentifiers.IdDsa.Id, (object)"DSA");
     encryptionAlgs.Add((object)PkcsObjectIdentifiers.RsaEncryption.Id, (object)"RSA");
     encryptionAlgs.Add((object)TeleTrusTObjectIdentifiers.TeleTrusTRsaSignatureAlgorithm, (object)"RSA");
     encryptionAlgs.Add((object)X509ObjectIdentifiers.IdEARsa.Id, (object)"RSA");
     encryptionAlgs.Add((object)CmsSignedGenerator.EncryptionRsaPss, (object)"RSAandMGF1");
     encryptionAlgs.Add((object)CryptoProObjectIdentifiers.GostR3410x94.Id, (object)"GOST3410");
     encryptionAlgs.Add((object)CryptoProObjectIdentifiers.GostR3410x2001.Id, (object)"ECGOST3410");
     encryptionAlgs.Add((object)"1.3.6.1.4.1.5849.1.6.2", (object)"ECGOST3410");
     encryptionAlgs.Add((object)"1.3.6.1.4.1.5849.1.1.5", (object)"GOST3410");
     digestAlgs.Add((object)PkcsObjectIdentifiers.MD2.Id, (object)"MD2");
     digestAlgs.Add((object)PkcsObjectIdentifiers.MD4.Id, (object)"MD4");
     digestAlgs.Add((object)PkcsObjectIdentifiers.MD5.Id, (object)"MD5");
     digestAlgs.Add((object)OiwObjectIdentifiers.IdSha1.Id, (object)"SHA1");
     digestAlgs.Add((object)NistObjectIdentifiers.IdSha224.Id, (object)"SHA224");
     digestAlgs.Add((object)NistObjectIdentifiers.IdSha256.Id, (object)"SHA256");
     digestAlgs.Add((object)NistObjectIdentifiers.IdSha384.Id, (object)"SHA384");
     digestAlgs.Add((object)NistObjectIdentifiers.IdSha512.Id, (object)"SHA512");
     digestAlgs.Add((object)TeleTrusTObjectIdentifiers.RipeMD128.Id, (object)"RIPEMD128");
     digestAlgs.Add((object)TeleTrusTObjectIdentifiers.RipeMD160.Id, (object)"RIPEMD160");
     digestAlgs.Add((object)TeleTrusTObjectIdentifiers.RipeMD256.Id, (object)"RIPEMD256");
     digestAlgs.Add((object)CryptoProObjectIdentifiers.GostR3411.Id, (object)"GOST3411");
     digestAlgs.Add((object)"1.3.6.1.4.1.5849.1.2.1", (object)"GOST3411");
     digestAliases.Add((object)"SHA1", (object)new string[1] {
         "SHA-1"
     });
     digestAliases.Add((object)"SHA224", (object)new string[1] {
         "SHA-224"
     });
     digestAliases.Add((object)"SHA256", (object)new string[1] {
         "SHA-256"
     });
     digestAliases.Add((object)"SHA384", (object)new string[1] {
         "SHA-384"
     });
     digestAliases.Add((object)"SHA512", (object)new string[1] {
         "SHA-512"
     });
     noParams.Add(CmsSignedGenerator.EncryptionDsa);
     noParams.Add(EncryptionECDsaWithSha1);
     noParams.Add(EncryptionECDsaWithSha224);
     noParams.Add(EncryptionECDsaWithSha256);
     noParams.Add(EncryptionECDsaWithSha384);
     noParams.Add(EncryptionECDsaWithSha512);
     ecAlgorithms.Add((object)CmsSignedGenerator.DigestSha1, (object)EncryptionECDsaWithSha1);
     ecAlgorithms.Add((object)CmsSignedGenerator.DigestSha224, (object)EncryptionECDsaWithSha224);
     ecAlgorithms.Add((object)CmsSignedGenerator.DigestSha256, (object)EncryptionECDsaWithSha256);
     ecAlgorithms.Add((object)CmsSignedGenerator.DigestSha384, (object)EncryptionECDsaWithSha384);
     ecAlgorithms.Add((object)CmsSignedGenerator.DigestSha512, (object)EncryptionECDsaWithSha512);
 }
コード例 #2
0
 static CmsSignedHelper()
 {
     CmsSignedHelper.Instance       = new CmsSignedHelper();
     CmsSignedHelper.encryptionAlgs = Platform.CreateHashtable();
     CmsSignedHelper.digestAlgs     = Platform.CreateHashtable();
     CmsSignedHelper.digestAliases  = Platform.CreateHashtable();
     CmsSignedHelper.AddEntries(NistObjectIdentifiers.DsaWithSha224, "SHA224", "DSA");
     CmsSignedHelper.AddEntries(NistObjectIdentifiers.DsaWithSha256, "SHA256", "DSA");
     CmsSignedHelper.AddEntries(NistObjectIdentifiers.DsaWithSha384, "SHA384", "DSA");
     CmsSignedHelper.AddEntries(NistObjectIdentifiers.DsaWithSha512, "SHA512", "DSA");
     CmsSignedHelper.AddEntries(OiwObjectIdentifiers.DsaWithSha1, "SHA1", "DSA");
     CmsSignedHelper.AddEntries(OiwObjectIdentifiers.MD4WithRsa, "MD4", "RSA");
     CmsSignedHelper.AddEntries(OiwObjectIdentifiers.MD4WithRsaEncryption, "MD4", "RSA");
     CmsSignedHelper.AddEntries(OiwObjectIdentifiers.MD5WithRsa, "MD5", "RSA");
     CmsSignedHelper.AddEntries(OiwObjectIdentifiers.Sha1WithRsa, "SHA1", "RSA");
     CmsSignedHelper.AddEntries(PkcsObjectIdentifiers.MD2WithRsaEncryption, "MD2", "RSA");
     CmsSignedHelper.AddEntries(PkcsObjectIdentifiers.MD4WithRsaEncryption, "MD4", "RSA");
     CmsSignedHelper.AddEntries(PkcsObjectIdentifiers.MD5WithRsaEncryption, "MD5", "RSA");
     CmsSignedHelper.AddEntries(PkcsObjectIdentifiers.Sha1WithRsaEncryption, "SHA1", "RSA");
     CmsSignedHelper.AddEntries(PkcsObjectIdentifiers.Sha224WithRsaEncryption, "SHA224", "RSA");
     CmsSignedHelper.AddEntries(PkcsObjectIdentifiers.Sha256WithRsaEncryption, "SHA256", "RSA");
     CmsSignedHelper.AddEntries(PkcsObjectIdentifiers.Sha384WithRsaEncryption, "SHA384", "RSA");
     CmsSignedHelper.AddEntries(PkcsObjectIdentifiers.Sha512WithRsaEncryption, "SHA512", "RSA");
     CmsSignedHelper.AddEntries(X9ObjectIdentifiers.ECDsaWithSha1, "SHA1", "ECDSA");
     CmsSignedHelper.AddEntries(X9ObjectIdentifiers.ECDsaWithSha224, "SHA224", "ECDSA");
     CmsSignedHelper.AddEntries(X9ObjectIdentifiers.ECDsaWithSha256, "SHA256", "ECDSA");
     CmsSignedHelper.AddEntries(X9ObjectIdentifiers.ECDsaWithSha384, "SHA384", "ECDSA");
     CmsSignedHelper.AddEntries(X9ObjectIdentifiers.ECDsaWithSha512, "SHA512", "ECDSA");
     CmsSignedHelper.AddEntries(X9ObjectIdentifiers.IdDsaWithSha1, "SHA1", "DSA");
     CmsSignedHelper.AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_1, "SHA1", "ECDSA");
     CmsSignedHelper.AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_224, "SHA224", "ECDSA");
     CmsSignedHelper.AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_256, "SHA256", "ECDSA");
     CmsSignedHelper.AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_384, "SHA384", "ECDSA");
     CmsSignedHelper.AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_512, "SHA512", "ECDSA");
     CmsSignedHelper.AddEntries(EacObjectIdentifiers.id_TA_RSA_v1_5_SHA_1, "SHA1", "RSA");
     CmsSignedHelper.AddEntries(EacObjectIdentifiers.id_TA_RSA_v1_5_SHA_256, "SHA256", "RSA");
     CmsSignedHelper.AddEntries(EacObjectIdentifiers.id_TA_RSA_PSS_SHA_1, "SHA1", "RSAandMGF1");
     CmsSignedHelper.AddEntries(EacObjectIdentifiers.id_TA_RSA_PSS_SHA_256, "SHA256", "RSAandMGF1");
     CmsSignedHelper.encryptionAlgs.Add(X9ObjectIdentifiers.IdDsa.Id, "DSA");
     CmsSignedHelper.encryptionAlgs.Add(PkcsObjectIdentifiers.RsaEncryption.Id, "RSA");
     CmsSignedHelper.encryptionAlgs.Add(TeleTrusTObjectIdentifiers.TeleTrusTRsaSignatureAlgorithm, "RSA");
     CmsSignedHelper.encryptionAlgs.Add(X509ObjectIdentifiers.IdEARsa.Id, "RSA");
     CmsSignedHelper.encryptionAlgs.Add(CmsSignedGenerator.EncryptionRsaPss, "RSAandMGF1");
     CmsSignedHelper.encryptionAlgs.Add(CryptoProObjectIdentifiers.GostR3410x94.Id, "GOST3410");
     CmsSignedHelper.encryptionAlgs.Add(CryptoProObjectIdentifiers.GostR3410x2001.Id, "ECGOST3410");
     CmsSignedHelper.encryptionAlgs.Add("1.3.6.1.4.1.5849.1.6.2", "ECGOST3410");
     CmsSignedHelper.encryptionAlgs.Add("1.3.6.1.4.1.5849.1.1.5", "GOST3410");
     CmsSignedHelper.digestAlgs.Add(PkcsObjectIdentifiers.MD2.Id, "MD2");
     CmsSignedHelper.digestAlgs.Add(PkcsObjectIdentifiers.MD4.Id, "MD4");
     CmsSignedHelper.digestAlgs.Add(PkcsObjectIdentifiers.MD5.Id, "MD5");
     CmsSignedHelper.digestAlgs.Add(OiwObjectIdentifiers.IdSha1.Id, "SHA1");
     CmsSignedHelper.digestAlgs.Add(NistObjectIdentifiers.IdSha224.Id, "SHA224");
     CmsSignedHelper.digestAlgs.Add(NistObjectIdentifiers.IdSha256.Id, "SHA256");
     CmsSignedHelper.digestAlgs.Add(NistObjectIdentifiers.IdSha384.Id, "SHA384");
     CmsSignedHelper.digestAlgs.Add(NistObjectIdentifiers.IdSha512.Id, "SHA512");
     CmsSignedHelper.digestAlgs.Add(TeleTrusTObjectIdentifiers.RipeMD128.Id, "RIPEMD128");
     CmsSignedHelper.digestAlgs.Add(TeleTrusTObjectIdentifiers.RipeMD160.Id, "RIPEMD160");
     CmsSignedHelper.digestAlgs.Add(TeleTrusTObjectIdentifiers.RipeMD256.Id, "RIPEMD256");
     CmsSignedHelper.digestAlgs.Add(CryptoProObjectIdentifiers.GostR3411.Id, "GOST3411");
     CmsSignedHelper.digestAlgs.Add("1.3.6.1.4.1.5849.1.2.1", "GOST3411");
     CmsSignedHelper.digestAliases.Add("SHA1", new string[]
     {
         "SHA-1"
     });
     CmsSignedHelper.digestAliases.Add("SHA224", new string[]
     {
         "SHA-224"
     });
     CmsSignedHelper.digestAliases.Add("SHA256", new string[]
     {
         "SHA-256"
     });
     CmsSignedHelper.digestAliases.Add("SHA384", new string[]
     {
         "SHA-384"
     });
     CmsSignedHelper.digestAliases.Add("SHA512", new string[]
     {
         "SHA-512"
     });
 }