Skip to content

Commit

Permalink
fix: correction de la détection des certificats PKCS11/PKCS12
Browse files Browse the repository at this point in the history
  • Loading branch information
dyv44 committed Nov 5, 2024
1 parent 87a15bc commit 5a58153
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public String decryptPassword(String key) {
}

public SignatureTokenConnection getSealToken() {
if((!StringUtils.hasText(globalProperties.getSealCertificatDriver()) && globalProperties.getSealCertificatType().equals(GlobalProperties.TokenType.PKCS11)) || globalProperties.getSealCertificatType().equals(GlobalProperties.TokenType.PKCS12)) {
if((StringUtils.hasText(globalProperties.getSealCertificatDriver()) && globalProperties.getSealCertificatType().equals(GlobalProperties.TokenType.PKCS11)) || globalProperties.getSealCertificatType().equals(GlobalProperties.TokenType.PKCS12)) {
return getPkcsToken();
} else if(globalProperties.getSealCertificatType().equals(GlobalProperties.TokenType.OPENSC)){
return openSCSignatureToken;
Expand All @@ -175,7 +175,7 @@ public AbstractKeyStoreTokenConnection getPkcsToken() throws EsupSignatureKeysto
if (StringUtils.hasText(globalProperties.getSealCertificatDriver()) && globalProperties.getSealCertificatType().equals(GlobalProperties.TokenType.PKCS11)) {
KeyStore.PasswordProtection passwordProtection = new KeyStore.PasswordProtection(globalProperties.getSealCertificatPin().toCharArray());
return new eu.europa.esig.dss.token.Pkcs11SignatureToken(globalProperties.getSealCertificatDriver(), passwordProtection);
} else if (!StringUtils.hasText(globalProperties.getSealCertificatFile()) && globalProperties.getSealCertificatType().equals(GlobalProperties.TokenType.PKCS12)) {
} else if (StringUtils.hasText(globalProperties.getSealCertificatFile()) && globalProperties.getSealCertificatType().equals(GlobalProperties.TokenType.PKCS12)) {
try {
return userKeystoreService.getPkcs12Token(new FileInputStream(globalProperties.getSealCertificatFile()), globalProperties.getSealCertificatPin());
} catch (FileNotFoundException e) {
Expand Down Expand Up @@ -254,4 +254,4 @@ public Health health() {
return Health.down().withDetail("seal certificat", "DOWN").build();
}
}
}
}

0 comments on commit 5a58153

Please sign in to comment.