Documentation
¶
Index ¶
- Constants
- Variables
- func DecryptWithRsa(keyId string, encrypted []byte) ([]byte, error)
- func EncryptWithRsa(keyId, rawData string) ([]byte, error)
- func ErrToCode(err error) int
- func Init()
- func RemoveRsaKey(keyId string) error
- func SignData(keyId, data string) ([]byte, error)
- func VerifySignature(keyId, data string, signature []byte) (bool, error)
- type KeyInfo
- type KeyInfos
- type ParamInfo
- type ParamValueInfo
Constants ¶
View Source
const ( ERR_OTHER_CODE = 1 // Error for 'agent not support' is 110 ERR_KEYID_NOTEXIST_CODE = 111 ERR_KEYID_DUPLICATED_CODE = 112 ERR_PARAM_NOTEXIST_CODE = 113 // length limit of plaintext to encrypt is 190byte, see https://crypto.stackexchange.com/questions/42097/what-is-the-maximum-size-of-the-plaintext-message-for-rsa-oaep LIMIT_PLAINTEXT_LEN = 190 )
Variables ¶
View Source
var ( ErrKeyIdNotExist = errors.New("Key id not exist") ErrKeyIdDuplicated = errors.New("Key id is duplicated") ErrParamNotExist = errors.New("Secret param not exist") // The ciphertext length cannot be less than the AES key length ErrCipherTextTooShort = errors.New("ciphertext too short") )
Functions ¶
func EncryptWithRsa ¶
func RemoveRsaKey ¶
Types ¶
type KeyInfo ¶
type ParamValueInfo ¶
type ParamValueInfo struct { SecretName string SecretValue string CreatedTimestamp int64 ExpiredTimestamp int64 }
func GetSecretParamValue ¶
func GetSecretParamValue(secretName string) (*ParamValueInfo, error)
Click to show internal directories.
Click to hide internal directories.