summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/uic/barcode
diff options
context:
space:
mode:
authorCGantert345 <57003061+CGantert345@users.noreply.github.com>2023-05-30 12:19:12 +0200
committerCGantert345 <57003061+CGantert345@users.noreply.github.com>2023-05-30 12:19:12 +0200
commitc5c2c73f3fe46e23871f609b82791540c1a16a24 (patch)
treea3d2ab2c3fef2323c0bf8da4bc9431ada524bfbe /src/main/java/org/uic/barcode
parentfix on productId in version 1 FCB (diff)
downloadUIC-barcode-c5c2c73f3fe46e23871f609b82791540c1a16a24.tar
UIC-barcode-c5c2c73f3fe46e23871f609b82791540c1a16a24.tar.gz
UIC-barcode-c5c2c73f3fe46e23871f609b82791540c1a16a24.tar.bz2
UIC-barcode-c5c2c73f3fe46e23871f609b82791540c1a16a24.tar.lz
UIC-barcode-c5c2c73f3fe46e23871f609b82791540c1a16a24.tar.xz
UIC-barcode-c5c2c73f3fe46e23871f609b82791540c1a16a24.tar.zst
UIC-barcode-c5c2c73f3fe46e23871f609b82791540c1a16a24.zip
Diffstat (limited to 'src/main/java/org/uic/barcode')
-rw-r--r--src/main/java/org/uic/barcode/Encoder.java15
-rw-r--r--src/main/java/org/uic/barcode/staticFrame/StaticFrame.java1
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java2
3 files changed, 14 insertions, 4 deletions
diff --git a/src/main/java/org/uic/barcode/Encoder.java b/src/main/java/org/uic/barcode/Encoder.java
index f2b9b0c..f8dae02 100644
--- a/src/main/java/org/uic/barcode/Encoder.java
+++ b/src/main/java/org/uic/barcode/Encoder.java
@@ -370,16 +370,27 @@ public class Encoder {
*/
public void signLevel1(String securityProvider,PrivateKey key,String signingAlg, String keyId) throws Exception {
if (dynamicFrame != null) {
- dynamicFrame.getLevel2Data().getLevel1Data().setSecurityProvider(securityProvider);
+ if (securityProvider != null && securityProvider.length() > 0) {
+ dynamicFrame.getLevel2Data().getLevel1Data().setSecurityProvider(securityProvider);
+ }
dynamicFrame.getLevel2Data().getLevel1Data().setLevel1SigningAlg(signingAlg);
dynamicFrame.getLevel2Data().getLevel1Data().setKeyId(Long.parseLong(keyId));
dynamicFrame.signLevel1(key);
} else if (staticFrame != null) {
staticFrame.setSignatureKey(keyId);
staticFrame.setSecurityProvider(securityProvider);
- if (staticFrame.getHeaderRecord()!= null && staticFrame.getHeaderRecord().getIssuer() == null) {
+ if (securityProvider != null &&
+ securityProvider.length() > 0 &&
+ staticFrame.getHeaderRecord()!= null) {
staticFrame.getHeaderRecord().setIssuer(securityProvider);
}
+ if (securityProvider != null &&
+ securityProvider.length() > 0 &&
+ staticFrame.getuFlex() != null &&
+ staticFrame.getuFlex().getTicket() != null &&
+ staticFrame.getuFlex().getTicket().getIssuerDetails() != null) {
+ staticFrame.getuFlex().getTicket().getIssuerDetails().setSecurityProvider(securityProvider);
+ }
staticFrame.signByAlgorithmOID(key,signingAlg);
} else if (ssbFrame != null) {
ssbFrame.signLevel1(key, null, keyId, signingAlg);
diff --git a/src/main/java/org/uic/barcode/staticFrame/StaticFrame.java b/src/main/java/org/uic/barcode/staticFrame/StaticFrame.java
index 25649df..6b577c5 100644
--- a/src/main/java/org/uic/barcode/staticFrame/StaticFrame.java
+++ b/src/main/java/org/uic/barcode/staticFrame/StaticFrame.java
@@ -19,7 +19,6 @@ import java.util.zip.DataFormatException;
import java.util.zip.Deflater;
import java.util.zip.Inflater;
-import org.uic.barcode.dynamicFrame.Constants;
import org.uic.barcode.ticket.EncodingFormatException;
import org.uic.barcode.utils.SecurityUtils;
diff --git a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java
index d8934d9..ada4c1a 100644
--- a/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java
+++ b/src/main/java/org/uic/barcode/ticket/api/utils/Api2OpenAsnEncoder.java
@@ -2127,7 +2127,7 @@ public class Api2OpenAsnEncoder implements Api2AsnEncoder {
if (data.getSecurityProvider() != null) {
asnData.setSecurityProviderNum(UicEncoderUtils.getNum(data.getSecurityProvider()));
- data.setSecurityProvider(data.getIssuer());
+ asnData.setSecurityProviderIA5(UicEncoderUtils.getIA5NonNum(data.getSecurityProvider()));
} else {
asnData.setSecurityProviderNum(UicEncoderUtils.getNum(data.getIssuer()));
}