-
Notifications
You must be signed in to change notification settings - Fork 8
HowTo decode a barcode
CGantert345 edited this page Oct 10, 2023
·
10 revisions
The decoding can decode both types of frames and different versions of FCB and dynamic content. The decoding of the content is done by the Decoder in this step.
Decoder decoder = new Decoder(byteArrayFromBarcode);
Take the keyId from the static or dynamic frame and take the keyId to select the appropriate public key
//with dynamic frame
decoder.getDynamicHeader().getLevel2Data().getLevel1Data().getKeyId();
//with static frame
decoder.getStaticFrame().getSignatureKey()
//planned for next version
String keyId = decoder.getLevel1KeyId();
Validate the level 1 signature (the only signature in a static frame barcode). Result codes are listed in class Constants.
int signatureCheckResult = decoder.validateLevel1(<publicKey>,<signing Algorithm OID (not needed for dynamic frames)>);
//using a specific Provider of the signature algorithm:
int signatureCheckResult = decoder.validateLevel1(<publicKey>,<signing Algorithm OID (not needed for dynamic frames)>, <provider>);
- Get the content
IUicRailTicket ticket = decoder.getUicTicket();
TicketLayout layout = decoder.getLayout();
StaticFrame staticFrame = decoder.getStaticFrame()
IDynamicFrame dynamicHeader = decoder.getDynamicFrame()
- (dynamic frame only) Get the dynamic content
Get the decoded content from the dynamic content part and the complete frame content.
IUicDynamicContent dynamicContent = decoder.getDynamicContent()
- (dynamic frame only) Validate the level 2 signature
Validate the level 2 signature (dynamic frame barcode only). Result codes are listed in class Constants.
int signatureCheckResult = decoder.validateLevel2();
//using a specific Provider of the signature algorithm:
int signatureCheckResult = decoder.validateLevel2(<provider>);