The AesKeywrapNettle Module.jl
AesKeywrapNettle
— ModuleAesKeywrapNettle
AES keywrap in Julia
(uses https://github.com/JuliaCrypto/Nettle.jl for AES)
Module Index
Detailed API
AesKeywrapNettle.aes_unwrap_key
— Functionaes_unwrap_key(kek, wrapped[, iv])
Unwraps the key "plaintext" using the key "kek" with the "Advanced Encryption Standard (AES) Key Wrap Algorithm" The initial vector "iv" is used for integrity check.
Arguments
kek::Array{UInt8}
: the key-encryption key, possible key lengths for "kek" are 128 bit, 192 bit, and 192 bitwrapped::Array{UInt8}
: the wrapped key (or plaintext) to wrap, the length of "wrapped" must be a multiple of 64 bitiv::Array{UInt8}
: the 64-bit initial value used during the wrapping process; If no iv is specified, the default iv [0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6] from rfc3394 is used.
Examples
DocTestSetup = quote
using AesKeywrapNettle
end
julia> b = aes_unwrap_key([0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f], [0x1f, 0xa6, 0x8b, 0x0a, 0x81, 0x12, 0xb4, 0x47, 0xae, 0xf3, 0x4b, 0xd8, 0xfb, 0x5a, 0x7b, 0x82, 0x9d, 0x3e, 0x86, 0x23, 0x71, 0xd2, 0xcf, 0xe5], [0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6])
16-element Vector{UInt8}:
0x00
0x11
0x22
0x33
0x44
0x55
0x66
0x77
0x88
0x99
0xaa
0xbb
0xcc
0xdd
0xee
0xff
AesKeywrapNettle.aes_wrap_key
— Functionaes_wrap_key(kek, plaintext[, iv])
Wraps the key "plaintext" using the key "kek" und the initial vector "iv" with the "Advanced Encryption Standard (AES) Key Wrap Algorithm"
Arguments
kek::Array{UInt8}
: the key-encryption key, possible key lengths for "kek" are 128 bit, 192 bit, and 192 bitplaintext::Array{UInt8}
: the key (or plaintext) to wrap, the length of "plaintext" must be a multiple of 64 bitiv::Array{UInt8}
: the 64-bit initial value used during the wrapping process; If no iv is specified, the default iv [0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6] from rfc3394 is used.
Examples
DocTestSetup = quote
using AesKeywrapNettle
end
julia> a = aes_wrap_key([0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f], [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff], [0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6])
24-element Vector{UInt8}:
0x1f
0xa6
0x8b
0x0a
0x81
0x12
0xb4
0x47
0xae
0xf3
⋮
0x82
0x9d
0x3e
0x86
0x23
0x71
0xd2
0xcf
0xe5