Hi, I have versions of my app written in B4A,B4i and B4J.
I also have a web service written in .net.
All versions have to send encrypted data to the service, which needs to be decrypted within the service.
I need the ability to go the other way, and encrypt on the .net side and decrypt in B4X environments.
I began by looking at the obvious choice B4XEncryption.
However based on current information it appears that this will only support the three B4X environments.
That's fare enough, and I appreciate no real support can be given on the .net side.
I've been looking at the BouncyCastle.Crypto DLL on the .net side, but since I don't know exactly what the encryption routine does inside B4XEncryption it's going to be tough going.
I've got some .net samples, see below, but I've no idea if it would be feasible to use the .net Bouncy Castle Libraries.
If this isn't possible, does anyone have any suggestions on options that might be used in this scenario?
_encoding = Encoding.ASCII;
Pkcs7Padding pkcs = new Pkcs7Padding();
_padding = pkcs;
public string Encrypt(string plain, string key)
{
byte[] result = BouncyCastleCrypto(true, _encoding.GetBytes(plain), key);
return Convert.ToBase64String(result);
}
public string Decrypt(string cipher, string key)
{
byte[] result = BouncyCastleCrypto(false, Convert.FromBase64String(cipher), key);
return _encoding.GetString(result);
}
I also have a web service written in .net.
All versions have to send encrypted data to the service, which needs to be decrypted within the service.
I need the ability to go the other way, and encrypt on the .net side and decrypt in B4X environments.
I began by looking at the obvious choice B4XEncryption.
However based on current information it appears that this will only support the three B4X environments.
That's fare enough, and I appreciate no real support can be given on the .net side.
I've been looking at the BouncyCastle.Crypto DLL on the .net side, but since I don't know exactly what the encryption routine does inside B4XEncryption it's going to be tough going.
I've got some .net samples, see below, but I've no idea if it would be feasible to use the .net Bouncy Castle Libraries.
If this isn't possible, does anyone have any suggestions on options that might be used in this scenario?
_encoding = Encoding.ASCII;
Pkcs7Padding pkcs = new Pkcs7Padding();
_padding = pkcs;
public string Encrypt(string plain, string key)
{
byte[] result = BouncyCastleCrypto(true, _encoding.GetBytes(plain), key);
return Convert.ToBase64String(result);
}
public string Decrypt(string cipher, string key)
{
byte[] result = BouncyCastleCrypto(false, Convert.FromBase64String(cipher), key);
return _encoding.GetString(result);
}