ExternalApp : Premier jet
This commit is contained in:
@@ -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