Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 14 additions & 36 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.nhind</groupId>
<artifactId>config-service-jar</artifactId>
<version>8.0.5</version>
<version>8.1.0</version>
<packaging>jar</packaging>
<name>NHIN Direct Java RI config service jar</name>
<description>NHIN Direct Java RI config service jar.</description>
Expand Down Expand Up @@ -48,7 +48,6 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<commons-net.version>3.8.0</commons-net.version>
<bcprov-jdk15on.version>1.68</bcprov-jdk15on.version>
</properties>
<dependencies>
<dependency>
Expand All @@ -58,28 +57,18 @@
<dependency>
<groupId>org.nhind</groupId>
<artifactId>config-store</artifactId>
<version>8.0.0</version>
</dependency>
<dependency>
<groupId>org.nhind</groupId>
<artifactId>config-model</artifactId>
<version>8.0.0</version>
</dependency>
<version>8.1.0</version>
</dependency>
<dependency>
<groupId>org.nhind</groupId>
<artifactId>direct-common</artifactId>
<version>8.0.0</version>
<version>8.1.0</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>${commons-net.version}</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>${bcprov-jdk15on.version}</version>
</dependency>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
Expand Down Expand Up @@ -190,6 +179,15 @@
<version>3.0.1</version>
</plugin>
-->
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.8.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
Expand Down Expand Up @@ -249,24 +247,4 @@
</plugin>
</plugins>
</reporting>
<distributionManagement>
<site>
<id>nhind-site</id>
<name>NHIN Direct API publication site</name>
<url>sftp://api.nhindirect.org/x/www/api.nhindirect.org/java/site/config/config-service-jar/${project.version}</url>
</site>
<snapshotRepository>
<id>sonatype-snapshot</id>
<name>Sonatype OSS Maven SNAPSHOT Repository</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
<repository>
<id>sonatype-release</id>
<name>Sonatype OSS Maven Release Repositor</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<uniqueVersion>false</uniqueVersion>
</repository>
</distributionManagement>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -292,28 +292,42 @@ public Mono<?> refreshBundle(TrustBundle bundle)
protected Mono<Collection<X509Certificate>> convertRawBundleToAnchorCollection(byte[] rawBundle, final TrustBundle existingBundle,
final LocalDateTime processAttempStart)
{
Collection<? extends Certificate> 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<? extends Certificate> 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)
Expand Down