Functions | Variables
pkcs12_test.cc File Reference
#include <gtest/gtest.h>
#include <openssl/bio.h>
#include <openssl/bytestring.h>
#include <openssl/crypto.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/pkcs8.h>
#include <openssl/mem.h>
#include <openssl/span.h>
#include <openssl/stack.h>
#include <openssl/x509.h>
#include "../test/test_util.h"
Include dependency graph for pkcs12_test.cc:

Go to the source code of this file.

Functions

static void ExpectPKCS12Parse (bssl::Span< const uint8_t > in, EVP_PKEY *expect_key, X509 *expect_cert, const std::vector< X509 * > &expect_ca_certs)
 
std::string GetTestData (const char *path)
 
static bssl::UniquePtr< EVP_PKEYLoadPrivateKey (bssl::Span< const uint8_t > der)
 
static bssl::UniquePtr< X509LoadX509 (bssl::Span< const uint8_t > der)
 
static bssl::UniquePtr< X509MakeTestCert (EVP_PKEY *key)
 
static bssl::UniquePtr< EVP_PKEYMakeTestKey ()
 
static bool PKCS12CreateVector (std::vector< uint8_t > *out, EVP_PKEY *pkey, const std::vector< X509 * > &certs)
 
static bssl::Span< const uint8_tStringToBytes (const std::string &str)
 
 TEST (PKCS12Test, Order)
 
 TEST (PKCS12Test, RoundTrip)
 
 TEST (PKCS12Test, TestEmptyPassword)
 
 TEST (PKCS12Test, TestNoEncryption)
 
 TEST (PKCS12Test, TestNSS)
 
 TEST (PKCS12Test, TestNullPassword)
 
 TEST (PKCS12Test, TestOpenSSL)
 
 TEST (PKCS12Test, TestPBES2)
 
 TEST (PKCS12Test, TestUnicode)
 
 TEST (PKCS12Test, TestWindows)
 
 TEST (PKCS12Test, TestWindowsCompat)
 
static void TestCompat (bssl::Span< const uint8_t > der)
 
static void TestImpl (const char *name, bssl::Span< const uint8_t > der, const char *password, const char *friendly_name)
 
static void TestRoundTrip (const char *password, const char *name, bssl::Span< const uint8_t > key_der, bssl::Span< const uint8_t > cert_der, std::vector< bssl::Span< const uint8_t >> chain_der, int key_nid, int cert_nid, int iterations, int mac_iterations)
 

Variables

static const char kPassword [] = "foo"
 
static const uint8_t kTestCert []
 
static const uint8_t kTestCert2 []
 
static const uint8_t kTestKey []
 
static const char kUnicodePassword [] = u8"Hello, 世界"
 

Function Documentation

◆ ExpectPKCS12Parse()

static void ExpectPKCS12Parse ( bssl::Span< const uint8_t in,
EVP_PKEY expect_key,
X509 expect_cert,
const std::vector< X509 * > &  expect_ca_certs 
)
static

Definition at line 517 of file pkcs12_test.cc.

◆ GetTestData()

std::string GetTestData ( const char *  path)

Definition at line 4454 of file crypto_test_data.cc.

◆ LoadPrivateKey()

static bssl::UniquePtr<EVP_PKEY> LoadPrivateKey ( bssl::Span< const uint8_t der)
static

Definition at line 300 of file pkcs12_test.cc.

◆ LoadX509()

static bssl::UniquePtr<X509> LoadX509 ( bssl::Span< const uint8_t der)
static

Definition at line 295 of file pkcs12_test.cc.

◆ MakeTestCert()

static bssl::UniquePtr<X509> MakeTestCert ( EVP_PKEY key)
static

Definition at line 469 of file pkcs12_test.cc.

◆ MakeTestKey()

static bssl::UniquePtr<EVP_PKEY> MakeTestKey ( )
static

Definition at line 454 of file pkcs12_test.cc.

◆ PKCS12CreateVector()

static bool PKCS12CreateVector ( std::vector< uint8_t > *  out,
EVP_PKEY pkey,
const std::vector< X509 * > &  certs 
)
static

Definition at line 488 of file pkcs12_test.cc.

◆ StringToBytes()

static bssl::Span<const uint8_t> StringToBytes ( const std::string &  str)
static

Definition at line 39 of file pkcs12_test.cc.

◆ TEST() [1/11]

TEST ( PKCS12Test  ,
Order   
)

Definition at line 556 of file pkcs12_test.cc.

◆ TEST() [2/11]

TEST ( PKCS12Test  ,
RoundTrip   
)

Definition at line 387 of file pkcs12_test.cc.

◆ TEST() [3/11]

TEST ( PKCS12Test  ,
TestEmptyPassword   
)

Definition at line 143 of file pkcs12_test.cc.

◆ TEST() [4/11]

TEST ( PKCS12Test  ,
TestNoEncryption   
)

Definition at line 134 of file pkcs12_test.cc.

◆ TEST() [5/11]

TEST ( PKCS12Test  ,
TestNSS   
)

Definition at line 102 of file pkcs12_test.cc.

◆ TEST() [6/11]

TEST ( PKCS12Test  ,
TestNullPassword   
)

Definition at line 156 of file pkcs12_test.cc.

◆ TEST() [7/11]

TEST ( PKCS12Test  ,
TestOpenSSL   
)

Definition at line 95 of file pkcs12_test.cc.

◆ TEST() [8/11]

TEST ( PKCS12Test  ,
TestPBES2   
)

Definition at line 117 of file pkcs12_test.cc.

◆ TEST() [9/11]

TEST ( PKCS12Test  ,
TestUnicode   
)

Definition at line 171 of file pkcs12_test.cc.

◆ TEST() [10/11]

TEST ( PKCS12Test  ,
TestWindows   
)

Definition at line 109 of file pkcs12_test.cc.

◆ TEST() [11/11]

TEST ( PKCS12Test  ,
TestWindowsCompat   
)

Definition at line 178 of file pkcs12_test.cc.

◆ TestCompat()

static void TestCompat ( bssl::Span< const uint8_t der)
static

Definition at line 71 of file pkcs12_test.cc.

◆ TestImpl()

static void TestImpl ( const char *  name,
bssl::Span< const uint8_t der,
const char *  password,
const char *  friendly_name 
)
static

Definition at line 44 of file pkcs12_test.cc.

◆ TestRoundTrip()

static void TestRoundTrip ( const char *  password,
const char *  name,
bssl::Span< const uint8_t key_der,
bssl::Span< const uint8_t cert_der,
std::vector< bssl::Span< const uint8_t >>  chain_der,
int  key_nid,
int  cert_nid,
int  iterations,
int  mac_iterations 
)
static

Definition at line 305 of file pkcs12_test.cc.

Variable Documentation

◆ kPassword

const char kPassword[] = "foo"
static

Definition at line 34 of file pkcs12_test.cc.

◆ kTestCert

const uint8_t kTestCert[]
static

Definition at line 199 of file pkcs12_test.cc.

◆ kTestCert2

const uint8_t kTestCert2[]
static

Definition at line 241 of file pkcs12_test.cc.

◆ kTestKey

const uint8_t kTestKey[]
static
Initial value:
= {
0x30, 0x81, 0x87, 0x02, 0x01, 0x00, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86,
0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
0x03, 0x01, 0x07, 0x04, 0x6d, 0x30, 0x6b, 0x02, 0x01, 0x01, 0x04, 0x20,
0x07, 0x0f, 0x08, 0x72, 0x7a, 0xd4, 0xa0, 0x4a, 0x9c, 0xdd, 0x59, 0xc9,
0x4d, 0x89, 0x68, 0x77, 0x08, 0xb5, 0x6f, 0xc9, 0x5d, 0x30, 0x77, 0x0e,
0xe8, 0xd1, 0xc9, 0xce, 0x0a, 0x8b, 0xb4, 0x6a, 0xa1, 0x44, 0x03, 0x42,
0x00, 0x04, 0xe6, 0x2b, 0x69, 0xe2, 0xbf, 0x65, 0x9f, 0x97, 0xbe, 0x2f,
0x1e, 0x0d, 0x94, 0x8a, 0x4c, 0xd5, 0x97, 0x6b, 0xb7, 0xa9, 0x1e, 0x0d,
0x46, 0xfb, 0xdd, 0xa9, 0xa9, 0x1e, 0x9d, 0xdc, 0xba, 0x5a, 0x01, 0xe7,
0xd6, 0x97, 0xa8, 0x0a, 0x18, 0xf9, 0xc3, 0xc4, 0xa3, 0x1e, 0x56, 0xe2,
0x7c, 0x83, 0x48, 0xdb, 0x16, 0x1a, 0x1c, 0xf5, 0x1d, 0x7e, 0xf1, 0x94,
0x2d, 0x4b, 0xcf, 0x72, 0x22, 0xc1}

Definition at line 184 of file pkcs12_test.cc.

◆ kUnicodePassword

const char kUnicodePassword[] = u8"Hello, 世界"
static

Definition at line 37 of file pkcs12_test.cc.



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