Dart
Dart
Get the Entire Loaded JWE Structure
See more JSON Web Encryption (JWE) Examples
Demonstrates Jwe.GetHeader, which copies the entire currently loaded JWE structure into a JsonObject.
Background. This is the full JWE representation, not a decoded or merged JOSE header. It can contain the protected, unprotected, and per-recipient header material.
Chilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
final jwe = CkJwe();
// Load the JWE.
final jweCompact = 'eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2R0NNIn0.<...>.<iv>.<ciphertext>.<tag>';
try {
jwe.loadJwe(jweCompact);
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
// Copy the entire loaded JWE structure into a JsonObject. This is the full JWE representation, not a
// decoded or merged JOSE header.
final json = CkJsonObject();
try {
jwe.getHeader(json);
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
json.emitCompact = false;
print(json.emit());
}