+ }
+
+ rsa_t *rsa = RSA_new();
+ if(!rsa)
+ return NULL;
+
+ RSA_set0_key(rsa, bn_n, bn_e, NULL);
+
+ return rsa;
+}
+
+rsa_t *rsa_set_hex_private_key(char *n, char *e, char *d) {
+ BIGNUM *bn_n = NULL;
+ BIGNUM *bn_e = NULL;
+ BIGNUM *bn_d = NULL;
+
+ if(BN_hex2bn(&bn_n, n) != strlen(n) || BN_hex2bn(&bn_e, e) != strlen(e) || BN_hex2bn(&bn_d, d) != strlen(d)) {
+ BN_free(bn_d);
+ BN_free(bn_e);
+ BN_free(bn_n);