Created
September 11, 2024 07:51
-
-
Save moomdate/e50cf2bd374b5f3077545abab87525cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SneakyThrows | |
public XadesSigner createXadesSigner(X509Certificate x509Certificate) { | |
final String PROVIDER_NAME = "LunaProvider"; | |
KeyStoreKeyingDataProvider.SigningCertSelector signingCertSelector = availableCertificates -> x509Certificate; | |
KeyStoreKeyingDataProvider.KeyStorePasswordProvider password = () -> tokenProperties.getPwd().toCharArray(); | |
KeyingDataProvider kp = new PKCS11KeyStoreKeyingDataProvider(tokenProperties.driverUse, PROVIDER_NAME, Integer.parseInt(tokenProperties.getSlot()), signingCertSelector, password, null, false); | |
XadesSigningProfile p = new XadesBesSigningProfile(kp).withAlgorithmsProviderEx(new XMLProcess.MyAlgorithmsProviderEx()); | |
return p.newSigner(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment