From 2ecd0bdcbd06e580671ebf16904655a2a56ddba5 Mon Sep 17 00:00:00 2001 From: CGantert345 <57003061+CGantert345@users.noreply.github.com> Date: Mon, 2 May 2022 10:00:40 +0200 Subject: search for the provider prior to the algorithm name --- .../java/org/uic/barcode/dynamicFrame/api/SimpleDynamicFrame.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/uic/barcode/dynamicFrame/api/SimpleDynamicFrame.java b/src/main/java/org/uic/barcode/dynamicFrame/api/SimpleDynamicFrame.java index 59ccd52..ae1b4e2 100644 --- a/src/main/java/org/uic/barcode/dynamicFrame/api/SimpleDynamicFrame.java +++ b/src/main/java/org/uic/barcode/dynamicFrame/api/SimpleDynamicFrame.java @@ -361,13 +361,15 @@ public class SimpleDynamicFrame implements IDynamicFrame { */ @Override public void signLevel2(PrivateKey key, Provider prov) throws Exception { + + if (prov == null) { + prov = SecurityUtils.findPrivateKeyProvider(key); + } //find the algorithm name for the signature OID String algo = AlgorithmNameResolver.getSignatureAlgorithmName(this.getLevel2Data().getLevel1Data().getLevel2SigningAlg(), prov); Signature sig = null; - if (prov == null) { - prov = SecurityUtils.findPrivateKeyProvider(key); - } + if (prov != null) { sig = Signature.getInstance(algo,prov); } else { -- cgit v1.2.3