{
EVP_PKEY *pkey;
ASN1_IA5STRING *chal;
+ ASN1_OBJECT *spkioid;
int i, n;
char *s;
BIO_printf(out, "Netscape SPKI:\n");
- i = OBJ_obj2nid(spki->spkac->pubkey->algor->algorithm);
+ X509_PUBKEY_get0_param(&spkioid, NULL, NULL, NULL, spki->spkac->pubkey);
+ i = OBJ_obj2nid(spkioid);
BIO_printf(out, " Public Key Algorithm: %s\n",
(i == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(i));
pkey = X509_PUBKEY_get(spki->spkac->pubkey);
return X509_PUBKEY_get(x->cert_info.key);
}
-ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x)
-{
- if (!x)
- return NULL;
- return x->cert_info.key->public_key;
-}
-
int X509_check_private_key(X509 *x, EVP_PKEY *k)
{
EVP_PKEY *xk;
#include <openssl/x509.h>
#include "internal/asn1_int.h"
#include "internal/evp_int.h"
+#include "internal/x509_int.h"
#include <openssl/rsa.h>
#include <openssl/dsa.h>
+struct X509_pubkey_st {
+ X509_ALGOR *algor;
+ ASN1_BIT_STRING *public_key;
+ EVP_PKEY *pkey;
+ CRYPTO_RWLOCK *lock;
+};
+
/* Minor tweak to operation: free up EVP_PKEY */
static int pubkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
void *exarg)
*pa = pub->algor;
return 1;
}
+
+ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x)
+{
+ if (x == NULL)
+ return NULL;
+ return x->cert_info.key->public_key;
+}
X509V3_CTX *ctx, char *str)
{
ASN1_OCTET_STRING *oct;
- ASN1_BIT_STRING *pk;
+ X509_PUBKEY *pubkey;
+ const unsigned char *pk;
+ int pklen;
unsigned char pkey_dig[EVP_MAX_MD_SIZE];
unsigned int diglen;
}
if (ctx->subject_req)
- pk = ctx->subject_req->req_info.pubkey->public_key;
+ pubkey = ctx->subject_req->req_info.pubkey;
else
- pk = ctx->subject_cert->cert_info.key->public_key;
+ pubkey = ctx->subject_cert->cert_info.key;
- if (!pk) {
+ if (pubkey == NULL) {
X509V3err(X509V3_F_S2I_SKEY_ID, X509V3_R_NO_PUBLIC_KEY);
goto err;
}
- if (!EVP_Digest
- (pk->data, pk->length, pkey_dig, &diglen, EVP_sha1(), NULL))
+ X509_PUBKEY_get0_param(NULL, &pk, &pklen, NULL, pubkey);
+
+ if (!EVP_Digest(pk, pklen, pkey_dig, &diglen, EVP_sha1(), NULL))
goto err;
if (!ASN1_OCTET_STRING_set(oct, pkey_dig, diglen)) {
ASN1_TIME *notAfter;
} X509_VAL;
-struct X509_pubkey_st {
- X509_ALGOR *algor;
- ASN1_BIT_STRING *public_key;
- EVP_PKEY *pkey;
- CRYPTO_RWLOCK *lock;
-};
-
typedef struct X509_sig_st X509_SIG;
typedef struct X509_name_entry_st X509_NAME_ENTRY;