-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrypto.go
More file actions
44 lines (36 loc) · 855 Bytes
/
crypto.go
File metadata and controls
44 lines (36 loc) · 855 Bytes
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
package enigma
import "fmt"
type AEADSuite uint16
const (
SuiteXChaCha20Poly1305 AEADSuite = 0x0001
SuiteAES256GCM AEADSuite = 0x0002
)
func (s AEADSuite) String() string {
switch s {
case SuiteXChaCha20Poly1305:
return "xchacha20-poly1305"
case SuiteAES256GCM:
return "aes-256-gcm"
default:
return fmt.Sprintf("unknown-suite(%d)", s)
}
}
func ParseAEADSuite(v uint16) (AEADSuite, error) {
s := AEADSuite(v)
switch s {
case SuiteXChaCha20Poly1305, SuiteAES256GCM:
return s, nil
default:
return 0, WrapError("enigma.ParseAEADSuite", ErrUnsupportedAlgorithm, fmt.Errorf("suite id %d", v))
}
}
type Profile string
const (
ProfileLocalPQ Profile = "local-pq"
ProfileCloudBalanced Profile = "cloud-balanced"
ProfileCompliance Profile = "compliance"
)
const (
ContainerMagic = "ENGM"
ContainerVersion = 1
)