Question Getting AES-Encryption work

Question

New member
Joined
Sep 23, 2010
Messages
2
Programming Experience
Beginner
I hope i chose the right subforum.

I have a problem with an encryption made in AdobeFlex and which I need to translate to VB.NET.

The core is a AES Encryption, but I tried several ways and code and the encrypted strings weren't the same :confused:

The original Flex Sourcecode is:
PHP:
        private function encryptAES(arg1:String, arg2:String, arg3:String="aes128-cfb8", arg4:String="None"):String
        {
            var loc1:*=com.hurlant.util.Hex.toArray(com.hurlant.util.Hex.fromString(arg2));
            var loc2:*=com.hurlant.util.Hex.toArray(com.hurlant.util.Hex.fromString(arg1));
            var loc3:*=arg4 != "pkcs5" ? new com.hurlant.crypto.symmetric.NullPad() : new com.hurlant.crypto.symmetric.PKCS5();
            var loc4:*=com.hurlant.crypto.Crypto.getCipher("simple-" + arg3, loc1, loc3);
            loc3.setBlockSize(loc4.getBlockSize());
            loc4.encrypt(loc2);
            return com.hurlant.util.Base64.encodeByteArray(loc2);
        }

My question is how to get the code work in VB.NET

thanks for your help in advance.
 
I think you should be able to do it with RijndaelManaged class, KeySize 128, set BlockSize, Padding as default PKCS7 or None, Mode CFB.
You may have to set IV to a byte array of nulls, like was done here: http://www.vbdotnetforums.com/security/18491-encryption.html
.Net also has tools for working with hex and base64 strings.
More specifics is not possible since I can't read that code, and there is no sample input/output data. I can't guarantee that is it actually possible to do exactly the same with .Net encryption.
 
Back
Top