Print Page | Close Window

Looking for an encryption method

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=12017
Printed Date: 31 March 2026 at 3:01am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Looking for an encryption method
Posted By: dj air
Subject: Looking for an encryption method
Date Posted: 02 October 2004 at 6:25am
hi guys,

ive been searching the net, for 2 way encryption mothods for an application im working on.

i have 160 bit for the login password.

but i want to allow the clients of the application to encrypt the contact details, as there are telephone, fax, addresses etc.

does anyone know of any good website/ tutorials for 2 way encryption.



Replies:
Posted By: Mart
Date Posted: 02 October 2004 at 6:34am
If you are willing to use ASP.NET there are some built in 2 way encryption methods including DES, RSA and Triple DES. If you can use ASP.NET I can post a sample for you


Posted By: dj air
Date Posted: 02 October 2004 at 6:42am
the client i am making the application for whats it done in asp, else i would have.

thanx for the suggestion though, i would like a copy anyway . good thing to have in the store (storage folder of scripts i have).


Posted By: Mart
Date Posted: 02 October 2004 at 6:45am
Ok, here you are, you just need to change the 2 keys and Import System.Security.Cryptography and System.IO before using.


Private rgbKEY As Byte() = {12, 75, 31, 49, 55, 8, 250, 78, 66, 249, 1, 29, 2, 255, 124, 93, 6, 14, 75, 164, 75, 24, 73, 192}
Private rgbIV As Byte() = {89, 154, 106, 44, 67, 1, 164, 2, 78, 11, 83, 14, 245, 9, 22, 137, 130, 19, 197, 47, 75, 43, 111, 192}

Public Function TripleDESEncrypt(ByVal input As String) As String
If Not input Is Nothing Then
Dim objCryptoService As New TripleDESCryptoServiceProvider
Dim msCrypt As New MemoryStream
Dim csCrypt As New CryptoStream(msCrypt, objCryptoService.CreateEncryptor(rgbKEY, rgbIV), CryptoStreamMode.Write)
Dim swCrypt As New StreamWriter(csCrypt)

swCrypt.Write(input)
swCrypt.Flush()
msCrypt.Flush()
csCrypt.FlushFinalBlock()
Return Convert.ToBase64String(msCrypt.GetBuffer, 0, msCrypt.Length)
swCrypt.Close()
End If
End Function

Public Function TripleDESDecrypt(ByVal input As String) As String
If input <> Nothing Then
Dim cryptoProvider As New TripleDESCryptoServiceProvider
Dim buffer As Byte() = Convert.FromBase64String(input)
Dim ms As New MemoryStream(buffer)
Dim cs As New CryptoStream(ms, cryptoProvider.CreateDecryptor(rgbKEY, rgbIV), CryptoStreamMode.Read)
Dim sr As StreamReader = New StreamReader(cs)

Return sr.ReadToEnd()
End If
End Function



Posted By: dj air
Date Posted: 03 October 2004 at 5:55pm
cheers,

 ill store that away, never know when it can be handy.

so does anyone else know away to do it with classic asp.

im searching but not finding to much.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net