Lines Matching +full:dsa +full:- +full:specific

2  * Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved.
26 #include <openssl/dsa.h>
46 /* Set to 0 if parameters should not be saved (dsa only) */
109 OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(ctx->provctx); in p8info_to_encp8()
111 if (ctx->cipher == NULL) in p8info_to_encp8()
115 &ctx->pwdata)) { in p8info_to_encp8()
119 /* First argument == -1 means "standard" */ in p8info_to_encp8()
120 p8 = PKCS8_encrypt_ex(-1, ctx->cipher, kstr, klen, NULL, 0, 0, p8info, libctx, NULL); in p8info_to_encp8()
197 if (!ctx->cipher_intent) in key_to_epki_der_priv_bio()
200 if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, in key_to_epki_der_priv_bio()
225 if (!ctx->cipher_intent) in key_to_epki_pem_priv_bio()
228 if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, in key_to_epki_pem_priv_bio()
253 if (ctx->cipher_intent) in key_to_pki_der_priv_bio()
257 if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, in key_to_pki_der_priv_bio()
285 if (ctx->cipher_intent) in key_to_pki_pem_priv_bio()
289 if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, in key_to_pki_pem_priv_bio()
317 if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, in key_to_spki_der_pub_bio()
343 if (p2s != NULL && !p2s(key, key_nid, ctx->save_parameters, in key_to_spki_pem_pub_bio()
360 * key_to_type_specific_* produce encoded output with type specific key data,
361 * no envelopment; the same kind of output as the type specific i2d_ and
403 PEM_ASN1_write_bio(k2d, pemname, out, key, ctx->cipher, in key_to_type_specific_pem_bio_cb()
415 ossl_pw_pem_password, &ctx->pwdata); in key_to_type_specific_pem_priv_bio()
440 /* ---------------------------------------------------------------------- */
454 params->length = i2d_DHxparams(dh, &params->data); in prepare_dh_params()
456 params->length = i2d_DHparams(dh, &params->data); in prepare_dh_params()
458 if (params->length <= 0) { in prepare_dh_params()
463 params->type = V_ASN1_SEQUENCE; in prepare_dh_params()
544 /* ---------------------------------------------------------------------- */
547 static int encode_dsa_params(const void *dsa, int nid, in encode_dsa_params() argument
557 params->length = i2d_DSAparams(dsa, &params->data); in encode_dsa_params()
559 if (params->length <= 0) { in encode_dsa_params()
570 static int prepare_dsa_params(const void *dsa, int nid, int save, in prepare_dsa_params() argument
573 const BIGNUM *p = DSA_get0_p(dsa); in prepare_dsa_params()
574 const BIGNUM *q = DSA_get0_q(dsa); in prepare_dsa_params()
575 const BIGNUM *g = DSA_get0_g(dsa); in prepare_dsa_params()
578 return encode_dsa_params(dsa, nid, pstr, pstrtype); in prepare_dsa_params()
585 static int dsa_spki_pub_to_der(const void *dsa, unsigned char **pder) in dsa_spki_pub_to_der() argument
591 if ((bn = DSA_get0_pub_key(dsa)) == NULL) { in dsa_spki_pub_to_der()
606 static int dsa_pki_priv_to_der(const void *dsa, unsigned char **pder) in dsa_pki_priv_to_der() argument
612 if ((bn = DSA_get0_priv_key(dsa)) == NULL) { in dsa_pki_priv_to_der()
635 # define dsa_input_type "DSA"
636 # define dsa_pem_type "DSA"
639 /* ---------------------------------------------------------------------- */
652 params->length = i2d_ECParameters(eckey, &params->data); in prepare_ec_explicit_params()
653 if (params->length <= 0) { in prepare_ec_explicit_params()
719 * as the pkeyalg->parameter field. (For a named curve this is an OID) in ec_pki_priv_to_der()
747 * according to the example in GM/T 0015-2012, appendix D.2.
757 /* ---------------------------------------------------------------------- */
772 keyblob = OPENSSL_memdup(ecxkey->pubkey, ecxkey->keylen); in ecx_spki_pub_to_der()
779 return ecxkey->keylen; in ecx_spki_pub_to_der()
788 if (ecxkey == NULL || ecxkey->privkey == NULL) { in ecx_pki_priv_to_der()
793 oct.data = ecxkey->privkey; in ecx_pki_priv_to_der()
794 oct.length = ecxkey->keylen; in ecx_pki_priv_to_der()
829 /* ---------------------------------------------------------------------- */
832 * Helper functions to prepare RSA-PSS params for encoding. We would
874 if (!ossl_DER_w_RSASSA_PSS_params(&pkt, -1, pss) in prepare_rsa_params()
886 * immediately de-allocated. in prepare_rsa_params()
936 #define rsapss_input_type "RSA-PSS"
938 #define rsapss_pem_type "RSA-PSS"
940 /* ---------------------------------------------------------------------- */
950 ctx->provctx = provctx; in key2any_newctx()
951 ctx->save_parameters = 1; in key2any_newctx()
961 ossl_pw_clear_passphrase_data(&ctx->pwdata); in key2any_freectx()
962 EVP_CIPHER_free(ctx->cipher); in key2any_freectx()
980 OSSL_LIB_CTX *libctx = ossl_prov_ctx_get0_libctx(ctx->provctx); in key2any_set_ctx_params()
997 EVP_CIPHER_free(ctx->cipher); in key2any_set_ctx_params()
998 ctx->cipher = NULL; in key2any_set_ctx_params()
999 ctx->cipher_intent = ciphername != NULL; in key2any_set_ctx_params()
1001 && ((ctx->cipher = in key2any_set_ctx_params()
1007 if (!OSSL_PARAM_get_int(save_paramsp, &ctx->save_parameters)) in key2any_set_ctx_params()
1060 BIO *out = ossl_bio_new_from_core_bio(ctx->provctx, cout); in key2any_encode()
1064 || ossl_pw_set_ossl_passphrase_cb(&ctx->pwdata, pwcb, pwcbarg))) in key2any_encode()
1105 /*-
1121 * - DO_PRIVATE_KEY
1122 * - DO_PUBLIC_KEY
1123 * - DO_PARAMETERS
1131 * - PrivateKeyInfo (raw unencrypted form)
1132 * - EncryptedPrivateKeyInfo (encrypted wrapping)
1152 * "type-specific" is a uniform name for key type specific output for private
1160 * - type_specific_keypair Only supports private and public key
1161 * - type_specific_params Only supports parameters
1162 * - type_specific Supports all parts of an EVP_PKEY
1163 * - type_specific_no_pub Supports all parts of an EVP_PKEY
1187 * Type specific aliases for the cases where we need to refer to them by
1261 ctx->provctx, selection, params); \
1322 MAKE_ENCODER(dsa, dsa, EVP_PKEY_DSA, type_specific, der);
1341 MAKE_ENCODER(dsa, dsa, EVP_PKEY_DSA, type_specific, pem);
1352 * implementations specified above, but are more specific.
1385 MAKE_ENCODER(dsa, dsa, EVP_PKEY_DSA, EncryptedPrivateKeyInfo, der);
1386 MAKE_ENCODER(dsa, dsa, EVP_PKEY_DSA, EncryptedPrivateKeyInfo, pem);
1387 MAKE_ENCODER(dsa, dsa, EVP_PKEY_DSA, PrivateKeyInfo, der);
1388 MAKE_ENCODER(dsa, dsa, EVP_PKEY_DSA, PrivateKeyInfo, pem);
1389 MAKE_ENCODER(dsa, dsa, EVP_PKEY_DSA, SubjectPublicKeyInfo, der);
1390 MAKE_ENCODER(dsa, dsa, EVP_PKEY_DSA, SubjectPublicKeyInfo, pem);
1434 * Support for key type specific output formats. Not all key types have
1450 MAKE_ENCODER(dsa, dsa, EVP_PKEY_DSA, DSA, der);
1451 MAKE_ENCODER(dsa, dsa, EVP_PKEY_DSA, DSA, pem);