Constants

ERROR_INVALID_SIGNATURE

ERROR_INVALID_SIGNATURE = -40001

ERROR_PARSE_XML

ERROR_PARSE_XML = -40002

ERROR_CALC_SIGNATURE

ERROR_CALC_SIGNATURE = -40003

ERROR_INVALID_AES_KEY

ERROR_INVALID_AES_KEY = -40004

ERROR_INVALID_APP_ID

ERROR_INVALID_APP_ID = -40005

ERROR_ENCRYPT_AES

ERROR_ENCRYPT_AES = -40006

ERROR_DECRYPT_AES

ERROR_DECRYPT_AES = -40007

ERROR_INVALID_XML

ERROR_INVALID_XML = -40008

ERROR_BASE64_ENCODE

ERROR_BASE64_ENCODE = -40009

ERROR_BASE64_DECODE

ERROR_BASE64_DECODE = -40010

ERROR_XML_BUILD

ERROR_XML_BUILD = -40011

ILLEGAL_BUFFER

ILLEGAL_BUFFER = -41003

Properties

$appId

$appId : string

App id.

Type

string

$token

$token : string

App token.

Type

string

$aesKey

$aesKey : string

Type

string

$blockSize

$blockSize : integer

Block size.

Type

integer

Methods

__construct()

__construct(string  $appId, string|null  $token = null, string|null  $aesKey = null) 

Constructor.

Parameters

string $appId
string|null $token
string|null $aesKey

getToken()

getToken() : string

Get the app token.

Returns

string

encrypt()

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

Encrypt the message and return XML.

Parameters

string $xml
string $nonce
integer $timestamp

Throws

\EasyWeChat\Kernel\Exceptions\RuntimeException

Returns

string

decrypt()

decrypt(string  $content, string  $msgSignature, string  $nonce, string  $timestamp) : string

Decrypt message.

Parameters

string $content
string $msgSignature
string $nonce
string $timestamp

Throws

\EasyWeChat\Kernel\Exceptions\RuntimeException

Returns

string

signature()

signature() : string

Get SHA1.

Throws

self

Returns

string

pkcs7Pad()

pkcs7Pad(string  $text, integer  $blockSize) : string

PKCS#7 pad.

Parameters

string $text
integer $blockSize

Throws

\EasyWeChat\Kernel\Exceptions\RuntimeException

Returns

string

pkcs7Unpad()

pkcs7Unpad(string  $text) : string

PKCS#7 unpad.

Parameters

string $text

Returns

string