/
scheme.go
31 lines (28 loc) · 1017 Bytes
/
scheme.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
package encryption
type EncryptionScheme interface {
Initialize(mnemonic string) ([]byte, error)
InitializeWithPrivateKey(privateKey []byte) error
InitForEncryption(tag string)
InitForEncryptionWithPoint(tag, point string) error
InitForDecryption(tag string, encryptedKey string) error
InitForDecryptionWithPoint(tag, point string) error
Encrypt(data []byte) (*EncryptedMessage, error)
Decrypt(*EncryptedMessage) ([]byte, error)
ReDecrypt(D *ReEncryptedMessage) ([]byte, error)
GetEncryptedKey() string
GetReGenKey(encPublicKey string, tag string) (string, error)
ReEncrypt(encMsg *EncryptedMessage, reGenKey string, clientPublicKey string) (*ReEncryptedMessage, error)
GetPublicKey() (string, error)
GetPrivateKey() (string, error)
GetEncryptedKeyPoint() string
}
func NewEncryptionScheme() EncryptionScheme {
return new(PREEncryptionScheme)
}
type EncryptedMessage struct {
EncryptedKey string
EncryptedData []byte
ReEncryptionKey string
MessageChecksum string
OverallChecksum string
}