Start with encryption

This commit is contained in:
Oracle 2026-04-23 19:22:01 +02:00
parent 9df61e0cd3
commit b6af1c9792
Signed by: Oracle
SSH key fingerprint: SHA256:x4/RtnjUyuHkdvmwNDsWSfcfF1V5PNr3OpriZqOvCX8
8 changed files with 413 additions and 79 deletions

View file

@ -1,6 +1,6 @@
package ai.nomyo;
import ai.nomyo.errors.SecurityError;
import java.util.concurrent.ExecutionException;
/**
* Entry point loads RSA keys and validates key length.
@ -10,17 +10,15 @@ public class Main {
static void main() {
SecureCompletionClient secureCompletionClient = new SecureCompletionClient();
//secureCompletionClient.generateKeys(true, "client_keys", "pokemon");
secureCompletionClient.loadKeys("client_keys/private_key.pem", "pokemon");
//secureCompletionClient.loadKeys("client_keys/private_key.pem", "pokemon");
try {
secureCompletionClient.validateRsaKey(secureCompletionClient.getPrivateKey());
} catch (SecurityError e) {
System.out.println("RSA Key is too short!");
return;
System.out.println(secureCompletionClient.fetchServerPublicKey().get());
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
System.out.println("RSA Key has correct length!");
}
}