Skip to content
New issue

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

unable to decrypt the encrypted messages using sjcl 256 gcm- tag mismatch error #437

Open
AmrithGanesh opened this issue Apr 11, 2023 · 0 comments

Comments

@AmrithGanesh
Copy link

AmrithGanesh commented Apr 11, 2023

Hello,

We are using the SJCL code to encrypt our payload using the sjcl-256-gcm algorithm. This issue occurs only sometimes and the next time we try, the encryption is good.
Error we receive while decryption is

sjcl.mode.gcm={name:"gcm",encrypt:function(a,b,c,d,e){var f=b.slice(0);b=sjcl.bitArray;d=d||[];a=sjcl.mode.gcm.C(!0,a,f,d,c,e||128);return b.concat(a.data,a.tag)},decrypt:function(a,b,c,d,e){var f=b.slice(0),g=sjcl.bitArray,h=g.bitLength(f);e=e||128;d=d||[];e<=h?(b=g.bitSlice(f,h-e),f=g.bitSlice(f,0,h-e)):(b=f,f=[]);a=sjcl.mode.gcm.C(!1,a,f,d,c,e);if(!g.equal(a.tag,b))throw new sjcl.exception.corrupt("gcm: tag doesn't match");return a.data},ka:function(a,b){var c,d,e,f,g,h=sjcl.bitArray.i;e=[0,0,

             ^

corrupt {
toString: [Function (anonymous)],
message: "gcm: tag doesn't match"
}

is there any patch required for this?
below is the data

Encrypted payload:
OxcWaStnKw5oYSerRW8ZUlsYcldRZG8ysw53RBARXQIEXM5iFTF3ODsFfjQOfl0DZU4YFHpkK25uXDptVlkoXcMoVULPIwpmfmARxQJVCRETTgIGFTF4kjgMbCgCJxTNTE4OFGFEHSqJHSBlTVnVCQtdBgQWLAJDWB8EcU1eAhNmYUdCQILEbSsXGmu/VAJGXWKeRVFkKGZ8WmgtAhBPXkgCVVFAuD4qY5w1Jn9ZC1VMD0Bfw2QefMSrU0BBSAgRcU4GBhcwYGg7aX4wdAxdCRlcDgb4rdPRO2VsKPpjCBxPCytCTHcoTWVbCmVUWR4JC14EBBcsfTwmDp9QEAxXAxlWBAYLM7I4UR1iJkk3T/ULXQT8FjB7MSlCYukCYwhmTwnYQkx3KFt/XjxwZF15VgtWbQQVMxclOwtjNRloXQMTXAQMdjFjODsPFCYMHDKdT/1RVQNoO23UUYRAQUgIERMCQVrGLW9hbx103hENWgEDwQIUWC02KlRaPmJFXxlaPqf9QkRzOUxq5ysmGh5fAxtfGQYRLH0wXw9+PhBrVwP07AQGFVsmJClgK2JGWW5HQBpRc0tlCWkIWuI+TkkBXwVOXVLAO285OwboMBlwT05sQBZG6nMoZn9MbD57R09sMQpSU0Z1JH7sXTplUkgpUncLFmwHMHREOxI0NQ0Mn2cZXA4GFTt9OCUPfjR6dkGeduRSUEBiOWF9WmRqRHgMR0xODqRQbRAkKRwqJhoeW4wZXI4FFuxvdVZCEw==

Thanks,
Amrith

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant