static void print_key_details(BIO *out, EVP_PKEY *key)
{
    int keyid = EVP_PKEY_id(key);
#ifndef OPENSSL_NO_EC
    if (keyid == EVP_PKEY_EC) {
        EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key);
        int nid;
        const char *cname;
        nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec));
        EC_KEY_free(ec);
        cname = EC_curve_nid2nist(nid);
        if (!cname)
            cname = OBJ_nid2sn(nid);
        BIO_printf(out, "%d bits EC (%s)", EVP_PKEY_bits(key), cname);
    } else
#endif
    {
        const char *algname;
        switch (keyid) {
        case EVP_PKEY_RSA:
            algname = "RSA";
            break;
        case EVP_PKEY_DSA:
            algname = "DSA";
            break;
        case EVP_PKEY_DH:
            algname = "DH";
            break;
        default:
            algname = OBJ_nid2sn(keyid);
            break;
        }
        BIO_printf(out, "%d bits %s", EVP_PKEY_bits(key), algname);
    }
}
['static void print_key_details(BIO *out, EVP_PKEY *key)\n{\n    int keyid = EVP_PKEY_id(key);\n#ifndef OPENSSL_NO_EC\n    if (keyid == EVP_PKEY_EC) {\n        EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key);\n        int nid;\n        const char *cname;\n        nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec));\n        EC_KEY_free(ec);\n        cname = EC_curve_nid2nist(nid);\n        if (!cname)\n            cname = OBJ_nid2sn(nid);\n        BIO_printf(out, "%d bits EC (%s)", EVP_PKEY_bits(key), cname);\n    } else\n#endif\n    {\n        const char *algname;\n        switch (keyid) {\n        case EVP_PKEY_RSA:\n            algname = "RSA";\n            break;\n        case EVP_PKEY_DSA:\n            algname = "DSA";\n            break;\n        case EVP_PKEY_DH:\n            algname = "DH";\n            break;\n        default:\n            algname = OBJ_nid2sn(keyid);\n            break;\n        }\n        BIO_printf(out, "%d bits %s", EVP_PKEY_bits(key), algname);\n    }\n}', 'int EVP_PKEY_id(const EVP_PKEY *pkey)\n{\n    return pkey->type;\n}', 'EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey)\n{\n    EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey);\n    if (ret != NULL)\n        EC_KEY_up_ref(ret);\n    return ret;\n}', 'EC_KEY *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey)\n{\n    if (pkey->type != EVP_PKEY_EC) {\n        EVPerr(EVP_F_EVP_PKEY_GET0_EC_KEY, EVP_R_EXPECTING_A_EC_KEY);\n        return NULL;\n    }\n    return pkey->pkey.ec;\n}', 'const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key)\n{\n    return key->group;\n}']