Back
unwrap (clj)
(source)multimethod
Wrap a key using some of key wrapping algorithms.
Examples
funcool/buddy-core
(ns buddy.core.keys-tests
(:require [clojure.test :refer :all]
[buddy.core.codecs :refer :all]
[buddy.core.nonce :as nonce]
[buddy.core.bytes :as bytes]
[buddy.core.keys :as keys]))
(testing "Wrap and unwrap a cek using aes128kw"
(let [result (keys/wrap cek secret16)
result' (keys/unwrap result secret16)]
(is (bytes/equals? result' cek))))
(testing "Wrap and unwrap a cek using aes192kw"
(let [result (keys/wrap cek secret24)
result' (keys/unwrap result secret24)]
(is (bytes/equals? result' cek))))
(testing "Wrap and unwrap a cek using aes256kw"
(let [result (keys/wrap cek secret32)
result' (keys/unwrap result secret32)]
(is (bytes/equals? result' cek))))