From 74d19c0493d7bf464d466b2dff2305021d911c27 Mon Sep 17 00:00:00 2001 From: CGantert345 <57003061+CGantert345@users.noreply.github.com> Date: Wed, 17 May 2023 13:57:03 +0200 Subject: SSB tests --- src/main/java/org/uic/barcode/Decoder.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/main/java/org/uic/barcode/Decoder.java') diff --git a/src/main/java/org/uic/barcode/Decoder.java b/src/main/java/org/uic/barcode/Decoder.java index 85faa4a..637bbf6 100644 --- a/src/main/java/org/uic/barcode/Decoder.java +++ b/src/main/java/org/uic/barcode/Decoder.java @@ -84,15 +84,22 @@ public class Decoder { * @throws EncodingFormatException the encoding format exception */ public int validateLevel1(PublicKey key) throws InvalidKeyException, NoSuchAlgorithmException, SignatureException, IllegalArgumentException, UnsupportedOperationException, IOException, EncodingFormatException { - if (dynamicFrame != null && dynamicFrame != null) { + if (dynamicFrame != null) { return dynamicFrame.validateLevel1(key) ; - } else { - if (staticFrame != null) { - return Constants.LEVEL1_VALIDATION_SIG_ALG_NOT_IMPLEMENTED; + } else if (staticFrame != null) { + if (staticFrame.verifyByAlgorithmOid(key,null)) { + return Constants.LEVEL1_VALIDATION_OK; + } else { + return Constants.LEVEL1_VALIDATION_FRAUD; + } + } else if (ssbFrame!= null) { + if (ssbFrame.verifyByAlgorithmOid(key,null, null)) { + return Constants.LEVEL1_VALIDATION_OK; } else { return Constants.LEVEL1_VALIDATION_FRAUD; } } + return Constants.LEVEL1_VALIDATION_NO_SIGNATURE; } /** -- cgit v1.2.3