PLCnext API Documentation 25.0.2.69
Public Member Functions | Protected Attributes | List of all members
Arp::System::Commons::Security::KeyPair Class Reference

class which represents a asymmetric key pair More...

#include <KeyPair.hpp>

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

Public Member Functions

 KeyPair ()
 Constructs an KeyPair
 
 KeyPair (const KeyPair &arg)=delete
 Copy constructor.
 
KeyPairoperator= (const KeyPair &arg)=delete
 Assignment operator.
 
virtual ~KeyPair (void)
 Destructs this instance and frees all resources.
 
EVP_PKEY * GetPkey ()
 returns a pointer to the OpenSSL EVP_PKEY* structure initialized with this KeyPair More...
 
virtual void LoadFromFile (const String &filename)
 Loads the KeyPair from a PEM encoded file filename More...
 
void LoadFromMemory (const std::vector< byte > &data)
 Loads the KeyPair from memory (PEM encoded) More...
 
void InitSslContext (SSL_CTX *pSslCtx) const
 Initializes a OpenSSL SSL_CTX structure ith this KeyPair More...
 
std::vector< byte > GetPublicKey ()
 Returns the public key portion of this key pair (PEM format) More...
 
KeyPairType GetKeyType ()
 Returns the type of this key pair
 
void WriteToFile (const String &filename)
 saves this KeyPair to a file in PEM format (the private key is not encrypted!)
 
void GenerateKeyPair (KeyPairType type)
 Generates a new key pair and replaced the current key pair with the generated More...
 

Protected Attributes

OpenSslEVP_PKEY opensslkey
 
KeyPairType keyType
 

Detailed Description

class which represents a asymmetric key pair

Member Function Documentation

◆ GenerateKeyPair()

void Arp::System::Commons::Security::KeyPair::GenerateKeyPair ( KeyPairType  type)

Generates a new key pair and replaced the current key pair with the generated

Parameters
typetype of key to generate

◆ GetPkey()

EVP_PKEY * Arp::System::Commons::Security::KeyPair::GetPkey ( )

returns a pointer to the OpenSSL EVP_PKEY* structure initialized with this KeyPair

Please Note: pointer is only valid when the KePair is not destroyed

◆ GetPublicKey()

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

Returns the public key portion of this key pair (PEM format)

Returns
byte vector with PEM encoded public key

◆ InitSslContext()

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

Initializes a OpenSSL SSL_CTX structure ith this KeyPair

Parameters
pSslCtxPointer to the OpenSSL SSL_CTX structure to initialize

◆ LoadFromFile()

void Arp::System::Commons::Security::KeyPair::LoadFromFile ( const String filename)
virtual

Loads the KeyPair from a PEM encoded file filename

Parameters
filenamefile from which the KeyPair is loaded. Must be PEM encoded

◆ LoadFromMemory()

void Arp::System::Commons::Security::KeyPair::LoadFromMemory ( const std::vector< byte > &  data)

Loads the KeyPair from memory (PEM encoded)

Parameters
databyte vector with PEM encoded Key Pair

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