RSA encryption in JUCE

I’m trying to encrypt and decrypt an RSA key in my JUCE code using the given infrastructure.

I would like to use a “normal” public and private key like i can generate here:

The juce RSAKey takes comma separated hex numbers. Is it possible to convert a string like the following to those two numbers?

Example 512 bit public key:
MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALnCO3zfsruYtyjVJ8VZOjPPLsNJlHX2xE86wwgiXd9+CeOmDgimfSeScvE89kl+RqnW8aPnruewoQwXy5a3AP8CAwEAAQ==

Any help and also other solutions are welcome. I want to use something standard, that i can also implement in the backend (dotnet core) using standard libraries.

Used the juce blowfish algorithm in the past, but it’s hard to find compatible standard implementations for this that do not need additional libraries.

Encryption keys should never be created using online tools. OpenSSL can be used for both local key creation and as a library to encrypt/decrypt.

1 Like

Thanks for the tip. I can imagine that it is not a good thing to generate it online. They write that the private key is generated in PKCS#8 and the public key is generated in X.509.

I have plans to generate the keys in my dotnet backend where i have secure crypto libraries. It would be nice if i could decrypt it with JUCE. But it looks that the JUCE RSA implementation is very basic. There is also no way to set any different modes(not sure if this is required).

OpenSSL for C++ on the other side maybe is an overkill. I heard that this library is huge and difficult to add? We don’t need to be super secure. I want to use it only to create serial numbers.

A single cpp class solution would be great.

Any ideas and thoughts?

I never used OpenSSL in a plugin, but for a desktop app a few years back. I remember it being painful to build from source, but if you’re lucky you might find a pre-built one that works for your setups. I’m not aware of a single cpp class solution, but I think others on this forum have figured it all out.

1 Like