I am using VS .Net 2003 to develop an VB.net Pocket PC
application which encrypts connection string information
for a SQL Server Database. I have copied the Crypto Class
code from the Pocket PC Signiture Application Sample into
my project
(
http://msdn.microsoft.com/mobility/understanding/articles/
default.aspx?pull=/library/en-
us/dnnetcomp/html/ppcsignatureapp.asp).
I can not get the text I send it, to be decrypted. I
error out with an 'unhandled exception'. This is when
using the PPC 2003 emulator (My device is only on PPC 2002
in which I just get a deployment error). One thing I
notice is that I get different hProv, hHash, and hKey
values when running the CryptoSvc2.Decrypt function versus
the CryptoSvc1.Encrypt function (this may be correct, I
don't know). The following is my code:
Dim EncryptString As String
Dim DecryptString As String
Dim CodedArray() As Byte
Dim EncryptArray As Byte()
Dim DecryptArray As Byte()
Dim CryptoSvc1 As New Security.Crypto
CodedArray = System.Text.Encoding.ASCII.GetBytes("AnyText")
EncryptArray = CryptoSvc1.Encrypt("123456789", CodedArray)
EncryptString = System.Text.Encoding.ASCII.GetChars _
(EncryptArray)
MsgBox("Encrypted Data: " & EncryptString)
Dim CryptoSvc2 As New Security.Crypto
CodedArray = System.Text.Encoding.ASCII.GetBytes _
(EncryptString)
DecryptArray = CryptoSvc2.Decrypt("123456789", CodedArray)
DecryptString = System.Text.Encoding.ASCII.GetChars _
(DecryptArray)
MsgBox("Decrypted Data: " & DecryptString)
Any help would be greatly appreciated!!
.