# Poco::Crypto

# class PKCS12Container

Library: Crypto
Package: Certificate
Header: Poco/Crypto/PKCS12Container.h

## Description

This class implements PKCS#12 container functionality.

## Member Summary

Member Functions: getCACerts, getFriendlyName, getFriendlyNamesCA, getKey, getX509Certificate, hasKey, hasX509Certificate, operator =

## Types Aliases

### CAList

using CAList = X509Certificate::List;

### CANameList

using CANameList = std::vector < std::string >;

## Constructors

### PKCS12Container

PKCS12Container(
const PKCS12Container & cont
);

Copy constructor.

### PKCS12Container

PKCS12Container(
PKCS12Container && cont
) noexcept;

Move constructor.

### PKCS12Container

explicit PKCS12Container(
std::istream & istr,
const std::string & password = ""
);

Creates the PKCS12Container object from a stream.

### PKCS12Container

explicit PKCS12Container(
const std::string & path,
const std::string & password = ""
);

Creates the PKCS12Container object from a file.

## Destructor

### ~PKCS12Container

~PKCS12Container();

Destroys the PKCS12Container.

## Member Functions

### getCACerts

const CAList & getCACerts() const;

Returns the list of CA certificates in this container.

### getFriendlyName

const std::string & getFriendlyName() const;

Returns the friendly name of the certificate bag.

### getFriendlyNamesCA

const CANameList & getFriendlyNamesCA() const;

Returns a list of CA certificates friendly names.

### getKey

EVPPKey getKey() const;

Return key as openssl EVP_PKEY wrapper object.

### getX509Certificate

const X509Certificate & getX509Certificate() const;

Returns the X509 certificate. Throws NotFoundException if there is no certificate.

### hasKey

bool hasKey() const;

Returns true if container contains the key.

### hasX509Certificate

bool hasX509Certificate() const;

Returns true if container has X509 certificate.

### operator =

PKCS12Container & operator = (
const PKCS12Container & cont
);

Assignment operator.

### operator =

PKCS12Container & operator = (
PKCS12Container && cont
) noexcept;

Move assignment operator.