\CryptoManana\Core\Traits\MessageEncryptionKeyPairTrait

Trait KeyPairTrait - Reusable implementation of `KeyPairInterface`.

Summary

Methods
Properties
Constants
setKeyPair()
getKeyPair()
setPrivateKey()
getPrivateKey()
setPublicKey()
getPublicKey()
checkIfThePrivateKeyIsSet()
checkIfThePublicKeyIsSet()
$$privateKey
$$publicKey
No constants found
validatePrivateKeyResource()
validatePublicKeyResource()
validateKeyPair()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$$privateKey

$$privateKey : string

The private key string property storage.

Type

string

$$publicKey

$$publicKey : string

The public key string property storage.

Type

string

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.

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.