Skip to content

Getting empty string in AES.decrypt #13

@thechaudharysab

Description

@thechaudharysab

I used this online tool https://www.javainuse.com/aesgenerator to generate this example data:

    const encryptedData = {
        cipher: "OuCmv1nXCzfy+529oeJU8g==",
        iv: "1234123412341234",
        key: "56785678567856785678567856785678"
    }

While encrypting the Mode selected is CBC, the Key Size is 256 bits, the output format is base64 in react native this is how I'm decrypting it:

    let bytes = CryptoJS.AES.decrypt(encryptedData.cipher, encryptedData.key);
    let originalText = JSON.parse(bytes.toString(CryptoJS.enc.Utf8));

    console.log("Text is: " + originalText);

But all I'm getting is Text is: .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions