PCL
pcl::Cipher Class Referenceabstract

Abstract base class for cipher algorithm implementations. More...

#include <Cryptography.h>

+ Inheritance diagram for pcl::Cipher:

Public Member Functions

 Cipher ()=default
 
 Cipher (const Cipher &)=default
 
virtual ~Cipher ()
 
virtual String AlgorithmName () const =0
 
template<class C >
ByteArray Decrypt (const C &input) const
 
template<class C >
void Decrypt (void *output, const C &input) const
 
virtual void Decrypt (void *output, const void *input, size_type length) const =0
 
template<class C >
ByteArray Encrypt (const C &input) const
 
template<class C >
void Encrypt (void *output, const C &input) const
 
virtual void Encrypt (void *output, const void *input, size_type length) const =0
 
virtual size_type KeyLength () const =0
 
Cipheroperator= (const Cipher &)=default
 

Detailed Description

Cipher defines a common interface for implementations of algorithms performing encryption and decryption of generic data.

Currently we have implemented the AES-256 cipher with CBC/ECB encryption and decryption on the PixInsight platform, available as the AES256 class.

See also
AES256

Definition at line 758 of file Cryptography.h.

Constructor & Destructor Documentation

◆ Cipher() [1/2]

pcl::Cipher::Cipher ( )
default

Default constructor.

◆ Cipher() [2/2]

pcl::Cipher::Cipher ( const Cipher )
default

Copy constructor.

◆ ~Cipher()

virtual pcl::Cipher::~Cipher ( )
inlinevirtual

Destroys a Cipher object.

Definition at line 780 of file Cryptography.h.

Member Function Documentation

◆ AlgorithmName()

virtual String pcl::Cipher::AlgorithmName ( ) const
pure virtual

Returns the name of this cipher algorithm.

Implemented in pcl::AES256.

◆ Decrypt() [1/3]

template<class C >
ByteArray pcl::Cipher::Decrypt ( const C &  input) const
inline

Out-of-place container decryption.

Parameters
inputReference to a container where the encrypted data (or cipher text) is stored as a contiguous block. The input container will be treated as a contiguous sequence of bytes, ignoring the data type of the items contained.

The C template argument must be a class with PCL container semantics (the Begin() and Size() member functions are required). Typically the ByteArray class is used, although any array-like class with contiguous storage is appropriate, including Array, String, Vector and Matrix.

Returns a ByteArray object with the decrypted data, or plain text), as a contiguous sequence of bytes.

Definition at line 906 of file Cryptography.h.

◆ Decrypt() [2/3]

template<class C >
void pcl::Cipher::Decrypt ( void *  output,
const C &  input 
) const
inline

Container decryption.

Parameters
[out]outputStarting address of the output buffer, where the decrypted data (or plain text) will be stored.
inputReference to a container where the encrypted data (or cipher text) is stored as a contiguous block. The input container will be treated as a contiguous sequence of bytes, ignoring the data type of the items contained.

The C template argument must be a class with PCL container semantics (the Begin() and Size() member functions are required). Typically the ByteArray class is used, although any array-like class with contiguous storage is appropriate, including Array, String, Vector and Matrix.

Definition at line 884 of file Cryptography.h.

◆ Decrypt() [3/3]

virtual void pcl::Cipher::Decrypt ( void *  output,
const void *  input,
size_type  length 
) const
pure virtual

Buffer decryption.

Parameters
[out]outputStarting address of the output buffer, where the decrypted data (or plain text) will be stored.
inputStarting address of the input buffer, where the encrypted data (or cipher text) is stored.
lengthThe buffer length in bytes.

Implemented in pcl::AES256.

◆ Encrypt() [1/3]

template<class C >
ByteArray pcl::Cipher::Encrypt ( const C &  input) const
inline

Out-of-place container encryption.

Parameters
inputReference to a container where the original data (or plain text) is stored as a contiguous block. The input container will be treated as a contiguous sequence of bytes, ignoring the data type of the items contained.

The C template argument must be a class with PCL container semantics (the Begin() and Size() member functions are required). Typically the ByteArray class is used, although any array-like class with contiguous storage is appropriate, including Array, String, Vector and Matrix.

Returns a ByteArray object with the encrypted data, or cipher text. The returned object can be used to decrypt the data with the Decrypt() member function.

Definition at line 860 of file Cryptography.h.

◆ Encrypt() [2/3]

template<class C >
void pcl::Cipher::Encrypt ( void *  output,
const C &  input 
) const
inline

Container encryption.

Parameters
[out]outputStarting address of the output buffer, where the encrypted data (or cipher text) will be stored.
inputReference to a container where the original data (or plain text) is stored as a contiguous block. The input container will be treated as a contiguous sequence of bytes, ignoring the data type of the items contained.

The C template argument must be a class with PCL container semantics (the Begin() and Size() member functions are required). Typically the ByteArray class is used, although any array-like class with contiguous storage is appropriate, including Array, String, Vector and Matrix.

Definition at line 837 of file Cryptography.h.

◆ Encrypt() [3/3]

virtual void pcl::Cipher::Encrypt ( void *  output,
const void *  input,
size_type  length 
) const
pure virtual

Buffer encryption.

Parameters
[out]outputStarting address of the output buffer, where the encrypted data (or cipher text) will be stored.
inputStarting address of the input buffer, where the original data (or plain text) is stored.
lengthThe buffer length in bytes.

Implemented in pcl::AES256.

◆ KeyLength()

virtual size_type pcl::Cipher::KeyLength ( ) const
pure virtual

Returns the length in bytes of a key in this cipher algorithm.

Implemented in pcl::AES256.

◆ operator=()

Cipher& pcl::Cipher::operator= ( const Cipher )
default

Copy assignment operator. Returns a reference to this object.


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