We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
public encrypt(data: string) { return Buffer.from( this.CBC.encrypt(padding.pkcs7.pad(utils.utf8.toBytes(data))) ).toString('base64'); } public decrypt(data: string) { return Buffer.from( padding.pkcs7.strip(this.CBC.decrypt(Buffer.from(data, 'base64'))) ).toString('utf-8'); }
As a test i did a encrypt and then a decrypt and the output is like:
Expected input
'{"method":"login_device","params":{...
Real output:
'��mWL�u�i\x14��-�pK_device","params":{
The rest of the string json (at ....) is good, only the first 16 characters are not
The text was updated successfully, but these errors were encountered:
Hi @RaresAil have you got solution for this
Sorry, something went wrong.
@brandtiwari007 Yes, i used NodeJS's Crypto library:
https://github.com/RaresAil/homebridge-tplink-smart-light/blob/a6a45d4e248fbe635c99f489a00962804f482159/src/api/TpLinkCipher.ts#L53
16 characters is one block. Probably it's related to iv. I guess you used different iv for encryption and decryption.
No branches or pull requests
As a test i did a encrypt and then a decrypt and the output is like:
Expected input
Real output:
The rest of the string json (at ....) is good, only the first 16 characters are not
The text was updated successfully, but these errors were encountered: