Your Digital Media Has Never Looked So Good

 
mjames
Topic Author
Posts: 3
Joined: Tue Nov 13, 2012 11:10 pm

Unable to get AES 128 encryption/decryption working

Thu Nov 15, 2012 9:51 am

I have already looked at the thread viewtopic.php?f=34&t=40497 and tried to follow up on that thread – it does not seem to help.

I am unable to figure out how to use AES 128 encryption. Roku box keeps rebooting in most of the attempts. Otherwise, setup call returns -1. It is working fine if I use "bf” and a 64 bit initialization vector.

Appreciate your help.

Here is my code snippet - wondering if I am doing something wrong

alg = "aes-128-cbc"
    pad = 1
    encryptKey = "10a58869d74be5a374cf867cfb473859"
    IV = "00000000000000000000000000000000"
    plainText = "00000000000000000000000000000000"

    encResult = crypto_encrypt(alg, encryptKey, IV, plainText, pad)
   

Function crypto_encrypt(alg as String, encryptKey As String, IV As String, text As String, pad as Integer) As String

   crypto = CreateObject("roEVPCipher")
   res = crypto.Setup(true, alg,encryptKey,IV,pad)
   print res
   
   ba = CreateObject("roByteArray")
   ba.FromAsciiString(text)

   enc = crypto.Process(ba)
   
   return enc.ToHexString()
   
End function
 
User avatar
RokuKevin
Roku Engineering
Posts: 796
Joined: Tue Sep 22, 2009 2:29 pm

Re: Unable to get AES 128 encryption/decryption working

Tue Nov 20, 2012 2:35 pm

Nothing wrong with your code. It works fine on a Roku2.

I can recreate the crash on a Roku1... It's a bug we'll have to look into at some point, but we don't anticipate a patch release anytime soon.

If this is truly required, I suggest utilizing the "Required Feature: Roku 2" when submitting your channel for publishing.

--Kevin
 
mjames
Topic Author
Posts: 3
Joined: Tue Nov 13, 2012 11:10 pm

Re: Unable to get AES 128 encryption/decryption working

Thu Nov 22, 2012 6:45 pm

Thanks Kevin. It is working on Roku2.

Who is online

Users browsing this forum: No registered users and 4 guests