자바 프로젝트가 있고 jks 인증 파일이 있습니다. 그러나 오래되었습니다 (만료 됨). 이제 새 pfx 인증 파일로 변경해야합니다. 하지만 어떻게하는지 모르겠습니다.
다음은 현재 프로젝트에 대한 정보입니다.
이것은 오래된 jks 파일 구성을 가진 pom.xml입니다.
<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>
여기에는 이름이 "SpecialHttpsClient"인 Java 클래스가 기본 httpsClient를 확장하며 이와 같은 메소드가 있습니다. mykeystore 파일은 리소스 패키지 아래에 있으며 그것에 대해 모릅니다.
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);
}
}
}
여기에 이름이 SpecialHttpsConnection이고 이와 같은 메서드가있는 또 다른 클래스가 있습니다. 문서 파일에 대해 아무것도 모릅니다.
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;
}
내 문제는 "mynewcert.pfx"파일을 이전 파일로 어떻게 변경할 수 있습니까?
다음은 jarsigner에 대한 솔루션입니다. 누군가에게 유용 할 수 있습니다.
cmd를 열고 cd go to / your / jre / bin / directory /를 입력하십시오.
유형
keytool -importkeystore -srckeystore "c : \ mypfxfolderdirectory \ mypfxfile.pfx"-srcstoretype PKCS12 -destkeystore "c : \ mypfxfolderdirectory \ myjksfile.jks"-deststoretype JKS -srcstorepass pfxFilePass -deststorepass jkspassFileStorePass -KeyPass -destpassFileStorePass -srcalias 1 -destkeystore
그 후 jks 파일은 상점 패스, 키 패스의 두 가지 암호로 생성됩니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다