Author: dbkr
Date: 2006-07-29 17:04:32 +0000 (Sat, 29 Jul 2006)
New Revision: 9814

Modified:
   trunk/apps/Freemail/src/freemail/AccountManager.java
   trunk/apps/Freemail/src/freemail/OutboundContact.java
   trunk/apps/Freemail/src/freemail/RTSFetcher.java
Log:
Use base32 rather than 10 for expressing BigIntegers in mailsites and whatnot 
(tanks nextgens :) )


Modified: trunk/apps/Freemail/src/freemail/AccountManager.java
===================================================================
--- trunk/apps/Freemail/src/freemail/AccountManager.java        2006-07-29 
16:58:33 UTC (rev 9813)
+++ trunk/apps/Freemail/src/freemail/AccountManager.java        2006-07-29 
17:04:32 UTC (rev 9814)
@@ -128,7 +128,7 @@
                        return null;
                }

-               return new RSAKeyParameters(true, new BigInteger(mod_str, 10), 
new BigInteger(privexp_str, 10));
+               return new RSAKeyParameters(true, new BigInteger(mod_str, 32), 
new BigInteger(privexp_str, 32));
        }

        private static void initAccFile(PropsFile accfile) {
@@ -186,9 +186,9 @@
                RSAKeyParameters pub = (RSAKeyParameters) keypair.getPublic();
                RSAKeyParameters priv = (RSAKeyParameters) keypair.getPrivate();

-               accfile.put("asymkey.modulus", pub.getModulus().toString());
-               accfile.put("asymkey.pubexponent", 
pub.getExponent().toString());
-               accfile.put("asymkey.privexponent", 
priv.getExponent().toString());
+               accfile.put("asymkey.modulus", pub.getModulus().toString(32));
+               accfile.put("asymkey.pubexponent", 
pub.getExponent().toString(32));
+               accfile.put("asymkey.privexponent", 
priv.getExponent().toString(32));

                System.out.println("Account creation completed.");
        }

Modified: trunk/apps/Freemail/src/freemail/OutboundContact.java
===================================================================
--- trunk/apps/Freemail/src/freemail/OutboundContact.java       2006-07-29 
16:58:33 UTC (rev 9813)
+++ trunk/apps/Freemail/src/freemail/OutboundContact.java       2006-07-29 
17:04:32 UTC (rev 9814)
@@ -205,7 +205,7 @@
                        }
                }

-               return new RSAKeyParameters(false, new BigInteger(mod_str, 10), 
new BigInteger(exp_str, 10));
+               return new RSAKeyParameters(false, new BigInteger(mod_str, 32), 
new BigInteger(exp_str, 32));
        }

        private String getRtsKsk() throws OutboundContactFatalException {
@@ -301,7 +301,6 @@
                //System.out.println(rtsmessage.toString());

                // sign the message
-               
                SHA256Digest sha256 = new SHA256Digest();
                sha256.update(rtsmessage.toString().getBytes(), 0, 
rtsmessage.toString().getBytes().length);
                byte[] hash = new byte[sha256.getDigestSize()];

Modified: trunk/apps/Freemail/src/freemail/RTSFetcher.java
===================================================================
--- trunk/apps/Freemail/src/freemail/RTSFetcher.java    2006-07-29 16:58:33 UTC 
(rev 9813)
+++ trunk/apps/Freemail/src/freemail/RTSFetcher.java    2006-07-29 17:04:32 UTC 
(rev 9814)
@@ -278,7 +278,7 @@
                        return true;
                }

-               RSAKeyParameters their_pubkey = new RSAKeyParameters(false, new 
BigInteger(their_modulus, 10), new BigInteger(their_exponent, 10));
+               RSAKeyParameters their_pubkey = new RSAKeyParameters(false, new 
BigInteger(their_modulus, 32), new BigInteger(their_exponent, 32));
                AsymmetricBlockCipher deccipher = new RSAEngine();
                deccipher.init(false, their_pubkey);



Reply via email to