Paul Kehrer | ca8e161 | 2015-03-16 20:57:09 -0500 | [diff] [blame^] | 1 | .. hazmat:: |
| 2 | |
| 3 | .. module:: cryptography.hazmat.primitives.keywrap |
| 4 | |
| 5 | Key wrapping |
| 6 | ============ |
| 7 | |
| 8 | Key wrapping is a cryptographic construct that uses symmetric encryption to |
| 9 | encapsulate key material. |
| 10 | |
| 11 | .. function:: aes_key_wrap(wrapping_key, key_to_wrap, backend) |
| 12 | |
| 13 | :param bytes wrapping_key: The wrapping key. |
| 14 | |
| 15 | :param bytes key_to_wrap: The key to wrap. |
| 16 | |
| 17 | :param backend: A |
| 18 | :class:`~cryptography.hazmat.backends.interfaces.CipherBackend` |
| 19 | provider that supports |
| 20 | :class:`~cryptography.hazmat.primitives.ciphers.algorithms.AES`. |
| 21 | |
| 22 | :return bytes: The wrapped key as bytes. |
| 23 | |
| 24 | .. function:: aes_key_unwrap(wrapping_key, wrapped_key, backend) |
| 25 | |
| 26 | :param bytes wrapping_key: The wrapping key. |
| 27 | |
| 28 | :param bytes wrapped_key: The wrapped key. |
| 29 | |
| 30 | :param backend: A |
| 31 | :class:`~cryptography.hazmat.backends.interfaces.CipherBackend` |
| 32 | provider that supports |
| 33 | :class:`~cryptography.hazmat.primitives.ciphers.algorithms.AES`. |
| 34 | |
| 35 | :return bytes: The unwrapped key as bytes. |
| 36 | |
| 37 | Exceptions |
| 38 | ~~~~~~~~~~ |
| 39 | |
| 40 | .. class:: InvalidUnwrap |
| 41 | |
| 42 | This is raised when a wrapped key fails to unwrap. It can be caused by a |
| 43 | corrupted or invalid wrapped key or an invalid wrapping key. |