Skip to content

Commit

Permalink
Merge branch 'dev' into 'test'
Browse files Browse the repository at this point in the history
fix: correction de la détection des certificats PKCS11/PKCS12 #461

See merge request si/esup-signature!2283
  • Loading branch information
dlemaignent committed Nov 5, 2024
2 parents c3ec397 + e96561d commit 79c1a97
Showing 1 changed file with 2 additions and 2 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

0 comments on commit 79c1a97

Please sign in to comment.