\EasyWeChat\EncryptionEncryptor

Class Encryptor.

Summary

Methods
Properties
Constants
__construct()
encryptMsg()
decryptMsg()
getSHA1()
encode()
decode()
No public properties found
No constants found
getAESKey()
$appId
$token
$AESKey
$blockSize
N/A
encrypt()
decrypt()
getRandomStr()
No private properties found
N/A

Properties

$appId

$appId : string

App id.

Type

string

$token

$token : string

App token.

Type

string

$AESKey

$AESKey : string

AES key.

Type

string

$blockSize

$blockSize : integer

Block size.

Type

integer

Methods

__construct()

__construct(string  $appId, string  $token, string  $AESKey) 

Constructor.

Parameters

string $appId
string $token
string $AESKey

encryptMsg()

encryptMsg(string  $xml, string  $nonce = null, integer  $timestamp = null) : string

Encrypt the message and return XML.

Parameters

string $xml
string $nonce
integer $timestamp

Returns

string

decryptMsg()

decryptMsg(string  $msgSignature, string  $nonce, string  $timestamp, string  $postXML) : array

Decrypt message.

Parameters

string $msgSignature
string $nonce
string $timestamp
string $postXML

Throws

\EasyWeChat\Encryption\EncryptionException

Returns

array

getSHA1()

getSHA1() : string

Get SHA1.

Throws

\EasyWeChat\Encryption\EncryptionException

Returns

string

encode()

encode(string  $text) : string

Encode string.

Parameters

string $text

Returns

string

decode()

decode(string  $decrypted) : string

Decode string.

Parameters

string $decrypted

Returns

string

getAESKey()

getAESKey() : string

Return AESKey.

Throws

\EasyWeChat\Core\Exceptions\InvalidConfigException

Returns

string

encrypt()

encrypt(string  $text, string  $appId) : string

Encrypt string.

Parameters

string $text
string $appId

Throws

\EasyWeChat\Encryption\EncryptionException

Returns

string

decrypt()

decrypt(string  $encrypted, string  $appId) : string

Decrypt message.

Parameters

string $encrypted
string $appId

Throws

\EasyWeChat\Encryption\EncryptionException

Returns

string

getRandomStr()

getRandomStr() : string

Generate random string.

Returns

string