i2d_RSA_PUBKEY(rsa, &p);
break;
default:
- return FALSE;
+ {
+ chunk_t n = chunk_empty, e = chunk_empty;
+ bool success = FALSE;
+
+ if (openssl_bn2chunk(rsa->n, &n) &&
+ openssl_bn2chunk(rsa->e, &e))
+ {
+ success = lib->encoding->encode(lib->encoding, type, rsa, fp,
+ CRED_PART_RSA_MODULUS, n,
+ CRED_PART_RSA_PUB_EXP, e, CRED_PART_END);
+ }
+ chunk_free(&n);
+ chunk_free(&e);
+ return success;
+ }
}
hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA1);
if (!hasher || !hasher->allocate_hash(hasher, key, fp))