Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Credentials & Tidal
22-06-2015, 10:09 PM
Post: #11
RE: Credentials & Tidal
Thanks again for really fast response Smile

Link is either messed up or somehow modified by forum software - just remove ')' at end and it should work, no problem Smile Like this:

http://travistidwell.com/jsencrypt/demo/
(there should not be ')' at end!)

But anyway, if I get you correctly it's really about CR/LF codes that somehow got lost and messed up the key?

That's great to hear! How do you copy/paste such a key?
For example:

writing RSA key
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzLy7SjHUkpnZtZ5mFJZ0
EXyiUpPaPOU4Q9tLa9odE7dqsOeEDY6nam/CKZRuSX1TL8wZx2+0BzcfYHiidXPi
oSsKI5j5QPwfDdcyw+FaRh4AybxrzLEnaKLJkeVnykkAxZU8b4LyypZijD+wl7Vf
1skB8mAfYJBJCb/3k33bBRiZ8XzIeUyLV3L9Znrv3bvS/Nerqf3TVXDmH+e0qADw
kI4HAsSv9wX4kThoTpWcYxrz4ox2LJD6jFN2hlp+8JA58cISvji8E+xs0D95dZUK
gSmvRrzrSiK6LkfNgjR1Rz0b+uww1P9AcjUfIFWs75qxAI/kr5f05IhgoNfwRmRC
nQIDAQAB
-----END PUBLIC KEY-----

Becomes after copy/paste:

SetPropertyPublicKey("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzLy7SjHUkpnZtZ5mFJZ0
EXyiUpPaPOU4Q9tLa9odE7dqsOeEDY6nam / CKZRuSX1TL8wZx2 + 0BzcfYHiidXPi
oSsKI5j5QPwfDdcyw + FaRh4AybxrzLEnaKLJkeVnykkAxZU8b4LyypZijD + wl7Vf
1skB8mAfYJBJCb / 3k33bBRiZ8XzIeUyLV3L9Znrv3bvS / Nerqf3TVXDmH + e0qADw
kI4HAsSv9wX4kThoTpWcYxrz4ox2LJD6jFN2hlp + 8JA58cISvji8E+xs0D95dZUK
gSmvRrzrSiK6LkfNgjR1Rz0b + uww1P9AcjUfIFWs75qxAI / kr5f05IhgoNfwRmRC
nQIDAQAB");

Which clearly won't compile - What is the proper way to get it into PublicKey? Smile
Find all posts by this user
23-06-2015, 12:44 PM
Post: #12
RE: Credentials & Tidal
(22-06-2015 10:09 PM)Josef Wrote:  Thanks again for really fast response Smile

Link is either messed up or somehow modified by forum software - just remove ')' at end and it should work, no problem Smile Like this:

http://travistidwell.com/jsencrypt/demo/
(there should not be ')' at end!)

But anyway, if I get you correctly it's really about CR/LF codes that somehow got lost and messed up the key?
That plus the lines before/after the key. You have to include the lines starting '----'

(22-06-2015 10:09 PM)Josef Wrote:  That's great to hear! How do you copy/paste such a key?
I wouldn't have thought copy/paste would be required for production code. That implies to me that you're planning on using a single key for all your users. That isn't secure - anyone who finds the key for one of your users would then have access to private data from all users.

It would be better if you generated a key programmatically at runtime instead. The code I posted previously will do this. There are plenty of other security libraries around if you prefer something other than openssl.

If you aren't too worried about security and really want to use a single key, you'd specify it as a string using something like

Code:
const char* key =
    "-----BEGIN PUBLIC KEY-----\n"
    "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzLy7SjHUkpnZtZ5mFJZ0\n"
    "EXyiUpPaPOU4Q9tLa9odE7dqsOeEDY6nam/CKZRuSX1TL8wZx2+0BzcfYHiidXPi\n"
    "oSsKI5j5QPwfDdcyw+FaRh4AybxrzLEnaKLJkeVnykkAxZU8b4LyypZijD+wl7Vf\n"
    "1skB8mAfYJBJCb/3k33bBRiZ8XzIeUyLV3L9Znrv3bvS/Nerqf3TVXDmH+e0qADw\n"
    "kI4HAsSv9wX4kThoTpWcYxrz4ox2LJD6jFN2hlp+8JA58cISvji8E+xs0D95dZUK\n"
    "gSmvRrzrSiK6LkfNgjR1Rz0b+uww1P9AcjUfIFWs75qxAI/kr5f05IhgoNfwRmRC\n"
    "nQIDAQAB\n"
    "-----END PUBLIC KEY-----";
Find all posts by this user
23-06-2015, 01:56 PM
Post: #13
RE: Credentials & Tidal
That did the trick - thanks!

I see Kazoo now calls Set() with username & encrypted password - great!

I suppose next thing to do for Renderer is to use Tidal's API to log in and then increase SequenceNumber so CP can call Get() and acquire Tidal session token?

In order to log in password must be decrypted: Is there a Decrypt() utility function in OpenHome or do we need openSSL (or other library) for that as well?
Find all posts by this user
23-06-2015, 01:59 PM
Post: #14
RE: Credentials & Tidal
Glad to hear you're making progress!

You'll need to use a security library to decrypt the password. (You'll need the private key that goes with the public key used for encryption too!)
Find all posts by this user
23-06-2015, 02:06 PM
Post: #15
RE: Credentials & Tidal
Yes of course - any library recommendations for C/C++ (Windows)?

Thanks again!
Find all posts by this user
23-06-2015, 02:52 PM
Post: #16
RE: Credentials & Tidal
(23-06-2015 02:06 PM)Josef Wrote:  Yes of course - any library recommendations for C/C++ (Windows)?

We use openssl (v1.0.1j). Its a bit of a pain to get it building but you could use the key generation code I posted unchanged.
Find all posts by this user
23-06-2015, 04:46 PM
Post: #17
RE: Credentials & Tidal
Ok, will check it out - Thanks once more!
Find all posts by this user


Forum Jump: