I have to decrypt the encrypted SEK using APP key and encode JSON data using decrypted SEK to post for E-invoice Generation and sample code for Java and C# and I have converted in PHP but unfortunately failed to get desired output in PHP OpenSSL is not supported from my point as I am trying from last week
Sample JAVA & C# Code For Encryption and decryption
https://einv-apisandbox.nic.in/sample-code-in-java.html https://einv-apisandbox.nic.in/sample-code-in-c-sharp-dot-net.html
The goal is to decrypt and encrypt data using OpenSSL in PHP
my implementation as of now -
public function encrypt1($data, $secret_key)
{
return base64_encode(openssl_encrypt(base64_decode($data), $method='AES-256-ECB', base64_decode($secret_key), OPENSSL_RAW_DATA));
}
public function decrypt1($data,$secret_key)
{
return base64_encode(openssl_decrypt(base64_decode($data), $method='AES-256-ECB', $secret_key, OPENSSL_RAW_DATA));
}