Merge remote-tracking branch 'origin/main'

This commit is contained in:
2025-12-03 16:34:58 +01:00
2 changed files with 6 additions and 5 deletions

View File

@@ -2,8 +2,8 @@ package externalApp.externalApp.src;
import common.common.src.ports.Ports;
import common.common.src.logger.Logger;
import org.gradle.internal.impldep.com.fasterxml.jackson.databind.ObjectMapper;
import org.gradle.internal.impldep.com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import javax.net.ssl.HttpsURLConnection;
import java.io.*;
@@ -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));