\CryptoManana\Core\Abstractions\MessageEncryptionAbstractAsymmetricEncryptionAlgorithm

Class AbstractAsymmetricEncryptionAlgorithm - The asymmetric algorithm abstraction representation.

Summary

Methods
Properties
Constants
setKeyPair()
getKeyPair()
setPrivateKey()
getPrivateKey()
setPublicKey()
getPublicKey()
checkIfThePrivateKeyIsSet()
checkIfThePublicKeyIsSet()
__construct()
No public properties found
ALGORITHM_NAME
KEY_SIZE
validatePrivateKeyResource()
validatePublicKeyResource()
validateKeyPair()
validatePlainData()
validateCipherOrSignatureData()
$privateKey
$publicKey
N/A
No private methods found
No private properties found
N/A

Constants

ALGORITHM_NAME

ALGORITHM_NAME

The internal name of the algorithm.

KEY_SIZE

KEY_SIZE

The internal key size measured in raw bytes length for the algorithm

Properties

$privateKey

$privateKey : string

The private key string property storage.

Type

string — The private key string value.

$publicKey

$publicKey : string

The public key string property storage.

Type

string — The public key string value.

Methods

setKeyPair()

setKeyPair(\CryptoManana\DataStructures\KeyPair  $keyPair) : $this

Setter for the whole key pair as an array.

Parameters

\CryptoManana\DataStructures\KeyPair $keyPair

The private and public key pair as an object.

Throws

\Exception

Validation errors.

Returns

$this —

The encryption/signature algorithm object.

getKeyPair()

getKeyPair() : \CryptoManana\DataStructures\KeyPair

Getter for the whole key pair as an array.

Throws

\Exception

Validation errors.

Returns

\CryptoManana\DataStructures\KeyPair

The private and public key pair as an object.

setPrivateKey()

setPrivateKey(string  $privateKey) : $this

Setter for the private key string property.

Parameters

string $privateKey

The private key string.

Throws

\Exception

Validation errors.

Returns

$this —

The encryption/signature algorithm object.

getPrivateKey()

getPrivateKey() : string

Getter for the private key string property.

Returns

string —

The private key string.

setPublicKey()

setPublicKey(string  $publicKey) : $this

Setter for the public key string property.

Parameters

string $publicKey

The public key string.

Throws

\Exception

Validation errors.

Returns

$this —

The encryption/signature algorithm object.

getPublicKey()

getPublicKey() : string

Getter for the public key string property.

Returns

string —

The public key string.

checkIfThePrivateKeyIsSet()

checkIfThePrivateKeyIsSet() 

Checks if the private key is present.

Throws

\Exception

If there is no private key set.

checkIfThePublicKeyIsSet()

checkIfThePublicKeyIsSet() 

Checks if the public key is present.

Throws

\Exception

If there is no public key set.

__construct()

__construct() 

Asymmetrical algorithm constructor.

validatePrivateKeyResource()

validatePrivateKeyResource(string  $privateKey) : string

Internal method for the validation of the private key resource.

Parameters

string $privateKey

The private key input string.

Throws

\Exception

Validation errors.

Returns

string —

The extracted public key string from the private key resource.

validatePublicKeyResource()

validatePublicKeyResource(string  $publicKey) 

Internal method for the validation of the public key resource.

Parameters

string $publicKey

The public key input string.

Throws

\Exception

Validation errors.

validateKeyPair()

validateKeyPair(string  $privateKey, string  $publicKey) 

Internal method for the validation of the private and public key pair string representations.

Parameters

string $privateKey

The private key input string.

string $publicKey

The public key input string.

Throws

\Exception

Validation errors.

validatePlainData()

validatePlainData(string  $plainData) 

Internal method for the validation of plain data used at encryption/signing operations.

Parameters

string $plainData

The plain input string.

Throws

\Exception

Validation errors.

validateCipherOrSignatureData()

validateCipherOrSignatureData(string  $cipherOrSignatureData) 

Internal method for the validation of cipher/signature data used at decryption/verifying operations.

Parameters

string $cipherOrSignatureData

The encrypted input string or a signature string.

Throws

\Exception

Validation errors.