I am using the version of BouncyCastle.NET and I have to keep the RSA private key for the file explicitly encrypted with a password for security reasons.
What I'm trying to do now is this:
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
)
But BouncyCastle raises a NullReferenceException in the last statement. Since the method is completely undocumented> :( I wonder if any of you know how to use it correctly ...
(none of my NULL parameters, by the way, already checked that)
source
share