soter_status_t soter_rsa_key_pair_gen_export_key(soter_rsa_key_pair_gen_t* ctx, void* key, size_t* key_length, bool isprivate){ EVP_PKEY *pkey; SOTER_CHECK_PARAM(ctx); pkey = EVP_PKEY_CTX_get0_pkey(ctx->pkey_ctx); SOTER_CHECK_PARAM(pkey); SOTER_CHECK_PARAM(EVP_PKEY_RSA == EVP_PKEY_id(pkey)); if (isprivate) { return soter_engine_specific_to_rsa_priv_key((const soter_engine_specific_rsa_key_t *)pkey, (soter_container_hdr_t *)key, key_length); } else { return soter_engine_specific_to_rsa_pub_key((const soter_engine_specific_rsa_key_t *)pkey, (soter_container_hdr_t *)key, key_length); } }
soter_status_t soter_rsa_export_key(soter_sign_ctx_t* ctx, void* key, size_t* key_length, bool isprivate) { EVP_PKEY *pkey = EVP_PKEY_CTX_get0_pkey(ctx->pkey_ctx); if (!pkey){ return SOTER_INVALID_PARAMETER; } if(isprivate) { return soter_engine_specific_to_rsa_priv_key((const soter_engine_specific_rsa_key_t *)pkey, (soter_container_hdr_t *)key, key_length); } else { return soter_engine_specific_to_rsa_pub_key((const soter_engine_specific_rsa_key_t *)pkey, (soter_container_hdr_t *)key, key_length); } }