You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
a colleague of mine and I are working on a flutter project. The application is supposed to retrieve JWE encrypted Data and decrypt it to display the data. We successfully got the encrypted data and now want to use this library to decrypt it.
To do this, we followed this example:
main() async {
var encoded ="eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0.""UGhIOguC7IuEvf_NPVaXsGMoLOmwvc1GyqlIKOK1nN94nHPoltGRhWhw7Zx0-kFm""1NJn8LE9XShH59_i8J0PH5ZZyNfGy2xGdULU7sHNF6Gp2vPLgNZ__deLKxGHZ7Pc""HALUzoOegEI-8E66jX2E4zyJKx-YxzZIItRzC5hlRirb6Y5Cl_p-ko3YvkkysZIF""NPccxRU7qve1WYPxqbb2Yw8kZqa2rMWI5ng8OtvzlV7elprCbuPhcCdZ6XDP0_F8""rkXds2vE4X-ncOIM8hAYHHi29NX0mcKiRaD0-D-ljQTP-cFPgwCp6X-nZZd9OHBv""-B3oWh2TbqmScqXMR4gp_A.""AxY8DCtDaGlsbGljb3RoZQ.""KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY.""9hH0vgRfYgPnAHOd8stkvw";
// create a JsonWebEncryption from the encoded stringvar jwe =JsonWebEncryption.fromCompactSerialization(encoded);
// create a JsonWebKey for decrypting the signaturevar jwk =newJsonWebKey.fromJson(
{
"kty":"RSA",
"n":"sXchDaQebHnPiGvyDOAT4saGEUetSyo9MKLOoWFsueri23bOdgWp4Dy1Wl""UzewbgBHod5pcM9H95GQRV3JDXboIRROSBigeC5yjU1hGzHHyXss8UDpre""cbAYxknTcQkhslANGRUZmdTOQ5qTRsLAt6BTYuyvVRdhS8exSZEy_c4gs_""7svlJJQ4H9_NxsiIoLwAEk7-Q3UXERGYw_75IDrGA84-lA_-Ct4eTlXHBI""Y2EaV7t7LjJaynVJCpkv4LKjTTAumiGUIuQhrNhZLuF_RJ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H7mI7hPG-PYE_""odApKdnqECHWw0J-F0JWnUd6D2B_1TvF9mXA2Qx-iGYn8OVV1Bsmp6qU",
"qi":"eNho5yRBEBxhGBtQRww9QirZsB66TrfFReG_CcteI1aCneT0ELGhYlRlC""tUkTRclIfuEPmNsNDPbLoLqqCVznFbvdB7x-Tl-m0l_eFTj2KiqwGqE9PZ""B9nNTwMVvH3VRRSLWACvPnSiwP8N5Usy-WRXS-V7TbpxIhvepTfE0NNo"
},
);
var keyStore =newJsonWebKeyStore()..addKey(jwk);
// decrypt the payloadvar payload =await jwe.getPayload(keyStore);
print("decrypted content: ${payload.stringContent}");
}
We tried this with our key and this encrypted data:
And that showed us, that the data was compressed. With your example, no compression algorithm was applied and it worked. So now our theory is, that the compression leads to this error.
Do you know how we should handle the compressed data with this library? Or is it not possible to encrypt compressed data with it?
Thanks for your response and help!
Best regards,
S.
The text was updated successfully, but these errors were encountered:
Hi,
a colleague of mine and I are working on a flutter project. The application is supposed to retrieve JWE encrypted Data and decrypt it to display the data. We successfully got the encrypted data and now want to use this library to decrypt it.
To do this, we followed this example:
We tried this with our key and this encrypted data:
We expected that the result would be this String:
But we got this error:
We tried to decrypt the data with the same key in Java and it got us the right result, so we don't think the key or payload is invalid.
But we looked at the encrypted data anyway. We decoded the encrypted data and successfully got the header:
And that showed us, that the data was compressed. With your example, no compression algorithm was applied and it worked. So now our theory is, that the compression leads to this error.
Do you know how we should handle the compressed data with this library? Or is it not possible to encrypt compressed data with it?
Thanks for your response and help!
Best regards,
S.
The text was updated successfully, but these errors were encountered: