Mas*_*r_T 5 .net c# vb.net rsa bouncycastle
我正在使用.NET版本的BouncyCastle,我必须将私有RSA密钥保存到文件中,显然是出于安全原因使用密码加密.
我现在正在尝试的是:
Dim rand As New SecureRandom
Dim arr As Byte() = New Byte(7) {}
rand.NextBytes(arr)
Dim privateKeyInfo As EncryptedPrivateKeyInfo = EncryptedPrivateKeyInfoFactory.CreateEncryptedPrivateKeyInfo(
"PBEwithHmacSHA-256",
Repository.Password.ToCharArray,
arr,
1,
data.BouncyCastlePrivateKey
)
Run Code Online (Sandbox Code Playgroud)
但是BouncyCastle在最后一条指令上遇到了NullReferenceException.由于该方法完全没有记录> :(我想知道你们中是否有人知道如何正确使用它...
(顺便说一下,我的参数都没有为NULL,已经检查过了)