diff --git a/core/java/src/net/i2p/crypto/CertUtil.java b/core/java/src/net/i2p/crypto/CertUtil.java
index 3c4c5ab90895cf9f238203f73f7010f12057c5d9..cdbd8c76bfb7d10e6266fe75160238d412464a67 100644
--- a/core/java/src/net/i2p/crypto/CertUtil.java
+++ b/core/java/src/net/i2p/crypto/CertUtil.java
@@ -349,9 +349,9 @@ public final class CertUtil {
                 throw new CertificateEncodingException("bad base64 cert");
             PrivateKey rv = null;
             // try all the types
+            KeySpec ks = new PKCS8EncodedKeySpec(data);
             for (SigAlgo algo : EnumSet.allOf(SigAlgo.class)) {
                 try {
-                    KeySpec ks = new PKCS8EncodedKeySpec(data);
                     String alg = algo.getName();
                     KeyFactory kf = KeyFactory.getInstance(alg);
                     rv = kf.generatePrivate(ks);
diff --git a/core/java/src/net/i2p/crypto/elgamal/impl/ElGamalPrivateKeyImpl.java b/core/java/src/net/i2p/crypto/elgamal/impl/ElGamalPrivateKeyImpl.java
index 0076c58e00791a737d0cf728ee6768a5ea9671f8..df1d7d74f5d594e9d3173899925050fd470b0f47 100644
--- a/core/java/src/net/i2p/crypto/elgamal/impl/ElGamalPrivateKeyImpl.java
+++ b/core/java/src/net/i2p/crypto/elgamal/impl/ElGamalPrivateKeyImpl.java
@@ -4,6 +4,7 @@ import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.math.BigInteger;
+import java.security.spec.InvalidKeySpecException;
 import java.security.spec.PKCS8EncodedKeySpec;
 
 import javax.crypto.interfaces.DHPrivateKey;
@@ -65,9 +66,9 @@ public class ElGamalPrivateKeyImpl
     }
 
     public ElGamalPrivateKeyImpl(
-        PKCS8EncodedKeySpec spec)
+        PKCS8EncodedKeySpec spec) throws InvalidKeySpecException
     {
-        throw new UnsupportedOperationException("todo");
+        throw new InvalidKeySpecException("todo");
         //this.x = spec.getX();
         //this.elSpec = new ElGamalParameterSpec(spec.getP(), spec.getG());
     }
diff --git a/core/java/src/net/i2p/crypto/elgamal/impl/ElGamalPublicKeyImpl.java b/core/java/src/net/i2p/crypto/elgamal/impl/ElGamalPublicKeyImpl.java
index 8df61ec50ebd40cd7a921b5076db6f027579b8f9..28028e47c36010d0d03749928d9790b28baff9ce 100644
--- a/core/java/src/net/i2p/crypto/elgamal/impl/ElGamalPublicKeyImpl.java
+++ b/core/java/src/net/i2p/crypto/elgamal/impl/ElGamalPublicKeyImpl.java
@@ -4,6 +4,7 @@ import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.math.BigInteger;
+import java.security.spec.InvalidKeySpecException;
 import java.security.spec.X509EncodedKeySpec;
 
 import javax.crypto.interfaces.DHPublicKey;
@@ -60,9 +61,9 @@ public class ElGamalPublicKeyImpl
     }
     
     public ElGamalPublicKeyImpl(
-        X509EncodedKeySpec spec)
+        X509EncodedKeySpec spec) throws InvalidKeySpecException
     {
-        throw new UnsupportedOperationException("todo");
+        throw new InvalidKeySpecException("todo");
         //this.y = y;
         //this.elSpec = elSpec;
     }