cryptal  latest
Cryptography Abstraction Layer
fpoirotte\Cryptal\Padding\Pkcs7 Class Reference

Pads a string using the scheme defined in PKCS#7. More...

+ Inheritance diagram for fpoirotte\Cryptal\Padding\Pkcs7:

Public Member Functions

 getPaddingData ($blockSize, $expectedSize)
 
 getPaddingSize ($paddedData, $blockSize)
 

Detailed Description

Pads a string using the scheme defined in PKCS#7.

Definition at line 8 of file Pkcs7.php.

Member Function Documentation

fpoirotte\Cryptal\Padding\Pkcs7::getPaddingData (   $blockSize,
  $expectedSize 
)

Return padding data to form a complete block.

Parameters
int$blockSizeThe cipher's block size, in bytes.
int$expectedSizeThe padding's expected size (in bytes) to form a (possibly new) complete block. This value is always such that: $ 0 < \$expectedSize <= \$blockSize $
Return values
stringPadding data.

Implements fpoirotte\Cryptal\PaddingInterface.

Definition at line 10 of file Pkcs7.php.

fpoirotte\Cryptal\Padding\Pkcs7::getPaddingSize (   $paddedData,
  $blockSize 
)

Return the size (in bytes) of the padding in some already-padded data.

Parameters
string$paddedDataThe padded data to analyze.
int$blockSizeThe cipher's block size, in bytes.
Exceptions
ExceptionAn exception is thrown when the supplied data is invalid (was not padded using the currently-selected scheme).
Warning
Some padding schemes can generate ambiguous data, resulting in possible data loss while removing the padding. This method suffers from the same shortcomings. If possible, you should not rely on this method to determine the plaintext's length. Instead, you should retrieve it using other means (eg. out-of-band communications).

Implements fpoirotte\Cryptal\PaddingInterface.

Definition at line 15 of file Pkcs7.php.


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