ExternalApp : Premier jet

This commit is contained in:
Matthias Guillitte
2025-12-03 16:15:42 +01:00
parent da011dbdcd
commit 3630ad4d1f

View File

@@ -34,13 +34,12 @@ public class Main {
// Signer le JSON
KeyStore keyStore = KeyStore.getInstance("PKCS12");
char[] password = /* TODO */.toCharArray();
try (FileInputStream pkFile = new FileInputStream("ma_cle.p12")) {
keyStore.load(pkFile, password);
keyStore.load(pkFile, "heplhepl".toCharArray());
} catch (CertificateException | NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
PrivateKey privateKey = (PrivateKey) keyStore.getKey(/* TODO */, password);
PrivateKey privateKey = (PrivateKey) keyStore.getKey("TODO : nom de la clé dans le trustore", "hepl".toCharArray());
Signature signature = Signature.getInstance("SHA256withRSA");
signature.initSign(privateKey);
signature.update(jsonString.getBytes(StandardCharsets.UTF_8));