PLCnext API Documentation 23.0.2.9
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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.
 
 IdentityStore (const IdentityStore &arg)=delete
 Copy constructor.
 
IdentityStoreoperator= (const IdentityStore &arg)=delete
 Assignment operator.
 
 ~IdentityStore (void)=default
 Destructs this instance and frees all resources.
 
String GetName (void) const
 Returns the name of the IdentityStore More...
 
String GetFullCertificateFileName (void) const
 summary>Returns the absolute path to the key file
 
String GetFullKeyFileName (void) const
 summary>Returns the absolute path to the tpm key file
 
String GetFullTpmKeyFileName (void) const
 summary>checks if a certificate is available for this IdentityStore
 
bool HasCertificate (void)
 
const std::shared_ptr< KeyPair > & GetKeyPair (void)
 summary>Returns the type of the key pair
 
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
 
std::vector< std::vector< byte > > GetIssuerPemCertificates (void)
 summary>creates all needed directories inside the folder of this IdentityStore
 
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

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

◆ 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

◆ 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: