From fb951f4016600771258b3a5fd0817b246e6b733f Mon Sep 17 00:00:00 2001 From: Emmanuel Bourg Date: Tue, 16 Jul 2024 12:35:59 +0200 Subject: [PATCH] Set the SpcSpOpusInfo attribute only if programName or programURL are specified --- jsign-core/src/main/java/net/jsign/AuthenticodeSigner.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jsign-core/src/main/java/net/jsign/AuthenticodeSigner.java b/jsign-core/src/main/java/net/jsign/AuthenticodeSigner.java index 9b124f3e..f29401e6 100644 --- a/jsign-core/src/main/java/net/jsign/AuthenticodeSigner.java +++ b/jsign-core/src/main/java/net/jsign/AuthenticodeSigner.java @@ -507,8 +507,10 @@ private AttributeTable createAuthenticatedAttributes() { SpcStatementType spcStatementType = new SpcStatementType(AuthenticodeObjectIdentifiers.SPC_INDIVIDUAL_SP_KEY_PURPOSE_OBJID); attributes.add(new Attribute(AuthenticodeObjectIdentifiers.SPC_STATEMENT_TYPE_OBJID, new DERSet(spcStatementType))); - SpcSpOpusInfo spcSpOpusInfo = new SpcSpOpusInfo(programName, programURL); - attributes.add(new Attribute(AuthenticodeObjectIdentifiers.SPC_SP_OPUS_INFO_OBJID, new DERSet(spcSpOpusInfo))); + if (programName != null || programURL != null) { + SpcSpOpusInfo spcSpOpusInfo = new SpcSpOpusInfo(programName, programURL); + attributes.add(new Attribute(AuthenticodeObjectIdentifiers.SPC_SP_OPUS_INFO_OBJID, new DERSet(spcSpOpusInfo))); + } return new AttributeTable(new DERSet(attributes.toArray(new ASN1Encodable[0]))); }