2017 © Pedro Peláez
 

library aes-kw

A PHP library for AES Key Wrap algorithm with padding support.

image

sop/aes-kw

A PHP library for AES Key Wrap algorithm with padding support.

  • Friday, December 8, 2017
  • by sop
  • Repository
  • 1 Watchers
  • 1 Stars
  • 841 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 5 % Grown

The README.md

AES Key Wrap

Build Status Scrutinizer Code Quality Coverage Status License, (*1)

A PHP library for AES Key Wrap (RFC 3394) algorithm with padding (RFC 5649) support., (*2)

Supports AES key sizes of 128, 192 and 256 bits., (*3)

Requirements

  • PHP >=7.2
  • openssl
  • hash

Installation

This library is available on Packagist., (*4)

composer require sop/aes-kw

Code examples

Here are some simple usage examples. Namespaces are omitted for brevity., (*5)

Wrap a 128 bit key with AES-128

Wrap a key of 16 bytes using a 16-byte key encryption key., (*6)

$kek = '0123456789abcdef'; // 128-bit key encryption key
$key = 'MySecretPassword'; // key to encrypt
$algo = new AESKW128();
$ciphertext = $algo->wrap($key, $kek);
echo bin2hex($ciphertext);

Outputs:, (*7)

89efdbc3501f1f5e952a4bbae1329c9f1a47b9fd61b48dee

Unwrap a key

Unwrap a key from previous example. $kek and $algo variables are the same. $ciphertext variable contains the output from a wrapping procedure., (*8)

$key = $algo->unwrap($ciphertext, $kek);
echo $key;

Outputs:, (*9)

MySecretPassword

Wrap an arbitrary length passphrase with AES-192

Wrapping a key that is not a multiple of 64 bits requires padding., (*10)

$kek = '012345678901234567890123'; // 192-bit key encryption key
$key = 'My hovercraft is full of eels.'; // passphrase to encrypt
$algo = new AESKW192();
$ciphertext = $algo->wrapPad($key, $kek);
echo bin2hex($ciphertext);

Outputs:, (*11)

f319811450badfe4385b5534bf26fa6f9fdcd1a593b3ae6b707f15c1015bbf3faf58619818bd8784

Unwrap a key with padding

Key that was wrapped with padding must be unwrapped with unwrapPad., (*12)

$key = $algo->unwrapPad($ciphertext, $kek);
echo $key;

Outputs:, (*13)

My hovercraft is full of eels.

License

This project is licensed under the MIT License., (*14)

The Versions

08/12 2017

dev-master

9999999-dev https://github.com/sop/aes-kw

A PHP library for AES Key Wrap algorithm with padding support.

  Sources   Download

MIT

The Requires

  • ext-openssl *
  • php >=7.0
  • ext-hash *

 

The Development Requires

by Joni Eskelinen

aes key wrap aes key wrap

28/11 2017

2.0.0

2.0.0.0 https://github.com/sop/aes-kw

A PHP library for AES Key Wrap algorithm with padding support.

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-openssl *

 

The Development Requires

by Joni Eskelinen

aes key wrap aes key wrap

03/08 2017

1.0.5

1.0.5.0 https://github.com/sop/aes-kw

A PHP library for AES Key Wrap algorithm with padding support.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-openssl *

 

by Joni Eskelinen

aes key wrap aes key wrap

22/06 2016

1.0.4

1.0.4.0 https://github.com/sop/aes-kw

A PHP library for AES Key Wrap algorithm with padding support.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-openssl *

 

by Joni Eskelinen

aes key wrap aes key wrap

07/06 2016

1.0.3

1.0.3.0 https://github.com/sop/aes-kw

A PHP library for AES Key Wrap algorithm with padding support.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-openssl *

 

by Joni Eskelinen

aes key wrap aes key wrap

14/05 2016

1.0.2

1.0.2.0 https://github.com/sop/aes-kw

A PHP library for AES Key Wrap algorithm with padding support.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-openssl *

 

by Joni Eskelinen

aes key wrap aes key wrap

10/05 2016

1.0.1

1.0.1.0 https://github.com/sop/aes-kw

A PHP library for AES Key Wrap algorithm with padding support.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-openssl *

 

by Joni Eskelinen

aes key wrap aes key wrap

19/04 2016

1.0.0

1.0.0.0 https://github.com/sop/aes-kw

A PHP library for AES Key Wrap algorithm with padding support.

  Sources   Download

MIT

The Requires

  • php >=5.6.3
  • ext-openssl *

 

by Joni Eskelinen

aes key wrap aes key wrap