Lines Matching refs:pkey
28 /* Set any parameters associated with pkey */
29 static int rsa_param_encode(const EVP_PKEY *pkey,
32 const RSA *rsa = pkey->pkey.rsa;
53 static int rsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
60 if (!rsa_param_encode(pkey, &str, &strtype))
62 penclen = i2d_RSAPublicKey(pkey->pkey.rsa, &penc);
65 if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(pkey->ameth->pkey_id),
73 static int rsa_pub_decode(EVP_PKEY *pkey, const X509_PUBKEY *pubkey)
90 switch (pkey->ameth->pkey_id) {
102 if (!EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, rsa)) {
115 if (((RSA_flags(a->pkey.rsa) & RSA_METHOD_FLAG_NO_CHECK))
116 || (RSA_flags(b->pkey.rsa) & RSA_METHOD_FLAG_NO_CHECK)) {
120 if (BN_cmp(b->pkey.rsa->n, a->pkey.rsa->n) != 0
121 || BN_cmp(b->pkey.rsa->e, a->pkey.rsa->e) != 0)
126 static int old_rsa_priv_decode(EVP_PKEY *pkey,
133 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, rsa);
137 static int old_rsa_priv_encode(const EVP_PKEY *pkey, unsigned char **pder)
139 return i2d_RSAPrivateKey(pkey->pkey.rsa, pder);
142 static int rsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
149 if (!rsa_param_encode(pkey, &str, &strtype))
151 rklen = i2d_RSAPrivateKey(pkey->pkey.rsa, &rk);
159 if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(pkey->ameth->pkey_id), 0,
170 static int rsa_priv_decode(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8)
177 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, rsa);
182 static int int_rsa_size(const EVP_PKEY *pkey)
184 return RSA_size(pkey->pkey.rsa);
187 static int rsa_bits(const EVP_PKEY *pkey)
189 return BN_num_bits(pkey->pkey.rsa->n);
192 static int rsa_security_bits(const EVP_PKEY *pkey)
194 return RSA_security_bits(pkey->pkey.rsa);
197 static void int_rsa_free(EVP_PKEY *pkey)
199 RSA_free(pkey->pkey.rsa);
297 static int pkey_rsa_print(BIO *bp, const EVP_PKEY *pkey, int off, int priv)
299 const RSA *x = pkey->pkey.rsa;
311 if (BIO_printf(bp, "%s ", pkey_is_pss(pkey) ? "RSA-PSS" : "RSA") <= 0)
379 if (pkey_is_pss(pkey) && !rsa_pss_param_print(bp, 1, x->pss, off))
386 static int rsa_pub_print(BIO *bp, const EVP_PKEY *pkey, int indent,
389 return pkey_rsa_print(bp, pkey, indent, 0);
392 static int rsa_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent,
395 return pkey_rsa_print(bp, pkey, indent, 1);
417 static int rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
425 if (pkey->pkey.rsa->pss != NULL) {
426 if (!ossl_rsa_pss_get_param(pkey->pkey.rsa->pss, &md, &mgf1md,
515 * From PSS AlgorithmIdentifier set public key parameters. If pkey isn't NULL
521 const X509_ALGOR *sigalg, EVP_PKEY *pkey)
542 if (pkey) {
543 if (!EVP_DigestVerifyInit(ctx, &pkctx, md, NULL, pkey))
614 const ASN1_BIT_STRING *sig, EVP_PKEY *pkey)
621 if (ossl_rsa_pss_to_ctx(ctx, NULL, sigalg, pkey) > 0) {
723 static int rsa_pkey_check(const EVP_PKEY *pkey)
725 return RSA_check_key_ex(pkey->pkey.rsa, NULL);
728 static size_t rsa_pkey_dirty_cnt(const EVP_PKEY *pkey)
730 return pkey->pkey.rsa->dirty_cnt;
742 RSA *rsa = from->pkey.rsa;
797 EVP_PKEY *pkey = EVP_PKEY_CTX_get0_pkey(pctx);
852 ok = EVP_PKEY_assign_RSA(pkey, rsa);
855 ok = EVP_PKEY_assign(pkey, EVP_PKEY_RSA_PSS, rsa);
893 RSA *rsa = from->pkey.rsa;