C# RSA加密、解密、加签、验签、支持JAVA格式公钥私钥、PEM格式公钥私钥、.NET格式公钥私钥 -变态模式【支持私钥加密,公钥解密】(二)
RSA变态模式:【私钥加密,公钥解密】
一般这种写法都是JAVA弄的。.NET原生不支持。为啥,我也不清楚,大概是因为安全性问题吧,毕竟公钥是人人都可是持有的。私钥只有自己拥有。
对接注意事项:https://www.cnblogs.com/kevin860/p/9557845.html
一般方法请看:https://www.cnblogs.com/kevin860/p/9557845.html
签名一直都是【私钥加签、公钥验签】只为证明该消息是你发出来的。
这里使用了BouncyCastle1.8.1.0 nuget包。
所有加签、加密返回结果都是base64的,注意格式换。如下:
1 byte[] dataBytes = Convert.FromBase64String(data); 2 string base64Str = Convert.ToBase64String(signer.GenerateSignature());
RSAHelper类
基于BouncyCastle部分
1 <code class="language-csharp"> #region 私钥加密 2 /// <summary> 3 /// 基于BouncyCastle的RSA私钥加密 4 /// </summary> 5 /// <param name="privateKeyJava"></param> 6 /// <param name="data"></param> 7 /// <returns></returns> 8 public static string EncryptPrivateKeyJava(string privateKeyJava, string data, string encoding = "UTF-8") 9 { 10 RsaKeyParameters privateKeyParam = (RsaKeyParameters)PrivateKeyFactory.CreateKey(Convert.FromBase64String(privateKeyJava)); 11 byte[] cipherbytes = Encoding.GetEncoding(encoding).GetBytes(data); 12 RsaEngine rsa = new RsaEngine(); 13 rsa.Init(true, privateKeyParam);//参数true表示加密/false表示解密。 14 cipherbytes = rsa.ProcessBlock(cipherbytes, 0, cipherbytes.Length); 15 return Convert.ToBase64String(cipherbytes); 16 } 17 #endregion 18 19 #region 公钥解密 20 /// <summary> 21 /// 基于BouncyCastle的RSA公钥解密 22 /// </summary> 23 /// <param name="publicKeyJava"></param> 24 /// <param name="data"></param> 25 /// <param name="encoding"></param> 26 /// <returns></returns> 27 public static string DecryptPublicKeyJava(string publicKeyJava, string data, string encoding = "UTF-8") 28 { 29 RsaKeyParameters publicKeyParam = (RsaKeyParameters)PublicKeyFactory.CreateKey(Convert.FromBase64String(publicKeyJava)); 30 byte[] cipherbytes = Convert.FromBase64String(data); 31 RsaEngine rsa = new RsaEngine(); 32 rsa.Init(false, publicKeyParam);//参数true表示加密/false表示解密。 33 cipherbytes = rsa.ProcessBlock(cipherbytes, 0, cipherbytes.Length); 34 return Encoding.GetEncoding(encoding).GetString(cipherbytes); 35 } 36 #endregion 37 #region 加签 38 /// <summary> 39 /// 基于BouncyCastle的RSA签名 40 /// </summary> 41 /// <param name="data"></param> 42 /// <param name="privateKeyJava"></param> 43 /// <param name="hashAlgorithm">JAVA的和.NET的不一样,如:MD5(.NET)等同于MD5withRSA(JAVA)</param> 44 /// <param name="encoding"></param> 45 /// <returns></returns> 46 public static string RSASignJavaBouncyCastle(string data, string privateKeyJava, string hashAlgorithm = "MD5withRSA", string encoding = "UTF-8") 47 { 48 RsaKeyParameters privateKeyParam = (RsaKeyParameters)PrivateKeyFactory.CreateKey(Convert.FromBase64String(privateKeyJava)); 49 ISigner signer = SignerUtilities.GetSigner(hashAlgorithm); 50 signer.Init(true, privateKeyParam);//参数为true验签,参数为false加签 51 var dataByte = Encoding.GetEncoding(encoding).GetBytes(data); 52 signer.BlockUpdate(dataByte, 0, dataByte.Length); 53 //return Encoding.GetEncoding(encoding).GetString(signer.GenerateSignature()); //签名结果 非Base64String 54 return Convert.ToBase64String(signer.GenerateSignature()); 55 } 56 #endregion 57 #region 验签 58 /// <summary> 59 /// 基于BouncyCastle的RSA签名 60 /// </summary> 61 /// <param name="data">源数据</param> 62 /// <param name="publicKeyJava"></param> 63 /// <param name="signature">base64签名</param> 64 /// <param name="hashAlgorithm">JAVA的和.NET的不一样,如:MD5(.NET)等同于MD5withRSA(JAVA)</param> 65 /// <param name="encoding"></param> 66 /// <returns></returns> 67 public static bool VerifyJavaBouncyCastle(string data, string publicKeyJava, string signature, string hashAlgorithm = "MD5withRSA", string encoding = "UTF-8") 68 { 69 RsaKeyParameters publicKeyParam = (RsaKeyParameters)PublicKeyFactory.CreateKey(Convert.FromBase64String(publicKeyJava)); 70 ISigner signer = SignerUtilities.GetSigner(hashAlgorithm); 71 signer.Init(false, publicKeyParam); 72 byte[] dataByte = Encoding.GetEncoding(encoding).GetBytes(data); 73 signer.BlockUpdate(dataByte, 0, dataByte.Length); 74 //byte[] signatureByte = Encoding.GetEncoding(encoding).GetBytes(signature);// 非Base64String 75 byte[] signatureByte = Convert.FromBase64String(signature); 76 return signer.VerifySignature(signatureByte); 77 } 78 #endregion</code>
PEM格式秘钥,自己改了下源代码,能直接加载PEM的string格式的RSA。不用读取文件。改的有些不太合理,就不发了。
单元测试及调用方法
//注意SHA-512WITHRSA/PSS 对应的公私钥大小,不满足需求会报错的 key is too small
Algorithms请参见GetAlgorithms()方法。这个都是从BouncyCastle源码里拿出来的。注意.NET对应的格式。
1 /// <summary> 2 /// BouncyCastle加签/验签 3 /// </summary> 4 [TestMethod] 5 public void BouncyCastleSignVerify() 6 { 7 string publicKeyJava = @"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiRpgGZSOYKG36k6f56D0bHHOQZubt344qgRAVrSmw0udQCV8YsN/qpjlVAeT3gpQ1kKf7YvuR3KylXu0/ckvwya7AYsfEGiRahZcH6uElfyLKcR/6PioMvNLDB2mxgfvZXRRqfxOss8Byb6SP1/xSHPwcJQUc/u5wiczEEWKwNyVRTkjKSIKp5iA+bjN9WGdscdBkNYxZTbbKwDJvzyouiniKR5kSa/6LUMmVDlqz1ZgGfj0WK+6He1o/QoR9s7o143+JjNEzLaLkaolyOBWiBaSYYcQzpdlbi4OOvpHVpVrZ00aJDo9Q2/Dui7orKoKRcCqVDizJd80n47Tf6uVEQIDAQAB"; 8 string privateKeyJava = @"MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCJGmAZlI5gobfqTp/noPRscc5Bm5u3fjiqBEBWtKbDS51AJXxiw3+qmOVUB5PeClDWQp/ti+5HcrKVe7T9yS/DJrsBix8QaJFqFlwfq4SV/IspxH/o+Kgy80sMHabGB+9ldFGp/E6yzwHJvpI/X/FIc/BwlBRz+7nCJzMQRYrA3JVFOSMpIgqnmID5uM31YZ2xx0GQ1jFlNtsrAMm/PKi6KeIpHmRJr/otQyZUOWrPVmAZ+PRYr7od7Wj9ChH2zujXjf4mM0TMtouRqiXI4FaIFpJhhxDOl2VuLg46+kdWlWtnTRokOj1Db8O6LuisqgpFwKpUOLMl3zSfjtN/q5URAgMBAAECggEAaLkfzIo/kqoUPEHgPGIiMS9gt5Zvg+JC0AK9Tj1g3+3C6Ht5nkrsGlf9W4kKNmE0y+RKGn12/VYr+KhsYCmrdOoBj7U/fh4RbLI1ne86MAKeHcI9XauJdpmFqnR/reXjw1/s/OV/C2+5Uutg9E2JlKkScDt7v/f4NMgSZgxoZtU0waPYj5ubhJfbvlWAGol6u0TRlklcfpuhlJAtD4WgAEQm0XmGEVkS3/eKO9vywexkM7YGV2IXqQgvdCVuCl0YGpW4v4qvVixC1b5KU+jgvcFUdHnIFfrEhtVw+byfj4sUfRFk9TCj3HwSsQNa0PnhZINKftnKJGQsP1bC43UgwQKBgQDb4wyA6UPlhR4C2jTn3RE3C87Pl6h8oYAgHzRBLvuDJctKZ3sB4AW+AJhd5Wgdhl6sr0TKPUP+UQicQhD2W8DEPT8Obo3FnCASxBIdJqyDXFL9fQ/g6WrTJ1Dojx1uAPfxWJQJsf6Fev//LbJxukQ1N2pFk/FZljYNtbWkZZqo6QKBgQCfnsBVlW27/ZL98MmlXLnIeDPqj2QtE2jAfyAP0GfaCq94QEyWYavPG9W+jPf114yebwYe4T9MUgVzLZKRFwHBKyBjKz2GgjQgC4s3v18XP/v3lS68E0mYfgiSIJ3X6CMf//RR00XX4fdBmvFxPjv85upgV5WK299gkiDkDvFx6QKBgFwBTtQJxq0c3AfZgdWavH9J44kdLhSoBtJp/BViMT8Y600Aq4mHUR/FY/u157Ci7q5Wz/PHWtHo2i93vV032xrBfcbuH0gWIZ14iRPFgN2eHeOPFrvHLzmW89W7PFcw9I35wEemQJdddgwx9L59b9jMjRz74DraDVgDNjPJh8MxAoGARyrczkvFlV/FvfsxrMze+Ia/fwFXxNE2jz0e6m4dH5ZMDe19OD9r/veGIWNw2ue0Bp+xturu8fRQAb577ry3R40W76BD2kkLPI5pD/3/Q7p/eS/Gmoxu79Kht6VbOvyBTK8uG517MnnJaDLRG5CH5oZ+UV47iqHlwoTkrUoMVKECgYB1MUZZfGFG0fP03O1zwUddUq7Z/y1MLA3fs+vDFTeM3WKGYy7C1e8/vPtNmyaD/UYBpS6FxKVBNx4+mItbJzlHE42eNR5qX0GXwWJfyBTs3DCW9NIAiOT+0dXRma2leS8mPsKzidbtnKVj+tFW2+0cPqWRgzTVAgd1Srm86S/92w=="; 9 10 var algorithms = GetAlgorithms(); 11 string data = "helo world!"; 12 //int bbc = 0; 13 foreach (var item in algorithms.Keys) 14 { 15 if (!item.ToString().Contains("RSA")) 16 continue; 17 if (item.ToString() == "SHA-512WITHRSA/PSS") 18 { 19 //注意SHA-512WITHRSA/PSS 对应的公私钥大小,不满足需求会报错的 key is too small 20 } 21 string signResult = RSAHelper.RSASignJavaBouncyCastle(data, privateKeyJava, item.ToString()); 22 bool result = RSAHelper.VerifyJavaBouncyCastle(data, publicKeyJava, signResult, item.ToString()); 23 if (!result) 24 { 25 int a = 0; 26 int b = 0 / a; 27 } 28 } 29 } 30 private IDictionary GetAlgorithms() 31 { 32 IDictionary algorithms = new Hashtable(); 33 algorithms["MD2WITHRSA"] = "MD2withRSA"; 34 algorithms["MD2WITHRSAENCRYPTION"] = "MD2withRSA"; 35 algorithms[PkcsObjectIdentifiers.MD2WithRsaEncryption.Id] = "MD2withRSA"; 36 37 algorithms["MD4WITHRSA"] = "MD4withRSA"; 38 algorithms["MD4WITHRSAENCRYPTION"] = "MD4withRSA"; 39 algorithms[PkcsObjectIdentifiers.MD4WithRsaEncryption.Id] = "MD4withRSA"; 40 41 algorithms["MD5WITHRSA"] = "MD5withRSA"; 42 algorithms["MD5WITHRSAENCRYPTION"] = "MD5withRSA"; 43 algorithms[PkcsObjectIdentifiers.MD5WithRsaEncryption.Id] = "MD5withRSA"; 44 45 algorithms["SHA1WITHRSA"] = "SHA-1withRSA"; 46 algorithms["SHA1WITHRSAENCRYPTION"] = "SHA-1withRSA"; 47 algorithms[PkcsObjectIdentifiers.Sha1WithRsaEncryption.Id] = "SHA-1withRSA"; 48 algorithms["SHA-1WITHRSA"] = "SHA-1withRSA"; 49 50 algorithms["SHA224WITHRSA"] = "SHA-224withRSA"; 51 algorithms["SHA224WITHRSAENCRYPTION"] = "SHA-224withRSA"; 52 algorithms[PkcsObjectIdentifiers.Sha224WithRsaEncryption.Id] = "SHA-224withRSA"; 53 algorithms["SHA-224WITHRSA"] = "SHA-224withRSA"; 54 55 algorithms["SHA256WITHRSA"] = "SHA-256withRSA"; 56 algorithms["SHA256WITHRSAENCRYPTION"] = "SHA-256withRSA"; 57 algorithms[PkcsObjectIdentifiers.Sha256WithRsaEncryption.Id] = "SHA-256withRSA"; 58 algorithms["SHA-256WITHRSA"] = "SHA-256withRSA"; 59 60 algorithms["SHA384WITHRSA"] = "SHA-384withRSA"; 61 algorithms["SHA384WITHRSAENCRYPTION"] = "SHA-384withRSA"; 62 algorithms[PkcsObjectIdentifiers.Sha384WithRsaEncryption.Id] = "SHA-384withRSA"; 63 algorithms["SHA-384WITHRSA"] = "SHA-384withRSA"; 64 65 algorithms["SHA512WITHRSA"] = "SHA-512withRSA"; 66 algorithms["SHA512WITHRSAENCRYPTION"] = "SHA-512withRSA"; 67 algorithms[PkcsObjectIdentifiers.Sha512WithRsaEncryption.Id] = "SHA-512withRSA"; 68 algorithms["SHA-512WITHRSA"] = "SHA-512withRSA"; 69 70 algorithms["PSSWITHRSA"] = "PSSwithRSA"; 71 algorithms["RSASSA-PSS"] = "PSSwithRSA"; 72 algorithms[PkcsObjectIdentifiers.IdRsassaPss.Id] = "PSSwithRSA"; 73 algorithms["RSAPSS"] = "PSSwithRSA"; 74 75 algorithms["SHA1WITHRSAANDMGF1"] = "SHA-1withRSAandMGF1"; 76 algorithms["SHA-1WITHRSAANDMGF1"] = "SHA-1withRSAandMGF1"; 77 algorithms["SHA1WITHRSA/PSS"] = "SHA-1withRSAandMGF1"; 78 algorithms["SHA-1WITHRSA/PSS"] = "SHA-1withRSAandMGF1"; 79 80 algorithms["SHA224WITHRSAANDMGF1"] = "SHA-224withRSAandMGF1"; 81 algorithms["SHA-224WITHRSAANDMGF1"] = "SHA-224withRSAandMGF1"; 82 algorithms["SHA224WITHRSA/PSS"] = "SHA-224withRSAandMGF1"; 83 algorithms["SHA-224WITHRSA/PSS"] = "SHA-224withRSAandMGF1"; 84 85 algorithms["SHA256WITHRSAANDMGF1"] = "SHA-256withRSAandMGF1"; 86 algorithms["SHA-256WITHRSAANDMGF1"] = "SHA-256withRSAandMGF1"; 87 algorithms["SHA256WITHRSA/PSS"] = "SHA-256withRSAandMGF1"; 88 algorithms["SHA-256WITHRSA/PSS"] = "SHA-256withRSAandMGF1"; 89 90 algorithms["SHA384WITHRSAANDMGF1"] = "SHA-384withRSAandMGF1"; 91 algorithms["SHA-384WITHRSAANDMGF1"] = "SHA-384withRSAandMGF1"; 92 algorithms["SHA384WITHRSA/PSS"] = "SHA-384withRSAandMGF1"; 93 algorithms["SHA-384WITHRSA/PSS"] = "SHA-384withRSAandMGF1"; 94 95 algorithms["SHA512WITHRSAANDMGF1"] = "SHA-512withRSAandMGF1"; 96 algorithms["SHA-512WITHRSAANDMGF1"] = "SHA-512withRSAandMGF1"; 97 algorithms["SHA512WITHRSA/PSS"] = "SHA-512withRSAandMGF1"; 98 algorithms["SHA-512WITHRSA/PSS"] = "SHA-512withRSAandMGF1"; 99 100 algorithms["RIPEMD128WITHRSA"] = "RIPEMD128withRSA"; 101 algorithms["RIPEMD128WITHRSAENCRYPTION"] = "RIPEMD128withRSA"; 102 algorithms[TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD128.Id] = "RIPEMD128withRSA"; 103 104 algorithms["RIPEMD160WITHRSA"] = "RIPEMD160withRSA"; 105 algorithms["RIPEMD160WITHRSAENCRYPTION"] = "RIPEMD160withRSA"; 106 algorithms[TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD160.Id] = "RIPEMD160withRSA"; 107 108 algorithms["RIPEMD256WITHRSA"] = "RIPEMD256withRSA"; 109 algorithms["RIPEMD256WITHRSAENCRYPTION"] = "RIPEMD256withRSA"; 110 algorithms[TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD256.Id] = "RIPEMD256withRSA"; 111 112 algorithms["NONEWITHRSA"] = "RSA"; 113 algorithms["RSAWITHNONE"] = "RSA"; 114 algorithms["RAWRSA"] = "RSA"; 115 116 algorithms["RAWRSAPSS"] = "RAWRSASSA-PSS"; 117 algorithms["NONEWITHRSAPSS"] = "RAWRSASSA-PSS"; 118 algorithms["NONEWITHRSASSA-PSS"] = "RAWRSASSA-PSS"; 119 120 algorithms["NONEWITHDSA"] = "NONEwithDSA"; 121 algorithms["DSAWITHNONE"] = "NONEwithDSA"; 122 algorithms["RAWDSA"] = "NONEwithDSA"; 123 124 algorithms["DSA"] = "SHA-1withDSA"; 125 algorithms["DSAWITHSHA1"] = "SHA-1withDSA"; 126 algorithms["DSAWITHSHA-1"] = "SHA-1withDSA"; 127 algorithms["SHA/DSA"] = "SHA-1withDSA"; 128 algorithms["SHA1/DSA"] = "SHA-1withDSA"; 129 algorithms["SHA-1/DSA"] = "SHA-1withDSA"; 130 algorithms["SHA1WITHDSA"] = "SHA-1withDSA"; 131 algorithms["SHA-1WITHDSA"] = "SHA-1withDSA"; 132 algorithms[X9ObjectIdentifiers.IdDsaWithSha1.Id] = "SHA-1withDSA"; 133 134 algorithms["DSAWITHSHA224"] = "SHA-224withDSA"; 135 algorithms["DSAWITHSHA-224"] = "SHA-224withDSA"; 136 algorithms["SHA224/DSA"] = "SHA-224withDSA"; 137 algorithms["SHA-224/DSA"] = "SHA-224withDSA"; 138 algorithms["SHA224WITHDSA"] = "SHA-224withDSA"; 139 algorithms["SHA-224WITHDSA"] = "SHA-224withDSA"; 140 algorithms[NistObjectIdentifiers.DsaWithSha224.Id] = "SHA-224withDSA"; 141 142 algorithms["DSAWITHSHA256"] = "SHA-256withDSA"; 143 algorithms["DSAWITHSHA-256"] = "SHA-256withDSA"; 144 algorithms["SHA256/DSA"] = "SHA-256withDSA"; 145 algorithms["SHA-256/DSA"] = "SHA-256withDSA"; 146 algorithms["SHA256WITHDSA"] = "SHA-256withDSA"; 147 algorithms["SHA-256WITHDSA"] = "SHA-256withDSA"; 148 algorithms[NistObjectIdentifiers.DsaWithSha256.Id] = "SHA-256withDSA"; 149 150 algorithms["DSAWITHSHA384"] = "SHA-384withDSA"; 151 algorithms["DSAWITHSHA-384"] = "SHA-384withDSA"; 152 algorithms["SHA384/DSA"] = "SHA-384withDSA"; 153 algorithms["SHA-384/DSA"] = "SHA-384withDSA"; 154 algorithms["SHA384WITHDSA"] = "SHA-384withDSA"; 155 algorithms["SHA-384WITHDSA"] = "SHA-384withDSA"; 156 algorithms[NistObjectIdentifiers.DsaWithSha384.Id] = "SHA-384withDSA"; 157 158 algorithms["DSAWITHSHA512"] = "SHA-512withDSA"; 159 algorithms["DSAWITHSHA-512"] = "SHA-512withDSA"; 160 algorithms["SHA512/DSA"] = "SHA-512withDSA"; 161 algorithms["SHA-512/DSA"] = "SHA-512withDSA"; 162 algorithms["SHA512WITHDSA"] = "SHA-512withDSA"; 163 algorithms["SHA-512WITHDSA"] = "SHA-512withDSA"; 164 algorithms[NistObjectIdentifiers.DsaWithSha512.Id] = "SHA-512withDSA"; 165 166 algorithms["NONEWITHECDSA"] = "NONEwithECDSA"; 167 algorithms["ECDSAWITHNONE"] = "NONEwithECDSA"; 168 169 algorithms["ECDSA"] = "SHA-1withECDSA"; 170 algorithms["SHA1/ECDSA"] = "SHA-1withECDSA"; 171 algorithms["SHA-1/ECDSA"] = "SHA-1withECDSA"; 172 algorithms["ECDSAWITHSHA1"] = "SHA-1withECDSA"; 173 algorithms["ECDSAWITHSHA-1"] = "SHA-1withECDSA"; 174 algorithms["SHA1WITHECDSA"] = "SHA-1withECDSA"; 175 algorithms["SHA-1WITHECDSA"] = "SHA-1withECDSA"; 176 algorithms[X9ObjectIdentifiers.ECDsaWithSha1.Id] = "SHA-1withECDSA"; 177 algorithms[TeleTrusTObjectIdentifiers.ECSignWithSha1.Id] = "SHA-1withECDSA"; 178 179 algorithms["SHA224/ECDSA"] = "SHA-224withECDSA"; 180 algorithms["SHA-224/ECDSA"] = "SHA-224withECDSA"; 181 algorithms["ECDSAWITHSHA224"] = "SHA-224withECDSA"; 182 algorithms["ECDSAWITHSHA-224"] = "SHA-224withECDSA"; 183 algorithms["SHA224WITHECDSA"] = "SHA-224withECDSA"; 184 algorithms["SHA-224WITHECDSA"] = "SHA-224withECDSA"; 185 algorithms[X9ObjectIdentifiers.ECDsaWithSha224.Id] = "SHA-224withECDSA"; 186 187 algorithms["SHA256/ECDSA"] = "SHA-256withECDSA"; 188 algorithms["SHA-256/ECDSA"] = "SHA-256withECDSA"; 189 algorithms["ECDSAWITHSHA256"] = "SHA-256withECDSA"; 190 algorithms["ECDSAWITHSHA-256"] = "SHA-256withECDSA"; 191 algorithms["SHA256WITHECDSA"] = "SHA-256withECDSA"; 192 algorithms["SHA-256WITHECDSA"] = "SHA-256withECDSA"; 193 algorithms[X9ObjectIdentifiers.ECDsaWithSha256.Id] = "SHA-256withECDSA"; 194 195 algorithms["SHA384/ECDSA"] = "SHA-384withECDSA"; 196 algorithms["SHA-384/ECDSA"] = "SHA-384withECDSA"; 197 algorithms["ECDSAWITHSHA384"] = "SHA-384withECDSA"; 198 algorithms["ECDSAWITHSHA-384"] = "SHA-384withECDSA"; 199 algorithms["SHA384WITHECDSA"] = "SHA-384withECDSA"; 200 algorithms["SHA-384WITHECDSA"] = "SHA-384withECDSA"; 201 algorithms[X9ObjectIdentifiers.ECDsaWithSha384.Id] = "SHA-384withECDSA"; 202 203 algorithms["SHA512/ECDSA"] = "SHA-512withECDSA"; 204 algorithms["SHA-512/ECDSA"] = "SHA-512withECDSA"; 205 algorithms["ECDSAWITHSHA512"] = "SHA-512withECDSA"; 206 algorithms["ECDSAWITHSHA-512"] = "SHA-512withECDSA"; 207 algorithms["SHA512WITHECDSA"] = "SHA-512withECDSA"; 208 algorithms["SHA-512WITHECDSA"] = "SHA-512withECDSA"; 209 algorithms[X9ObjectIdentifiers.ECDsaWithSha512.Id] = "SHA-512withECDSA"; 210 211 algorithms["RIPEMD160/ECDSA"] = "RIPEMD160withECDSA"; 212 algorithms["ECDSAWITHRIPEMD160"] = "RIPEMD160withECDSA"; 213 algorithms["RIPEMD160WITHECDSA"] = "RIPEMD160withECDSA"; 214 algorithms[TeleTrusTObjectIdentifiers.ECSignWithRipeMD160.Id] = "RIPEMD160withECDSA"; 215 216 algorithms["GOST-3410"] = "GOST3410"; 217 algorithms["GOST-3410-94"] = "GOST3410"; 218 algorithms["GOST3411WITHGOST3410"] = "GOST3410"; 219 algorithms[CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x94.Id] = "GOST3410"; 220 221 algorithms["ECGOST-3410"] = "ECGOST3410"; 222 algorithms["ECGOST-3410-2001"] = "ECGOST3410"; 223 algorithms["GOST3411WITHECGOST3410"] = "ECGOST3410"; 224 algorithms[CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001.Id] = "ECGOST3410"; 225 return algorithms; 226 }