Hot Door CORE Forum

Full Version: AES encryption
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm at that point in some of my plugins where I need to add the registration functions to authorize them online (except, of course, for the free ones). I've never used AES before but I understand the public and private key concept. Testing the hdi::core::crypt and ::crypt::aes functions in CORE have, however, been quite humbling. I'd be really grateful if someone could provide some sample code to get me started in the right direction for encrypting and decrypting AES. I presume this can be done on a variety of data types such as a struct or JSON file. Any other general registration-related tips would be most welcomed as well.

Many thanks in advance! Undecided
(08-03-2016, 06:04 PM)Rick Johnson Wrote: [ -> ]I'm at that point in some of my plugins where I need to add the registration functions to authorize them online (except, of course, for the free ones). I've never used AES before but I understand the public and private key concept.

Actually AES is symmetric key crypto, whereas RSA is asymmetric. With AES the same key is used to encrypt and decrypt, but with RSA one is used to encrypt but the other is used to decrypt.

(08-03-2016, 06:04 PM)Rick Johnson Wrote: [ -> ]Testing the hdi::core::crypt and ::crypt::aes functions in CORE have, however, been quite humbling. I'd be really grateful if someone could provide some sample code to get me started in the right direction for encrypting and decrypting AES. I presume this can be done on a variety of data types such as a struct or JSON file. Any other general registration-related tips would be most welcomed as well.

Our crypto classes will encrypt any data you provide to them in a std:Confusedtring container. However, the hdi::core::Registration class already handles encryption of the file on disk, you just have to provide the key to it. Store the key somewhere in your source code (hardcoded) or derive the key from some consistent runtime information (like machine UUID) and pass it to the Registration::load() method.