-
Notifications
You must be signed in to change notification settings - Fork 0
/
xipher_const.go
69 lines (57 loc) · 2.03 KB
/
xipher_const.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package xipher
import (
"fmt"
"dev.shib.me/xipher/crypto/asx"
)
const (
// secretKeyBaseLength is the length of a secret key when being generated.
secretKeyBaseLength = asx.PrivateKeyLength
// secretKeyLength is the length of a private key when being exported.
secretKeyLength = secretKeyBaseLength + 2
// publicKeyMinLength is the minimum length of a public key.
publicKeyMinLength = asx.MinPublicKeyLength + 1 // +1 for the key type
// Argon2 Default Spec
argon2Iterations uint8 = 16
argon2Memory uint8 = 64
argon2Threads uint8 = 1
kdfParamsLenth = 3
kdfSaltLength = 16
kdfSpecLength = kdfParamsLenth + kdfSaltLength
// Key Types
keyTypeDirect uint8 = 0
keyTypePwd uint8 = 1
// Ciphertext Types
ctKeyAsymmetric uint8 = 0
ctPwdAsymmetric uint8 = 1
ctKeySymmetric uint8 = 2
ctPwdSymmetric uint8 = 3
keyVersion uint8 = 0
)
var (
errGeneratingSalt = fmt.Errorf("%s: error generating salt", "xipher")
errInvalidPassword = fmt.Errorf("%s: invalid password", "xipher")
errInvalidCiphertext = fmt.Errorf("%s: invalid ciphertext", "xipher")
errSecretKeyUnavailableForPwd = fmt.Errorf("%s: can't derive secret key for passwords", "xipher")
errInvalidPublicKey = fmt.Errorf("%s: invalid public key", "xipher")
errInvalidKDFSpec = fmt.Errorf("%s: invalid kdf spec", "xipher")
errDecryptionFailedPwdRequired = fmt.Errorf("%s: decryption failed, password required", "xipher")
errDecryptionFailedKeyRequired = fmt.Errorf("%s: decryption failed, key required", "xipher")
)
var (
version = ""
commitDate = ""
fullCommit = ""
releaseURL = ""
appInfo *string
)
const (
website = "https://dev.shib.me/xipher"
description = "Xipher is a curated collection of cryptographic primitives put together to perform key/password based asymmetric encryption."
art = `
__ ___ _
\ \/ (_)_ __ | |__ ___ _ __
\ /| | '_ \| '_ \ / _ \ '__|
/ \| | |_) | | | | __/ |
/_/\_\_| .__/|_| |_|\___|_|
|_| `
)