【发布时间】:2018-10-04 10:35:52
【问题描述】:
我正在用 C# 开发现有 java 应用程序的新版本。
现有应用程序使用带有 java.security.spec.* 和 boncycastle api 的 RSA 加密。
我正在为下面的 java 代码寻找 c# 中的等效代码:
public static java.security.PublicKey getKey
(
org.bouncycastle.asn1.x509.RSAPublicKeyStructure rsaPublicKey
)
{
java.security.KeyFactory keyFactory = KeyFactory.getInstance("RSA");
java.security.spec.RSAPublicKeySpec keySpec = new RSAPublicKeySpec(
rsaPublicKey.getModulus(),
rsaPublicKey.getPublicExponent());
java.security.PublicKey pkey = keyFactory.generatePublic(keySpec);
return pkey;
}
我“谷歌”了很多,但没有找到解决方案。
提前感谢您的帮助。
【问题讨论】:
标签: c# java encryption rsa