Advertisement
ZeekoSec

BouncyCastleRSA

Apr 7th, 2015
518
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.48 KB | None | 0 0
  1. Public Function Encrypt(data As Byte(), key As AsymmetricKeyParameter) As Byte()
  2.     Dim engine = New RsaEngine()
  3.     engine.Init(True, key)
  4.     Dim blockSize = engine.GetInputBlockSize()
  5.     Return engine.ProcessBlock(data, 0, blockSize)
  6. End Function
  7.  
  8. Public Function Decrypt(data As Byte(), key As AsymmetricKeyParameter) As Byte()
  9.     Dim engine = New RsaEngine()
  10.     engine.Init(False, key)
  11.     Dim blockSize = engine.GetInputBlockSize()
  12.     Return engine.ProcessBlock(data, 0, blockSize)
  13. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement