Documentation
¶
Index ¶
- Constants
- func AsymmDecrypt(privk_pem string, ciphertext []byte, algo AsymmAlgo) ([]byte, error)
- func AsymmEncrypt(puk_pem string, plaintext []byte, algo AsymmAlgo) ([]byte, error)
- func EnvelopeOpen(cc CipherSuite, prik string, envelope []byte) ([]byte, error)
- func EnvelopeSeal(cc CipherSuite, puk string, data []byte) ([]byte, error)
- func HKDF(secret []byte, salt []byte, info []byte, target_size int, alg HashAlgo) []byte
- func SymmetricDecrypt(key []byte, alg SymmAlgo, ciphertext []byte) ([]byte, error)
- func SymmetricEncrypt(key []byte, alg SymmAlgo, plaintext []byte) []byte
- func SymmetricKeyValid(key []byte, alg SymmAlgo) bool
- type AsymmAlgo
- type CipherSuite
- type Cryptor
- type EncdbCipher
- type EncdbSDK
- type HashAlgo
- type ServerVersion
- type SymmAlgo
Constants ¶
View Source
const ( CHECK_CODE_SIZE = 1 DATA_TYEP_SIZE = 1 BITS_SIZE = 1 NONCE_SIZE = 8 HEADER_SIZE = CHECK_CODE_SIZE + DATA_TYEP_SIZE + BITS_SIZE )
View Source
const ( RDS ServerVersion = "RDS" // rds mysql POLAR_LAGACY = "POLARDB_LEGACY" // polardb. encdb version < 1.1.14 POLAR_1_1_14 = "POLARDB_1.1.14" // polar, encdb version == 1.1.14 )
View Source
const ( AES_128_CBC SymmAlgo = "AES_128_CBC" AES_128_CTR = "AES_128_CTR" AES_128_ECB = "AES_128_ECB" AES_128_GCM = "AES_128_GCM" SM4_128_CBC = "SM4_128_CBC" SM4_128_CTR = "SM4_128_CTR" SM4_128_ECB = "SM4_128_ECB" SM4_128_GCM = "SM4_128_GCM" INVALID = "INVALID" )
View Source
const ( REQUEST_ID_MEK_PROVISION int = 48 REQUEST_ID_SERVER_INFO_GET = 0 REQUEST_ID_IMPORT_RULE = 160 )
View Source
const ( AES_BLOCK_SIZE = 16 AES_128_KEY_SIZE = 16 SM4_BLOCK_SIZE = 16 SM4_KEY_SIZE = 16 GCM_TAG_SIZE = 16 GCM_IV_SIZE = 12 CBC_IV_SIZE = 16 CTR_IV_SIZE = 16 )
View Source
const ENCDB_SDK_VERSION = "1.2.15"
Variables ¶
This section is empty.
Functions ¶
func AsymmDecrypt ¶
func AsymmEncrypt ¶
func EnvelopeOpen ¶
func EnvelopeOpen(cc CipherSuite, prik string, envelope []byte) ([]byte, error)
func EnvelopeSeal ¶
func EnvelopeSeal(cc CipherSuite, puk string, data []byte) ([]byte, error)
func SymmetricDecrypt ¶
func SymmetricKeyValid ¶
Types ¶
type CipherSuite ¶
type CipherSuite struct {
// contains filtered or unexported fields
}
func FromString ¶
func FromString(s string) *CipherSuite
func (*CipherSuite) ToString ¶
func (cs *CipherSuite) ToString() string
type Cryptor ¶
type Cryptor struct { Algo SymmAlgo MEK []byte Nonce []byte DEK []byte Server_cs CipherSuite Server_puk string // pem format Server_puk_hash string Server_version ServerVersion }
type EncdbCipher ¶
type EncdbCipher struct {
// contains filtered or unexported fields
}
Help parse a cipher
func ParseCipher ¶
func ParseCipher(ciphertext []byte) (*EncdbCipher, error)
func (*EncdbCipher) GetEncAlgo ¶
func (encdb_cipher *EncdbCipher) GetEncAlgo() (SymmAlgo, error)
func (*EncdbCipher) GetType ¶
func (encdb_cipher *EncdbCipher) GetType() uint8
type EncdbSDK ¶
func (*EncdbSDK) GetServerInfo ¶
func (sdk *EncdbSDK) GetServerInfo()
func (*EncdbSDK) ImportRule ¶
func (*EncdbSDK) ProvisionMEK ¶
type ServerVersion ¶ added in v1.0.2
type ServerVersion string
Click to show internal directories.
Click to hide internal directories.