Skip to content

Commit

Permalink
Change docs formatting to markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
sop committed May 15, 2019
1 parent ef4f383 commit 0629fc8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
8 changes: 3 additions & 5 deletions lib/AESKW/AESKeyWrapAlgorithm.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ interface AESKeyWrapAlgorithm
* Wrap a key using given key encryption key.
*
* Key length must be at least 64 bits (8 octets) and a multiple
* of 64 bits (8 octets).
* Use <i>wrapPad</i> to wrap a key of arbitrary length.
* of 64 bits (8 octets). Use `wrapPad()` to wrap a key of arbitrary length.
*
* Key encryption key must have a size of underlying AES algorithm,
* ie. 128, 196 or 256 bits.
Expand Down Expand Up @@ -53,7 +52,7 @@ public function unwrap(string $ciphertext, string $kek): string;
*
* This variant of wrapping does not place any restriction on key size.
*
* Key encryption key has the same restrictions as with <i>wrap</i> method.
* Key encryption key has the same restrictions as with `wrap()` method.
*
* @see https://tools.ietf.org/html/rfc5649#section-4.1
*
Expand All @@ -69,8 +68,7 @@ public function wrapPad(string $key, string $kek): string;
/**
* Unwrap a key from a padded ciphertext using given key encryption key.
*
* This variant of unwrapping must be used if the key was wrapped using
* <i>wrapPad</i>.
* This variant of unwrapping must be used if the key was wrapped using `wrapPad()`.
*
* @see https://tools.ietf.org/html/rfc5649#section-4.2
*
Expand Down
24 changes: 10 additions & 14 deletions lib/AESKW/Algorithm.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public function __construct(string $iv = self::DEFAULT_IV)
* Wrap a key using given key encryption key.
*
* Key length must be at least 64 bits (8 octets) and a multiple
* of 64 bits (8 octets).
* Use <i>wrapPad</i> to wrap a key of arbitrary length.
* of 64 bits (8 octets). Use `wrapPad()` to wrap a key of arbitrary length.
*
* Key encryption key must have a size of underlying AES algorithm,
* ie. 128, 196 or 256 bits.
Expand Down Expand Up @@ -123,7 +122,7 @@ public function unwrap(string $ciphertext, string $kek): string
*
* This variant of wrapping does not place any restriction on key size.
*
* Key encryption key has the same restrictions as with <i>wrap</i> method.
* Key encryption key has the same restrictions as with `wrap()` method.
*
* @param string $key Key to wrap
* @param string $kek Key encryption key
Expand Down Expand Up @@ -160,8 +159,7 @@ public function wrapPad(string $key, string $kek): string
/**
* Unwrap a key from a padded ciphertext using given key encryption key.
*
* This variant of unwrapping must be used if the key was wrapped using
* <i>wrapPad</i>.
* This variant of unwrapping must be used if the key was wrapped using `wrapPad()`.
*
* @param string $ciphertext Ciphertext of the wrapped and padded key
* @param string $kek Key encryption key
Expand Down Expand Up @@ -225,11 +223,11 @@ protected function _checkKEKSize(string $kek): self
*
* @see https://tools.ietf.org/html/rfc3394#section-2.2.1
*
* @param string[] $P Plaintext, n 64-bit values <code>{P1, P2, ..., Pn}</code>
* @param string[] $P Plaintext, n 64-bit values `{P1, P2, ..., Pn}`
* @param string $kek Key encryption key
* @param string $iv Initial value
*
* @return string[] Ciphertext, (n+1) 64-bit values <code>{C0, C1, ..., Cn}</code>
* @return string[] Ciphertext, (n+1) 64-bit values `{C0, C1, ..., Cn}`
*/
protected function _wrapBlocks(array $P, string $kek, string $iv): array
{
Expand Down Expand Up @@ -268,8 +266,7 @@ protected function _wrapBlocks(array $P, string $kek, string $iv): array
* @param string $ciphertext Ciphertext
* @param string $kek Encryption key
*
* @return array Tuple of plaintext <code>{P1, P2, ..., Pn}</code> and
* integrity value <code>A</code>
* @return array Tuple of plaintext `{P1, P2, ..., Pn}` and integrity value `A`
*/
protected function _unwrapPaddedCiphertext(string $ciphertext, string $kek): array
{
Expand All @@ -293,19 +290,18 @@ protected function _unwrapPaddedCiphertext(string $ciphertext, string $kek): arr
/**
* Apply Key Unwrap to data blocks.
*
* Uses the index based version of key unwrap procedure
* described in the RFC.
* Uses the index based version of key unwrap procedure described in the RFC.
*
* Does not compute step 3.
*
* @see https://tools.ietf.org/html/rfc3394#section-2.2.2
*
* @param string[] $C Ciphertext, (n+1) 64-bit values <code>{C0, C1, ..., Cn}</code>
* @param string[] $C Ciphertext, (n+1) 64-bit values `{C0, C1, ..., Cn}`
* @param string $kek Key encryption key
*
* @throws \UnexpectedValueException
*
* @return array Tuple of integrity value <code>A</code> and register <code>R</code>
* @return array Tuple of integrity value `A` and register `R`
*/
protected function _unwrapBlocks(array $C, string $kek): array
{
Expand Down Expand Up @@ -372,7 +368,7 @@ protected function _checkPaddedIntegrity(string $A): void
/**
* Verify that the padding of the plaintext is valid.
*
* @param array $P Plaintext, n 64-bit values <code>{P1, P2, ..., Pn}</code>
* @param array $P Plaintext, n 64-bit values `{P1, P2, ..., Pn}`
* @param string $A Integrity check value
*
* @throws \UnexpectedValueException
Expand Down

0 comments on commit 0629fc8

Please sign in to comment.