Lines Matching refs:key
42 /* OpenSSL doesn't provide direct access to key values */
51 static EVP_PKEY *pub_ed25519_to_ossl(const unsigned char *key)
57 memmove(buf + PUBPREFIXLEN, key, DNS_KEY_ED25519SIZE);
63 unsigned char *key)
78 memmove(key, buf + len - DNS_KEY_ED25519SIZE, DNS_KEY_ED25519SIZE);
87 static EVP_PKEY *pub_ed448_to_ossl(const unsigned char *key)
93 memmove(buf + PUBPREFIXLEN, key, DNS_KEY_ED448SIZE);
99 unsigned char *key)
114 memmove(key, buf + len - DNS_KEY_ED448SIZE, DNS_KEY_ED448SIZE);
125 static EVP_PKEY *priv_ed25519_to_ossl(const unsigned char *key)
131 memmove(buf + PRIVPREFIXLEN, key, DNS_KEY_ED25519SIZE);
138 unsigned char *key)
153 memmove(key, buf + len - DNS_KEY_ED25519SIZE, DNS_KEY_ED25519SIZE);
162 static EVP_PKEY *priv_ed448_to_ossl(const unsigned char *key)
168 memmove(buf + PRIVPREFIXLEN, key, DNS_KEY_ED448SIZE);
175 unsigned char *key)
190 memmove(key, buf + len - DNS_KEY_ED448SIZE, DNS_KEY_ED448SIZE);
194 static isc_result_t openssleddsa_todns(const dst_key_t *key,
198 openssleddsa_createctx(dst_key_t *key, dst_context_t *dctx) {
202 UNUSED(key);
203 REQUIRE(dctx->key->key_alg == DST_ALG_ED25519 ||
204 dctx->key->key_alg == DST_ALG_ED448);
216 REQUIRE(dctx->key->key_alg == DST_ALG_ED25519 ||
217 dctx->key->key_alg == DST_ALG_ED448);
231 REQUIRE(dctx->key->key_alg == DST_ALG_ED25519 ||
232 dctx->key->key_alg == DST_ALG_ED448);
254 dst_key_t *key = dctx->key;
257 EVP_PKEY *pkey = key->keydata.pkey;
262 REQUIRE(key->key_alg == DST_ALG_ED25519 ||
263 key->key_alg == DST_ALG_ED448);
268 if (key->key_alg == DST_ALG_ED25519)
303 dst_key_t *key = dctx->key;
306 EVP_PKEY *pkey = key->keydata.pkey;
311 REQUIRE(key->key_alg == DST_ALG_ED25519 ||
312 key->key_alg == DST_ALG_ED448);
317 if (key->key_alg == DST_ALG_ED25519)
376 openssleddsa_generate(dst_key_t *key, int unused, void (*callback)(int)) {
382 REQUIRE(key->key_alg == DST_ALG_ED25519 ||
383 key->key_alg == DST_ALG_ED448);
387 if (key->key_alg == DST_ALG_ED25519) {
389 key->key_size = DNS_KEY_ED25519SIZE;
392 key->key_size = DNS_KEY_ED448SIZE;
410 key->keydata.pkey = pkey;
420 openssleddsa_isprivate(const dst_key_t *key) {
421 EVP_PKEY *pkey = key->keydata.pkey;
439 openssleddsa_destroy(dst_key_t *key) {
440 EVP_PKEY *pkey = key->keydata.pkey;
443 key->keydata.pkey = NULL;
447 openssleddsa_todns(const dst_key_t *key, isc_buffer_t *data) {
448 EVP_PKEY *pkey = key->keydata.pkey;
454 pkey = key->keydata.pkey;
455 switch (key->key_alg) {
478 openssleddsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
483 REQUIRE(key->key_alg == DST_ALG_ED25519 ||
484 key->key_alg == DST_ALG_ED448);
489 if (key->key_alg == DST_ALG_ED25519) {
503 key->keydata.pkey = pkey;
504 key->key_size = len;
509 openssleddsa_tofile(const dst_key_t *key, const char *directory) {
516 REQUIRE(key->key_alg == DST_ALG_ED25519 ||
517 key->key_alg == DST_ALG_ED448);
519 if (key->keydata.pkey == NULL)
522 if (key->external) {
524 return (dst__privstruct_writefile(key, &priv, directory));
527 pkey = key->keydata.pkey;
528 if (key->key_alg == DST_ALG_ED25519) {
530 buf = isc_mem_get(key->mctx, len);
540 ret = dst__privstruct_writefile(key, &priv, directory);
543 buf = isc_mem_get(key->mctx, len);
553 ret = dst__privstruct_writefile(key, &priv, directory);
558 isc_mem_put(key->mctx, buf, len);
578 openssleddsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
583 isc_mem_t *mctx = key->mctx;
585 REQUIRE(key->key_alg == DST_ALG_ED25519 ||
586 key->key_alg == DST_ALG_ED448);
588 /* read private key file */
589 ret = dst__privstruct_parse(key, DST_ALG_ED25519, lexer, mctx, &priv);
593 if (key->external) {
598 key->keydata.pkey = pub->keydata.pkey;
605 if (key->key_alg == DST_ALG_ED25519) {
622 key->keydata.pkey = pkey;
623 key->key_size = len;