summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorCGantert345 <57003061+CGantert345@users.noreply.github.com>2024-05-21 15:25:16 +0200
committerCGantert345 <57003061+CGantert345@users.noreply.github.com>2024-05-21 15:25:16 +0200
commitb6dc3080f4cc86e26a76dec7c0100dfb04d56664 (patch)
treed906ae3b85cac5928563cf71e9e4b0069a19b3db /src/main
parentdeprecated tests which are used for deprecated functions only. (diff)
downloadUIC-barcode-b6dc3080f4cc86e26a76dec7c0100dfb04d56664.tar
UIC-barcode-b6dc3080f4cc86e26a76dec7c0100dfb04d56664.tar.gz
UIC-barcode-b6dc3080f4cc86e26a76dec7c0100dfb04d56664.tar.bz2
UIC-barcode-b6dc3080f4cc86e26a76dec7c0100dfb04d56664.tar.lz
UIC-barcode-b6dc3080f4cc86e26a76dec7c0100dfb04d56664.tar.xz
UIC-barcode-b6dc3080f4cc86e26a76dec7c0100dfb04d56664.tar.zst
UIC-barcode-b6dc3080f4cc86e26a76dec7c0100dfb04d56664.zip
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/uic/barcode/Decoder.java2
-rw-r--r--src/main/java/org/uic/barcode/staticFrame/StaticFrame.java5
2 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/org/uic/barcode/Decoder.java b/src/main/java/org/uic/barcode/Decoder.java
index 0878d8d..d9f20ff 100644
--- a/src/main/java/org/uic/barcode/Decoder.java
+++ b/src/main/java/org/uic/barcode/Decoder.java
@@ -23,6 +23,7 @@ import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.ticket.UicRailTicketCoder;
import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+import org.uic.barcode.utils.SecurityUtils;
/**
@@ -165,6 +166,7 @@ public class Decoder {
} else if (staticFrame != null) {
+ // guess the signature algorithm based on the signature size
if (staticFrame.verifyByAlgorithmOid(key,signingAlg, provider)) {
return Constants.LEVEL1_VALIDATION_OK;
} else {
diff --git a/src/main/java/org/uic/barcode/staticFrame/StaticFrame.java b/src/main/java/org/uic/barcode/staticFrame/StaticFrame.java
index bf97acb..a8d7651 100644
--- a/src/main/java/org/uic/barcode/staticFrame/StaticFrame.java
+++ b/src/main/java/org/uic/barcode/staticFrame/StaticFrame.java
@@ -706,6 +706,11 @@ public class StaticFrame {
* @throws IOException
*/
public boolean verifyByAlgorithmOid(PublicKey key, String signingAlg, Provider prov) throws InvalidKeyException, NoSuchAlgorithmException, SignatureException, IllegalArgumentException, UnsupportedOperationException, IOException, EncodingFormatException {
+
+ if ((signingAlg == null || signingAlg.length() < 1) && this.getSignature() != null) {
+ signingAlg = SecurityUtils.getDsaAlgorithm(this.getSignature());
+ }
+
//find the algorithm name for the signature OID
String algo = null;
Service service = prov.getService("Signature",signingAlg);