-
Notifications
You must be signed in to change notification settings - Fork 0
/
AesCtrParams.cljs
67 lines (54 loc) · 2.21 KB
/
AesCtrParams.cljs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
(ns web.crypto.AesCtrParams
"The AesCtrParams dictionary of the Web Crypto API represents
object that should be passed as the algorithm parameter into
`SubtleCrypto.decrypt()`, `SubtleCrypto.wrapKey()`, or `SubtleCrypto.unwrapKey()`,
using the AES-CTR algorithm."
(:refer-clojure :exclude [name]))
(defn name
"Property.
A DOMString. This should be set to AES-CTR."
[this]
(-> this (.-name)))
(defn set-name!
"Property.
A DOMString. This should be set to AES-CTR."
[this val]
(aset this "name" val))
(defn counter
"Property.
A BufferSource — the initial value of the counter block. This
be 16 bytes long (the AES block size). The rightmost length bits
this block are used for the counter, and the rest is used for
nonce. For example, if length is set to 64, then the first half
counter is the nonce and the second half is used for the counter."
[this]
(-> this (.-counter)))
(defn set-counter!
"Property.
A BufferSource — the initial value of the counter block. This
be 16 bytes long (the AES block size). The rightmost length bits
this block are used for the counter, and the rest is used for
nonce. For example, if length is set to 64, then the first half
counter is the nonce and the second half is used for the counter."
[this val]
(aset this "counter" val))
(defn length
"Property.
A Number — the number of bits in the counter block that are used
the actual counter. The counter must be big enough that it doesn't
if the message is n blocks and the counter is m bits long, then
following must be true: n <= 2m. The NIST SP800-38A standard,
defines CTR, suggests that the counter should occupy half of
counter block (see Appendix B.2), so for AES it would be 64."
[this]
(-> this (.-length)))
(defn set-length!
"Property.
A Number — the number of bits in the counter block that are used
the actual counter. The counter must be big enough that it doesn't
if the message is n blocks and the counter is m bits long, then
following must be true: n <= 2m. The NIST SP800-38A standard,
defines CTR, suggests that the counter should occupy half of
counter block (see Appendix B.2), so for AES it would be 64."
[this val]
(aset this "length" val))