ibscas
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2012
02:02 PM
Encryption between PHP and BRS?
I was wondering if anyone had written something that allows the Roku to encrypt a string then a PHP script to de-crypt it and vice-versa? I want to interract with my server but would prefer that the lines of communication be encrypted however I'm not sure how the BRS does it's encryption so that I can de-crypt it on the other side.
For instance, I want to send a URL that may have a password on a query string and don't want to send &password=xxxxxxx if I can send &password=929dkxd834kdja and have my PHP script figure what the password is.
Any insight is appreciated!
For instance, I want to send a URL that may have a password on a query string and don't want to send &password=xxxxxxx if I can send &password=929dkxd834kdja and have my PHP script figure what the password is.
Any insight is appreciated!
11 REPLIES 11
MSGreg
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2012
02:13 PM
Re: Encryption between PHP and BRS?
Using https and putting the password in the POST instead of in the query should cover it.
If you must encode your own, you might be able to use
roEVPCipher
If you must encode your own, you might be able to use
roEVPCipher
ibscas
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2012
03:00 PM
Re: Encryption between PHP and BRS?
That was only an example, I want to do my own an already know about roEVPCipher, I'm just wondering if anyone actually wrote a routine in PHP that decrypts a BRS encrypted string.
MSGreg
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2012
03:06 PM
Re: Encryption between PHP and BRS?
Ahh, sorry to tell you what you already know 😞
I don't have any PHP <-> Brightscript code that matches crypt/decrypt.
I don't have any PHP <-> Brightscript code that matches crypt/decrypt.

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2012
03:18 PM
Re: Encryption between PHP and BRS?
There is no such thing as a "BRS encypted string". The roEVPCipher supports loads of different standard encryption methods (as listed in the link MSGreg posted). Pick one of the supported encryption methods, and find equivalent decryption code in PHP, and you should be good to go.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
MSGreg
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2012
03:20 PM
Re: Encryption between PHP and BRS?
As a follow up, in case no one else responds, I'll use this space to speculate.
Looks like PHP crypt is in reality a hash function built for making password hashes. Not what you need (as you probably know).
Mcrypt is a PHP extension that seems to contain perhaps the correct functions. There are a lot of options (i.e. CBC mode, CFB mode, etc.). It'll take a comparison of Mcrypt manual page.
More notes to come, unless someone else chimes in definitively.
Looks like PHP crypt is in reality a hash function built for making password hashes. Not what you need (as you probably know).
Mcrypt is a PHP extension that seems to contain perhaps the correct functions. There are a lot of options (i.e. CBC mode, CFB mode, etc.). It'll take a comparison of Mcrypt manual page.
More notes to come, unless someone else chimes in definitively.
MSGreg
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2012
04:57 PM
Re: Encryption between PHP and BRS?
It looks like roEVP* uses OPenSSL library. Mcrypt may not be compatible (one forum post said of the difference: "Because of different password-to-encryption-key derivation methods.")
You may be safer using OpenSSL library in PHP. The biggest gotcha seems to be handling the padding.
You may be safer using OpenSSL library in PHP. The biggest gotcha seems to be handling the padding.
MSGreg
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2012
05:04 PM
Re: Encryption between PHP and BRS?
And it looks like the roEVP only implement symmetric ciphers and digests. Not public/private key handling. So you'll be stuck using some sort of symmetric encryption where the key is available in full on both sides (in Brightscript and in PHP) unless perhaps you send the key from the server to Brightscript over SSL.
This would be much better if roEVP_Seal... and roEVP_Open... functions were available. That way you could have a public key distributed with the brightscript, and a private key stay on the server.
Sorry for the stream of consciousness posts on this topic...
This would be much better if roEVP_Seal... and roEVP_Open... functions were available. That way you could have a public key distributed with the brightscript, and a private key stay on the server.
Sorry for the stream of consciousness posts on this topic...
MSGreg
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2012
05:23 PM
Re: Encryption between PHP and BRS?
Here is a decent thread and post about the interaction of PHP and BrightScript regarding encryption and hex vs. binary keys.
ibscas
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2012
05:28 PM
Re: Encryption between PHP and BRS?
Awesome, MSGreg, I really appreciate that!!!!!! I don't know why in all my forum searching this didn't come up in my results 😞