I created a web server in B4J for receiving requests from a program created with Microsoft Access
The sending of requests from Access to the B4J web server takes place correctly and also the responses
Now I would like to pass some encrypted data, using routines like at this link, which shows an example of encryption and decryption in B4J code
The question is: how to make a routine in vba that can correctly decrypt the string encrypted by the Encrypt routine in B4J?
And similarly, how to make a procedure in vba to encrypt a string so that once decrypted by the Decrypt procedure as in the link above, the string appears as original?
The sending of requests from Access to the B4J web server takes place correctly and also the responses
Now I would like to pass some encrypted data, using routines like at this link, which shows an example of encryption and decryption in B4J code
B4X:
#AdditionalJar: bcprov-jdk15on-154
Sub Process_Globals
End Sub
Sub AppStart (Args() As String)
Dim p As String = "123456"
Dim s As String = "top secret"
Dim enc As String = Encrypt(s, p)
Log(enc)
Dim dec As String = Decrypt(enc, p)
Log(dec)
End Sub
Private Sub Encrypt (Text As String, Password As String) As String
Dim c As B4XCipher
Dim b() As Byte = c.Encrypt(Text.GetBytes("utf8"), Password)
Dim su As StringUtils
Return su.EncodeBase64(b)
End Sub
Private Sub Decrypt(EncryptedText As String, Password As String) As String
Dim c As B4XCipher
Dim su As StringUtils
Dim enc() As Byte = su.DecodeBase64(EncryptedText)
Dim dec() As Byte = c.Decrypt(enc, Password)
Return BytesToString(dec, 0, dec.Length, "utf8")
End Sub
The question is: how to make a routine in vba that can correctly decrypt the string encrypted by the Encrypt routine in B4J?
And similarly, how to make a procedure in vba to encrypt a string so that once decrypted by the Decrypt procedure as in the link above, the string appears as original?