Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -78,6 +78,8 @@ dependencies {
|
|||||||
testImplementation(platform("org.junit:junit-bom:5.10.0"))
|
testImplementation(platform("org.junit:junit-bom:5.10.0"))
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||||
|
|
||||||
|
implementation("com.fasterxml.jackson.core:jackson-databind:2.17.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.test {
|
tasks.test {
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package externalApp.externalApp.src;
|
|||||||
|
|
||||||
import common.common.src.ports.Ports;
|
import common.common.src.ports.Ports;
|
||||||
import common.common.src.logger.Logger;
|
import common.common.src.logger.Logger;
|
||||||
import org.gradle.internal.impldep.com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.gradle.internal.impldep.com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@@ -34,13 +34,12 @@ public class Main {
|
|||||||
|
|
||||||
// Signer le JSON
|
// Signer le JSON
|
||||||
KeyStore keyStore = KeyStore.getInstance("PKCS12");
|
KeyStore keyStore = KeyStore.getInstance("PKCS12");
|
||||||
char[] password = /* TODO */.toCharArray();
|
|
||||||
try (FileInputStream pkFile = new FileInputStream("ma_cle.p12")) {
|
try (FileInputStream pkFile = new FileInputStream("ma_cle.p12")) {
|
||||||
keyStore.load(pkFile, password);
|
keyStore.load(pkFile, "heplhepl".toCharArray());
|
||||||
} catch (CertificateException | NoSuchAlgorithmException e) {
|
} catch (CertificateException | NoSuchAlgorithmException e) {
|
||||||
throw new RuntimeException(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 signature = Signature.getInstance("SHA256withRSA");
|
||||||
signature.initSign(privateKey);
|
signature.initSign(privateKey);
|
||||||
signature.update(jsonString.getBytes(StandardCharsets.UTF_8));
|
signature.update(jsonString.getBytes(StandardCharsets.UTF_8));
|
||||||
|
|||||||
Reference in New Issue
Block a user