Path use for name placement
SecssUtil.class.php support PHP5.4.8 and above according to the project's need to place the corresponding path
Used to provide merchant signature, verification, encryption, decryption, document verification and other method calls
Mer.pfx can be placed under any path, but need to call method specify file location and name Merchant signing certificate (console request)
Cp.cer can be placed under any path, but the method needs to be called to specify the file location and name Chinapay signing certificate (public key)
Security.properties Security configuration file, according to project Engineering needs to place the corresponding path under the designated signature Verification document file storage path, etc.
=============================================================================================================== ======
Class Name: Secssutil
Method Description:
Method Name Purpose
Init is used to create a certificate object, initialize a secure cryptographic control, and initialize the public private key information
Sign is used for signing merchant messages
Getsign gets the string generated after the merchant's signature
Verify verifying the response data returned by Chinapay
Verifyfile verifying the settlement and reconciliation file signatures returned by Chinapay
EncryptData encrypt sensitive data during trading
Getencvalue Gets the encrypted ciphertext string
Decryptdata to decrypt sensitive data in the course of a transaction
Getdecvalue gets the decrypted plaintext string
Encryptpin to encrypt a password
Getencpin Gets the encrypted password string
Geterrcode Obtaining processing results of merchant signature, verification, encryption and decryption
Geterrmsg Get the Chinese description of the response code
=============================================================================================================== ======
Initialize the security control method: Init
Method Description:
Public function init ($securityPropFile)
Role:
Used to create a certificate object, initialize a secure cryptographic control, and initialize the public private key information.
Using this method requires that the security.properties be placed under the PHP project path and configured as follows:
#交易证书路径
Sign.file=d:/cert_cp/000000000000001.pfx
#交易证书密码
Sign.file.password=xxxxxx
#交易证书的密钥容器格式
Sign.cert.type=pkcs12
#报文中不参与签名的字段名称, multiple fields are separated by commas
Sign.invalid.fields=signature,certid
#验签证书路径
Verify.file=d:/cert_cp/cp_test.cer
#签名值字段名称
Signature.field=signature
Parameter description:
SecurityPropFile:security.properties file Full path
Security.properties file, the merchant only needs to modify the Sign.file, Sign.file.password, verify.file three items.
return value:
True: Indicates that the certificate file is initialized correctly, and the signature method signature or signature verification method can be called to verify the signature;
False: Indicates that the certificate file initialization failed, and the signature method and signature verification method cannot be used.
Note: This method is in class Secssutil.
Netpayclient for PHP usage notes