The API cannot do it. The encoding requires that numbers with the high-bit on
have a leading zero to avoid being interpreted as negative numbers as you
noticed. You could maybe generate our own RSA numbers with the high-bit off –
i.e., make your own RSA_new kind of API. The BN code can have f
Hi,
Following code is simplified to demonstrate plain RSA public key with the
OpenSSL library:
RSA_ptr rsa(RSA_new(), ::RSA_free);
BN_ptr bn(BN_new(), ::BN_free);
BN_set_word(bn.get(), RSA_F4); //65535
RSA_generate_key_ex(rsa.get(), 320, bn.get(), NULL);
BIO * keybio = BIO_ne