Lines Matching refs:rsa
29 #include "mincrypt/rsa.h"
35 #include <openssl/rsa.h>
38 // Convert OpenSSL RSA private key to android pre-computed RSAPublicKey format.
40 static int convert_to_mincrypt_format(RSA *rsa, RSAPublicKey *pkey)
45 if (RSA_size(rsa) != RSANUMBYTES)
57 BN_copy(n, rsa->n);
71 pkey->exponent = BN_get_word(rsa->e);
87 static int write_public_keyfile(RSA *private_key, const char *private_key_path)
119 RSA *rsa = NULL;
144 rsa = EVP_PKEY_get1_RSA(pkey);
145 if (!rsa) {
146 printf("Failed to get the RSA public key from '%s'\n", pem_file);
150 if (write_public_keyfile(rsa, key_file) < 0) {
167 if (rsa) {
168 RSA_free(rsa);
178 RSA* rsa = RSA_new();
182 if (!pkey || !exponent || !rsa) {
188 RSA_generate_key_ex(rsa, 2048, exponent, NULL);
189 EVP_PKEY_set1_RSA(pkey, rsa);
202 if (write_public_keyfile(rsa, file) < 0) {
213 RSA_free(rsa);