|
26 | 26 | import javax.crypto.spec.IvParameterSpec; |
27 | 27 | import javax.crypto.spec.PBEKeySpec; |
28 | 28 | import javax.crypto.spec.SecretKeySpec; |
29 | | -import javax.security.auth.DestroyFailedException; |
30 | | -import javax.security.auth.Destroyable; |
31 | 29 |
|
32 | 30 | import de.ntcomputer.crypto.hash.HashCondenser; |
33 | 31 | import de.ntcomputer.crypto.hash.ProgressListener; |
|
49 | 47 | * @author DevCybran |
50 | 48 | * |
51 | 49 | */ |
52 | | -public class Ed25519PrivateKey implements Destroyable { |
| 50 | +public class Ed25519PrivateKey { |
53 | 51 | static final EdDSAParameterSpec P_SPEC = EdDSANamedCurveTable.getByName(EdDSANamedCurveTable.CURVE_ED25519_SHA512); |
54 | 52 | private static SecureRandom random = null; |
55 | 53 | private final EdDSAPrivateKey key; |
@@ -134,11 +132,6 @@ public static Ed25519PrivateKey loadFromString(String privateKeyString, char[] p |
134 | 132 | throw new RuntimeException(e); |
135 | 133 | } catch (BadPaddingException e) { |
136 | 134 | throw new InvalidKeyException("the supplied private key is corrupted or the password is wrong", e); |
137 | | - } finally { |
138 | | - try { |
139 | | - key.destroy(); |
140 | | - } catch (DestroyFailedException e) { |
141 | | - } |
142 | 135 | } |
143 | 136 | } |
144 | 137 |
|
@@ -211,11 +204,6 @@ public String saveAsString(char[] password) throws IllegalArgumentException, NoS |
211 | 204 | return Utils.bytesToHex(salt) + Utils.bytesToHex(iv) + Utils.bytesToHex(encryptedKey); |
212 | 205 | } catch (InvalidKeyException | IllegalBlockSizeException | BadPaddingException | InvalidAlgorithmParameterException e) { |
213 | 206 | throw new RuntimeException(e); |
214 | | - } finally { |
215 | | - try { |
216 | | - key.destroy(); |
217 | | - } catch (DestroyFailedException e) { |
218 | | - } |
219 | 207 | } |
220 | 208 | } |
221 | 209 |
|
@@ -334,14 +322,4 @@ public void signToFile(File source, File signatureFile, ProgressListener listene |
334 | 322 | Files.write(signatureFile.toPath(), signature.getBytes(StandardCharsets.UTF_8)); |
335 | 323 | } |
336 | 324 |
|
337 | | - @Override |
338 | | - public void destroy() throws DestroyFailedException { |
339 | | - this.key.destroy(); |
340 | | - } |
341 | | - |
342 | | - @Override |
343 | | - public boolean isDestroyed() { |
344 | | - return this.key.isDestroyed(); |
345 | | - } |
346 | | - |
347 | 325 | } |
0 commit comments