Classes | Functions | Variables
pkcs8_x509.c File Reference
#include <openssl/pkcs8.h>
#include <limits.h>
#include <openssl/asn1t.h>
#include <openssl/asn1.h>
#include <openssl/bio.h>
#include <openssl/buf.h>
#include <openssl/bytestring.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/digest.h>
#include <openssl/hmac.h>
#include <openssl/mem.h>
#include <openssl/rand.h>
#include <openssl/x509.h>
#include "internal.h"
#include "../bytestring/internal.h"
#include "../internal.h"
Include dependency graph for pkcs8_x509.c:

Go to the source code of this file.

Classes

struct  pkcs12_st
 

Functions

static int add_bag_attributes (CBB *bag, const char *name, const uint8_t *key_id, size_t key_id_len)
 
static int add_cert_bag (CBB *cbb, X509 *cert, const char *name, const uint8_t *key_id, size_t key_id_len)
 
static int add_cert_safe_contents (CBB *cbb, X509 *cert, const STACK_OF(X509) *chain, const char *name, const uint8_t *key_id, size_t key_id_len)
 
static int add_encrypted_data (CBB *out, int pbe_nid, const char *password, size_t password_len, unsigned iterations, const uint8_t *in, size_t in_len)
 
 ASN1_SEQUENCE_cb (PKCS8_PRIV_KEY_INFO, pkey_cb)
 
PKCS12d2i_PKCS12 (PKCS12 **out_p12, const uint8_t **ber_bytes, size_t ber_len)
 
PKCS12d2i_PKCS12_bio (BIO *bio, PKCS12 **out_p12)
 
PKCS12d2i_PKCS12_fp (FILE *fp, PKCS12 **out_p12)
 
int i2d_PKCS12 (const PKCS12 *p12, uint8_t **out)
 
int i2d_PKCS12_bio (BIO *bio, const PKCS12 *p12)
 
int i2d_PKCS12_fp (FILE *fp, const PKCS12 *p12)
 
static int parse_bag_attributes (CBS *attrs, uint8_t **out_friendly_name, size_t *out_friendly_name_len)
 
static int pkcs12_check_mac (int *out_mac_ok, const char *password, size_t password_len, const CBS *salt, unsigned iterations, const EVP_MD *md, const CBS *authsafes, const CBS *expected_mac)
 
PKCS12PKCS12_create (const char *password, const char *name, const EVP_PKEY *pkey, X509 *cert, const STACK_OF(X509) *chain, int key_nid, int cert_nid, int iterations, int mac_iterations, int key_type)
 
void PKCS12_free (PKCS12 *p12)
 
int PKCS12_get_key_and_certs (EVP_PKEY **out_key, STACK_OF(X509) *out_certs, CBS *ber_in, const char *password)
 
static int PKCS12_handle_content_info (CBS *content_info, struct pkcs12_context *ctx)
 
static int PKCS12_handle_safe_bag (CBS *safe_bag, struct pkcs12_context *ctx)
 
static int PKCS12_handle_sequence (CBS *sequence, struct pkcs12_context *ctx, int(*handle_element)(CBS *cbs, struct pkcs12_context *ctx))
 
int pkcs12_iterations_acceptable (uint64_t iterations)
 
int PKCS12_parse (const PKCS12 *p12, const char *password, EVP_PKEY **out_pkey, X509 **out_cert, STACK_OF(X509) **out_ca_certs)
 
void PKCS12_PBE_add (void)
 
int PKCS12_verify_mac (const PKCS12 *p12, const char *password, int password_len)
 
static int pkey_cb (int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg)
 

Variables

static const uint8_t kCertBag []
 
static const uint8_t kFriendlyName []
 
static const uint8_t kKeyBag []
 
static const uint8_t kLocalKeyID []
 
static const uint8_t kPKCS7Data []
 
static const uint8_t kPKCS7EncryptedData []
 
static const uint8_t kPKCS8ShroudedKeyBag []
 
static const uint8_t kX509Certificate []
 

Function Documentation

◆ add_bag_attributes()

static int add_bag_attributes ( CBB bag,
const char *  name,
const uint8_t key_id,
size_t  key_id_len 
)
static

Definition at line 996 of file pkcs8_x509.c.

◆ add_cert_bag()

static int add_cert_bag ( CBB cbb,
X509 cert,
const char *  name,
const uint8_t key_id,
size_t  key_id_len 
)
static

Definition at line 1042 of file pkcs8_x509.c.

◆ add_cert_safe_contents()

static int add_cert_safe_contents ( CBB cbb,
X509 cert,
const STACK_OF(X509) *  chain,
const char *  name,
const uint8_t key_id,
size_t  key_id_len 
)
static

Definition at line 1072 of file pkcs8_x509.c.

◆ add_encrypted_data()

static int add_encrypted_data ( CBB out,
int  pbe_nid,
const char *  password,
size_t  password_len,
unsigned  iterations,
const uint8_t in,
size_t  in_len 
)
static

Definition at line 1092 of file pkcs8_x509.c.

◆ ASN1_SEQUENCE_cb()

ASN1_SEQUENCE_cb ( PKCS8_PRIV_KEY_INFO  ,
pkey_cb   
)

◆ d2i_PKCS12()

PKCS12* d2i_PKCS12 ( PKCS12 **  out_p12,
const uint8_t **  ber_bytes,
size_t  ber_len 
)

Definition at line 787 of file pkcs8_x509.c.

◆ d2i_PKCS12_bio()

PKCS12* d2i_PKCS12_bio ( BIO bio,
PKCS12 **  out_p12 
)

Definition at line 815 of file pkcs8_x509.c.

◆ d2i_PKCS12_fp()

PKCS12* d2i_PKCS12_fp ( FILE *  fp,
PKCS12 **  out_p12 
)

Definition at line 864 of file pkcs8_x509.c.

◆ i2d_PKCS12()

int i2d_PKCS12 ( const PKCS12 p12,
uint8_t **  out 
)

Definition at line 878 of file pkcs8_x509.c.

◆ i2d_PKCS12_bio()

int i2d_PKCS12_bio ( BIO bio,
const PKCS12 p12 
)

Definition at line 902 of file pkcs8_x509.c.

◆ i2d_PKCS12_fp()

int i2d_PKCS12_fp ( FILE *  fp,
const PKCS12 p12 
)

Definition at line 906 of file pkcs8_x509.c.

◆ parse_bag_attributes()

static int parse_bag_attributes ( CBS attrs,
uint8_t **  out_friendly_name,
size_t *  out_friendly_name_len 
)
static

Definition at line 355 of file pkcs8_x509.c.

◆ pkcs12_check_mac()

static int pkcs12_check_mac ( int out_mac_ok,
const char *  password,
size_t  password_len,
const CBS salt,
unsigned  iterations,
const EVP_MD md,
const CBS authsafes,
const CBS expected_mac 
)
static

Definition at line 603 of file pkcs8_x509.c.

◆ PKCS12_create()

PKCS12* PKCS12_create ( const char *  password,
const char *  name,
const EVP_PKEY pkey,
X509 cert,
const STACK_OF(X509) *  chain,
int  key_nid,
int  cert_nid,
int  iterations,
int  mac_iterations,
int  key_type 
)

Definition at line 1153 of file pkcs8_x509.c.

◆ PKCS12_free()

void PKCS12_free ( PKCS12 p12)

Definition at line 1377 of file pkcs8_x509.c.

◆ PKCS12_get_key_and_certs()

int PKCS12_get_key_and_certs ( EVP_PKEY **  out_key,
STACK_OF(X509) *  out_certs,
CBS ber_in,
const char *  password 
)

Definition at line 634 of file pkcs8_x509.c.

◆ PKCS12_handle_content_info()

static int PKCS12_handle_content_info ( CBS content_info,
struct pkcs12_context *  ctx 
)
static

Definition at line 526 of file pkcs8_x509.c.

◆ PKCS12_handle_safe_bag()

static int PKCS12_handle_safe_bag ( CBS safe_bag,
struct pkcs12_context *  ctx 
)
static

Definition at line 414 of file pkcs8_x509.c.

◆ PKCS12_handle_sequence()

static int PKCS12_handle_sequence ( CBS sequence,
struct pkcs12_context *  ctx,
int(*)(CBS *cbs, struct pkcs12_context *ctx handle_element 
)
static

Definition at line 285 of file pkcs8_x509.c.

◆ pkcs12_iterations_acceptable()

int pkcs12_iterations_acceptable ( uint64_t  iterations)

Definition at line 78 of file pkcs8_x509.c.

◆ PKCS12_parse()

int PKCS12_parse ( const PKCS12 p12,
const char *  password,
EVP_PKEY **  out_pkey,
X509 **  out_cert,
STACK_OF(X509) **  out_ca_certs 
)

Definition at line 917 of file pkcs8_x509.c.

◆ PKCS12_PBE_add()

void PKCS12_PBE_add ( void  )

Definition at line 780 of file pkcs8_x509.c.

◆ PKCS12_verify_mac()

int PKCS12_verify_mac ( const PKCS12 p12,
const char *  password,
int  password_len 
)

Definition at line 969 of file pkcs8_x509.c.

◆ pkey_cb()

static int pkey_cb ( int  operation,
ASN1_VALUE **  pval,
const ASN1_ITEM it,
void *  exarg 
)
static

Definition at line 94 of file pkcs8_x509.c.

Variable Documentation

◆ kCertBag

const uint8_t kCertBag[]
static
Initial value:
= {0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
0x01, 0x0c, 0x0a, 0x01, 0x03}

Definition at line 336 of file pkcs8_x509.c.

◆ kFriendlyName

const uint8_t kFriendlyName[]
static
Initial value:
= {0x2a, 0x86, 0x48, 0x86, 0xf7,
0x0d, 0x01, 0x09, 0x14}

Definition at line 340 of file pkcs8_x509.c.

◆ kKeyBag

const uint8_t kKeyBag[]
static
Initial value:
= {0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
0x01, 0x0c, 0x0a, 0x01, 0x01}

Definition at line 328 of file pkcs8_x509.c.

◆ kLocalKeyID

const uint8_t kLocalKeyID[]
static
Initial value:
= {0x2a, 0x86, 0x48, 0x86, 0xf7,
0x0d, 0x01, 0x09, 0x15}

Definition at line 344 of file pkcs8_x509.c.

◆ kPKCS7Data

const uint8_t kPKCS7Data[]
static
Initial value:
= {0x2a, 0x86, 0x48, 0x86, 0xf7,
0x0d, 0x01, 0x07, 0x01}

Definition at line 517 of file pkcs8_x509.c.

◆ kPKCS7EncryptedData

const uint8_t kPKCS7EncryptedData[]
static
Initial value:
= {0x2a, 0x86, 0x48, 0x86, 0xf7,
0x0d, 0x01, 0x07, 0x06}

Definition at line 521 of file pkcs8_x509.c.

◆ kPKCS8ShroudedKeyBag

const uint8_t kPKCS8ShroudedKeyBag[]
static
Initial value:
= {
0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x0c, 0x0a, 0x01, 0x02}

Definition at line 332 of file pkcs8_x509.c.

◆ kX509Certificate

const uint8_t kX509Certificate[]
static
Initial value:
= {0x2a, 0x86, 0x48, 0x86, 0xf7,
0x0d, 0x01, 0x09, 0x16, 0x01}

Definition at line 348 of file pkcs8_x509.c.



grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:26