From 5756a33aaa06cc9194292e749d0f332cb4709cbd Mon Sep 17 00:00:00 2001 From: Andreas Kretschmer Date: Wed, 6 Dec 2023 12:28:25 +0100 Subject: [PATCH] fix: extension processing in CMP client --- CHANGELOG.md | 5 +++++ pom.xml | 2 +- .../com/siemens/pki/cmpclientcomponent/main/CmpClient.java | 5 +++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73f8592e..23c10816 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -123,3 +123,8 @@ fix: update some dependencies ### 4.0.0 (Nov 8 2023) feat: implement configurable recipient + +### 4.0.1 (Dec 6 2024) + +fix: extension processing in CMP client + diff --git a/pom.xml b/pom.xml index 2782ec38..24c66100 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ com.siemens.pki CmpRaComponent jar - 4.0.0 + 4.0.1 UTF-8 . diff --git a/src/main/java/com/siemens/pki/cmpclientcomponent/main/CmpClient.java b/src/main/java/com/siemens/pki/cmpclientcomponent/main/CmpClient.java index 088f41b5..6bc37114 100644 --- a/src/main/java/com/siemens/pki/cmpclientcomponent/main/CmpClient.java +++ b/src/main/java/com/siemens/pki/cmpclientcomponent/main/CmpClient.java @@ -451,13 +451,14 @@ public EnrollmentResult invokeEnrollment() { case PKIBody.TYPE_CERT_REQ: case PKIBody.TYPE_INIT_REQ: { final String subject = enrollmentContext.getSubject(); - ifNotNull(enrollmentContext.getExtensions(), exts -> exts.stream() + final Extension[] extensions = ifNotNull(enrollmentContext.getExtensions(), exts -> exts.stream() .map(ext -> new Extension( new ASN1ObjectIdentifier(ext.getId()), ext.isCritical(), ext.getValue())) .toArray(Extension[]::new)); final CertTemplateBuilder ctb = new CertTemplateBuilder() .setSubject(ifNotNull(subject, X500Name::new)) - .setPublicKey(enrolledPublicKeyInfo); + .setPublicKey(enrolledPublicKeyInfo) + .setExtensions((Extensions) ifNotNull(extensions, Extensions::new)); requestBody = PkiMessageGenerator.generateIrCrKurBody( enrollmentType, ctb.build(), null, enrolledPrivateKey); pvno = enrolledPrivateKey == null ? PKIHeader.CMP_2021 : PKIHeader.CMP_2000;