Lines Matching refs:pkey

570 #define EVP_PKEY_get0_RSA(_pkey) _pkey->pkey.rsa  in ZEND_GET_MODULE()
571 #define EVP_PKEY_get0_DH(_pkey) _pkey->pkey.dh in ZEND_GET_MODULE()
572 #define EVP_PKEY_get0_DSA(_pkey) _pkey->pkey.dsa in ZEND_GET_MODULE()
573 #define EVP_PKEY_get0_EC_KEY(_pkey) _pkey->pkey.ec in ZEND_GET_MODULE()
757 EVP_PKEY *pkey = (EVP_PKEY *)rsrc->ptr; in php_openssl_pkey_free() local
759 assert(pkey != NULL); in php_openssl_pkey_free()
761 EVP_PKEY_free(pkey); in php_openssl_pkey_free()
831 static int php_openssl_is_private_key(EVP_PKEY* pkey);
1805 EVP_PKEY * pkey = NULL; in PHP_FUNCTION() local
1815 pkey = php_openssl_evp_from_zval(zpkey, 0, challenge, challenge_len, 1, &keyresource); in PHP_FUNCTION()
1817 if (pkey == NULL) { in PHP_FUNCTION()
1851 if (!NETSCAPE_SPKI_set_pubkey(spki, pkey)) { in PHP_FUNCTION()
1857 if (!NETSCAPE_SPKI_sign(spki, pkey, mdtype)) { in PHP_FUNCTION()
1883 if (keyresource == NULL && pkey != NULL) { in PHP_FUNCTION()
1884 EVP_PKEY_free(pkey); in PHP_FUNCTION()
1905 EVP_PKEY *pkey = NULL; in PHP_FUNCTION() local
1933 pkey = X509_PUBKEY_get(spki->spkac->pubkey); in PHP_FUNCTION()
1934 if (pkey == NULL) { in PHP_FUNCTION()
1940 i = NETSCAPE_SPKI_verify(spki, pkey); in PHP_FUNCTION()
1947 if (pkey != NULL) { in PHP_FUNCTION()
1948 EVP_PKEY_free(pkey); in PHP_FUNCTION()
1970 EVP_PKEY *pkey = NULL; in PHP_FUNCTION() local
1999 pkey = X509_PUBKEY_get(spki->spkac->pubkey); in PHP_FUNCTION()
2000 if (pkey == NULL) { in PHP_FUNCTION()
2007 if (out && PEM_write_bio_PUBKEY(out, pkey)) { in PHP_FUNCTION()
2025 if (pkey != NULL) { in PHP_FUNCTION()
2026 EVP_PKEY_free(pkey); in PHP_FUNCTION()
2953 EVP_PKEY * pkey = NULL; in PHP_FUNCTION() local
2973 if (d2i_PKCS12_bio(bio_in, &p12) && PKCS12_parse(p12, pass, &pkey, &cert, &ca)) { in PHP_FUNCTION()
2993 if (pkey) { in PHP_FUNCTION()
2995 if (PEM_write_bio_PrivateKey(bio_out, pkey, NULL, NULL, 0, 0, NULL)) { in PHP_FUNCTION()
3040 if (pkey) { in PHP_FUNCTION()
3041 EVP_PKEY_free(pkey); in PHP_FUNCTION()
4041 static int php_openssl_is_private_key(EVP_PKEY* pkey) in php_openssl_is_private_key() argument
4043 assert(pkey != NULL); in php_openssl_is_private_key()
4045 switch (EVP_PKEY_id(pkey)) { in php_openssl_is_private_key()
4049 RSA *rsa = EVP_PKEY_get0_RSA(pkey); in php_openssl_is_private_key()
4066 DSA *dsa = EVP_PKEY_get0_DSA(pkey); in php_openssl_is_private_key()
4084 DH *dh = EVP_PKEY_get0_DH(pkey); in php_openssl_is_private_key()
4103 EC_KEY *ec = EVP_PKEY_get0_EC_KEY(pkey); in php_openssl_is_private_key()
4143 static zend_bool php_openssl_pkey_init_and_assign_rsa(EVP_PKEY *pkey, RSA *rsa, zval *data) in php_openssl_pkey_init_and_assign_rsa() argument
4167 if (!EVP_PKEY_assign_RSA(pkey, rsa)) { in php_openssl_pkey_init_and_assign_rsa()
4303 EVP_PKEY *pkey; in PHP_FUNCTION() local
4307 pkey = EVP_PKEY_new(); in PHP_FUNCTION()
4308 if (pkey) { in PHP_FUNCTION()
4311 if (php_openssl_pkey_init_and_assign_rsa(pkey, rsa, data)) { in PHP_FUNCTION()
4312 RETURN_RES(zend_register_resource(pkey, le_key)); in PHP_FUNCTION()
4318 EVP_PKEY_free(pkey); in PHP_FUNCTION()
4325 pkey = EVP_PKEY_new(); in PHP_FUNCTION()
4326 if (pkey) { in PHP_FUNCTION()
4330 if (EVP_PKEY_assign_DSA(pkey, dsa)) { in PHP_FUNCTION()
4331 RETURN_RES(zend_register_resource(pkey, le_key)); in PHP_FUNCTION()
4340 EVP_PKEY_free(pkey); in PHP_FUNCTION()
4347 pkey = EVP_PKEY_new(); in PHP_FUNCTION()
4348 if (pkey) { in PHP_FUNCTION()
4352 if (EVP_PKEY_assign_DH(pkey, dh)) { in PHP_FUNCTION()
4353 ZVAL_COPY_VALUE(return_value, zend_list_insert(pkey, le_key)); in PHP_FUNCTION()
4363 EVP_PKEY_free(pkey); in PHP_FUNCTION()
4375 pkey = EVP_PKEY_new(); in PHP_FUNCTION()
4376 if (pkey) { in PHP_FUNCTION()
4455 if (EC_KEY_check_key(eckey) && EVP_PKEY_assign_EC_KEY(pkey, eckey)) { in PHP_FUNCTION()
4457 RETURN_RES(zend_register_resource(pkey, le_key)); in PHP_FUNCTION()
4480 if (pkey != NULL) { in PHP_FUNCTION()
4481 EVP_PKEY_free(pkey); in PHP_FUNCTION()
4677 EVP_PKEY *pkey; in PHP_FUNCTION() local
4683 pkey = php_openssl_evp_from_zval(cert, 1, NULL, 0, 1, &res); in PHP_FUNCTION()
4684 if (pkey == NULL) { in PHP_FUNCTION()
4697 EVP_PKEY *pkey; in PHP_FUNCTION() local
4702 if ((pkey = (EVP_PKEY *)zend_fetch_resource(Z_RES_P(key), "OpenSSL key", le_key)) == NULL) { in PHP_FUNCTION()
4714 EVP_PKEY *pkey; in PHP_FUNCTION() local
4724 pkey = php_openssl_evp_from_zval(cert, 0, passphrase, passphrase_len, 1, &res); in PHP_FUNCTION()
4726 if (pkey == NULL) { in PHP_FUNCTION()
4740 EVP_PKEY *pkey; in PHP_FUNCTION() local
4749 if ((pkey = (EVP_PKEY *)zend_fetch_resource(Z_RES_P(key), "OpenSSL key", le_key)) == NULL) { in PHP_FUNCTION()
4753 if (!PEM_write_bio_PUBKEY(out, pkey)) { in PHP_FUNCTION()
4761 add_assoc_long(return_value, "bits", EVP_PKEY_bits(pkey)); in PHP_FUNCTION()
4766 switch (EVP_PKEY_base_id(pkey)) { in PHP_FUNCTION()
4770 RSA *rsa = EVP_PKEY_get0_RSA(pkey); in PHP_FUNCTION()
4799 DSA *dsa = EVP_PKEY_get0_DSA(pkey); in PHP_FUNCTION()
4821 DH *dh = EVP_PKEY_get0_DH(pkey); in PHP_FUNCTION()
4843 if (EVP_PKEY_get0_EC_KEY(pkey) != NULL) { in PHP_FUNCTION()
4852 const EC_KEY *ec_key = EVP_PKEY_get0_EC_KEY(pkey); in PHP_FUNCTION()
4888 if ((d = EC_KEY_get0_private_key(EVP_PKEY_get0_EC_KEY(pkey))) != NULL) { in PHP_FUNCTION()
4917 EVP_PKEY *pkey; in PHP_FUNCTION() local
4925 if ((pkey = (EVP_PKEY *)zend_fetch_resource(Z_RES_P(key), "OpenSSL key", le_key)) == NULL) { in PHP_FUNCTION()
4928 if (EVP_PKEY_base_id(pkey) != EVP_PKEY_DH) { in PHP_FUNCTION()
4931 dh = EVP_PKEY_get0_DH(pkey); in PHP_FUNCTION()
5601 EVP_PKEY *pkey; in PHP_FUNCTION() local
5615 pkey = php_openssl_evp_from_zval(key, 0, "", 0, 0, &keyresource); in PHP_FUNCTION()
5617 if (pkey == NULL) { in PHP_FUNCTION()
5624 cryptedlen = EVP_PKEY_size(pkey); in PHP_FUNCTION()
5627 switch (EVP_PKEY_id(pkey)) { in PHP_FUNCTION()
5633 EVP_PKEY_get0_RSA(pkey), in PHP_FUNCTION()
5653 EVP_PKEY_free(pkey); in PHP_FUNCTION()
5663 EVP_PKEY *pkey; in PHP_FUNCTION() local
5678 pkey = php_openssl_evp_from_zval(key, 0, "", 0, 0, &keyresource); in PHP_FUNCTION()
5679 if (pkey == NULL) { in PHP_FUNCTION()
5686 cryptedlen = EVP_PKEY_size(pkey); in PHP_FUNCTION()
5689 switch (EVP_PKEY_id(pkey)) { in PHP_FUNCTION()
5695 EVP_PKEY_get0_RSA(pkey), in PHP_FUNCTION()
5720 EVP_PKEY_free(pkey); in PHP_FUNCTION()
5733 EVP_PKEY *pkey; in PHP_FUNCTION() local
5746 pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, 0, &keyresource); in PHP_FUNCTION()
5747 if (pkey == NULL) { in PHP_FUNCTION()
5754 cryptedlen = EVP_PKEY_size(pkey); in PHP_FUNCTION()
5757 switch (EVP_PKEY_id(pkey)) { in PHP_FUNCTION()
5763 EVP_PKEY_get0_RSA(pkey), in PHP_FUNCTION()
5781 EVP_PKEY_free(pkey); in PHP_FUNCTION()
5794 EVP_PKEY *pkey; in PHP_FUNCTION() local
5809 pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, 0, &keyresource); in PHP_FUNCTION()
5810 if (pkey == NULL) { in PHP_FUNCTION()
5817 cryptedlen = EVP_PKEY_size(pkey); in PHP_FUNCTION()
5820 switch (EVP_PKEY_id(pkey)) { in PHP_FUNCTION()
5826 EVP_PKEY_get0_RSA(pkey), in PHP_FUNCTION()
5856 EVP_PKEY_free(pkey); in PHP_FUNCTION()
5895 EVP_PKEY *pkey; in PHP_FUNCTION() local
5909 pkey = php_openssl_evp_from_zval(key, 0, "", 0, 0, &keyresource); in PHP_FUNCTION()
5910 if (pkey == NULL) { in PHP_FUNCTION()
5931 siglen = EVP_PKEY_size(pkey); in PHP_FUNCTION()
5938 EVP_SignFinal(md_ctx, (unsigned char*)ZSTR_VAL(sigbuf), &siglen, pkey)) { in PHP_FUNCTION()
5951 EVP_PKEY_free(pkey); in PHP_FUNCTION()
5961 EVP_PKEY *pkey; in PHP_FUNCTION() local
5995 pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, 0, &keyresource); in PHP_FUNCTION()
5996 if (pkey == NULL) { in PHP_FUNCTION()
6005 …(err = EVP_VerifyFinal(md_ctx, (unsigned char *)signature, (unsigned int)signature_len, pkey)) < 0… in PHP_FUNCTION()
6011 EVP_PKEY_free(pkey); in PHP_FUNCTION()
6153 EVP_PKEY *pkey; in PHP_FUNCTION() local
6171 pkey = php_openssl_evp_from_zval(privkey, 0, "", 0, 0, &keyresource); in PHP_FUNCTION()
6172 if (pkey == NULL) { in PHP_FUNCTION()
6209 if (ctx != NULL && EVP_OpenInit(ctx, cipher, (unsigned char *)ekey, (int)ekey_len, iv_buf, pkey) && in PHP_FUNCTION()
6223 EVP_PKEY_free(pkey); in PHP_FUNCTION()