From 0629fc8647704ccc3041549b7bb322d488fa42ab Mon Sep 17 00:00:00 2001 From: Joni Eskelinen Date: Wed, 15 May 2019 14:22:03 +0300 Subject: [PATCH] Change docs formatting to markdown --- lib/AESKW/AESKeyWrapAlgorithm.php | 8 +++----- lib/AESKW/Algorithm.php | 24 ++++++++++-------------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/lib/AESKW/AESKeyWrapAlgorithm.php b/lib/AESKW/AESKeyWrapAlgorithm.php index 46fe6f2..7281332 100644 --- a/lib/AESKW/AESKeyWrapAlgorithm.php +++ b/lib/AESKW/AESKeyWrapAlgorithm.php @@ -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 wrapPad 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. @@ -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 wrap method. + * Key encryption key has the same restrictions as with `wrap()` method. * * @see https://tools.ietf.org/html/rfc5649#section-4.1 * @@ -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 - * wrapPad. + * This variant of unwrapping must be used if the key was wrapped using `wrapPad()`. * * @see https://tools.ietf.org/html/rfc5649#section-4.2 * diff --git a/lib/AESKW/Algorithm.php b/lib/AESKW/Algorithm.php index 149c5a0..2495a1c 100644 --- a/lib/AESKW/Algorithm.php +++ b/lib/AESKW/Algorithm.php @@ -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 wrapPad 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. @@ -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 wrap method. + * Key encryption key has the same restrictions as with `wrap()` method. * * @param string $key Key to wrap * @param string $kek Key encryption key @@ -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 - * wrapPad. + * 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 @@ -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 {P1, P2, ..., Pn} + * @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 {C0, C1, ..., Cn} + * @return string[] Ciphertext, (n+1) 64-bit values `{C0, C1, ..., Cn}` */ protected function _wrapBlocks(array $P, string $kek, string $iv): array { @@ -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 {P1, P2, ..., Pn} and - * integrity value A + * @return array Tuple of plaintext `{P1, P2, ..., Pn}` and integrity value `A` */ protected function _unwrapPaddedCiphertext(string $ciphertext, string $kek): array { @@ -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 {C0, C1, ..., Cn} + * @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 A and register R + * @return array Tuple of integrity value `A` and register `R` */ protected function _unwrapBlocks(array $C, string $kek): array { @@ -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 {P1, P2, ..., Pn} + * @param array $P Plaintext, n 64-bit values `{P1, P2, ..., Pn}` * @param string $A Integrity check value * * @throws \UnexpectedValueException