forked from greenboxal/cryptokit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
key.go
48 lines (40 loc) · 838 Bytes
/
key.go
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
package cryptokit
type KeyType uint
const (
_ KeyType = 0
AesKey = 1
DesKey = 2
TdesKey = 3
RsaKey = 3
DsaKey = 4
RawKey = 5
)
type KeyCapability uint
const (
_ KeyCapability = 0
Encrypt = 0x1
Decrypt = 0x2
Wrap = 0x4
Unwrap = 0x8
Derive = 0x10
EncryptDecrypt = Encrypt | Decrypt
AllCapabilities = Encrypt | Decrypt | Wrap | Unwrap | Derive
)
type KeyAttributes struct {
ID string
Type KeyType
Length uint
Permanent bool
Extractable bool
Capabilities KeyCapability
}
type Key interface {
ID() string
Type() KeyType
Length() uint
Attributes() KeyAttributes
Extract() ([]byte, error)
Session() Session
Destroy() error
Close() error
}