diff options
author | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2023-05-30 12:20:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-30 12:20:51 +0200 |
commit | 5762aadf4ac3b69d99978ecc7232ea2107addd14 (patch) | |
tree | 6815663e8a68bf9177c64421f299b63a378608b5 /src/main/java/org/uic/barcode/Encoder.java | |
parent | Merge pull request #64 from UnionInternationalCheminsdeFer/ssb-barcodes (diff) | |
parent | fix on the security provider (diff) | |
download | UIC-barcode-5762aadf4ac3b69d99978ecc7232ea2107addd14.tar UIC-barcode-5762aadf4ac3b69d99978ecc7232ea2107addd14.tar.gz UIC-barcode-5762aadf4ac3b69d99978ecc7232ea2107addd14.tar.bz2 UIC-barcode-5762aadf4ac3b69d99978ecc7232ea2107addd14.tar.lz UIC-barcode-5762aadf4ac3b69d99978ecc7232ea2107addd14.tar.xz UIC-barcode-5762aadf4ac3b69d99978ecc7232ea2107addd14.tar.zst UIC-barcode-5762aadf4ac3b69d99978ecc7232ea2107addd14.zip |
Diffstat (limited to '')
-rw-r--r-- | src/main/java/org/uic/barcode/Encoder.java | 15 |
1 files changed, 13 insertions, 2 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);
|