Descargar Función Desencriptar

Anuncio
GAZUM® Encrypter v1.0
Función Desencriptar
Sobre GAZUM® Encrypter v1.0
GAZUM® Encrypter v1.0 es un software de
descarga gratuita que le permitirá encriptar
passwords cuando los mismos van a ser
utilizados por alguna otra herramienta y
deben almacenarse en algún archivo plano o
bien en la Registry de la máquina. Para
desencriptar el algoritmo se debe utilizar la
función desencriptar que transcribimos a
continuación:
Función desencriptar
Dim passPhrase As String = "2132432wqwe2@!\dsb."
Dim saltValue As String = "s@1tValue"
Dim hashAlgorithm As String = "SHA1"
Dim passwordIterations As Integer = 2
Dim initVector As String = "@1B2c3D4e5F6g7H8"
Dim keySize As Integer = 256
Public Shared Function Decrypt(ByVal cipherText As
String, ByVal passPhrase As String, ByVal saltValue As
String,ByVal hashAlgorithm As String,ByVal
passwordIterations As Integer, ByVal initVector As
String, ByVal keySize As Integer) As String
Dim initVectorBytes As Byte()
initVectorBytes =
Encoding.ASCII.GetBytes(initVector)
Dim saltValueBytes As Byte()
saltValueBytes =
Encoding.ASCII.GetBytes(saltValue)
Dim cipherTextBytes As Byte()
cipherTextBytes =
Convert.FromBase64String(cipherText)
Dim password As PasswordDeriveBytes
password = New PasswordDeriveBytes(passPhrase,
saltValueBytes, hashAlgorithm, passwordIterations)
Dim keyBytes As Byte()
keyBytes = password.GetBytes(keySize / 8)
Dim symmetricKey As RijndaelManaged
symmetricKey = New RijndaelManaged
symmetricKey.Mode = CipherMode.CBC
Dim decryptor As ICryptoTransform
decryptor = symmetricKey.CreateDecryptor(keyBytes,
initVectorBytes)
Dim memoryStream As MemoryStream
memoryStream = New
MemoryStream(cipherTextBytes)
Dim cryptoStream As CryptoStream
cryptoStream = New CryptoStream(memoryStream,
decryptor, CryptoStreamMode.Read)
Dim plainTextBytes As Byte()
ReDim plainTextBytes(cipherTextBytes.Length)
Dim decryptedByteCount As Integer
decryptedByteCount =
cryptoStream.Read(plainTextBytes, 0,
plainTextBytes.Length)
memoryStream.Close()
cryptoStream.Close()
Dim plainText As String
plainText = Encoding.UTF8.GetString(plainTextBytes,
0, decryptedByteCount)
Decrypt = plainText
End Function
Sobre GAZUM® Technologies
Con más de 15 años de experiencia en brindar soluciones
y servicios a medida para empresas basados en software
world-class. Nuestros clientes nos eligen porque somos
sinónimo de calidad, confiabilidad y conocimiento.
¡Contáctenos!
www.gazum.com / consulting@gazum.com
+54 11 4850-1366
Descargar