ExternalApp : Premier jet
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user