Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Reminder for RSA .net
- Public Class EZRSA
- Public RSACSP As RSACryptoServiceProvider
- Public RSAinfo As RSAParameters
- Private Padding As Boolean
- Sub New(ByVal KeySize As Integer, Optional ByVal Padding As Boolean = True)
- If KeySize < 384 Then Throw New Exception("KeySize must be 384 or higher")
- If KeySize Mod 8 > 0 Then Throw New Exception("KeySize must be a multiple of 8")
- RSACSP = New RSACryptoServiceProvider(KeySize)
- RSAinfo = RSACSP.ExportParameters(True)
- Me.Padding = Padding
- End Sub
- Function Encrypt(ByVal Data() As Byte) As Byte()
- Return RSACSP.Encrypt(Data, Padding)
- End Function
- Function Decrypt(ByVal Data() As Byte) As Byte()
- Return RSACSP.Decrypt(Data, Padding)
- End Function
- End Class
Advertisement
Add Comment
Please, Sign In to add comment