diff --git a/pom.xml b/pom.xml index 9ab00ab..ea59d3a 100755 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.nhind config-service-jar - 8.0.5 + 8.1.0 jar NHIN Direct Java RI config service jar NHIN Direct Java RI config service jar. @@ -48,7 +48,6 @@ UTF-8 3.8.0 - 1.68 @@ -58,28 +57,18 @@ org.nhind config-store - 8.0.0 - - - org.nhind - config-model - 8.0.0 - + 8.1.0 + org.nhind direct-common - 8.0.0 + 8.1.0 commons-net commons-net ${commons-net.version} - - - org.bouncycastle - bcprov-jdk15on - ${bcprov-jdk15on.version} - + com.h2database h2 @@ -190,6 +179,15 @@ 3.0.1 --> + + org.sonatype.central + central-publishing-maven-plugin + 0.8.0 + true + + central + + @@ -249,24 +247,4 @@ - - - nhind-site - NHIN Direct API publication site - sftp://api.nhindirect.org/x/www/api.nhindirect.org/java/site/config/config-service-jar/${project.version} - - - sonatype-snapshot - Sonatype OSS Maven SNAPSHOT Repository - https://oss.sonatype.org/content/repositories/snapshots/ - false - - - sonatype-release - Sonatype OSS Maven Release Repositor - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - false - - - diff --git a/src/main/java/org/nhindirect/config/processor/impl/DefaultBundleRefreshProcessorImpl.java b/src/main/java/org/nhindirect/config/processor/impl/DefaultBundleRefreshProcessorImpl.java index 4a2cd82..2eee8d0 100644 --- a/src/main/java/org/nhindirect/config/processor/impl/DefaultBundleRefreshProcessorImpl.java +++ b/src/main/java/org/nhindirect/config/processor/impl/DefaultBundleRefreshProcessorImpl.java @@ -292,28 +292,42 @@ public Mono refreshBundle(TrustBundle bundle) protected Mono> convertRawBundleToAnchorCollection(byte[] rawBundle, final TrustBundle existingBundle, final LocalDateTime processAttempStart) { - Collection bundleCerts = null; - InputStream inStream = null; - // check to see if its an unsigned PKCS7 container + + boolean isSigned = false; + try { - inStream = new ByteArrayInputStream(rawBundle); - bundleCerts = CertificateFactory.getInstance("X.509").generateCertificates(inStream); - - // in Java 7, an invalid bundle may be returned as a null instead of throw an exception - // if its null and has no anchors, then try again as a signed bundle - if (bundleCerts != null && bundleCerts.size() == 0) - bundleCerts = null; - + final CMSSignedData signed = new CMSSignedData(rawBundle); + if (signed.getSignerInfos().getSigners().size() > 0) + isSigned = true; } - catch (Exception e) - { - /* no-op for now.... this may not be a p7b, so try it as a signed message*/ - } - finally - { - IOUtils.closeQuietly(inStream); + catch (Exception e) {/*no-op*/} + + Collection bundleCerts = null; + InputStream inStream = null; + + if (!isSigned) { + try + { + inStream = new ByteArrayInputStream(rawBundle); + bundleCerts = CertificateFactory.getInstance("X.509").generateCertificates(inStream); + + // in Java 7, an invalid bundle may be returned as a null instead of throw an exception + // if its null and has no anchors, then try again as a signed bundle + if (bundleCerts != null && bundleCerts.size() == 0) + bundleCerts = null; + + } + catch (Exception e) + { + /* no-op for now.... this may not be a p7b, so try it as a signed message*/ + } + finally + { + IOUtils.closeQuietly(inStream); + } } + // didnt work... try again as a CMS signed message if (bundleCerts == null)