DLL DE CRIPTOGRAFIA

XXXANGELSXXX 27/10/2010 11:36:58
#356027
Bom dia meus amigos, vejam só, utilizo no meu sistema uma dll para criptografar e descriptografar dados como abaixo, so que, criptografei no meu banco de dados as informaçoes, agora para acessar o portal eu preciso descriptografar essa senha e nao to conseguindo, eu referenciei a dll no meu projeto, e utilizei o metodo imports para ver se funcionava, so que a dll que tenho não e importado todos os metodos dela, alguem poderia me ajudar? abaixo o codigo da dll, pensei em criar uma classe no proprio asp.net, mas nao consegui fazer rodar..

   

Public Function Cripitografa(Psenha As String) As Variant
Dim v_sqlerrm As String
Dim SenhaCript As String
Dim var1 As String
Const MIN_ASC = 32
Const MAX_ASC = 126
Const NUM_ASC = MAX_ASC - MIN_ASC + 1

chave = 2001 [ô][ô]qualquer nº para montar o algorítimo da criptografia
Dim offset As Long
Dim str_len As Integer
Dim i As Integer
Dim ch As Integer

to_text = [Ô][Ô]
offset = NumericPassword(chave)
Rnd -1
Randomize offset
str_len = Len(Psenha)
For i = 1 To str_len
ch = Asc(Mid$(Psenha, i, 1))
If ch >= MIN_ASC And ch <= MAX_ASC Then
ch = ch - MIN_ASC
offset = Int((NUM_ASC + 1) * Rnd)
ch = ((ch + offset) Mod NUM_ASC)
ch = ch + MIN_ASC
to_text = to_text & Chr$(ch)
End If
Next i

Cripitografa = to_text
End Function

Public Function Descripitografia(Psenha As String) As Variant

Dim v_sqlerrm As String
Dim SenhaCript As String

Dim var1 As String

Const MIN_ASC = 32 [ô] Space.
Const MAX_ASC = 126 [ô] ~.
Const NUM_ASC = MAX_ASC - MIN_ASC + 1

chave = 2001 [ô][ô]qualquer nº para montar o algorítimo da criptografia
Dim offset As Long
Dim str_len As Integer
Dim i As Integer
Dim ch As Integer

to_text = [Ô][Ô]
offset = NumericPassword(chave)
Rnd -1
Randomize offset
str_len = Len(Psenha)
For i = 1 To str_len
ch = Asc(Mid$(Psenha, i, 1))
If ch >= MIN_ASC And ch <= MAX_ASC Then
ch = ch - MIN_ASC
offset = Int((NUM_ASC + 1) * Rnd)
ch = ((ch - offset) Mod NUM_ASC)
If ch < 0 Then ch = ch + NUM_ASC
ch = ch + MIN_ASC
to_text = to_text & Chr$(ch)
End If
Next i

Descripitografia = to_text

End Function
Public Function NumericPassword(ByVal password As String) As Long
Dim value As Long
Dim ch As Long
Dim shift1 As Long
Dim shift2 As Long
Dim i As Integer
Dim str_len As Integer
str_len = Len(password)
For i = 1 To str_len
[ô] Adiciona a próxima letra
ch = Asc(Mid$(password, i, 1))
value = value Xor (ch * 2 ^ shift1)
value = value Xor (ch * 2 ^ shift2)

[ô] Change the shift offsets.
shift1 = (shift1 + 7) Mod 19
shift2 = (shift2 + 13) Mod 23
Next i
NumericPassword = value
End Function




XXXANGELSXXX 27/10/2010 12:51:11
#356036
Consegui gente,
[ô]referenciei a dll , utilizei o imports
Imports CriptoAsp
[ô]referenciei a biblioteca da mesma
Public ws As CriptoAsp.clsCryptAsp = New CriptoAsp.clsCryptAsp
e utilizei, ..

ws.criptografa(senha.text)

mamão com açucar.
Tópico encerrado , respostas não são mais permitidas