Encriptacion

22/11/2004 - 00:57 por Lian | Informe spam
Alguien tiene o me puede decir alguna clase ya echa que
solo ponga un pass y Encripte y desencripte con todo lo
de la seguridad de framework.

Osea lo que quiero es solo poner pass sin tener que
aprender todo ese rollo de Encriptacion .
 

Leer las respuestas

#1 Eduardo A. Morcillo [MS MVP VB]
22/11/2004 - 01:45 | Informe spam
Aqui tienes una funcion para encriptar un string:

Public Shared Function Encrypt(ByVal text As String, ByVal password
As String) As String

' Create the 3DES provider object
Dim tdes As New TripleDESCryptoServiceProvider

' Convert the string to a byte array
Dim data() As Byte = UTF8.GetBytes(text)

' Derive the key from the password
Dim iv() As Byte = {0, 0, 0, 0, 0, 0, 0, 0}
Dim keyb() As Byte = (New PasswordDeriveBytes(password,
iv).CryptDeriveKey("TripleDES", "MD5", tdes.KeySize, iv))

' Create an encryptor object
Dim transform As ICryptoTransform = tdes.CreateEncryptor(keyb, iv)

' Encrypt the string, convert the result to Base64 and UrlEncode
it
Return
System.Convert.ToBase64String(transform.TransformFinalBlock(data, 0,
data.Length))

End Function

La funcion para desencriptar te queda de tarea, que como puedes ver no es
tan complicado y nunca esta demas aprender. :)

Eduardo A. Morcillo [MS MVP VB]

Preguntas similares