RSA.PrivateKey
authorbrian <brian@brianweb.net>
Fri, 4 Jun 2004 04:46:59 +0000 (04:46 +0000)
committerbrian <brian@brianweb.net>
Fri, 4 Jun 2004 04:46:59 +0000 (04:46 +0000)
darcs-hash:20040604044659-24bed-cc4eb0ef054661ae3244925d5c203b57375acd8e.gz

src/org/ibex/crypto/RSA.java

index 994c7c8..7156cce 100644 (file)
@@ -51,5 +51,30 @@ public class RSA {
             exponent = (BigInteger) seq.elementAt(1);
         }
     }
-
+    
+    public static class PrivateKey {
+        public final int version;
+        public final BigInteger modulus;
+        public final BigInteger publicExponent;
+        public final BigInteger privateExponent;
+        public final BigInteger prime1;
+        public final BigInteger prime2;
+        public final BigInteger exponent1;
+        public final BigInteger exponent2;
+        public final BigInteger coefficient;
+        
+        public PrivateKey(Object o) throws DER.Exception {
+            Vector seq = (Vector) o;
+            version = ((Number)seq.elementAt(0)).intValue();
+            if(version != 0) throw new DER.Exception("Only private key version 0 is supported");
+            modulus = (BigInteger) seq.elementAt(1);
+            publicExponent = (BigInteger) seq.elementAt(2);
+            privateExponent = (BigInteger) seq.elementAt(3);
+            prime1 = (BigInteger) seq.elementAt(4);
+            prime2 = (BigInteger) seq.elementAt(5);
+            exponent1 = (BigInteger) seq.elementAt(6);
+            exponent2 = (BigInteger) seq.elementAt(7);
+            coefficient = (BigInteger) seq.elementAt(8);
+        }
+    }
 }