Documentation
¶
Overview ¶
Package crypto provides AES-128-ECB encryption/decryption for WeChat CDN media.
Index ¶
- func DecodeAESKey(encoded string) ([]byte, error)
- func DecryptAESECB(ciphertext, key []byte) ([]byte, error)
- func EncodeAESKeyBase64(key []byte) string
- func EncodeAESKeyHex(key []byte) string
- func EncryptAESECB(plaintext, key []byte) ([]byte, error)
- func EncryptedSize(rawSize int) int
- func GenerateAESKey() ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeAESKey ¶
DecodeAESKey decodes an aes_key from the protocol. Handles: direct hex (32 chars), base64(raw 16 bytes), base64(hex string 32 chars).
func DecryptAESECB ¶
DecryptAESECB decrypts AES-128-ECB ciphertext and removes PKCS7 padding.
func EncodeAESKeyBase64 ¶
EncodeAESKeyBase64 returns base64(hex) for CDNMedia.aes_key.
func EncodeAESKeyHex ¶
EncodeAESKeyHex returns the hex string of a key (for getuploadurl).
func EncryptAESECB ¶
EncryptAESECB encrypts plaintext with AES-128-ECB and PKCS7 padding.
func EncryptedSize ¶
EncryptedSize calculates the size after AES-128-ECB with PKCS7 padding.
func GenerateAESKey ¶
GenerateAESKey generates a random 16-byte AES key.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.