There is a java project, and has a jks certification file. But it is old (expired). Now i have to change it a new pfx certification file. But i don't know how i do it.
here is some information about current project;
this is pom.xml with old jks file configuration
<profile>
<id>sign-base</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>sign</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<verbose>true</verbose>
<storepass>OldJKSKeystorePass</storepass>
<keypass>OldJKSKeyPass</keypass>
<arguments>
<argument>-tsa</argument>
<argument>http://timestamp.globalsign.com/scripts/timestamp.dll</argument>
</arguments>
<keystore>${pom.parent.basedir}${file.separator}OldJKSFile.jks</keystore>
<alias>1</alias>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Here, there is a java class that name is "SpecialHttpsClient" extend default httpsClient, and it has a method like that. mykeystore file is under the resources package and i dont know about it.
private SSLSocketFactory newSslSocketFactory() {
InputStream in =null;
try {
KeyStore trusted = KeyStore.getInstance("JKS");
in = this.getClass().getResourceAsStream("/mykeystore");
trusted.load(in, "mykeystorepass".toCharArray());
SSLSocketFactory sf = new SSLSocketFactory(trusted);
sf.setHostnameVerifier(sslSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
return sf;
} catch (Exception e) {
logger.error("An error was occurred while creating SSLSocketFactory!***************", e);
return null;
} finally {
if(in!=null )
try {
in.close();
} catch (IOException e) {
logger.error("An error was occurred while creating SSLSocketFactory!***************", e);
}
}
}
Here is another class that name is SpecialHttpsConnection and has a method like that. I dont know anything about document file.
private static TrustManagerFactory getTrustManagerFactory() throws Exception {
if(trustManagerFactory==null) {
try {
KeyStore trusted =null;
trusted = KeyStore.getInstance("JKS");
InputStream in = SpecialHttpsConnection.class.getResourceAsStream("/document");
try {
trusted.load(in, "T1@ePudf27?wE".toCharArray());
} finally {
in.close();
}
trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init(trusted);
} catch(Exception e) {
logger.error("An error was occurred while creating TrustManagerFactory!***************",e);
throw e;
}
}
return trustManagerFactory;
}
My problem is that; how can i change "mynewcert.pfx" file with old?