Unable to decrypt cipher encrypted by Crypto-JS (AES default)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- java, javascript, lua, node.js
- Domain
- backend, cryptography
Research direction
Start with the resty.aes usage shown in the issue and compare it with the CryptoJS AES encrypt/decrypt example and the Java AES/CBC/PKCS5Padding configuration. Reproduce the supplied ciphertext and inspect the cipher, key, IV, and encoding parameters used by each example. Done means resty.aes decrypts the supplied ciphertext to the original plaintext or documents the incompatibility clearly.
Written by the indexing model from the issue text.
Description
Hello,
I am not able to decrypt back what was encrypted using Crypto-JS in browser Javascript / NodeJS:
// Encrypt
var ciphertext = CryptoJS.AES.encrypt('testingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtestingtesting', '&&nH8P3bxk+?C4gR');
// Decrypt
var bytes = CryptoJS.AES.decrypt(ciphertext.toString(), '&&nH8P3bxk+?C4gR');
var plaintext = bytes.toString(CryptoJS.enc.Utf8);
console.log(plaintext);
I can decrypt it in Java using:
Cipher.getInstance("AES/CBC/PKCS5Padding")
But, I get
nil
when I try to do it with resty.aes. Here is the code:
local aes = require "resty.aes"
local cipher = aes.cipher(256)
local aes_256_cbc_md5 = aes:new('&&nH8P3bxk+?C4gR', nil, cipher)
local cipherText = 'U2FsdGVkX1859eIyt4M7VHNBl9BGMdsemPYAADKmqs9sltwKINfzVMci0Vw1NLr73Iti67zQ0+JoqVcL59Gcp+4R5NY6wg2n3r0wqLcQRc7PkIGpgup1UJp4DzhXSIGHz08Eu/nEbt3jAh3S4GVUoVFbXLluf/BvedTGdsqcN2EPL9S/WQOc5QDyl9OQjpBl+QS56nWL0DO6iR/6CIoEuQ+zC/7KTpBw2jQf8sxuDNptZzwKLlDi2sWSaeCkvPj+m8zheAlnZzVc+L5JeLdcx7WkIRQImNs9P5bkhXmiK2nZnw4yco3QHbzRkRBJiB3HgdYDauHsuKmR21zv9VLjAcGTrZjiUbtrBfuTRawKOiAFm599Inbq+Ugu9n4RelQ2CTdxwDfe3ZE3kscP3dyAmg=='
ngx.say(aes_256_cbc_md5:decrypt(cipherText))
Could someone please help me with server side decryption?
- Dominant language
- Lua
- Stars
- 443
- Forks
- 143
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openresty/lua-resty-string
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
openresty/lua-resty-string#109 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
openresty/lua-resty-string#95 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
openresty/lua-resty-string#92 · 4 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
openresty/lua-resty-string#91 · 4 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 25/100
openresty/lua-resty-string#90 · 1 comment ·
All issues in openresty/lua-resty-string
Similar issues
-
component:cosh
Difficulty 1/5 Under an hour Newbie friendliness 91/100
agentic-os-org/ANOLISA#4490 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
mason-org/mason.nvim#2114 ·
-
bug
Difficulty 2/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100