[🚀] add crypto pkg
This commit is contained in:
22
pkg/crypto/interface.go
Normal file
22
pkg/crypto/interface.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package crypto
|
||||
|
||||
// Encryptor 加密器接口
|
||||
type Encryptor interface {
|
||||
// Encrypt 加密数据
|
||||
Encrypt(plaintext []byte) ([]byte, error)
|
||||
|
||||
// Decrypt 解密数据
|
||||
Decrypt(ciphertext []byte) ([]byte, error)
|
||||
|
||||
// Name 返回加密算法名称
|
||||
Name() string
|
||||
}
|
||||
|
||||
// Signer 签名器接口
|
||||
type Signer interface {
|
||||
// Sign 生成签名
|
||||
Sign(data []byte) ([]byte, error)
|
||||
|
||||
// Verify 验证签名
|
||||
Verify(data, signature []byte) error
|
||||
}
|
||||
Reference in New Issue
Block a user