Help with porting C# .net code for encryption/decryption in B4A

DSD

Member
Licensed User
Longtime User
Hello,
I have a task I need help with.

It is about being able to encrypt and decrypt an xml file with B4A.

I already have a WinForms application (written i C#) that encrypts and decrypts a specific xml file.
The code for doing this encryption/decryption is written in C# and I need help porting this code to B4A.
This so i can do the same thing from my B4A app.

The encryption used in C# is RijndaelManaged and is part of the .NET Framework.

For someone who is familiar with the encryption / decryption B4A this should be a pretty simple job.
I have provided a zip-file (see below) that contains a sampe xml-file and a the C# class used to encrypt/decrypt the xml-file and I have also included a C# sample project that encrypt and decrypts the content of the sample xml-file.

What I need is a B4A sample project that can encrypt/decrypt this sample xml-file.
And the C# sample project should be able to encrypt the file and the B4A sample project should be able to decrypt the xml-file and vice versa.

Payment will be made in this case as a donation via Paypal.
I am willing to pay a fixed price for the work. Please note that since I'm a private person and not a company the price has to be moderate.

Contact me if you are interested so I can provide more information.

Kind regards

/Mattias
 

Attachments

  • B4A Crypto.zip
    52.8 KB · Views: 282

vpires

Member
Licensed User
Longtime User
Hello.
Since i'm not a C# user, can you please tell me what's the result of :

Encript("Secret Text","Secret Password")

If it's 2iZUJ9WSebaU6g5n14Qt2Q==, then it's done.
If not, please give me the base64Encoded values of SecretKey.GetBytes(32) and SecretKey.GetBytes(16) with this password

Nelson
 

DSD

Member
Licensed User
Longtime User

Hello,

thank you for helping me with this.
Perhaps we should come to some sort of arrangement regarding the fee before you put any work into this?

Here's the result:

Encrypted Value = G0z6oznEOtpr+U8L3BJ9dHVd2WCCyDp3XvpV3H8FYSI=

SecretKey.GetBytes32=FHTf0hw+j70sbltfqpPcEUMUmUCiLOJtn0Yw1MElSWs=
SecretKey.GetBytes16=LG5bX6qT3BE9q/9wwsNzew==

Here's an excerpt from the comments in the C# code:

//This class uses an extension of the PBKDF1 algorithm defined in the PKCS#5 v2.0
//standard to derive bytes suitable for use as key material from a password.
//The standard is documented in IETF RRC 2898.

Somehow I believe that the Cipher should be set to
"AES/ECB/PKCS5Padding"

And that the key algorithm should have "SHA-1"

Kind regards

/Mattias
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…