Skip to content

Commit 7e9c39f

Browse files
committed
Replaced generic runtimeexception
1 parent de10d89 commit 7e9c39f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

crypto-java/src/main/java/de/dominikschadow/javasecurity/asymmetric/DSA.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ private KeyStore loadKeystore(String keystorePath, char[] keystorePassword) thro
7575
private PrivateKey loadPrivateKey(KeyStore ks, String keyAlias, char[] keyPassword) throws KeyStoreException,
7676
UnrecoverableKeyException, NoSuchAlgorithmException {
7777
if (!ks.containsAlias(keyAlias)) {
78-
throw new RuntimeException("Private key " + keyAlias + " not found in keystore");
78+
throw new UnrecoverableKeyException("Private key " + keyAlias + " not found in keystore");
7979
}
8080

8181
return (PrivateKey) ks.getKey(keyAlias, keyPassword);
8282
}
8383

84-
private PublicKey loadPublicKey(KeyStore ks, String keyAlias) throws KeyStoreException {
84+
private PublicKey loadPublicKey(KeyStore ks, String keyAlias) throws KeyStoreException, UnrecoverableKeyException {
8585
if (!ks.containsAlias(keyAlias)) {
86-
throw new RuntimeException("Public key " + keyAlias + " not found in keystore");
86+
throw new UnrecoverableKeyException("Public key " + keyAlias + " not found in keystore");
8787
}
8888

8989
return ks.getCertificate(keyAlias).getPublicKey();

crypto-java/src/main/java/de/dominikschadow/javasecurity/asymmetric/RSA.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ private KeyStore loadKeystore(String keystorePath, char[] keystorePassword) thro
8080
private PrivateKey loadPrivateKey(KeyStore ks, String keyAlias, char[] keyPassword) throws KeyStoreException,
8181
UnrecoverableKeyException, NoSuchAlgorithmException {
8282
if (!ks.containsAlias(keyAlias)) {
83-
throw new RuntimeException("Private key " + keyAlias + " not found in keystore");
83+
throw new UnrecoverableKeyException("Private key " + keyAlias + " not found in keystore");
8484
}
8585

8686
return (PrivateKey) ks.getKey(keyAlias, keyPassword);
8787
}
8888

89-
private PublicKey loadPublicKey(KeyStore ks, String keyAlias) throws KeyStoreException {
89+
private PublicKey loadPublicKey(KeyStore ks, String keyAlias) throws KeyStoreException, UnrecoverableKeyException {
9090
if (!ks.containsAlias(keyAlias)) {
91-
throw new RuntimeException("Public key " + keyAlias + " not found in keystore");
91+
throw new UnrecoverableKeyException("Public key " + keyAlias + " not found in keystore");
9292
}
9393

9494
return ks.getCertificate(keyAlias).getPublicKey();

crypto-java/src/main/java/de/dominikschadow/javasecurity/symmetric/AES.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private KeyStore loadKeystore(String keystorePath, char[] keystorePassword) thro
9191
private Key loadKey(KeyStore ks, String keyAlias, char[] keyPassword) throws KeyStoreException,
9292
UnrecoverableKeyException, NoSuchAlgorithmException {
9393
if (!ks.containsAlias(keyAlias)) {
94-
throw new RuntimeException("Secret key " + keyAlias + " not found in keystore");
94+
throw new UnrecoverableKeyException("Secret key " + keyAlias + " not found in keystore");
9595
}
9696

9797
return ks.getKey(keyAlias, keyPassword);

0 commit comments

Comments
 (0)