Dart
Dart
Example: Crypt2.GetSignedAttributes method
Demonstrates how to call the GetSignedAttributes method.Chilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
final crypt = CkCrypt2();
final bdPkcs7 = CkBinData();
try {
bdPkcs7.loadFile('qa_data/cades/CAdES-T/Signature-C-T-1.p7m');
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
final json = CkJsonObject();
json.emitCompact = false;
final sbJson = CkStringBuilder();
var i = 0;
var tryNext = true;
while (tryNext) {
if (crypt.getSignedAttributes(i, bdPkcs7, sbJson)) {
json.loadSb(sbJson);
print('$i: ');
print(json.emit());
} else {
tryNext = false;
}
i++;
}
// Sample output:
// 0:
// {
// "signedAttributes": [
// {
// "oid": "1.2.840.113549.1.9.3",
// "name": "Content Type"
// },
// {
// "oid": "1.2.840.113549.1.9.5",
// "name": "Signing Time"
// },
// {
// "oid": "1.2.840.113549.1.9.4",
// "name": "Message Digest"
// },
// {
// "oid": "1.2.840.113549.1.9.16.2.47",
// "name": "Signing Certificate V2"
// }
// ]
// }
}