PLCnext API Documentation  22.9.0.33
Public Types | Public Member Functions | List of all members
Arp::System::Commons::Security::IdentityStore Class Reference

Class with represents a Identity (Certificate with Chain and private Key) and is able to initialze an OpenSSL SSL Conetxt More...

#include <IdentityStore.hpp>

Inheritance diagram for Arp::System::Commons::Security::IdentityStore:
Inheritance graph

Public Types

enum  KeyMustExist : bool { IgnoreMissingKey = false , RequireKeyExists = true }
 

Public Member Functions

 IdentityStore (const String &basePath, const String &name, KeyMustExist requireKeyExists=RequireKeyExists)
 Constructs an IdentityStore instance. More...
 
 IdentityStore (const IdentityStore &arg)=delete
 Copy constructor. More...
 
IdentityStoreoperator= (const IdentityStore &arg)=delete
 Assignment operator. More...
 
 ~IdentityStore (void)=default
 Destructs this instance and frees all resources. More...
 
String GetName (void) const
 Returns the name of the IdentityStore More...
 
String GetFullCertificateFileName (void) const
 summary>Returns the absolute path to the key file More...
 
String GetFullKeyFileName (void) const
 summary>Returns the absolute path to the tpm key file More...
 
String GetFullTpmKeyFileName (void) const
 summary>checks if a certificate is available for this IdentityStore More...
 
bool HasCertificate (void)
 
const std::shared_ptr< KeyPair > & GetKeyPair (void)
 summary>Returns the type of the key pair More...
 
KeyPairType GetKeyType (void)
 
void InitSslContext (SSL_CTX *pSslCtx) const
 Initializes a OpenSSL SSL_:CTX Structure with the private key and certificate More...
 
std::vector< byteGetPublicKey (void)
 
SecurityConfigurationError SetKeyPair (const std::vector< byte > &pemData)
 
SecurityConfigurationError SetCertificate (const std::vector< byte > &pemData)
 
std::vector< byteGetPemCertificate (void)
 
std::vector< byteGetDerCertificate (void)
 
std::vector< byteGetPemCertificateWithChain (void)
 
std::vector< byteGetDerCertificateWithChain (void)
 summary>get the issuer certificates in PEM format More...
 
std::vector< std::vector< byte > > GetIssuerPemCertificates (void)
 summary>creates all needed directories inside the folder of this IdentityStore More...
 
void CreateAllDirectories (void)
 summary>list all elements in the list referenced by ListType More...
 
SecurityConfigurationError ListContent (SecurityListType type, std::vector< ItemInfo > &result)
 summary>add an element into the list referenced by ListType More...
 
SecurityConfigurationError AddElement (SecurityListType type, const std::vector< byte > &pemData)
 summary>delete an elements from the list referenced by ListType, identified by identifier More...
 
SecurityConfigurationError DeleteElement (SecurityListType type, const String &identifier)
 summary>Generate a new KeyPair for this IdentityStore More...
 
SecurityConfigurationError GenerateKeyPair (KeyPairType type)
 
std::vector< byteGenerateCSR ()
 
bool VerifyCertMatchesWithPrivateKey (void)
 

Detailed Description

Class with represents a Identity (Certificate with Chain and private Key) and is able to initialze an OpenSSL SSL Conetxt

internal class used by TlsSocket

Constructor & Destructor Documentation

◆ IdentityStore() [1/2]

Arp::System::Commons::Security::IdentityStore::IdentityStore ( const String basePath,
const String name,
KeyMustExist  requireKeyExists = RequireKeyExists 
)

Constructs an IdentityStore instance.

◆ IdentityStore() [2/2]

Arp::System::Commons::Security::IdentityStore::IdentityStore ( const IdentityStore arg)
delete

Copy constructor.

◆ ~IdentityStore()

Arp::System::Commons::Security::IdentityStore::~IdentityStore ( void  )
default

Destructs this instance and frees all resources.

Member Function Documentation

◆ AddElement()

SecurityConfigurationError Arp::System::Commons::Security::IdentityStore::AddElement ( SecurityListType  type,
const std::vector< byte > &  pemData 
)

summary>delete an elements from the list referenced by ListType, identified by identifier

returns>SecurityConfigurationError::None if operation was successful. In case of an error the error code identified the error is returned

◆ CreateAllDirectories()

void Arp::System::Commons::Security::IdentityStore::CreateAllDirectories ( void  )

summary>list all elements in the list referenced by ListType

returns>SecurityConfigurationError::None if operation was successful. In case of an error the error code identified the error is returned

◆ DeleteElement()

SecurityConfigurationError Arp::System::Commons::Security::IdentityStore::DeleteElement ( SecurityListType  type,
const String identifier 
)

summary>Generate a new KeyPair for this IdentityStore

returns>SecurityConfigurationError::None if operation was successful. In case of an error the error code identified the error is returned

◆ GenerateCSR()

std::vector<byte> Arp::System::Commons::Security::IdentityStore::GenerateCSR ( )

summary>verify if the certificates matches with the Key pair returns>true if the certificate matches the private key, false otherwise

◆ GenerateKeyPair()

SecurityConfigurationError Arp::System::Commons::Security::IdentityStore::GenerateKeyPair ( KeyPairType  type)

summary>Generate a Certiciate Signing Request (CSR) for the Key Pair of this IdentityStore returns>byte vector with generated CSR in PEM format

◆ GetDerCertificate()

std::vector<byte> Arp::System::Commons::Security::IdentityStore::GetDerCertificate ( void  )

summary>get certificate as byte array in PEM format with issuer certificates appended returns>byte vector with PEM encoded certificate with all certificates from its chain appended

◆ GetDerCertificateWithChain()

std::vector<byte> Arp::System::Commons::Security::IdentityStore::GetDerCertificateWithChain ( void  )

summary>get the issuer certificates in PEM format

◆ GetFullCertificateFileName()

String Arp::System::Commons::Security::IdentityStore::GetFullCertificateFileName ( void  ) const
inline

summary>Returns the absolute path to the key file

◆ GetFullKeyFileName()

String Arp::System::Commons::Security::IdentityStore::GetFullKeyFileName ( void  ) const
inline

summary>Returns the absolute path to the tpm key file

◆ GetFullTpmKeyFileName()

String Arp::System::Commons::Security::IdentityStore::GetFullTpmKeyFileName ( void  ) const
inline

summary>checks if a certificate is available for this IdentityStore

◆ GetIssuerPemCertificates()

std::vector<std::vector<byte> > Arp::System::Commons::Security::IdentityStore::GetIssuerPemCertificates ( void  )

summary>creates all needed directories inside the folder of this IdentityStore

◆ GetKeyPair()

const std::shared_ptr<KeyPair>& Arp::System::Commons::Security::IdentityStore::GetKeyPair ( void  )

summary>Returns the type of the key pair

◆ GetName()

String Arp::System::Commons::Security::IdentityStore::GetName ( void  ) const
inline

Returns the name of the IdentityStore

summary>Returns the absolute path to the certificate file

◆ GetPemCertificate()

std::vector<byte> Arp::System::Commons::Security::IdentityStore::GetPemCertificate ( void  )

summary>get certificate as byte array in DER format returns>byte vector with DER encoded certificate

◆ GetPemCertificateWithChain()

std::vector<byte> Arp::System::Commons::Security::IdentityStore::GetPemCertificateWithChain ( void  )

summary>get certificate as byte array in DER format with issuer certificates appended returns>byte vector with DER encoded certificate with all certificates from its chain appended

◆ GetPublicKey()

std::vector<byte> Arp::System::Commons::Security::IdentityStore::GetPublicKey ( void  )

summary>Sets the key pair from pem data out if memory param pemData="pemData">std::vector<byte> with pem encoded key pair

returns>SecurityConfigurationError::None if operation was successful. In case of an error the error code identified the error is returned

◆ InitSslContext()

void Arp::System::Commons::Security::IdentityStore::InitSslContext ( SSL_CTX *  pSslCtx) const

Initializes a OpenSSL SSL_:CTX Structure with the private key and certificate

param name="pSslCtx">Pointer to the OpenSSL SSL_CTX structure to initialize

summary>reads the public key in PEM format

Returns
byte vector with PEM encoded public key

◆ ListContent()

SecurityConfigurationError Arp::System::Commons::Security::IdentityStore::ListContent ( SecurityListType  type,
std::vector< ItemInfo > &  result 
)

summary>add an element into the list referenced by ListType

returns>SecurityConfigurationError::None if operation was successful. In case of an error the error code identified the error is returned

◆ operator=()

IdentityStore& Arp::System::Commons::Security::IdentityStore::operator= ( const IdentityStore arg)
delete

Assignment operator.

◆ SetCertificate()

SecurityConfigurationError Arp::System::Commons::Security::IdentityStore::SetCertificate ( const std::vector< byte > &  pemData)

summary>get certificate as byte array in PEM format returns>byte vector with PEM encoded certificate

◆ SetKeyPair()

SecurityConfigurationError Arp::System::Commons::Security::IdentityStore::SetKeyPair ( const std::vector< byte > &  pemData)

summary>Sets the certificate from pem data out if memory param pemData="pemData">std::vector<byte> with pem encoded certificate

returns>SecurityConfigurationError::None if operation was successful. In case of an error the error code identified the error is returned


The documentation for this class was generated from the following file: