[Autocrypt] How to create the "raw key" part from an RSA key
holger krekel
holger at merlinux.eu
Tue May 16 17:53:58 EDT 2017
Hi Bjoern,
i am not involved with openssl on the c-level but did you look into
https://shanetully.com/2012/06/openssl-rsa-aes-and-c/ ?
This also might help:
http://openssl.6102.n7.nabble.com/How-to-use-a-binary-public-key-td43325.html
And if you or someone finds out an openssl cmdline invocation which generates a proper Autocrypt RSA-2048 key we could add it to the docs.
holger
On Tue, May 16, 2017 at 13:13 +0200, Bjoern wrote:
> Hi there,
>
> I'm just about to add AutoCrypt to Delta Chat.
>
> I'm creating the key pair using the following code:
>
> // generate key
> BIGNUM* e = BN_new();
> RSA* rsa = RSA_new();
>
> BN_set_word(e, 65537);
> if( RSA_generate_key_ex(rsa, 2024, e, 0) != 1 ) {
> goto cleanup;
> }
>
> // convert RSA key to PUBLIC KEY
> EVP_PKEY* pkey = EVP_PKEY_new();
> EVP_PKEY_set1_RSA(pkey, rsa);
>
> now I can get the keys as `-----BEGIN PUBLIC KEY----- ...` and
> `-----BEGIN RSA PRIVATE KEY----- ...` using
>
> PEM_write_bio_PUBKEY(bio1, pkey);
>
> and
>
> PEM_write_bio_RSAPrivateKey(bio2, rsa, NULL, NULL, 0, NULL, NULL);
>
> But how can I get the key in the "raw" form needed by Autocrypt?
> (base64 encoding itself is no problem)
>
> (for various reasons, I cannont use libraries based upon GnuPG as PEP
> or GPGME and I wanted a portable C code)
>
> Any help is wecome as this would saves me tons of time :-) (I am not
> expert in OpenSSL)
> _______________________________________________
> Autocrypt mailing list
>
> Post: Autocrypt at lists.mayfirst.org
> List info: https://lists.mayfirst.org/mailman/listinfo/autocrypt
>
> To Unsubscribe
> Send email to: Autocrypt-unsubscribe at lists.mayfirst.org
> Or visit: https://lists.mayfirst.org/mailman/options/autocrypt/holger%40merlinux.eu
>
> You are subscribed as: holger at merlinux.eu
More information about the Autocrypt
mailing list