| | |
NO value was pass over to it..
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2005
Posts: 1
Reputation:
Solved Threads: 0
When i run the program at the WebApplication.. the error is "An unhandled exception of type 'System.ExecutionEngineException' occurred in mscorlib.dll"
Web service Code:
Dim xmlKeys As String 'A combination of both the public and private keys
Dim xmlPublicKey As String 'The public key only
Dim PlainTextBArray As Byte() 'The plaintext message in a byte array
Dim CypherTextBArray As Byte() 'The cyphertext message in a byte array
<WebMethod()> _
Public Function HelloWorld() As String
'Return "Hello World"
'End Function
Dim rsa As New RSACryptoServiceProvider
xmlPublicKey = rsa.ToXmlString(False)
xmlKeys = rsa.ToXmlString(True)
'get the public key so you can encrypt the message:
rsa.FromXmlString(xmlPublicKey)
'get the message
Dim message As String = "hello String"
If message.Length > 58 Then MsgBox("You must use fewer than 59 characters") : Exit Function
'transform message string into a byte array:
PlainTextBArray = (New UnicodeEncoding).GetBytes(message)
' Encrypt
CypherTextBArray = rsa.Encrypt(PlainTextBArray, False)
'view the cyphertext
Dim Enc As String
For i As Integer = 0 To CypherTextBArray.Length - 1
Enc &= Chr(CypherTextBArray(i))
Next i
Return Enc
Web application Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim test As New localhost.Service1
'TextBox1.Text = test.HelloWorld()
Dim rsa As New RSACryptoServiceProvider
xmlPublicKey = rsa.ToXmlString(False)
xmlKeys = rsa.ToXmlString(True)
'get the keys, thereby creating an RSA object that's identical
'to the one used in the Form_Load event when the keys were first built
rsa.FromXmlString(xmlKeys)
'create a byte array and then put the decrypted plaintext into it
Dim RestoredPlainText As Byte() = rsa.Decrypt(CypherTextBArray, False) << Error Occur at this line..
'Step through the two-byte unicode plaintext, displaying the restored plaintext message
For i As Integer = 0 To (RestoredPlainText.Length - 1) Step 2
TextBox1.Text &= Chr(RestoredPlainText(i))
Next i
End Sub
Web service Code:
Dim xmlKeys As String 'A combination of both the public and private keys
Dim xmlPublicKey As String 'The public key only
Dim PlainTextBArray As Byte() 'The plaintext message in a byte array
Dim CypherTextBArray As Byte() 'The cyphertext message in a byte array
<WebMethod()> _
Public Function HelloWorld() As String
'Return "Hello World"
'End Function
Dim rsa As New RSACryptoServiceProvider
xmlPublicKey = rsa.ToXmlString(False)
xmlKeys = rsa.ToXmlString(True)
'get the public key so you can encrypt the message:
rsa.FromXmlString(xmlPublicKey)
'get the message
Dim message As String = "hello String"
If message.Length > 58 Then MsgBox("You must use fewer than 59 characters") : Exit Function
'transform message string into a byte array:
PlainTextBArray = (New UnicodeEncoding).GetBytes(message)
' Encrypt
CypherTextBArray = rsa.Encrypt(PlainTextBArray, False)
'view the cyphertext
Dim Enc As String
For i As Integer = 0 To CypherTextBArray.Length - 1
Enc &= Chr(CypherTextBArray(i))
Next i
Return Enc
Web application Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim test As New localhost.Service1
'TextBox1.Text = test.HelloWorld()
Dim rsa As New RSACryptoServiceProvider
xmlPublicKey = rsa.ToXmlString(False)
xmlKeys = rsa.ToXmlString(True)
'get the keys, thereby creating an RSA object that's identical
'to the one used in the Form_Load event when the keys were first built
rsa.FromXmlString(xmlKeys)
'create a byte array and then put the decrypted plaintext into it
Dim RestoredPlainText As Byte() = rsa.Decrypt(CypherTextBArray, False) << Error Occur at this line..
'Step through the two-byte unicode plaintext, displaying the restored plaintext message
For i As Integer = 0 To (RestoredPlainText.Length - 1) Step 2
TextBox1.Text &= Chr(RestoredPlainText(i))
Next i
End Sub
![]() |
Similar Threads
- c language problm, how to pass pointer to a function (C)
- how to get pass url variables from one page to another page with out knowing them? (ColdFusion)
- IPSec Pass-thru (Networking Hardware Configuration)
- Pass XML file contents to a hash table. (Java)
Other Threads in the VB.NET Forum
- Previous Thread: help with vb.net
- Next Thread: Using Windows XP Visual Styles with Controls on Windows Forms
| Thread Tools | Search this Thread |
.net .net2008 2008 access add advanced application array assignment basic beginner box browser button buttons center click code combo cpu cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic editvb.net employees excel exists fade filter forms html images isnumericfuntioncall listview map mobile module msaccess mssqlbackend mysql net number objects open pan panel pdf picturebox picturebox2 port position print printing printpreview record regex reuse right-to-left save search serial settings shutdown socket sorting sqldatbase sqlserver storedprocedure survey temp temperature textbox timer timespan transparency txttoxmlconverter usercontol vb vb.net vba vbnet vista visual visualbasic visualbasic.net visualstudio.net web winforms wpf wrapingcode xml year





