Zonemaster-LDNS
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
ldns/host2str.c view on Meta::CPAN
} else if (ldns_key_algorithm(k) == LDNS_SIGN_DSA_NSEC3) {
ldns_buffer_printf(output,"Algorithm: 6 (DSA_NSEC3)\n");
}
/* print to buf, convert to bin, convert to b64,
* print to buf */
if(1) {
const BIGNUM *p=NULL, *q=NULL, *g=NULL,
*priv_key=NULL, *pub_key=NULL;
#if OPENSSL_VERSION_NUMBER < 0x10100000 || (defined(HAVE_LIBRESSL) && LIBRESSL_VERSION_NUMBER < 0x20700000)
#ifndef S_SPLINT_S
p = dsa->p;
q = dsa->q;
g = dsa->g;
priv_key = dsa->priv_key;
pub_key = dsa->pub_key;
#endif /* splint */
#else
DSA_get0_pqg(dsa, &p, &q, &g);
DSA_get0_key(dsa, &pub_key, &priv_key);
#endif
if(!ldns_print_bignum_b64_line(output, "Prime(p)", p))
goto error;
if(!ldns_print_bignum_b64_line(output, "Subprime(q)", q))
goto error;
if(!ldns_print_bignum_b64_line(output, "Base(g)", g))
goto error;
if(!ldns_print_bignum_b64_line(output, "Private_value(x)", priv_key))
goto error;
if(!ldns_print_bignum_b64_line(output, "Public_value(y)", pub_key))
goto error;
}
break;
#endif /* USE_DSA */
case LDNS_SIGN_ECC_GOST:
/* no format defined, use blob */
#if defined(HAVE_SSL) && defined(USE_GOST)
ldns_buffer_printf(output, "Private-key-format: v1.2\n");
ldns_buffer_printf(output, "Algorithm: %d (ECC-GOST)\n", LDNS_SIGN_ECC_GOST);
status = ldns_gost_key2buffer_str(output,
#ifndef S_SPLINT_S
k->_key.key
#else
NULL
#endif
);
#else
goto error;
#endif /* GOST */
break;
case LDNS_SIGN_ECDSAP256SHA256:
case LDNS_SIGN_ECDSAP384SHA384:
#ifdef USE_ECDSA
ldns_buffer_printf(output, "Private-key-format: v1.2\n");
ldns_buffer_printf(output, "Algorithm: %d (", ldns_key_algorithm(k));
status=ldns_algorithm2buffer_str(output, (ldns_algorithm)ldns_key_algorithm(k));
#ifndef S_SPLINT_S
ldns_buffer_printf(output, ")\n");
if(k->_key.key) {
EC_KEY* ec = EVP_PKEY_get1_EC_KEY(k->_key.key);
const BIGNUM* b = EC_KEY_get0_private_key(ec);
if(!ldns_print_bignum_b64_line(output, "PrivateKey", b))
goto error;
/* down reference count in EC_KEY
* its still assigned to the PKEY */
EC_KEY_free(ec);
}
#endif /* splint */
#else
goto error;
#endif /* ECDSA */
break;
#ifdef USE_ED25519
case LDNS_SIGN_ED25519:
ldns_buffer_printf(output, "Private-key-format: v1.2\n");
ldns_buffer_printf(output, "Algorithm: %d (", ldns_key_algorithm(k));
status=ldns_algorithm2buffer_str(output, (ldns_algorithm)ldns_key_algorithm(k));
ldns_buffer_printf(output, ")\n");
if (status) break;
status = ldns_ed25519_key2buffer_str(output,
k->_key.key);
break;
#endif /* USE_ED25519 */
#ifdef USE_ED448
case LDNS_SIGN_ED448:
ldns_buffer_printf(output, "Private-key-format: v1.2\n");
ldns_buffer_printf(output, "Algorithm: %d (", ldns_key_algorithm(k));
status=ldns_algorithm2buffer_str(output, (ldns_algorithm)ldns_key_algorithm(k));
ldns_buffer_printf(output, ")\n");
if (status) break;
status = ldns_ed448_key2buffer_str(output,
k->_key.key);
break;
#endif /* USE_ED448 */
case LDNS_SIGN_HMACMD5:
/* there's not much of a format defined for TSIG */
/* It's just a binary blob, Same for all algorithms */
ldns_buffer_printf(output, "Private-key-format: v1.2\n");
ldns_buffer_printf(output, "Algorithm: 157 (HMAC_MD5)\n");
status = ldns_hmac_key2buffer_str(output, k);
break;
case LDNS_SIGN_HMACSHA1:
ldns_buffer_printf(output, "Private-key-format: v1.2\n");
ldns_buffer_printf(output, "Algorithm: 158 (HMAC_SHA1)\n");
status = ldns_hmac_key2buffer_str(output, k);
break;
case LDNS_SIGN_HMACSHA224:
ldns_buffer_printf(output, "Private-key-format: v1.2\n");
ldns_buffer_printf(output, "Algorithm: 162 (HMAC_SHA224)\n");
status = ldns_hmac_key2buffer_str(output, k);
break;
case LDNS_SIGN_HMACSHA256:
ldns_buffer_printf(output, "Private-key-format: v1.2\n");
ldns_buffer_printf(output, "Algorithm: 159 (HMAC_SHA256)\n");
status = ldns_hmac_key2buffer_str(output, k);
break;
case LDNS_SIGN_HMACSHA384:
ldns_buffer_printf(output, "Private-key-format: v1.2\n");
ldns_buffer_printf(output, "Algorithm: 164 (HMAC_SHA384)\n");
status = ldns_hmac_key2buffer_str(output, k);
break;
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.638 second using v1.00-cache-2.02-grep-82fe00e-cpan-2cc899e4a130 )