mrpostman-cvs Mailing List for MrPostman (Page 2)
Brought to you by:
chris_humphreys,
mrbook
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(100) |
Feb
(115) |
Mar
(29) |
Apr
(17) |
May
(18) |
Jun
|
Jul
(12) |
Aug
|
Sep
|
Oct
(6) |
Nov
(2) |
Dec
(10) |
2004 |
Jan
(14) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: <chr...@us...> - 2003-11-22 14:59:19
|
Update of /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/yahoo In directory sc8-pr-cvs1:/tmp/cvs-serv32026 Modified Files: YahooMailSession.java Log Message: No messages log Index: YahooMailSession.java =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/yahoo/YahooMailSession.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** YahooMailSession.java 7 Oct 2003 18:25:16 -0000 1.19 --- YahooMailSession.java 22 Nov 2003 14:58:44 -0000 1.20 *************** *** 280,283 **** --- 280,284 ---- if (matcher.find()) { number_messages = 0; + logger.info("No messages"); return 0; } *************** *** 286,289 **** --- 287,291 ---- if (matcher.find()) { number_messages = 0; + logger.info("No messages"); return 0; } |
From: <chr...@us...> - 2003-11-22 14:58:54
|
Update of /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/pop In directory sc8-pr-cvs1:/tmp/cvs-serv31978 Modified Files: PopConnection.java Log Message: Fixed extension message Index: PopConnection.java =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/pop/PopConnection.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PopConnection.java 24 Apr 2003 22:30:33 -0000 1.14 --- PopConnection.java 22 Nov 2003 14:58:10 -0000 1.15 *************** *** 74,77 **** --- 74,78 ---- private String login; private String password; + private String usernameExtension; private WebMailSession wms = null; protected Socket client; *************** *** 158,165 **** Matcher matcher = userPat.matcher(line); matcher.find(); - sendOk("user " + matcher.group(1) + " accepted"); login = new String(matcher.group(1)); ! have_username = true; ! return false; /* PASS */ } else if (passPat.matcher(line).find()) { --- 159,175 ---- Matcher matcher = userPat.matcher(line); matcher.find(); login = new String(matcher.group(1)); ! Matcher extmatcher = userExtensionPat.matcher(login); ! if (extmatcher.find()) { ! usernameExtension = new String(extmatcher.group(1)); ! logger.fine("Extension: " + usernameExtension); ! sendOk("user " + matcher.group(1) + " accepted"); ! //login = new String(matcher.group(1)); ! have_username = true; ! return false; ! } else { ! sendErr("please provide complete email address for username e.g. us...@ho... or us...@ya..."); ! return false; ! } /* PASS */ } else if (passPat.matcher(line).find()) { *************** *** 168,179 **** return false; } ! Matcher extmatcher = userExtensionPat.matcher(login); ! extmatcher.find(); ! String usernameExtension = new String(extmatcher.group(1)); ! logger.fine("Extension: " + usernameExtension); Matcher matcher = passPat.matcher(line); matcher.find(); password = new String(matcher.group(1)); ! logger.info("Found extension: " + usernameExtension); wms = MrPostman.getMainInstance().getModuleHandlerForExtension(usernameExtension); --- 178,189 ---- return false; } ! //Matcher extmatcher = userExtensionPat.matcher(login); ! //if (extmatcher.find()) { ! // String usernameExtension = new String(extmatcher.group(1)); ! // logger.fine("Extension: " + usernameExtension); Matcher matcher = passPat.matcher(line); matcher.find(); password = new String(matcher.group(1)); ! //logger.info("Found extension: " + usernameExtension); wms = MrPostman.getMainInstance().getModuleHandlerForExtension(usernameExtension); |
From: <lb...@us...> - 2003-10-07 18:25:22
|
Update of /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/yahoo In directory sc8-pr-cvs1:/tmp/cvs-serv3821/src/org/mrbook/mrpostman/yahoo Modified Files: YahooMailSession.java Log Message: Added a new extension for india Index: YahooMailSession.java =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/yahoo/YahooMailSession.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** YahooMailSession.java 6 Oct 2003 14:31:40 -0000 1.18 --- YahooMailSession.java 7 Oct 2003 18:25:16 -0000 1.19 *************** *** 723,727 **** public String[] getRecognizedExtensions() { ! String[] extensions = {"@yahoo.com", "@yahoo.com.au", "@yahoo.co.uk", "@yahoo.ca", "@yahoo.fr", "@yahoo.com.hk", "@yahoo.de", "@yahoo.es"}; return extensions; } --- 723,727 ---- public String[] getRecognizedExtensions() { ! String[] extensions = {"@yahoo.com", "@yahoo.com.au", "@yahoo.co.uk", "@yahoo.ca", "@yahoo.fr", "@yahoo.com.hk", "@yahoo.de", "@yahoo.es", "@yahoo.co.in"}; return extensions; } |
From: <chr...@us...> - 2003-10-06 14:31:45
|
Update of /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/yahoo In directory sc8-pr-cvs1:/tmp/cvs-serv11987 Modified Files: YahooMailSession.java Log Message: regional addresses added Index: YahooMailSession.java =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/yahoo/YahooMailSession.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** YahooMailSession.java 3 Oct 2003 13:53:17 -0000 1.17 --- YahooMailSession.java 6 Oct 2003 14:31:40 -0000 1.18 *************** *** 723,727 **** public String[] getRecognizedExtensions() { ! String[] extensions = {"@yahoo.com", "@yahoo.com.au", "@yahoo.co.uk", "@yahoo.ca"}; return extensions; } --- 723,727 ---- public String[] getRecognizedExtensions() { ! String[] extensions = {"@yahoo.com", "@yahoo.com.au", "@yahoo.co.uk", "@yahoo.ca", "@yahoo.fr", "@yahoo.com.hk", "@yahoo.de", "@yahoo.es"}; return extensions; } |
From: <chr...@us...> - 2003-10-06 14:30:15
|
Update of /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/hotmail In directory sc8-pr-cvs1:/tmp/cvs-serv11616 Modified Files: HotmailMailSession.java Log Message: Dutch support added Index: HotmailMailSession.java =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/hotmail/HotmailMailSession.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** HotmailMailSession.java 30 Jul 2003 02:08:41 -0000 1.28 --- HotmailMailSession.java 6 Oct 2003 14:30:11 -0000 1.29 *************** *** 121,124 **** --- 121,125 ---- local.put("DE", new String[] {"Posteingang", "(\\d+)\\s<b>\\((\\d+)\\)"}); local.put("JA", new String[] {"\u53d7\u4fe1\u30c8\u30ec\u30a4", "(\\d+)\\s<b>\\((\\d+)\\)"}); + local.put("NL", new String[] {"Postvak IN", "(\\d+)\\s<b>\\((\\d+)\\)"}); } |
Update of /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/gui In directory sc8-pr-cvs1:/tmp/cvs-serv19719/src/org/mrbook/mrpostman/gui Modified Files: messages.properties messages_de.properties messages_es.properties messages_fr.properties moduleoptiongui.xml Log Message: Yahoo Trash empty Index: messages.properties =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/gui/messages.properties,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** messages.properties 29 May 2003 10:54:36 -0000 1.9 --- messages.properties 3 Oct 2003 13:53:17 -0000 1.10 *************** *** 64,65 **** --- 64,68 ---- modules.yahoo.option.https.label=Use HTTPS modules.yahoo.option.https.desc=Use HTTPS rather than HTTP for signon + + modules.yahoo.option.emptyTrash.label=Empty Trash + modules.yahoo.option.emptyTrash.desc=Empty Trash after successful mail collection \ No newline at end of file Index: messages_de.properties =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/gui/messages_de.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** messages_de.properties 29 May 2003 10:54:36 -0000 1.2 --- messages_de.properties 3 Oct 2003 13:53:17 -0000 1.3 *************** *** 128,129 **** --- 128,131 ---- + modules.yahoo.option.emptyTrash.label=Empty Trash + modules.yahoo.option.emptyTrash.desc=Empty Trash after successful mail collection \ No newline at end of file Index: messages_es.properties =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/gui/messages_es.properties,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** messages_es.properties 29 May 2003 10:54:36 -0000 1.8 --- messages_es.properties 3 Oct 2003 13:53:17 -0000 1.9 *************** *** 65,66 **** --- 65,69 ---- modules.yahoo.option.https.label=Use HTTPS modules.yahoo.option.https.desc=Use HTTPS rather than HTTP for signon + + modules.yahoo.option.emptyTrash.label=Empty Trash + modules.yahoo.option.emptyTrash.desc=Empty Trash after successful mail collection \ No newline at end of file Index: messages_fr.properties =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/gui/messages_fr.properties,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** messages_fr.properties 29 May 2003 10:54:36 -0000 1.14 --- messages_fr.properties 3 Oct 2003 13:53:17 -0000 1.15 *************** *** 130,131 **** --- 130,134 ---- modules.yahoo.option.https.label=Use HTTPS modules.yahoo.option.https.desc=Utiliser HTTPS plutot que HTTP pour s'authentifier. + + modules.yahoo.option.emptyTrash.label=Empty Trash + modules.yahoo.option.emptyTrash.desc=Empty Trash after successful mail collection \ No newline at end of file Index: moduleoptiongui.xml =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/gui/moduleoptiongui.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** moduleoptiongui.xml 8 May 2003 07:57:37 -0000 1.3 --- moduleoptiongui.xml 3 Oct 2003 13:53:17 -0000 1.4 *************** *** 51,54 **** --- 51,59 ---- <input type="checkbox" /> </module-option> + <module-option id="yahoo.emptyTrash"> + <label>modules.yahoo.option.emptyTrash.label</label> + <desc>modules.yahoo.option.emptyTrash.desc</desc> + <input type="checkbox" /> + </module-option> </module> |
From: <chr...@us...> - 2003-10-03 13:53:22
|
Update of /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/yahoo In directory sc8-pr-cvs1:/tmp/cvs-serv19719/src/org/mrbook/mrpostman/yahoo Modified Files: YahooMailSession.java Log Message: Yahoo Trash empty Index: YahooMailSession.java =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/yahoo/YahooMailSession.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** YahooMailSession.java 22 Jul 2003 12:45:18 -0000 1.16 --- YahooMailSession.java 3 Oct 2003 13:53:17 -0000 1.17 *************** *** 63,69 **** private static final String[] AUTHORS = {"Hector Urtubia <ur...@mr...>"}; private static final ModuleOption[] OPTIONS = { ! new ModuleOption("yahoo.https", "true") }; ! private static final ModuleInfo MODULE_INFO = new ModuleInfo("yahoo", AUTHORS, "0.5", "http://mrpostman.sourceforge.net/updates/yahoo", "/en/yahoo/index.html", OPTIONS); private static Logger logger = Logger.getLogger("org.mrbook.mrpostman.yahoo.YahooMailSession"); --- 63,70 ---- private static final String[] AUTHORS = {"Hector Urtubia <ur...@mr...>"}; private static final ModuleOption[] OPTIONS = { ! new ModuleOption("yahoo.https", "true"), ! new ModuleOption("yahoo.emptyTrash", "false") }; ! private static final ModuleInfo MODULE_INFO = new ModuleInfo("yahoo", AUTHORS, "0.6", "http://mrpostman.sourceforge.net/updates/yahoo", "/en/yahoo/index.html", OPTIONS); private static Logger logger = Logger.getLogger("org.mrbook.mrpostman.yahoo.YahooMailSession"); *************** *** 77,81 **** private boolean gotNumMessages = false; private boolean useHttps = true; ! // private Map cookieJar=null; private CookieJar cj = null; --- 78,84 ---- private boolean gotNumMessages = false; private boolean useHttps = true; ! private boolean emptyTrash = false; //empty trash after collection option - CH 3/10/03 ! private String trashEmptyUrl = null; ! // private Map cookieJar=null; private CookieJar cj = null; *************** *** 102,108 **** } else { logger.info("Log-in using http"); ! url = new URL(httpLoginURL + "?" + postRequest); conn = (HttpURLConnection) url.openConnection(); ! } // conn.setRequestMethod("POST"); --- 105,111 ---- } else { logger.info("Log-in using http"); ! url = new URL(httpLoginURL + "?" + postRequest); conn = (HttpURLConnection) url.openConnection(); ! } // conn.setRequestMethod("POST"); *************** *** 119,123 **** // wr.flush(); // wr.close(); ! /* get the cookies */ /*getCookies(conn); --- 122,126 ---- // wr.flush(); // wr.close(); ! /* get the cookies */ /*getCookies(conn); *************** *** 137,141 **** Pattern unreadMessagesPattern = Pattern.compile("Inbox\\s\\(([0-9]+)\\)"); Pattern unreadMessagesPatternOld = Pattern.compile("Inbox\\s\\(([0-9]+)\\)"); ! Matcher unreadMessagesMatcher = null; --- 140,144 ---- Pattern unreadMessagesPattern = Pattern.compile("Inbox\\s\\(([0-9]+)\\)"); Pattern unreadMessagesPatternOld = Pattern.compile("Inbox\\s\\(([0-9]+)\\)"); ! Matcher unreadMessagesMatcher = null; *************** *** 148,158 **** return WebMailSession.WMS_LOGIN_FAILED; } ! ! if (invalidPassword.matcher(line2).find()) { logger.warning("Invalid Password"); return WebMailSession.WMS_LOGIN_FAILED; } ! unreadMessagesMatcher = unreadMessagesPattern.matcher(line2); ; --- 151,161 ---- return WebMailSession.WMS_LOGIN_FAILED; } ! ! if (invalidPassword.matcher(line2).find()) { logger.warning("Invalid Password"); return WebMailSession.WMS_LOGIN_FAILED; } ! unreadMessagesMatcher = unreadMessagesPattern.matcher(line2); ; *************** *** 162,165 **** --- 165,169 ---- logger.info("You have " + unread_messages + " unread messages"); } + } rd.close(); *************** *** 188,192 **** logger.warning("Invalid URL\n"); } ! if (useHttps) { return matcher.group(1).replaceAll("%3a", ":"); --- 192,196 ---- logger.warning("Invalid URL\n"); } ! if (useHttps) { return matcher.group(1).replaceAll("%3a", ":"); *************** *** 246,249 **** --- 250,257 ---- Pattern noMessagesPattern = Pattern.compile("This\\s*folder\\s*has\\s*no\\s*messages"); Pattern noMessagesPatternOld = Pattern.compile("Folder\\s*Inbox\\s*has\\s*no\\s+"); + //Added Trash Empty link pattern - CH 3/10/03 + Pattern trashPattern = Pattern.compile("<a href=\"(\\S+)\">Trash</a>"); + Pattern trashEmptyPattern = Pattern.compile("<a href=\"(\\S+)\">Empty</a>"); + Matcher matcher = null; *************** *** 280,283 **** --- 288,313 ---- return 0; } + + //check for empty trash link - CH 03/10/03 + //leave this at the end of the loop + matcher = trashPattern.matcher(line); + if (matcher.find()) { + logger.fine("Found Trash folder link, checking for empty url..."); + + //it could be on this line or the next line... + matcher = trashEmptyPattern.matcher(line); + if (!matcher.find()) { + line = br.readLine(); + logger.finest("html: " + line); + if (line != null) { + matcher = trashEmptyPattern.matcher(line); + } + } + if (matcher.find()) { + trashEmptyUrl = matcher.group(1); + logger.fine("Found Trash Empty URL: " + trashEmptyUrl); + } + } + } *************** *** 319,323 **** logger.info("Found crumb = " + crumb); } ! matcher = msgidPattern.matcher(line); --- 349,353 ---- logger.info("Found crumb = " + crumb); } ! matcher = msgidPattern.matcher(line); *************** *** 626,630 **** public void quitSession() { ! /* do nothing */ } --- 656,687 ---- public void quitSession() { ! //Empty Trash folder if option is enabled and we have the url - ch 03/10/03 ! if (emptyTrash && trashEmptyUrl != null) { ! logger.finest("About to Empty Trash...."); ! ! try { ! URL url = new URL(baseUrl + trashEmptyUrl); ! logger.finest(url.toString()); ! HttpURLConnection conn = (HttpURLConnection) url.openConnection(); ! conn.setRequestProperty("User-Agent", UserAgent); ! conn.setRequestProperty("Accept", "*/*"); ! conn.setRequestProperty("Allowed", "GET HEAD PUT"); ! conn.setInstanceFollowRedirects(false); ! HTTPRedirectHandler hrh = new HTTPRedirectHandler(conn); ! hrh.setCookieJar(cj); ! hrh.connect(); ! cj.addAll(hrh.getCookieJar()); ! BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream())); ! String line = null; ! ! while ((line = br.readLine()) != null) { ! logger.finest("html: " + line); ! } ! ! logger.finest("Trash Emptied."); ! } catch (Exception e) { ! logger.log(Level.SEVERE, "Exception whilst emptying trash!", e); ! } ! } } *************** *** 684,687 **** --- 741,746 ---- if ("yahoo.https".equals(optionName)) { useHttps = "true".equalsIgnoreCase(value); + } else if ("yahoo.emptyTrash".equals(optionName)) { + emptyTrash = "true".equalsIgnoreCase(value); } } |
From: <chr...@us...> - 2003-10-03 13:53:22
|
Update of /cvsroot/mrpostman/mrpostman In directory sc8-pr-cvs1:/tmp/cvs-serv19719 Modified Files: build.properties Log Message: Yahoo Trash empty Index: build.properties =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/build.properties,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** build.properties 29 May 2003 21:24:36 -0000 1.5 --- build.properties 3 Oct 2003 13:53:17 -0000 1.6 *************** *** 1,3 **** ! project.version=0.1 # Uncomment this property to prevent the use of checkstyle ! #checkstyle.notused=true \ No newline at end of file --- 1,3 ---- ! project.version=1.0.2 # Uncomment this property to prevent the use of checkstyle ! checkstyle.notused=true |
From: <chr...@us...> - 2003-07-30 02:08:43
|
Update of /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/hotmail In directory sc8-pr-cvs1:/tmp/cvs-serv31438 Modified Files: HotmailMailSession.java Log Message: UIDL MD5 fix + checkstyle changes Index: HotmailMailSession.java =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/hotmail/HotmailMailSession.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** HotmailMailSession.java 28 Jul 2003 11:28:12 -0000 1.27 --- HotmailMailSession.java 30 Jul 2003 02:08:41 -0000 1.28 *************** *** 882,886 **** */ public String getUniqueMessageId(int num) throws MailSessionException { ! //This is based on work by Peter Joanes try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); --- 882,886 ---- */ public String getUniqueMessageId(int num) throws MailSessionException { ! //This is based on work by Peter Joanes. Thanks Peter! try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); *************** *** 888,899 **** retrieveMessage(num, pw, 1); bos.flush(); ! if(logger.isLoggable(Level.FINEST)) { ! String header = bos.toString(); ! logger.finest("Returning a hashcode of header field: " + header); } byte[] data = bos.toByteArray(); MD5 md5 = new MD5(); ! md5.update(data,0,data.length); String hash = Util.toString(md5.digest()); logger.finest("Returning hash: " + hash); --- 888,899 ---- retrieveMessage(num, pw, 1); bos.flush(); ! if (logger.isLoggable(Level.FINEST)) { ! String header = bos.toString(); ! logger.finest("Returning a hashcode of header field: " + header); } byte[] data = bos.toByteArray(); MD5 md5 = new MD5(); ! md5.update(data, 0, data.length); String hash = Util.toString(md5.digest()); logger.finest("Returning hash: " + hash); |
From: <chr...@us...> - 2003-07-30 02:01:32
|
Update of /cvsroot/mrpostman/mrpostman/src/gnu/crypto/util In directory sc8-pr-cvs1:/tmp/cvs-serv30277/util Modified Files: Util.java Log Message: ran jalopy to format code to our conventions Index: Util.java =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/gnu/crypto/util/Util.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Util.java 28 Jul 2003 11:22:52 -0000 1.1 --- Util.java 30 Jul 2003 02:01:29 -0000 1.2 *************** *** 1,4 **** --- 1,34 ---- + /* + * -*- mode: java; c-basic-indent: 4; indent-tabs-mode: nil -*- + * :indentSize=4:noTabs=true:tabSize=4:indentOnTab=true:indentOnEnter=true:mode=java: + * ex: set tabstop=4 expandtab: + * + * MrPostman - webmail <-> email gateway + * Copyright (C) 2002-2003 MrPostman Development Group + * Projectpage: http://mrbook.org/mrpostman/ + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * In particular, this implies that users are responsible for + * using MrPostman after reading the terms and conditions given + * by their web-mail provider. + * + * You should have received a copy of the GNU General Public License + * Named LICENSE in the base directory of this distribution, + * if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package gnu.crypto.util; + // ---------------------------------------------------------------------------- // $Id$ *************** *** 50,392 **** */ public class Util { ! // Constants and variables ! // ------------------------------------------------------------------------- ! ! private static final char[] HEX_DIGITS = { ! '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' ! }; ! // Constructor(s) ! // ------------------------------------------------------------------------- ! /** Trivial constructor to enforce Singleton pattern. */ ! private Util() { ! super(); ! } ! // Class methods ! // ------------------------------------------------------------------------- ! /** ! * <p>Returns <code>true</code> if the two designated byte arrays are ! * (a) non-null, (b) of the same length, and (c) contain the same values.</p> ! * ! * @param a the first byte array. ! * @param b the second byte array. ! * @return <code>true</code> if the two designated arrays contain the same ! * values. Returns <code>false</code> otherwise. ! */ ! public static boolean areEqual(byte[] a, byte[] b) { ! if (a == null || b == null) { ! return false; ! } ! int aLength = a.length; ! if (aLength != b.length) { ! return false; ! } ! for (int i = 0; i < aLength; i++) { ! if (a[i] != b[i]) { return false; ! } ! } ! return true; ! } ! /** ! * <p>Returns a string of hexadecimal digits from a byte array. Each byte is ! * converted to 2 hex symbols; zero(es) included.</p> ! * ! * <p>This method calls the method with same name and three arguments as:</p> ! * ! * <pre> ! * toString(ba, 0, ba.length); ! * </pre> ! * ! * @param ba the byte array to convert. ! * @return a string of hexadecimal characters (two for each byte) ! * representing the designated input byte array. ! */ ! public static String toString(byte[] ba) { ! return toString(ba, 0, ba.length); ! } ! /** ! * <p>Returns a string of hexadecimal digits from a byte array, starting at ! * <code>offset</code> and consisting of <code>length</code> bytes. Each byte ! * is converted to 2 hex symbols; zero(es) included. ! * ! * @param ba the byte array to convert. ! * @param offset the index from which to start considering the bytes to ! * convert. ! * @param length the count of bytes, starting from the designated offset to ! * convert. ! * @return a string of hexadecimal characters (two for each byte) ! * representing the designated input byte sub-array. ! */ ! public static final String toString(byte[] ba, int offset, int length) { ! char[] buf = new char[length * 2]; ! for (int i = 0, j = 0, k; i < length; ) { ! k = ba[offset + i++]; ! buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F]; ! buf[j++] = HEX_DIGITS[ k & 0x0F]; ! } ! return new String(buf); ! } ! /** ! * <p>Returns a string of hexadecimal digits from a byte array. Each byte is ! * converted to 2 hex symbols; zero(es) included. The argument is ! * treated as a large little-endian integer and is returned as a ! * large big-endian integer.</p> ! * ! * <p>This method calls the method with same name and three arguments as:</p> ! * ! * <pre> ! * toReversedString(ba, 0, ba.length); ! * </pre> ! * ! * @param ba the byte array to convert. ! * @return a string of hexadecimal characters (two for each byte) ! * representing the designated input byte array. ! */ ! public static String toReversedString(byte[] ba) { ! return toReversedString(ba, 0, ba.length); ! } ! /** ! * <p>Returns a string of hexadecimal digits from a byte array, starting at ! * <code>offset</code> and consisting of <code>length</code> bytes. Each byte ! * is converted to 2 hex symbols; zero(es) included.</p> ! * ! * <p>The byte array is treated as a large little-endian integer, and ! * is returned as a large big-endian integer.</p> ! * ! * @param ba the byte array to convert. ! * @param offset the index from which to start considering the bytes to ! * convert. ! * @param length the count of bytes, starting from the designated offset to ! * convert. ! * @return a string of hexadecimal characters (two for each byte) ! * representing the designated input byte sub-array. ! */ ! public static final String ! toReversedString(byte[] ba, int offset, int length) { ! char[] buf = new char[length * 2]; ! for (int i = offset+length-1, j = 0, k; i >= offset; ) { ! k = ba[offset + i--]; ! buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F]; ! buf[j++] = HEX_DIGITS[ k & 0x0F]; ! } ! return new String(buf); ! } ! /** ! * <p>Returns a byte array from a string of hexadecimal digits.</p> ! * ! * @param s a string of hexadecimal ASCII characters ! * @return the decoded byte array from the input hexadecimal string. ! */ ! public static byte[] toBytesFromString(String s) { ! int limit = s.length(); ! byte[] result = new byte[((limit + 1) / 2)]; ! int i = 0, j = 0; ! if ((limit % 2) == 1) { ! result[j++] = (byte) fromDigit(s.charAt(i++)); ! } ! while (i < limit) { ! result[j ] = (byte) (fromDigit(s.charAt(i++)) << 4); ! result[j++] |= (byte) fromDigit(s.charAt(i++)); ! } ! return result; ! } ! ! /** ! * <p>Returns a byte array from a string of hexadecimal digits, ! * interpreting them as a large big-endian integer and returning it ! * as a large little-endian integer.</p> ! * ! * @param s a string of hexadecimal ASCII characters ! * @return the decoded byte array from the input hexadecimal string. ! */ ! public static byte[] toReversedBytesFromString(String s) { ! int limit = s.length(); ! byte[] result = new byte[((limit + 1) / 2)]; ! int i = 0; ! if ((limit % 2) == 1) { ! result[i++] = (byte) fromDigit(s.charAt(--limit)); ! } ! while (limit > 0) { ! result[i ] = (byte) fromDigit(s.charAt(--limit)); ! result[i++] |= (byte) (fromDigit(s.charAt(--limit)) << 4); ! } ! return result; ! } ! /** ! * <p>Returns a number from <code>0</code> to <code>15</code> corresponding ! * to the designated hexadecimal digit.</p> ! * ! * @param c a hexadecimal ASCII symbol. ! */ ! public static int fromDigit(char c) { ! if (c >= '0' && c <= '9') { ! return c - '0'; ! } else if (c >= 'A' && c <= 'F') { ! return c - 'A' + 10; ! } else if (c >= 'a' && c <= 'f') { ! return c - 'a' + 10; ! } else ! throw new IllegalArgumentException("Invalid hexadecimal digit: " + c); ! } ! /** ! * <p>Returns a string of 8 hexadecimal digits (most significant digit first) ! * corresponding to the unsigned integer <code>n</code>.</p> ! * ! * @param n the unsigned integer to convert. ! * @return a hexadecimal string 8-character long. ! */ ! public static String toString(int n) { ! char[] buf = new char[8]; ! for (int i = 7; i >= 0; i--) { ! buf[i] = HEX_DIGITS[n & 0x0F]; ! n >>>= 4; ! } ! return new String(buf); ! } ! /** ! * <p>Returns a string of hexadecimal digits from an integer array. Each int ! * is converted to 4 hex symbols.</p> ! */ ! public static String toString(int[] ia) { ! int length = ia.length; ! char[] buf = new char[length * 8]; ! for (int i = 0, j = 0, k; i < length; i++) { ! k = ia[i]; ! buf[j++] = HEX_DIGITS[(k >>> 28) & 0x0F]; ! buf[j++] = HEX_DIGITS[(k >>> 24) & 0x0F]; ! buf[j++] = HEX_DIGITS[(k >>> 20) & 0x0F]; ! buf[j++] = HEX_DIGITS[(k >>> 16) & 0x0F]; ! buf[j++] = HEX_DIGITS[(k >>> 12) & 0x0F]; ! buf[j++] = HEX_DIGITS[(k >>> 8) & 0x0F]; ! buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F]; ! buf[j++] = HEX_DIGITS[ k & 0x0F]; ! } ! return new String(buf); ! } ! /** ! * <p>Returns a string of 16 hexadecimal digits (most significant digit ! * first) corresponding to the unsigned long <code>n</code>.</p> ! * ! * @param n the unsigned long to convert. ! * @return a hexadecimal string 16-character long. ! */ ! public static String toString(long n) { ! char[] b = new char[16]; ! for (int i = 15; i >= 0; i--) { ! b[i] = HEX_DIGITS[(int)(n & 0x0FL)]; ! n >>>= 4; ! } ! return new String(b); ! } ! /** ! * <p>Similar to the <code>toString()</code> method except that the Unicode ! * escape character is inserted before every pair of bytes. Useful to ! * externalise byte arrays that will be constructed later from such strings; ! * eg. s-box values.</p> ! * ! * @exception ArrayIndexOutOfBoundsException if the length is odd. ! */ ! public static String toUnicodeString(byte[] ba) { ! return toUnicodeString(ba, 0, ba.length); ! } ! /** ! * <p>Similar to the <code>toString()</code> method except that the Unicode ! * escape character is inserted before every pair of bytes. Useful to ! * externalise byte arrays that will be constructed later from such strings; ! * eg. s-box values.</p> ! * ! * @exception ArrayIndexOutOfBoundsException if the length is odd. ! */ ! public static final String ! toUnicodeString(byte[] ba, int offset, int length) { ! StringBuffer sb = new StringBuffer(); ! int i = 0; ! int j = 0; ! int k; ! sb.append('\n').append("\""); ! while (i < length) { ! sb.append("\\u"); ! k = ba[offset + i++]; ! sb.append(HEX_DIGITS[(k >>> 4) & 0x0F]); ! sb.append(HEX_DIGITS[ k & 0x0F]); ! k = ba[offset + i++]; ! sb.append(HEX_DIGITS[(k >>> 4) & 0x0F]); ! sb.append(HEX_DIGITS[ k & 0x0F]); ! if ((++j % 8) == 0) { ! sb.append("\"+").append('\n').append("\""); ! } ! } ! sb.append("\"").append('\n'); ! return sb.toString(); ! } ! /** ! * <p>Similar to the <code>toString()</code> method except that the Unicode ! * escape character is inserted before every pair of bytes. Useful to ! * externalise integer arrays that will be constructed later from such ! * strings; eg. s-box values.</p> ! * ! * @exception ArrayIndexOutOfBoundsException if the length is not a multiple ! * of 4. ! */ ! public static String toUnicodeString(int[] ia) { ! StringBuffer sb = new StringBuffer(); ! int i = 0; ! int j = 0; ! int k; ! sb.append('\n').append("\""); ! while (i < ia.length) { ! k = ia[i++]; ! sb.append("\\u"); ! sb.append(HEX_DIGITS[(k >>> 28) & 0x0F]); ! sb.append(HEX_DIGITS[(k >>> 24) & 0x0F]); ! sb.append(HEX_DIGITS[(k >>> 20) & 0x0F]); ! sb.append(HEX_DIGITS[(k >>> 16) & 0x0F]); ! sb.append("\\u"); ! sb.append(HEX_DIGITS[(k >>> 12) & 0x0F]); ! sb.append(HEX_DIGITS[(k >>> 8) & 0x0F]); ! sb.append(HEX_DIGITS[(k >>> 4) & 0x0F]); ! sb.append(HEX_DIGITS[ k & 0x0F]); ! if ((++j % 4) == 0) { ! sb.append("\"+").append('\n').append("\""); ! } ! } ! sb.append("\"").append('\n'); ! return sb.toString(); ! } ! public static byte[] toBytesFromUnicode(String s) { ! int limit = s.length() * 2; ! byte[] result = new byte[limit]; ! char c; ! for (int i = 0; i < limit; i++) { ! c = s.charAt(i >>> 1); ! result[i] = (byte)(((i & 1) == 0) ? c >>> 8 : c); ! } ! return result; ! } ! // Instance methods ! // ------------------------------------------------------------------------- ! } --- 80,434 ---- */ public class Util { + // Constants and variables + // ------------------------------------------------------------------------- + private static final char[] HEX_DIGITS = { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' + }; ! // Constructor(s) ! // ------------------------------------------------------------------------- ! /** Trivial constructor to enforce Singleton pattern. */ ! private Util() { ! super(); ! } ! // Class methods ! // ------------------------------------------------------------------------- ! /** ! * <p>Returns <code>true</code> if the two designated byte arrays are ! * (a) non-null, (b) of the same length, and (c) contain the same values.</p> ! * ! * @param a the first byte array. ! * @param b the second byte array. ! * @return <code>true</code> if the two designated arrays contain the same ! * values. Returns <code>false</code> otherwise. ! */ ! public static boolean areEqual(byte[] a, byte[] b) { ! if ((a == null) || (b == null)) { ! return false; ! } ! int aLength = a.length; ! if (aLength != b.length) { return false; ! } ! for (int i = 0; i < aLength; i++) { ! if (a[i] != b[i]) { ! return false; ! } ! } ! return true; ! } ! /** ! * <p>Returns a string of hexadecimal digits from a byte array. Each byte is ! * converted to 2 hex symbols; zero(es) included.</p> ! * ! * <p>This method calls the method with same name and three arguments as:</p> ! * ! * <pre> ! * toString(ba, 0, ba.length); ! * </pre> ! * ! * @param ba the byte array to convert. ! * @return a string of hexadecimal characters (two for each byte) ! * representing the designated input byte array. ! */ ! public static String toString(byte[] ba) { ! return toString(ba, 0, ba.length); ! } ! /** ! * <p>Returns a string of hexadecimal digits from a byte array, starting at ! * <code>offset</code> and consisting of <code>length</code> bytes. Each byte ! * is converted to 2 hex symbols; zero(es) included. ! * ! * @param ba the byte array to convert. ! * @param offset the index from which to start considering the bytes to ! * convert. ! * @param length the count of bytes, starting from the designated offset to ! * convert. ! * @return a string of hexadecimal characters (two for each byte) ! * representing the designated input byte sub-array. ! */ ! public static final String toString(byte[] ba, int offset, int length) { ! char[] buf = new char[length * 2]; ! for (int i = 0, j = 0, k; i < length;) { ! k = ba[offset + i++]; ! buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F]; ! buf[j++] = HEX_DIGITS[k & 0x0F]; ! } ! return new String(buf); ! } ! /** ! * <p>Returns a string of hexadecimal digits from a byte array. Each byte is ! * converted to 2 hex symbols; zero(es) included. The argument is ! * treated as a large little-endian integer and is returned as a ! * large big-endian integer.</p> ! * ! * <p>This method calls the method with same name and three arguments as:</p> ! * ! * <pre> ! * toReversedString(ba, 0, ba.length); ! * </pre> ! * ! * @param ba the byte array to convert. ! * @return a string of hexadecimal characters (two for each byte) ! * representing the designated input byte array. ! */ ! public static String toReversedString(byte[] ba) { ! return toReversedString(ba, 0, ba.length); ! } ! /** ! * <p>Returns a string of hexadecimal digits from a byte array, starting at ! * <code>offset</code> and consisting of <code>length</code> bytes. Each byte ! * is converted to 2 hex symbols; zero(es) included.</p> ! * ! * <p>The byte array is treated as a large little-endian integer, and ! * is returned as a large big-endian integer.</p> ! * ! * @param ba the byte array to convert. ! * @param offset the index from which to start considering the bytes to ! * convert. ! * @param length the count of bytes, starting from the designated offset to ! * convert. ! * @return a string of hexadecimal characters (two for each byte) ! * representing the designated input byte sub-array. ! */ ! public static final String toReversedString(byte[] ba, int offset, int length) { ! char[] buf = new char[length * 2]; ! for (int i = (offset + length) - 1, j = 0, k; i >= offset;) { ! k = ba[offset + i--]; ! buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F]; ! buf[j++] = HEX_DIGITS[k & 0x0F]; ! } ! return new String(buf); ! } ! /** ! * <p>Returns a byte array from a string of hexadecimal digits.</p> ! * ! * @param s a string of hexadecimal ASCII characters ! * @return the decoded byte array from the input hexadecimal string. ! */ ! public static byte[] toBytesFromString(String s) { ! int limit = s.length(); ! byte[] result = new byte[((limit + 1) / 2)]; ! int i = 0; ! int j = 0; ! if ((limit % 2) == 1) { ! result[j++] = (byte) fromDigit(s.charAt(i++)); ! } ! while (i < limit) { ! result[j] = (byte) (fromDigit(s.charAt(i++)) << 4); ! result[j++] |= (byte) fromDigit(s.charAt(i++)); ! } ! return result; ! } ! /** ! * <p>Returns a byte array from a string of hexadecimal digits, ! * interpreting them as a large big-endian integer and returning it ! * as a large little-endian integer.</p> ! * ! * @param s a string of hexadecimal ASCII characters ! * @return the decoded byte array from the input hexadecimal string. ! */ ! public static byte[] toReversedBytesFromString(String s) { ! int limit = s.length(); ! byte[] result = new byte[((limit + 1) / 2)]; ! int i = 0; ! if ((limit % 2) == 1) { ! result[i++] = (byte) fromDigit(s.charAt(--limit)); ! } ! while (limit > 0) { ! result[i] = (byte) fromDigit(s.charAt(--limit)); ! result[i++] |= (byte) (fromDigit(s.charAt(--limit)) << 4); ! } ! return result; ! } ! /** ! * <p>Returns a number from <code>0</code> to <code>15</code> corresponding ! * to the designated hexadecimal digit.</p> ! * ! * @param c a hexadecimal ASCII symbol. ! */ ! public static int fromDigit(char c) { ! if ((c >= '0') && (c <= '9')) { ! return c - '0'; ! } else if ((c >= 'A') && (c <= 'F')) { ! return c - 'A' + 10; ! } else if ((c >= 'a') && (c <= 'f')) { ! return c - 'a' + 10; ! } else { ! throw new IllegalArgumentException("Invalid hexadecimal digit: " + c); ! } ! } ! /** ! * <p>Returns a string of 8 hexadecimal digits (most significant digit first) ! * corresponding to the unsigned integer <code>n</code>.</p> ! * ! * @param n the unsigned integer to convert. ! * @return a hexadecimal string 8-character long. ! */ ! public static String toString(int n) { ! char[] buf = new char[8]; ! for (int i = 7; i >= 0; i--) { ! buf[i] = HEX_DIGITS[n & 0x0F]; ! n >>>= 4; ! } ! return new String(buf); ! } ! /** ! * <p>Returns a string of hexadecimal digits from an integer array. Each int ! * is converted to 4 hex symbols.</p> ! */ ! public static String toString(int[] ia) { ! int length = ia.length; ! char[] buf = new char[length * 8]; ! for (int i = 0, j = 0, k; i < length; i++) { ! k = ia[i]; ! buf[j++] = HEX_DIGITS[(k >>> 28) & 0x0F]; ! buf[j++] = HEX_DIGITS[(k >>> 24) & 0x0F]; ! buf[j++] = HEX_DIGITS[(k >>> 20) & 0x0F]; ! buf[j++] = HEX_DIGITS[(k >>> 16) & 0x0F]; ! buf[j++] = HEX_DIGITS[(k >>> 12) & 0x0F]; ! buf[j++] = HEX_DIGITS[(k >>> 8) & 0x0F]; ! buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F]; ! buf[j++] = HEX_DIGITS[k & 0x0F]; ! } ! return new String(buf); ! } ! /** ! * <p>Returns a string of 16 hexadecimal digits (most significant digit ! * first) corresponding to the unsigned long <code>n</code>.</p> ! * ! * @param n the unsigned long to convert. ! * @return a hexadecimal string 16-character long. ! */ ! public static String toString(long n) { ! char[] b = new char[16]; ! ! for (int i = 15; i >= 0; i--) { ! b[i] = HEX_DIGITS[(int) (n & 0x0FL)]; ! n >>>= 4; ! } ! return new String(b); ! } ! ! /** ! * <p>Similar to the <code>toString()</code> method except that the Unicode ! * escape character is inserted before every pair of bytes. Useful to ! * externalise byte arrays that will be constructed later from such strings; ! * eg. s-box values.</p> ! * ! * @exception ArrayIndexOutOfBoundsException if the length is odd. ! */ ! public static String toUnicodeString(byte[] ba) { ! return toUnicodeString(ba, 0, ba.length); ! } ! ! /** ! * <p>Similar to the <code>toString()</code> method except that the Unicode ! * escape character is inserted before every pair of bytes. Useful to ! * externalise byte arrays that will be constructed later from such strings; ! * eg. s-box values.</p> ! * ! * @exception ArrayIndexOutOfBoundsException if the length is odd. ! */ ! public static final String toUnicodeString(byte[] ba, int offset, int length) { ! StringBuffer sb = new StringBuffer(); ! int i = 0; ! int j = 0; ! int k; ! sb.append('\n').append("\""); ! ! while (i < length) { ! sb.append("\\u"); ! ! k = ba[offset + i++]; ! sb.append(HEX_DIGITS[(k >>> 4) & 0x0F]); ! sb.append(HEX_DIGITS[k & 0x0F]); ! ! k = ba[offset + i++]; ! sb.append(HEX_DIGITS[(k >>> 4) & 0x0F]); ! sb.append(HEX_DIGITS[k & 0x0F]); ! ! if ((++j % 8) == 0) { ! sb.append("\"+").append('\n').append("\""); ! } ! } ! sb.append("\"").append('\n'); ! return sb.toString(); ! } ! ! /** ! * <p>Similar to the <code>toString()</code> method except that the Unicode ! * escape character is inserted before every pair of bytes. Useful to ! * externalise integer arrays that will be constructed later from such ! * strings; eg. s-box values.</p> ! * ! * @exception ArrayIndexOutOfBoundsException if the length is not a multiple ! * of 4. ! */ ! public static String toUnicodeString(int[] ia) { ! StringBuffer sb = new StringBuffer(); ! int i = 0; ! int j = 0; ! int k; ! sb.append('\n').append("\""); ! ! while (i < ia.length) { ! k = ia[i++]; ! sb.append("\\u"); ! sb.append(HEX_DIGITS[(k >>> 28) & 0x0F]); ! sb.append(HEX_DIGITS[(k >>> 24) & 0x0F]); ! sb.append(HEX_DIGITS[(k >>> 20) & 0x0F]); ! sb.append(HEX_DIGITS[(k >>> 16) & 0x0F]); ! sb.append("\\u"); ! sb.append(HEX_DIGITS[(k >>> 12) & 0x0F]); ! sb.append(HEX_DIGITS[(k >>> 8) & 0x0F]); ! sb.append(HEX_DIGITS[(k >>> 4) & 0x0F]); ! sb.append(HEX_DIGITS[k & 0x0F]); ! ! if ((++j % 4) == 0) { ! sb.append("\"+").append('\n').append("\""); ! } ! } ! sb.append("\"").append('\n'); ! return sb.toString(); ! } ! ! public static byte[] toBytesFromUnicode(String s) { ! int limit = s.length() * 2; ! byte[] result = new byte[limit]; ! char c; ! ! for (int i = 0; i < limit; i++) { ! c = s.charAt(i >>> 1); ! result[i] = (byte) (((i & 1) == 0) ? c >>> 8 : c); ! } ! ! return result; ! } ! ! // Instance methods ! // ------------------------------------------------------------------------- ! } \ No newline at end of file |
From: <chr...@us...> - 2003-07-30 02:01:32
|
Update of /cvsroot/mrpostman/mrpostman/src/gnu/crypto In directory sc8-pr-cvs1:/tmp/cvs-serv30277 Modified Files: Registry.java Log Message: ran jalopy to format code to our conventions Index: Registry.java =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/gnu/crypto/Registry.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Registry.java 28 Jul 2003 11:22:52 -0000 1.1 --- Registry.java 30 Jul 2003 02:01:29 -0000 1.2 *************** *** 1,4 **** --- 1,34 ---- + /* + * -*- mode: java; c-basic-indent: 4; indent-tabs-mode: nil -*- + * :indentSize=4:noTabs=true:tabSize=4:indentOnTab=true:indentOnEnter=true:mode=java: + * ex: set tabstop=4 expandtab: + * + * MrPostman - webmail <-> email gateway + * Copyright (C) 2002-2003 MrPostman Development Group + * Projectpage: http://mrbook.org/mrpostman/ + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * In particular, this implies that users are responsible for + * using MrPostman after reading the terms and conditions given + * by their web-mail provider. + * + * You should have received a copy of the GNU General Public License + * Named LICENSE in the base directory of this distribution, + * if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package gnu.crypto; + // ---------------------------------------------------------------------------- // $Id$ *************** *** 51,198 **** */ public interface Registry { ! // Constants ! // ------------------------------------------------------------------------- ! ! /** The name of our Provider. */ ! String GNU_CRYPTO = "GNU-CRYPTO"; ! ! // Names of properties to use in Maps when initialising primitives ......... ! // Symmetric block cipher algorithms and synonyms........................... - String ANUBIS_CIPHER = "anubis"; - String BLOWFISH_CIPHER = "blowfish"; - String DES_CIPHER = "des"; - String KHAZAD_CIPHER = "khazad"; - String RIJNDAEL_CIPHER = "rijndael"; - String SERPENT_CIPHER = "serpent"; // String SERPENT_BITSLICE_CIPHER = "serpent-bitslice"; ! String SQUARE_CIPHER = "square"; ! String TRIPLEDES_CIPHER = "tripledes"; ! String TWOFISH_CIPHER = "twofish"; ! String NULL_CIPHER = "null"; ! ! /** AES is synonymous to Rijndael for 128-bit block size only. */ ! String AES_CIPHER = "aes"; ! /** TripleDES is also known as DESede. */ ! String DESEDE_CIPHER = "desede"; ! // Message digest algorithms and synonyms................................... ! String WHIRLPOOL_HASH = "whirlpool"; ! String RIPEMD128_HASH = "ripemd128"; ! String RIPEMD160_HASH = "ripemd160"; ! String SHA160_HASH = "sha-160"; ! String MD5_HASH = "md5"; ! String MD4_HASH = "md4"; ! String MD2_HASH = "md2"; ! /** RIPEMD-128 is synonymous to RIPEMD128. */ ! String RIPEMD_128_HASH = "ripemd-128"; ! /** RIPEMD-160 is synonymous to RIPEMD160. */ ! String RIPEMD_160_HASH = "ripemd-160"; ! /** SHA-1 is synonymous to SHA-160. */ ! String SHA_1_HASH = "sha-1"; ! /** SHA1 is synonymous to SHA-160. */ ! String SHA1_HASH = "sha1"; ! /** SHA is synonymous to SHA-160. */ ! String SHA_HASH = "sha"; ! // Symmetric block cipher modes of operations............................... ! /** Electronic CodeBook mode. */ ! String ECB_MODE = "ecb"; ! /** Counter (NIST) mode. */ ! String CTR_MODE = "ctr"; ! /** Integer Counter Mode (David McGrew). */ ! String ICM_MODE = "icm"; ! /** Output Feedback Mode (NIST). */ ! String OFB_MODE = "ofb"; ! /** Cipher block chaining mode (NIST). */ ! String CBC_MODE = "cbc"; ! /** Cipher feedback mode (NIST). */ ! String CFB_MODE = "cfb"; ! // Padding scheme names and synonyms........................................ ! /** PKCS#7 padding scheme. */ ! String PKCS7_PAD = "pkcs7"; ! /** Trailing Bit Complement padding scheme. */ ! String TBC_PAD = "tbc"; ! // Pseudo-random number generators.......................................... ! /** (Apparently) RC4 keystream PRNG. */ ! String ARCFOUR_PRNG = "arcfour"; ! /** We use "rc4" as an alias for "arcfour". */ ! String RC4_PRNG = "rc4"; ! /** PRNG based on David McGrew's Integer Counter Mode. */ ! String ICM_PRNG = "icm"; ! /** PRNG based on a designated hash functiopn. */ ! String MD_PRNG = "md"; ! /** PRNG based on UMAC's Key Derivation Function. */ ! String UMAC_PRNG = "umac-kdf"; ! // Asymmetric keypair generators............................................ ! String DSS_KPG = "dss"; ! String RSA_KPG = "rsa"; ! /** DSA is synonymous to DSS. */ ! String DSA_KPG = "dsa"; ! // Signature-with-appendix schemes.......................................... ! String DSS_SIG = "dss"; ! String RSA_PSS_SIG = "rsa-pss"; ! /** DSA is synonymous to DSS. */ ! String DSA_SIG = "dsa"; ! // Keyed-Hash Message Authentication Code .................................. ! /** Name prefix of every HMAC implementation. */ ! String HMAC_NAME_PREFIX = "hmac-"; ! // Other MAC algorithms .................................................... - /** Message Authentication Code using Universal Hashing (Ted Krovetz). */ - String UHASH32 = "uhash32"; - String UMAC32 = "umac32"; - /** The Truncated Multi-Modular Hash Function -v1 (David McGrew). */ - String TMMH16 = "tmmh16"; // String TMMH32 = "tmmh32"; ! // Format IDs used to identify how we externalise asymmetric keys .......... ! int RAW_ENCODING_ID = 1; ! ! // Magic bytes we generate/expect in externalised asymmetric keys .......... ! // the four bytes represent G (0x47) for GNU, 1 (0x01) for Raw format, ! // D (0x44) for DSS or R (0x52) for RSA, and finally P (0x50) for Public, ! // p (0x70) for private, or S (0x53) for signature. ! byte[] MAGIC_RAW_DSS_PUBLIC_KEY = new byte[] {0x47, RAW_ENCODING_ID, 0x44, 0x50}; ! byte[] MAGIC_RAW_DSS_PRIVATE_KEY = new byte[] {0x47, RAW_ENCODING_ID, 0x44, 0x70}; ! byte[] MAGIC_RAW_DSS_SIGNATURE = new byte[] {0x47, RAW_ENCODING_ID, 0x44, 0x53}; ! byte[] MAGIC_RAW_RSA_PUBLIC_KEY = new byte[] {0x47, RAW_ENCODING_ID, 0x52, 0x50}; ! byte[] MAGIC_RAW_RSA_PRIVATE_KEY = new byte[] {0x47, RAW_ENCODING_ID, 0x52, 0x70}; ! byte[] MAGIC_RAW_RSA_PSS_SIGNATURE = new byte[] {0x47, RAW_ENCODING_ID, 0x52, 0x53}; ! // Methods ! // ------------------------------------------------------------------------- ! } --- 81,224 ---- */ public interface Registry { + // Constants + // ------------------------------------------------------------------------- ! /** The name of our Provider. */ ! String GNU_CRYPTO = "GNU-CRYPTO"; ! // Names of properties to use in Maps when initialising primitives ......... ! // Symmetric block cipher algorithms and synonyms........................... ! String ANUBIS_CIPHER = "anubis"; ! String BLOWFISH_CIPHER = "blowfish"; ! String DES_CIPHER = "des"; ! String KHAZAD_CIPHER = "khazad"; ! String RIJNDAEL_CIPHER = "rijndael"; ! String SERPENT_CIPHER = "serpent"; // String SERPENT_BITSLICE_CIPHER = "serpent-bitslice"; ! String SQUARE_CIPHER = "square"; ! String TRIPLEDES_CIPHER = "tripledes"; ! String TWOFISH_CIPHER = "twofish"; ! String NULL_CIPHER = "null"; ! /** AES is synonymous to Rijndael for 128-bit block size only. */ ! String AES_CIPHER = "aes"; ! /** TripleDES is also known as DESede. */ ! String DESEDE_CIPHER = "desede"; ! // Message digest algorithms and synonyms................................... ! String WHIRLPOOL_HASH = "whirlpool"; ! String RIPEMD128_HASH = "ripemd128"; ! String RIPEMD160_HASH = "ripemd160"; ! String SHA160_HASH = "sha-160"; ! String MD5_HASH = "md5"; ! String MD4_HASH = "md4"; ! String MD2_HASH = "md2"; ! /** RIPEMD-128 is synonymous to RIPEMD128. */ ! String RIPEMD_128_HASH = "ripemd-128"; ! /** RIPEMD-160 is synonymous to RIPEMD160. */ ! String RIPEMD_160_HASH = "ripemd-160"; ! /** SHA-1 is synonymous to SHA-160. */ ! String SHA_1_HASH = "sha-1"; ! /** SHA1 is synonymous to SHA-160. */ ! String SHA1_HASH = "sha1"; ! /** SHA is synonymous to SHA-160. */ ! String SHA_HASH = "sha"; ! // Symmetric block cipher modes of operations............................... ! /** Electronic CodeBook mode. */ ! String ECB_MODE = "ecb"; ! /** Counter (NIST) mode. */ ! String CTR_MODE = "ctr"; ! /** Integer Counter Mode (David McGrew). */ ! String ICM_MODE = "icm"; ! /** Output Feedback Mode (NIST). */ ! String OFB_MODE = "ofb"; ! /** Cipher block chaining mode (NIST). */ ! String CBC_MODE = "cbc"; ! /** Cipher feedback mode (NIST). */ ! String CFB_MODE = "cfb"; ! // Padding scheme names and synonyms........................................ ! /** PKCS#7 padding scheme. */ ! String PKCS7_PAD = "pkcs7"; ! /** Trailing Bit Complement padding scheme. */ ! String TBC_PAD = "tbc"; ! // Pseudo-random number generators.......................................... ! /** (Apparently) RC4 keystream PRNG. */ ! String ARCFOUR_PRNG = "arcfour"; ! /** We use "rc4" as an alias for "arcfour". */ ! String RC4_PRNG = "rc4"; ! /** PRNG based on David McGrew's Integer Counter Mode. */ ! String ICM_PRNG = "icm"; ! /** PRNG based on a designated hash functiopn. */ ! String MD_PRNG = "md"; ! /** PRNG based on UMAC's Key Derivation Function. */ ! String UMAC_PRNG = "umac-kdf"; ! // Asymmetric keypair generators............................................ ! String DSS_KPG = "dss"; ! String RSA_KPG = "rsa"; ! /** DSA is synonymous to DSS. */ ! String DSA_KPG = "dsa"; ! // Signature-with-appendix schemes.......................................... ! String DSS_SIG = "dss"; ! String RSA_PSS_SIG = "rsa-pss"; ! /** DSA is synonymous to DSS. */ ! String DSA_SIG = "dsa"; ! // Keyed-Hash Message Authentication Code .................................. ! /** Name prefix of every HMAC implementation. */ ! String HMAC_NAME_PREFIX = "hmac-"; ! // Other MAC algorithms .................................................... ! /** Message Authentication Code using Universal Hashing (Ted Krovetz). */ ! String UHASH32 = "uhash32"; ! String UMAC32 = "umac32"; ! /** The Truncated Multi-Modular Hash Function -v1 (David McGrew). */ ! String TMMH16 = "tmmh16"; // String TMMH32 = "tmmh32"; + // Format IDs used to identify how we externalise asymmetric keys .......... + int RAW_ENCODING_ID = 1; ! // Magic bytes we generate/expect in externalised asymmetric keys .......... ! // the four bytes represent G (0x47) for GNU, 1 (0x01) for Raw format, ! // D (0x44) for DSS or R (0x52) for RSA, and finally P (0x50) for Public, ! // p (0x70) for private, or S (0x53) for signature. ! byte[] MAGIC_RAW_DSS_PUBLIC_KEY = new byte[] {0x47, RAW_ENCODING_ID, 0x44, 0x50}; ! byte[] MAGIC_RAW_DSS_PRIVATE_KEY = new byte[] {0x47, RAW_ENCODING_ID, 0x44, 0x70}; ! byte[] MAGIC_RAW_DSS_SIGNATURE = new byte[] {0x47, RAW_ENCODING_ID, 0x44, 0x53}; ! byte[] MAGIC_RAW_RSA_PUBLIC_KEY = new byte[] {0x47, RAW_ENCODING_ID, 0x52, 0x50}; ! byte[] MAGIC_RAW_RSA_PRIVATE_KEY = new byte[] {0x47, RAW_ENCODING_ID, 0x52, 0x70}; ! byte[] MAGIC_RAW_RSA_PSS_SIGNATURE = new byte[] {0x47, RAW_ENCODING_ID, 0x52, 0x53}; ! // Methods ! // ------------------------------------------------------------------------- ! } \ No newline at end of file |
From: <chr...@us...> - 2003-07-28 11:28:15
|
Update of /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/hotmail In directory sc8-pr-cvs1:/tmp/cvs-serv21920 Modified Files: HotmailMailSession.java Log Message: Implemented MD5 Hash for UIDL fix Index: HotmailMailSession.java =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/hotmail/HotmailMailSession.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** HotmailMailSession.java 10 May 2003 04:54:46 -0000 1.26 --- HotmailMailSession.java 28 Jul 2003 11:28:12 -0000 1.27 *************** *** 34,37 **** --- 34,40 ---- //import com.sonalb.net.http.cookie.Cookie; + import gnu.crypto.hash.MD5; + import gnu.crypto.util.Util; + import org.mrbook.mrpostman.MailSessionException; import org.mrbook.mrpostman.ModuleInfo; *************** *** 52,56 **** Based on 'GotMail' perl script by Peter Hawkins <pet...@oz...> and the YahooMainSession by Hector Urtubia <ur...@mr...> ! Uses jCookie by Sonal Bansal. Note: Unfortunately Hotmail send an invalid cookie to us (now there's a surprise) --- 55,59 ---- Based on 'GotMail' perl script by Peter Hawkins <pet...@oz...> and the YahooMainSession by Hector Urtubia <ur...@mr...> ! Uses jCookie by Sonal Bansal and MD5 from the GNU Crypto Project. Note: Unfortunately Hotmail send an invalid cookie to us (now there's a surprise) *************** *** 299,303 **** logger.finest(cj.toString()); logger.finest("done"); ! // PATCH login url to use http so we can snoop... //loginURL = loginURL.substring(0, 4) + loginURL.substring(5); --- 302,306 ---- logger.finest(cj.toString()); logger.finest("done"); ! // PATCH login url to use http so we can snoop... //loginURL = loginURL.substring(0, 4) + loginURL.substring(5); *************** *** 837,840 **** --- 840,846 ---- * We'll have to calculate our our UIDL for the circular messages :( */ + /* + // Removed this pending further investigations, Message-IDs do not always + //appear and are not always unique. Replaced with the MD5 function below. - CH 28/7/03 public String getUniqueMessageId(int num) throws MailSessionException { try { *************** *** 864,867 **** --- 870,902 ---- return Integer.toString(header.hashCode()); } + } catch (IOException i) { + logger.log(Level.SEVERE, "should not happen", i); + throw new MailSessionException("IOException whilst attempting to read UIDL for message" + num); + } + } + */ + + /** + * Return hotmail's UIDL for this message. We can get this by generating the MD5 hash of the message + * header fields. Hopefully this is unique! + */ + public String getUniqueMessageId(int num) throws MailSessionException { + //This is based on work by Peter Joanes + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + PrintWriter pw = new PrintWriter(bos, true); + retrieveMessage(num, pw, 1); + bos.flush(); + if(logger.isLoggable(Level.FINEST)) { + String header = bos.toString(); + logger.finest("Returning a hashcode of header field: " + + header); + } + byte[] data = bos.toByteArray(); + MD5 md5 = new MD5(); + md5.update(data,0,data.length); + String hash = Util.toString(md5.digest()); + logger.finest("Returning hash: " + hash); + return hash; } catch (IOException i) { logger.log(Level.SEVERE, "should not happen", i); |
From: <chr...@us...> - 2003-07-28 11:22:55
|
Update of /cvsroot/mrpostman/mrpostman/src/gnu/crypto/util In directory sc8-pr-cvs1:/tmp/cvs-serv20672/crypto/util Added Files: Util.java Log Message: from gnu crypto project 1.1.0 --- NEW FILE: Util.java --- package gnu.crypto.util; // ---------------------------------------------------------------------------- // $Id: Util.java,v 1.1 2003/07/28 11:22:52 chris_humphreys Exp $ // // Copyright (C) 2001, 2002, Free Software Foundation, Inc. // // This file is part of GNU Crypto. // // GNU Crypto is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // // GNU Crypto is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; see the file COPYING. If not, write to the // // Free Software Foundation Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307 // USA // // Linking this library statically or dynamically with other modules is // making a combined work based on this library. Thus, the terms and // conditions of the GNU General Public License cover the whole // combination. // // As a special exception, the copyright holders of this library give // you permission to link this library with independent modules to // produce an executable, regardless of the license terms of these // independent modules, and to copy and distribute the resulting // executable under terms of your choice, provided that you also meet, // for each linked independent module, the terms and conditions of the // license of that module. An independent module is a module which is // not derived from or based on this library. If you modify this // library, you may extend this exception to your version of the // library, but you are not obligated to do so. If you do not wish to // do so, delete this exception statement from your version. // ---------------------------------------------------------------------------- /** * <p>A collection of utility methods used throughout this project.</p> * * @version $Revision: 1.1 $ */ public class Util { // Constants and variables // ------------------------------------------------------------------------- private static final char[] HEX_DIGITS = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' }; // Constructor(s) // ------------------------------------------------------------------------- /** Trivial constructor to enforce Singleton pattern. */ private Util() { super(); } // Class methods // ------------------------------------------------------------------------- /** * <p>Returns <code>true</code> if the two designated byte arrays are * (a) non-null, (b) of the same length, and (c) contain the same values.</p> * * @param a the first byte array. * @param b the second byte array. * @return <code>true</code> if the two designated arrays contain the same * values. Returns <code>false</code> otherwise. */ public static boolean areEqual(byte[] a, byte[] b) { if (a == null || b == null) { return false; } int aLength = a.length; if (aLength != b.length) { return false; } for (int i = 0; i < aLength; i++) { if (a[i] != b[i]) { return false; } } return true; } /** * <p>Returns a string of hexadecimal digits from a byte array. Each byte is * converted to 2 hex symbols; zero(es) included.</p> * * <p>This method calls the method with same name and three arguments as:</p> * * <pre> * toString(ba, 0, ba.length); * </pre> * * @param ba the byte array to convert. * @return a string of hexadecimal characters (two for each byte) * representing the designated input byte array. */ public static String toString(byte[] ba) { return toString(ba, 0, ba.length); } /** * <p>Returns a string of hexadecimal digits from a byte array, starting at * <code>offset</code> and consisting of <code>length</code> bytes. Each byte * is converted to 2 hex symbols; zero(es) included. * * @param ba the byte array to convert. * @param offset the index from which to start considering the bytes to * convert. * @param length the count of bytes, starting from the designated offset to * convert. * @return a string of hexadecimal characters (two for each byte) * representing the designated input byte sub-array. */ public static final String toString(byte[] ba, int offset, int length) { char[] buf = new char[length * 2]; for (int i = 0, j = 0, k; i < length; ) { k = ba[offset + i++]; buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F]; buf[j++] = HEX_DIGITS[ k & 0x0F]; } return new String(buf); } /** * <p>Returns a string of hexadecimal digits from a byte array. Each byte is * converted to 2 hex symbols; zero(es) included. The argument is * treated as a large little-endian integer and is returned as a * large big-endian integer.</p> * * <p>This method calls the method with same name and three arguments as:</p> * * <pre> * toReversedString(ba, 0, ba.length); * </pre> * * @param ba the byte array to convert. * @return a string of hexadecimal characters (two for each byte) * representing the designated input byte array. */ public static String toReversedString(byte[] ba) { return toReversedString(ba, 0, ba.length); } /** * <p>Returns a string of hexadecimal digits from a byte array, starting at * <code>offset</code> and consisting of <code>length</code> bytes. Each byte * is converted to 2 hex symbols; zero(es) included.</p> * * <p>The byte array is treated as a large little-endian integer, and * is returned as a large big-endian integer.</p> * * @param ba the byte array to convert. * @param offset the index from which to start considering the bytes to * convert. * @param length the count of bytes, starting from the designated offset to * convert. * @return a string of hexadecimal characters (two for each byte) * representing the designated input byte sub-array. */ public static final String toReversedString(byte[] ba, int offset, int length) { char[] buf = new char[length * 2]; for (int i = offset+length-1, j = 0, k; i >= offset; ) { k = ba[offset + i--]; buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F]; buf[j++] = HEX_DIGITS[ k & 0x0F]; } return new String(buf); } /** * <p>Returns a byte array from a string of hexadecimal digits.</p> * * @param s a string of hexadecimal ASCII characters * @return the decoded byte array from the input hexadecimal string. */ public static byte[] toBytesFromString(String s) { int limit = s.length(); byte[] result = new byte[((limit + 1) / 2)]; int i = 0, j = 0; if ((limit % 2) == 1) { result[j++] = (byte) fromDigit(s.charAt(i++)); } while (i < limit) { result[j ] = (byte) (fromDigit(s.charAt(i++)) << 4); result[j++] |= (byte) fromDigit(s.charAt(i++)); } return result; } /** * <p>Returns a byte array from a string of hexadecimal digits, * interpreting them as a large big-endian integer and returning it * as a large little-endian integer.</p> * * @param s a string of hexadecimal ASCII characters * @return the decoded byte array from the input hexadecimal string. */ public static byte[] toReversedBytesFromString(String s) { int limit = s.length(); byte[] result = new byte[((limit + 1) / 2)]; int i = 0; if ((limit % 2) == 1) { result[i++] = (byte) fromDigit(s.charAt(--limit)); } while (limit > 0) { result[i ] = (byte) fromDigit(s.charAt(--limit)); result[i++] |= (byte) (fromDigit(s.charAt(--limit)) << 4); } return result; } /** * <p>Returns a number from <code>0</code> to <code>15</code> corresponding * to the designated hexadecimal digit.</p> * * @param c a hexadecimal ASCII symbol. */ public static int fromDigit(char c) { if (c >= '0' && c <= '9') { return c - '0'; } else if (c >= 'A' && c <= 'F') { return c - 'A' + 10; } else if (c >= 'a' && c <= 'f') { return c - 'a' + 10; } else throw new IllegalArgumentException("Invalid hexadecimal digit: " + c); } /** * <p>Returns a string of 8 hexadecimal digits (most significant digit first) * corresponding to the unsigned integer <code>n</code>.</p> * * @param n the unsigned integer to convert. * @return a hexadecimal string 8-character long. */ public static String toString(int n) { char[] buf = new char[8]; for (int i = 7; i >= 0; i--) { buf[i] = HEX_DIGITS[n & 0x0F]; n >>>= 4; } return new String(buf); } /** * <p>Returns a string of hexadecimal digits from an integer array. Each int * is converted to 4 hex symbols.</p> */ public static String toString(int[] ia) { int length = ia.length; char[] buf = new char[length * 8]; for (int i = 0, j = 0, k; i < length; i++) { k = ia[i]; buf[j++] = HEX_DIGITS[(k >>> 28) & 0x0F]; buf[j++] = HEX_DIGITS[(k >>> 24) & 0x0F]; buf[j++] = HEX_DIGITS[(k >>> 20) & 0x0F]; buf[j++] = HEX_DIGITS[(k >>> 16) & 0x0F]; buf[j++] = HEX_DIGITS[(k >>> 12) & 0x0F]; buf[j++] = HEX_DIGITS[(k >>> 8) & 0x0F]; buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F]; buf[j++] = HEX_DIGITS[ k & 0x0F]; } return new String(buf); } /** * <p>Returns a string of 16 hexadecimal digits (most significant digit * first) corresponding to the unsigned long <code>n</code>.</p> * * @param n the unsigned long to convert. * @return a hexadecimal string 16-character long. */ public static String toString(long n) { char[] b = new char[16]; for (int i = 15; i >= 0; i--) { b[i] = HEX_DIGITS[(int)(n & 0x0FL)]; n >>>= 4; } return new String(b); } /** * <p>Similar to the <code>toString()</code> method except that the Unicode * escape character is inserted before every pair of bytes. Useful to * externalise byte arrays that will be constructed later from such strings; * eg. s-box values.</p> * * @exception ArrayIndexOutOfBoundsException if the length is odd. */ public static String toUnicodeString(byte[] ba) { return toUnicodeString(ba, 0, ba.length); } /** * <p>Similar to the <code>toString()</code> method except that the Unicode * escape character is inserted before every pair of bytes. Useful to * externalise byte arrays that will be constructed later from such strings; * eg. s-box values.</p> * * @exception ArrayIndexOutOfBoundsException if the length is odd. */ public static final String toUnicodeString(byte[] ba, int offset, int length) { StringBuffer sb = new StringBuffer(); int i = 0; int j = 0; int k; sb.append('\n').append("\""); while (i < length) { sb.append("\\u"); k = ba[offset + i++]; sb.append(HEX_DIGITS[(k >>> 4) & 0x0F]); sb.append(HEX_DIGITS[ k & 0x0F]); k = ba[offset + i++]; sb.append(HEX_DIGITS[(k >>> 4) & 0x0F]); sb.append(HEX_DIGITS[ k & 0x0F]); if ((++j % 8) == 0) { sb.append("\"+").append('\n').append("\""); } } sb.append("\"").append('\n'); return sb.toString(); } /** * <p>Similar to the <code>toString()</code> method except that the Unicode * escape character is inserted before every pair of bytes. Useful to * externalise integer arrays that will be constructed later from such * strings; eg. s-box values.</p> * * @exception ArrayIndexOutOfBoundsException if the length is not a multiple * of 4. */ public static String toUnicodeString(int[] ia) { StringBuffer sb = new StringBuffer(); int i = 0; int j = 0; int k; sb.append('\n').append("\""); while (i < ia.length) { k = ia[i++]; sb.append("\\u"); sb.append(HEX_DIGITS[(k >>> 28) & 0x0F]); sb.append(HEX_DIGITS[(k >>> 24) & 0x0F]); sb.append(HEX_DIGITS[(k >>> 20) & 0x0F]); sb.append(HEX_DIGITS[(k >>> 16) & 0x0F]); sb.append("\\u"); sb.append(HEX_DIGITS[(k >>> 12) & 0x0F]); sb.append(HEX_DIGITS[(k >>> 8) & 0x0F]); sb.append(HEX_DIGITS[(k >>> 4) & 0x0F]); sb.append(HEX_DIGITS[ k & 0x0F]); if ((++j % 4) == 0) { sb.append("\"+").append('\n').append("\""); } } sb.append("\"").append('\n'); return sb.toString(); } public static byte[] toBytesFromUnicode(String s) { int limit = s.length() * 2; byte[] result = new byte[limit]; char c; for (int i = 0; i < limit; i++) { c = s.charAt(i >>> 1); result[i] = (byte)(((i & 1) == 0) ? c >>> 8 : c); } return result; } // Instance methods // ------------------------------------------------------------------------- } |
From: <chr...@us...> - 2003-07-28 11:22:55
|
Update of /cvsroot/mrpostman/mrpostman/src/gnu/crypto/hash In directory sc8-pr-cvs1:/tmp/cvs-serv20672/crypto/hash Added Files: BaseHash.java IMessageDigest.java MD5.java Log Message: from gnu crypto project 1.1.0 --- NEW FILE: BaseHash.java --- package gnu.crypto.hash; // ---------------------------------------------------------------------------- // $Id: BaseHash.java,v 1.1 2003/07/28 11:22:52 chris_humphreys Exp $ // // Copyright (C) 2001, 2002, Free Software Foundation, Inc. // // This file is part of GNU Crypto. // // GNU Crypto is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // // GNU Crypto is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; see the file COPYING. If not, write to the // // Free Software Foundation Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307 // USA // // Linking this library statically or dynamically with other modules is // making a combined work based on this library. Thus, the terms and // conditions of the GNU General Public License cover the whole // combination. // // As a special exception, the copyright holders of this library give // you permission to link this library with independent modules to // produce an executable, regardless of the license terms of these // independent modules, and to copy and distribute the resulting // executable under terms of your choice, provided that you also meet, // for each linked independent module, the terms and conditions of the // license of that module. An independent module is a module which is // not derived from or based on this library. If you modify this // library, you may extend this exception to your version of the // library, but you are not obligated to do so. If you do not wish to // do so, delete this exception statement from your version. // ---------------------------------------------------------------------------- /** * <p>A base abstract class to facilitate hash implementations.</p> * * @version $Revision: 1.1 $ */ public abstract class BaseHash implements IMessageDigest { // Constants and variables // ------------------------------------------------------------------------- /** The canonical name prefix of the hash. */ protected String name; /** The hash (output) size in bytes. */ protected int hashSize; /** The hash (inner) block size in bytes. */ protected int blockSize; /** Number of bytes processed so far. */ protected long count; /** Temporary input buffer. */ protected byte[] buffer; // Constructor(s) // ------------------------------------------------------------------------- /** * <p>Trivial constructor for use by concrete subclasses.</p> * * @param name the canonical name prefix of this instance. * @param hashSize the block size of the output in bytes. * @param blockSize the block size of the internal transform. */ protected BaseHash(String name, int hashSize, int blockSize) { super(); this.name = name; this.hashSize = hashSize; this.blockSize = blockSize; this.buffer = new byte[blockSize]; resetContext(); } // Class methods // ------------------------------------------------------------------------- // Instance methods // ------------------------------------------------------------------------- // IMessageDigest interface implementation --------------------------------- public String name() { return name; } public int hashSize() { return hashSize; } public int blockSize() { return blockSize; } public void update(byte b) { // compute number of bytes still unhashed; ie. present in buffer int i = (int)(count % blockSize); count++; buffer[i] = b; if (i == (blockSize - 1)) { transform(buffer, 0); } } public void update(byte[] b, int offset, int len) { int n = (int)(count % blockSize); count += len; int partLen = blockSize - n; int i = 0; if (len >= partLen) { System.arraycopy(b, offset, buffer, n, partLen); transform(buffer, 0); for (i = partLen; i + blockSize - 1 < len; i+= blockSize) { transform(b, offset + i); } n = 0; } if (i < len) { System.arraycopy(b, offset + i, buffer, n, len - i); } } public byte[] digest() { byte[] tail = padBuffer(); // pad remaining bytes in buffer update(tail, 0, tail.length); // last transform of a message byte[] result = getResult(); // make a result out of context reset(); // reset this instance for future re-use return result; } public void reset() { // reset this instance for future re-use count = 0L; for (int i = 0; i < blockSize; ) { buffer[i++] = 0; } resetContext(); } // methods to be implemented by concrete subclasses ------------------------ public abstract Object clone(); public abstract boolean selfTest(); /** * <p>Returns the byte array to use as padding before completing a hash * operation.</p> * * @return the bytes to pad the remaining bytes in the buffer before * completing a hash operation. */ protected abstract byte[] padBuffer(); /** * <p>Constructs the result from the contents of the current context.</p> * * @return the output of the completed hash operation. */ protected abstract byte[] getResult(); /** Resets the instance for future re-use. */ protected abstract void resetContext(); /** * <p>The block digest transformation per se.</p> * * @param in the <i>blockSize</i> long block, as an array of bytes to digest. * @param offset the index where the data to digest is located within the * input buffer. */ protected abstract void transform(byte[] in, int offset); } --- NEW FILE: IMessageDigest.java --- package gnu.crypto.hash; // ---------------------------------------------------------------------------- // $Id: IMessageDigest.java,v 1.1 2003/07/28 11:22:52 chris_humphreys Exp $ // // Copyright (C) 2001, 2002, Free Software Foundation, Inc. // // This file is part of GNU Crypto. // // GNU Crypto is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // // GNU Crypto is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; see the file COPYING. If not, write to the // // Free Software Foundation Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307 // USA // // Linking this library statically or dynamically with other modules is // making a combined work based on this library. Thus, the terms and // conditions of the GNU General Public License cover the whole // combination. // // As a special exception, the copyright holders of this library give // you permission to link this library with independent modules to // produce an executable, regardless of the license terms of these // independent modules, and to copy and distribute the resulting // executable under terms of your choice, provided that you also meet, // for each linked independent module, the terms and conditions of the // license of that module. An independent module is a module which is // not derived from or based on this library. If you modify this // library, you may extend this exception to your version of the // library, but you are not obligated to do so. If you do not wish to // do so, delete this exception statement from your version. // ---------------------------------------------------------------------------- /** * <p>The basic visible methods of any hash algorithm.</p> * * <p>A hash (or message digest) algorithm produces its output by iterating a * basic compression function on blocks of data.</p> * * @version $Revision: 1.1 $ */ public interface IMessageDigest extends Cloneable { // Constants // ------------------------------------------------------------------------- // Methods // ------------------------------------------------------------------------- /** * <p>Returns the canonical name of this algorithm.</p> * * @return the canonical name of this instance. */ String name(); /** * <p>Returns the output length in bytes of this message digest algorithm.</p> * * @return the output length in bytes of this message digest algorithm. */ int hashSize(); /** * <p>Returns the algorithm's (inner) block size in bytes.</p> * * @return the algorithm's inner block size in bytes. */ int blockSize(); /** * <p>Continues a message digest operation using the input byte.</p> * * @param b the input byte to digest. */ void update(byte b); /** * <p>Continues a message digest operation, by filling the buffer, processing * data in the algorithm's HASH_SIZE-bit block(s), updating the context and * count, and buffering the remaining bytes in buffer for the next * operation.</p> * * @param in the input block. * @param offset start of meaningful bytes in input block. * @param length number of bytes, in input block, to consider. */ void update(byte[] in, int offset, int length); /** * <p>Completes the message digest by performing final operations such as * padding and resetting the instance.</p> * * @return the array of bytes representing the hash value. */ byte[] digest(); /** * <p>Resets the current context of this instance clearing any eventually cached * intermediary values.</p> */ void reset(); /** * <p>A basic test. Ensures that the digest of a pre-determined message is equal * to a known pre-computed value.</p> * * @return <tt>true</tt> if the implementation passes a basic self-test. * Returns <tt>false</tt> otherwise. */ boolean selfTest(); /** * <p>Returns a clone copy of this instance.</p> * * @return a clone copy of this instance. */ Object clone(); } --- NEW FILE: MD5.java --- package gnu.crypto.hash; // ---------------------------------------------------------------------------- // $Id: MD5.java,v 1.1 2003/07/28 11:22:52 chris_humphreys Exp $ // // Copyright (C) 2001, 2002, Free Software Foundation, Inc. // // This file is part of GNU Crypto. // // GNU Crypto is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // // GNU Crypto is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; see the file COPYING. If not, write to the // // Free Software Foundation Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307 // USA // // Linking this library statically or dynamically with other modules is // making a combined work based on this library. Thus, the terms and // conditions of the GNU General Public License cover the whole // combination. // // As a special exception, the copyright holders of this library give // you permission to link this library with independent modules to // produce an executable, regardless of the license terms of these // independent modules, and to copy and distribute the resulting // executable under terms of your choice, provided that you also meet, // for each linked independent module, the terms and conditions of the // license of that module. An independent module is a module which is // not derived from or based on this library. If you modify this // library, you may extend this exception to your version of the // library, but you are not obligated to do so. If you do not wish to // do so, delete this exception statement from your version. // ---------------------------------------------------------------------------- import gnu.crypto.Registry; import gnu.crypto.util.Util; /** * <p>The MD5 message-digest algorithm takes as input a message of arbitrary * length and produces as output a 128-bit "fingerprint" or "message digest" of * the input. It is conjectured that it is computationally infeasible to * produce two messages having the same message digest, or to produce any * message having a given prespecified target message digest.</p> * * <p>References:</p> * * <ol> * <li>The <a href="http://www.ietf.org/rfc/rfc1321.txt">MD5</a> Message- * Digest Algorithm.<br> * R. Rivest.</li> * </ol> * * @version $Revision: 1.1 $ */ public class MD5 extends BaseHash { // Constants and variables // ------------------------------------------------------------------------- private static final int BLOCK_SIZE = 64; // inner block size in bytes private static final String DIGEST0 = "D41D8CD98F00B204E9800998ECF8427E"; /** caches the result of the correctness test, once executed. */ private static Boolean valid; /** 128-bit interim result. */ private int h0, h1, h2, h3; // Constructor(s) // ------------------------------------------------------------------------- /** Trivial 0-arguments constructor. */ public MD5() { super(Registry.MD5_HASH, 16, BLOCK_SIZE); } /** * <p>Private constructor for cloning purposes.</p> * * @param md the instance to clone. */ private MD5(MD5 md) { this(); this.h0 = md.h0; this.h1 = md.h1; this.h2 = md.h2; this.h3 = md.h3; this.count = md.count; this.buffer = (byte[]) md.buffer.clone(); } // Class methods // ------------------------------------------------------------------------- // Instance methods // ------------------------------------------------------------------------- // java.lang.Cloneable interface implementation ---------------------------- public Object clone() { return new MD5(this); } // Implementation of concrete methods in BaseHash -------------------------- protected synchronized void transform(byte[] in, int i) { int X0 = (in[i++] & 0xFF) | (in[i++] & 0xFF) << 8 | (in[i++] & 0xFF) << 16 | in[i++] << 24; int X1 = (in[i++] & 0xFF) | (in[i++] & 0xFF) << 8 | (in[i++] & 0xFF) << 16 | in[i++] << 24; int X2 = (in[i++] & 0xFF) | (in[i++] & 0xFF) << 8 | (in[i++] & 0xFF) << 16 | in[i++] << 24; int X3 = (in[i++] & 0xFF) | (in[i++] & 0xFF) << 8 | (in[i++] & 0xFF) << 16 | in[i++] << 24; int X4 = (in[i++] & 0xFF) | (in[i++] & 0xFF) << 8 | (in[i++] & 0xFF) << 16 | in[i++] << 24; int X5 = (in[i++] & 0xFF) | (in[i++] & 0xFF) << 8 | (in[i++] & 0xFF) << 16 | in[i++] << 24; int X6 = (in[i++] & 0xFF) | (in[i++] & 0xFF) << 8 | (in[i++] & 0xFF) << 16 | in[i++] << 24; int X7 = (in[i++] & 0xFF) | (in[i++] & 0xFF) << 8 | (in[i++] & 0xFF) << 16 | in[i++] << 24; int X8 = (in[i++] & 0xFF) | (in[i++] & 0xFF) << 8 | (in[i++] & 0xFF) << 16 | in[i++] << 24; int X9 = (in[i++] & 0xFF) | (in[i++] & 0xFF) << 8 | (in[i++] & 0xFF) << 16 | in[i++] << 24; int X10 = (in[i++] & 0xFF) | (in[i++] & 0xFF) << 8 | (in[i++] & 0xFF) << 16 | in[i++] << 24; int X11 = (in[i++] & 0xFF) | (in[i++] & 0xFF) << 8 | (in[i++] & 0xFF) << 16 | in[i++] << 24; int X12 = (in[i++] & 0xFF) | (in[i++] & 0xFF) << 8 | (in[i++] & 0xFF) << 16 | in[i++] << 24; int X13 = (in[i++] & 0xFF) | (in[i++] & 0xFF) << 8 | (in[i++] & 0xFF) << 16 | in[i++] << 24; int X14 = (in[i++] & 0xFF) | (in[i++] & 0xFF) << 8 | (in[i++] & 0xFF) << 16 | in[i++] << 24; int X15 = (in[i++] & 0xFF) | (in[i++] & 0xFF) << 8 | (in[i++] & 0xFF) << 16 | in[i ] << 24; int A = h0; int B = h1; int C = h2; int D = h3; // hex constants are from md5.c in FSF Gnu Privacy Guard 0.9.2 // round 1 A += ((B & C) | (~B & D)) + X0 + 0xD76AA478; A = B + (A << 7 | A >>> -7); D += ((A & B) | (~A & C)) + X1 + 0xE8C7B756; D = A + (D << 12 | D >>> -12); C += ((D & A) | (~D & B)) + X2 + 0x242070DB; C = D + (C << 17 | C >>> -17); B += ((C & D) | (~C & A)) + X3 + 0xC1BDCEEE; B = C + (B << 22 | B >>> -22); A += ((B & C) | (~B & D)) + X4 + 0xF57C0FAF; A = B + (A << 7 | A >>> -7); D += ((A & B) | (~A & C)) + X5 + 0x4787C62A; D = A + (D << 12 | D >>> -12); C += ((D & A) | (~D & B)) + X6 + 0xA8304613; C = D + (C << 17 | C >>> -17); B += ((C & D) | (~C & A)) + X7 + 0xFD469501; B = C + (B << 22 | B >>> -22); A += ((B & C) | (~B & D)) + X8 + 0x698098D8; A = B + (A << 7 | A >>> -7); D += ((A & B) | (~A & C)) + X9 + 0x8B44F7AF; D = A + (D << 12 | D >>> -12); C += ((D & A) | (~D & B)) + X10 + 0xFFFF5BB1; C = D + (C << 17 | C >>> -17); B += ((C & D) | (~C & A)) + X11 + 0x895CD7BE; B = C + (B << 22 | B >>> -22); A += ((B & C) | (~B & D)) + X12 + 0x6B901122; A = B + (A << 7 | A >>> -7); D += ((A & B) | (~A & C)) + X13 + 0xFD987193; D = A + (D << 12 | D >>> -12); C += ((D & A) | (~D & B)) + X14 + 0xA679438E; C = D + (C << 17 | C >>> -17); B += ((C & D) | (~C & A)) + X15 + 0x49B40821; B = C + (B << 22 | B >>> -22); // round 2 A += ((B & D) | (C & ~D)) + X1 + 0xF61E2562; A = B + (A << 5 | A >>> -5); D += ((A & C) | (B & ~C)) + X6 + 0xC040B340; D = A + (D << 9 | D >>> -9); C += ((D & B) | (A & ~B)) + X11 + 0x265E5A51; C = D + (C << 14 | C >>> -14); B += ((C & A) | (D & ~A)) + X0 + 0xE9B6C7AA; B = C + (B << 20 | B >>> -20); A += ((B & D) | (C & ~D)) + X5 + 0xD62F105D; A = B + (A << 5 | A >>> -5); D += ((A & C) | (B & ~C)) + X10 + 0x02441453; D = A + (D << 9 | D >>> -9); C += ((D & B) | (A & ~B)) + X15 + 0xD8A1E681; C = D + (C << 14 | C >>> -14); B += ((C & A) | (D & ~A)) + X4 + 0xE7D3FBC8; B = C + (B << 20 | B >>> -20); A += ((B & D) | (C & ~D)) + X9 + 0x21E1CDE6; A = B + (A << 5 | A >>> -5); D += ((A & C) | (B & ~C)) + X14 + 0xC33707D6; D = A + (D << 9 | D >>> -9); C += ((D & B) | (A & ~B)) + X3 + 0xF4D50D87; C = D + (C << 14 | C >>> -14); B += ((C & A) | (D & ~A)) + X8 + 0x455A14ED; B = C + (B << 20 | B >>> -20); A += ((B & D) | (C & ~D)) + X13 + 0xA9E3E905; A = B + (A << 5 | A >>> -5); D += ((A & C) | (B & ~C)) + X2 + 0xFCEFA3F8; D = A + (D << 9 | D >>> -9); C += ((D & B) | (A & ~B)) + X7 + 0x676F02D9; C = D + (C << 14 | C >>> -14); B += ((C & A) | (D & ~A)) + X12 + 0x8D2A4C8A; B = C + (B << 20 | B >>> -20); // round 3 A += (B ^ C ^ D) + X5 + 0xFFFA3942; A = B + (A << 4 | A >>> -4); D += (A ^ B ^ C) + X8 + 0x8771F681; D = A + (D << 11 | D >>> -11); C += (D ^ A ^ B) + X11 + 0x6D9D6122; C = D + (C << 16 | C >>> -16); B += (C ^ D ^ A) + X14 + 0xFDE5380C; B = C + (B << 23 | B >>> -23); A += (B ^ C ^ D) + X1 + 0xA4BEEA44; A = B + (A << 4 | A >>> -4); D += (A ^ B ^ C) + X4 + 0x4BDECFA9; D = A + (D << 11 | D >>> -11); C += (D ^ A ^ B) + X7 + 0xF6BB4B60; C = D + (C << 16 | C >>> -16); B += (C ^ D ^ A) + X10 + 0xBEBFBC70; B = C + (B << 23 | B >>> -23); A += (B ^ C ^ D) + X13 + 0x289B7EC6; A = B + (A << 4 | A >>> -4); D += (A ^ B ^ C) + X0 + 0xEAA127FA; D = A + (D << 11 | D >>> -11); C += (D ^ A ^ B) + X3 + 0xD4EF3085; C = D + (C << 16 | C >>> -16); B += (C ^ D ^ A) + X6 + 0x04881D05; B = C + (B << 23 | B >>> -23); A += (B ^ C ^ D) + X9 + 0xD9D4D039; A = B + (A << 4 | A >>> -4); D += (A ^ B ^ C) + X12 + 0xE6DB99E5; D = A + (D << 11 | D >>> -11); C += (D ^ A ^ B) + X15 + 0x1FA27CF8; C = D + (C << 16 | C >>> -16); B += (C ^ D ^ A) + X2 + 0xC4AC5665; B = C + (B << 23 | B >>> -23); // round 4 A += (C ^ (B | ~D)) + X0 + 0xF4292244; A = B + (A << 6 | A >>> -6); D += (B ^ (A | ~C)) + X7 + 0x432AFF97; D = A + (D << 10 | D >>> -10); C += (A ^ (D | ~B)) + X14 + 0xAB9423A7; C = D + (C << 15 | C >>> -15); B += (D ^ (C | ~A)) + X5 + 0xFC93A039; B = C + (B << 21 | B >>> -21); A += (C ^ (B | ~D)) + X12 + 0x655B59C3; A = B + (A << 6 | A >>> -6); D += (B ^ (A | ~C)) + X3 + 0x8F0CCC92; D = A + (D << 10 | D >>> -10); C += (A ^ (D | ~B)) + X10 + 0xFFEFF47D; C = D + (C << 15 | C >>> -15); B += (D ^ (C | ~A)) + X1 + 0x85845dd1; B = C + (B << 21 | B >>> -21); A += (C ^ (B | ~D)) + X8 + 0x6FA87E4F; A = B + (A << 6 | A >>> -6); D += (B ^ (A | ~C)) + X15 + 0xFE2CE6E0; D = A + (D << 10 | D >>> -10); C += (A ^ (D | ~B)) + X6 + 0xA3014314; C = D + (C << 15 | C >>> -15); B += (D ^ (C | ~A)) + X13 + 0x4E0811A1; B = C + (B << 21 | B >>> -21); A += (C ^ (B | ~D)) + X4 + 0xF7537E82; A = B + (A << 6 | A >>> -6); D += (B ^ (A | ~C)) + X11 + 0xBD3AF235; D = A + (D << 10 | D >>> -10); C += (A ^ (D | ~B)) + X2 + 0x2AD7D2BB; C = D + (C << 15 | C >>> -15); B += (D ^ (C | ~A)) + X9 + 0xEB86D391; B = C + (B << 21 | B >>> -21); h0 += A; h1 += B; h2 += C; h3 += D; } protected byte[] padBuffer() { int n = (int)(count % BLOCK_SIZE); int padding = (n < 56) ? (56 - n) : (120 - n); byte[] result = new byte[padding + 8]; // padding is always binary 1 followed by binary 0s result[0] = (byte) 0x80; // save number of bits, casting the long to an array of 8 bytes long bits = count << 3; result[padding++] = (byte) bits; result[padding++] = (byte)(bits >>> 8); result[padding++] = (byte)(bits >>> 16); result[padding++] = (byte)(bits >>> 24); result[padding++] = (byte)(bits >>> 32); result[padding++] = (byte)(bits >>> 40); result[padding++] = (byte)(bits >>> 48); result[padding ] = (byte)(bits >>> 56); return result; } protected byte[] getResult() { byte[] result = new byte[] { (byte) h0, (byte)(h0 >>> 8), (byte)(h0 >>> 16), (byte)(h0 >>> 24), (byte) h1, (byte)(h1 >>> 8), (byte)(h1 >>> 16), (byte)(h1 >>> 24), (byte) h2, (byte)(h2 >>> 8), (byte)(h2 >>> 16), (byte)(h2 >>> 24), (byte) h3, (byte)(h3 >>> 8), (byte)(h3 >>> 16), (byte)(h3 >>> 24) }; return result; } protected void resetContext() { // magic MD5/RIPEMD128 initialisation constants h0 = 0x67452301; h1 = 0xEFCDAB89; h2 = 0x98BADCFE; h3 = 0x10325476; } public boolean selfTest() { if (valid == null) { valid = new Boolean(DIGEST0.equals(Util.toString(new MD5().digest()))); } return valid.booleanValue(); } } |
From: <chr...@us...> - 2003-07-28 11:22:54
|
Update of /cvsroot/mrpostman/mrpostman/src/gnu/crypto In directory sc8-pr-cvs1:/tmp/cvs-serv20672/crypto Added Files: Registry.java Log Message: from gnu crypto project 1.1.0 --- NEW FILE: Registry.java --- package gnu.crypto; // ---------------------------------------------------------------------------- // $Id: Registry.java,v 1.1 2003/07/28 11:22:52 chris_humphreys Exp $ // // Copyright (C) 2001, 2002, Free Software Foundation, Inc. // // This file is part of GNU Crypto. // // GNU Crypto is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // // GNU Crypto is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; see the file COPYING. If not, write to the // // Free Software Foundation Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307 // USA // // Linking this library statically or dynamically with other modules is // making a combined work based on this library. Thus, the terms and // conditions of the GNU General Public License cover the whole // combination. // // As a special exception, the copyright holders of this library give // you permission to link this library with independent modules to // produce an executable, regardless of the license terms of these // independent modules, and to copy and distribute the resulting // executable under terms of your choice, provided that you also meet, // for each linked independent module, the terms and conditions of the // license of that module. An independent module is a module which is // not derived from or based on this library. If you modify this // library, you may extend this exception to your version of the // library, but you are not obligated to do so. If you do not wish to // do so, delete this exception statement from your version. // ---------------------------------------------------------------------------- /** * <p>A placeholder for <i>names</i> and <i>literals</i> used throughout this * library.</p> * * @version $Revision: 1.1 $ */ public interface Registry { // Constants // ------------------------------------------------------------------------- /** The name of our Provider. */ String GNU_CRYPTO = "GNU-CRYPTO"; // Names of properties to use in Maps when initialising primitives ......... // Symmetric block cipher algorithms and synonyms........................... String ANUBIS_CIPHER = "anubis"; String BLOWFISH_CIPHER = "blowfish"; String DES_CIPHER = "des"; String KHAZAD_CIPHER = "khazad"; String RIJNDAEL_CIPHER = "rijndael"; String SERPENT_CIPHER = "serpent"; // String SERPENT_BITSLICE_CIPHER = "serpent-bitslice"; String SQUARE_CIPHER = "square"; String TRIPLEDES_CIPHER = "tripledes"; String TWOFISH_CIPHER = "twofish"; String NULL_CIPHER = "null"; /** AES is synonymous to Rijndael for 128-bit block size only. */ String AES_CIPHER = "aes"; /** TripleDES is also known as DESede. */ String DESEDE_CIPHER = "desede"; // Message digest algorithms and synonyms................................... String WHIRLPOOL_HASH = "whirlpool"; String RIPEMD128_HASH = "ripemd128"; String RIPEMD160_HASH = "ripemd160"; String SHA160_HASH = "sha-160"; String MD5_HASH = "md5"; String MD4_HASH = "md4"; String MD2_HASH = "md2"; /** RIPEMD-128 is synonymous to RIPEMD128. */ String RIPEMD_128_HASH = "ripemd-128"; /** RIPEMD-160 is synonymous to RIPEMD160. */ String RIPEMD_160_HASH = "ripemd-160"; /** SHA-1 is synonymous to SHA-160. */ String SHA_1_HASH = "sha-1"; /** SHA1 is synonymous to SHA-160. */ String SHA1_HASH = "sha1"; /** SHA is synonymous to SHA-160. */ String SHA_HASH = "sha"; // Symmetric block cipher modes of operations............................... /** Electronic CodeBook mode. */ String ECB_MODE = "ecb"; /** Counter (NIST) mode. */ String CTR_MODE = "ctr"; /** Integer Counter Mode (David McGrew). */ String ICM_MODE = "icm"; /** Output Feedback Mode (NIST). */ String OFB_MODE = "ofb"; /** Cipher block chaining mode (NIST). */ String CBC_MODE = "cbc"; /** Cipher feedback mode (NIST). */ String CFB_MODE = "cfb"; // Padding scheme names and synonyms........................................ /** PKCS#7 padding scheme. */ String PKCS7_PAD = "pkcs7"; /** Trailing Bit Complement padding scheme. */ String TBC_PAD = "tbc"; // Pseudo-random number generators.......................................... /** (Apparently) RC4 keystream PRNG. */ String ARCFOUR_PRNG = "arcfour"; /** We use "rc4" as an alias for "arcfour". */ String RC4_PRNG = "rc4"; /** PRNG based on David McGrew's Integer Counter Mode. */ String ICM_PRNG = "icm"; /** PRNG based on a designated hash functiopn. */ String MD_PRNG = "md"; /** PRNG based on UMAC's Key Derivation Function. */ String UMAC_PRNG = "umac-kdf"; // Asymmetric keypair generators............................................ String DSS_KPG = "dss"; String RSA_KPG = "rsa"; /** DSA is synonymous to DSS. */ String DSA_KPG = "dsa"; // Signature-with-appendix schemes.......................................... String DSS_SIG = "dss"; String RSA_PSS_SIG = "rsa-pss"; /** DSA is synonymous to DSS. */ String DSA_SIG = "dsa"; // Keyed-Hash Message Authentication Code .................................. /** Name prefix of every HMAC implementation. */ String HMAC_NAME_PREFIX = "hmac-"; // Other MAC algorithms .................................................... /** Message Authentication Code using Universal Hashing (Ted Krovetz). */ String UHASH32 = "uhash32"; String UMAC32 = "umac32"; /** The Truncated Multi-Modular Hash Function -v1 (David McGrew). */ String TMMH16 = "tmmh16"; // String TMMH32 = "tmmh32"; // Format IDs used to identify how we externalise asymmetric keys .......... int RAW_ENCODING_ID = 1; // Magic bytes we generate/expect in externalised asymmetric keys .......... // the four bytes represent G (0x47) for GNU, 1 (0x01) for Raw format, // D (0x44) for DSS or R (0x52) for RSA, and finally P (0x50) for Public, // p (0x70) for private, or S (0x53) for signature. byte[] MAGIC_RAW_DSS_PUBLIC_KEY = new byte[] {0x47, RAW_ENCODING_ID, 0x44, 0x50}; byte[] MAGIC_RAW_DSS_PRIVATE_KEY = new byte[] {0x47, RAW_ENCODING_ID, 0x44, 0x70}; byte[] MAGIC_RAW_DSS_SIGNATURE = new byte[] {0x47, RAW_ENCODING_ID, 0x44, 0x53}; byte[] MAGIC_RAW_RSA_PUBLIC_KEY = new byte[] {0x47, RAW_ENCODING_ID, 0x52, 0x50}; byte[] MAGIC_RAW_RSA_PRIVATE_KEY = new byte[] {0x47, RAW_ENCODING_ID, 0x52, 0x70}; byte[] MAGIC_RAW_RSA_PSS_SIGNATURE = new byte[] {0x47, RAW_ENCODING_ID, 0x52, 0x53}; // Methods // ------------------------------------------------------------------------- } |
From: <chr...@us...> - 2003-07-28 11:21:06
|
Update of /cvsroot/mrpostman/mrpostman/src/gnu/crypto/util In directory sc8-pr-cvs1:/tmp/cvs-serv20425/util Log Message: Directory /cvsroot/mrpostman/mrpostman/src/gnu/crypto/util added to the repository |
From: <chr...@us...> - 2003-07-28 11:20:28
|
Update of /cvsroot/mrpostman/mrpostman/src/gnu/crypto/hash In directory sc8-pr-cvs1:/tmp/cvs-serv20286/hash Log Message: Directory /cvsroot/mrpostman/mrpostman/src/gnu/crypto/hash added to the repository |
From: <chr...@us...> - 2003-07-28 11:19:33
|
Update of /cvsroot/mrpostman/mrpostman/src/gnu/crypto In directory sc8-pr-cvs1:/tmp/cvs-serv20070/crypto Log Message: Directory /cvsroot/mrpostman/mrpostman/src/gnu/crypto added to the repository |
From: <chr...@us...> - 2003-07-28 11:19:13
|
Update of /cvsroot/mrpostman/mrpostman/src/gnu In directory sc8-pr-cvs1:/tmp/cvs-serv19995/gnu Log Message: Directory /cvsroot/mrpostman/mrpostman/src/gnu added to the repository |
From: <chr...@us...> - 2003-07-22 12:45:24
|
Update of /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/yahoo In directory sc8-pr-cvs1:/tmp/cvs-serv13079 Modified Files: YahooMailSession.java Log Message: yahoo.ca added Index: YahooMailSession.java =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/yahoo/YahooMailSession.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** YahooMailSession.java 8 May 2003 07:56:14 -0000 1.15 --- YahooMailSession.java 22 Jul 2003 12:45:18 -0000 1.16 *************** *** 666,670 **** public String[] getRecognizedExtensions() { ! String[] extensions = {"@yahoo.com", "@yahoo.com.au", "@yahoo.co.uk"}; return extensions; } --- 666,670 ---- public String[] getRecognizedExtensions() { ! String[] extensions = {"@yahoo.com", "@yahoo.com.au", "@yahoo.co.uk", "@yahoo.ca"}; return extensions; } |
From: <lb...@us...> - 2003-05-29 21:24:39
|
Update of /cvsroot/mrpostman/mrpostman In directory sc8-pr-cvs1:/tmp/cvs-serv22858 Modified Files: build.properties Log Message: Changed version Index: build.properties =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/build.properties,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** build.properties 29 May 2003 20:21:17 -0000 1.4 --- build.properties 29 May 2003 21:24:36 -0000 1.5 *************** *** 1,3 **** ! project.version=1.0.1 # Uncomment this property to prevent the use of checkstyle #checkstyle.notused=true --- 1,3 ---- ! project.version=0.1 # Uncomment this property to prevent the use of checkstyle #checkstyle.notused=true |
From: <lb...@us...> - 2003-05-29 20:21:24
|
Update of /cvsroot/mrpostman/mrpostman In directory sc8-pr-cvs1:/tmp/cvs-serv13744 Modified Files: build.properties Log Message: New version Index: build.properties =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/build.properties,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** build.properties 16 Apr 2003 18:27:43 -0000 1.3 --- build.properties 29 May 2003 20:21:17 -0000 1.4 *************** *** 1,3 **** ! project.version=1.0 final # Uncomment this property to prevent the use of checkstyle #checkstyle.notused=true --- 1,3 ---- ! project.version=1.0.1 # Uncomment this property to prevent the use of checkstyle #checkstyle.notused=true |
Update of /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/gui In directory sc8-pr-cvs1:/tmp/cvs-serv8687 Modified Files: MrPostmanGui.java messages.properties messages_de.properties messages_es.properties messages_fr.properties Log Message: HTTPS Proxy support Index: MrPostmanGui.java =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/gui/MrPostmanGui.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** MrPostmanGui.java 11 May 2003 13:57:51 -0000 1.20 --- MrPostmanGui.java 29 May 2003 10:54:35 -0000 1.21 *************** *** 97,100 **** --- 97,103 ---- private javax.swing.JTextField proxyAddr; private javax.swing.JTextField proxyPort; + private javax.swing.JCheckBox useHttpsProxy; + private javax.swing.JTextField httpsProxyAddr; + private javax.swing.JTextField httpsProxyPort; private javax.swing.JMenu jMenu1; *************** *** 200,203 **** --- 203,209 ---- proxyAddr = new javax.swing.JTextField(20); proxyPort = new javax.swing.JTextField(20); + useHttpsProxy = new javax.swing.JCheckBox(); + httpsProxyAddr = new javax.swing.JTextField(16); + httpsProxyPort = new javax.swing.JTextField(16); setTitle(MessageUtil.getMessage("application.title")); *************** *** 375,379 **** gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; proxyPanel.add(proxyPort, gridBagConstraints); ! jTabbedPane1.addTab(MessageUtil.getMessage("tab.proxy.title"), proxyPanel); --- 381,433 ---- gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; proxyPanel.add(proxyPort, gridBagConstraints); ! ! useHttpsProxy.setSelected((MrPostman.getMainInstance()).userprefs.getBoolean("UseHttpsProxy", false)); ! useHttpsProxy.setText(MessageUtil.getMessage("proxy.usehttpsproxy")); ! gridBagConstraints = new java.awt.GridBagConstraints(); ! gridBagConstraints.gridx = 0; ! gridBagConstraints.gridy = 3; ! gridBagConstraints.gridwidth = 2; ! gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; ! proxyPanel.add(useHttpsProxy, gridBagConstraints); ! useHttpsProxy.addItemListener(new java.awt.event.ItemListener() { ! public void itemStateChanged(java.awt.event.ItemEvent evt) { ! useHttpsProxyActionPerformed(evt); ! } ! }); ! ! gridBagConstraints = new java.awt.GridBagConstraints(); ! gridBagConstraints.gridx = 0; ! gridBagConstraints.gridy = 4; ! gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; ! tmplabel = new javax.swing.JLabel(); ! tmplabel.setText(MessageUtil.getMessage("proxy.addr")); ! tmplabel.setToolTipText(""); ! proxyPanel.add(tmplabel, gridBagConstraints); ! ! httpsProxyAddr.setText(MrPostman.getMainInstance().userprefs.get("httpsProxyAddr", "127.0.0.1")); ! gridBagConstraints = new java.awt.GridBagConstraints(); ! gridBagConstraints.gridx = 1; ! gridBagConstraints.gridy = 4; ! gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; ! gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; ! proxyPanel.add(httpsProxyAddr, gridBagConstraints); ! ! gridBagConstraints = new java.awt.GridBagConstraints(); ! gridBagConstraints.gridx = 0; ! gridBagConstraints.gridy = 5; ! gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; ! tmplabel = new javax.swing.JLabel(); ! tmplabel.setText(MessageUtil.getMessage("proxy.port")); ! tmplabel.setToolTipText(""); ! proxyPanel.add(tmplabel, gridBagConstraints); ! ! httpsProxyPort.setText(new Integer(MrPostman.getMainInstance().userprefs.getInt("httpsProxyPort", 8081)).toString()); ! gridBagConstraints = new java.awt.GridBagConstraints(); ! gridBagConstraints.gridx = 1; ! gridBagConstraints.gridy = 5; ! gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; ! gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; ! proxyPanel.add(httpsProxyPort, gridBagConstraints); ! jTabbedPane1.addTab(MessageUtil.getMessage("tab.proxy.title"), proxyPanel); *************** *** 582,585 **** --- 636,644 ---- MrPostman.getMainInstance().userprefs.put("proxyAddr", proxyAddr.getText()); MrPostman.getMainInstance().userprefs.put("proxyPort", proxyPort.getText()); + + MrPostman.getMainInstance().userprefs.putBoolean("useHttpsProxy", useHttpsProxy.isSelected()); + MrPostman.getMainInstance().userprefs.put("httpsProxyAddr", httpsProxyAddr.getText()); + MrPostman.getMainInstance().userprefs.put("httpsProxyPort", httpsProxyPort.getText()); + mpn.exit(); } *************** *** 611,614 **** --- 670,688 ---- } } + + private void useHttpsProxyActionPerformed(java.awt.event.ItemEvent evt) { + MrPostman.getMainInstance().userprefs.putBoolean("useHttpsProxy", useHttpsProxy.isSelected()); + MrPostman.getMainInstance().userprefs.put("httpsProxyAddr", httpsProxyAddr.getText()); + MrPostman.getMainInstance().userprefs.put("httpsProxyPort", httpsProxyPort.getText()); + Properties systemProperties = System.getProperties(); + if (evt.getStateChange() == evt.SELECTED) { + systemProperties.setProperty("https.proxyHost", httpsProxyAddr.getText()); + systemProperties.setProperty("https.proxyPort", httpsProxyPort.getText()); + } else { + systemProperties.remove("https.proxyHost"); + systemProperties.remove("https.proxyPort"); + } + } + //GEN-LAST:event_logButtonActionPerformed private void CloseGuiMenuItemActionPerformed(java.awt.event.ActionEvent evt) { //GEN-FIRST:event_CloseGuiMenuItemActionPerformed *************** *** 659,662 **** --- 733,741 ---- MrPostman.getMainInstance().userprefs.put("proxyAddr", proxyAddr.getText()); MrPostman.getMainInstance().userprefs.put("proxyPort", proxyPort.getText()); + + MrPostman.getMainInstance().userprefs.putBoolean("useHttpsProxy", useHttpsProxy.isSelected()); + MrPostman.getMainInstance().userprefs.put("httpsProxyAddr", httpsProxyAddr.getText()); + MrPostman.getMainInstance().userprefs.put("httpsProxyPort", httpsProxyPort.getText()); + mpn.exit(); } Index: messages.properties =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/gui/messages.properties,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** messages.properties 8 May 2003 07:57:37 -0000 1.8 --- messages.properties 29 May 2003 10:54:36 -0000 1.9 *************** *** 1,64 **** ! # The GUI messages for Mr Postman ! # Please do not hard code user visible strings in the java code! ! ! application.title=MrPostman ! application.help.title=MrPostman Help ! ! option.otherhosts=Allow other hosts to use MrPostman ! option.gui-startup=Run the GUI when program starts ! option.log-startup=Open Log window when program starts ! labels.serverport=Server Port : ! button.showlog=Show Log ! message.serverport.restartrequired=You must Restart MrPostman for this to take effect. ! ! proxy.useproxy=use Proxy Configuration: ! proxy.addr=address: ! proxy.port=port: ! proxy.user=user: ! proxy.password=password: ! ! tab.main.title=Main ! tab.modules.title=Modules ! tab.proxy.title=Proxy ! ! menu.file.title=File ! menu.file.item.close=Close GUI ! menu.file.item.exit=Exit ! ! menu.help.title=Help ! menu.help.item.using=Using MrPostman ! menu.help.item.about=About ! ! about.title=About ! about.info=@APPNAME@ @VERSION@\nBuild @DSTAMP@\n(C) 2003 The MrPostman Development Team\n\nHector Urtubia\nChris Humphreys\nLucas Bruand\nThomas O'Dowd\n\nLicensed under the terms of the GNU Public License\nVisit http://mrbook.org/mrpostman for updates\nand see how you can contribute ! ! using.title=Using MrPostman ! using.info=Please refer to the README file packaged on the executable JAR.\nFor more information, visit http://mrbook.org/mrpostman ! ! button.help.home=Help Home ! button.help.back=Back ! ! #module info panel messages... ! ! modules.info.version.label=Version : ! modules.info.authors.label=Author(s) : ! modules.info.options.label=Options : ! button.apply.label=Apply ! button.help.label=Help ! ! #Module option messages... ! ! modules.hotmail.option.unread.label=Unread Only ! modules.hotmail.option.unread.desc=Collect only Unread mail ! modules.hotmail.option.markread.label=Mark read ! modules.hotmail.option.markread.desc=Flag the collected messages as read ! ! modules.another.option.markread.label=Mark read ! modules.another.option.markread.desc=Flag the collected messages as read ! modules.another.option.debugpagehtml.label=Debug HTML ! modules.another.option.debugpagehtml.desc=Developer option - when selected logs web page html to log file ! modules.another.option.summary.label=Log Summary ! modules.another.option.summary.desc=Developer option - Writes a summary of mail collection to log file ! ! modules.yahoo.option.https.label=Use HTTPS ! modules.yahoo.option.https.desc=Use HTTPS rather than HTTP for signon --- 1,65 ---- ! # The GUI messages for Mr Postman ! # Please do not hard code user visible strings in the java code! ! ! application.title=MrPostman ! application.help.title=MrPostman Help ! ! option.otherhosts=Allow other hosts to use MrPostman ! option.gui-startup=Run the GUI when program starts ! option.log-startup=Open Log window when program starts ! labels.serverport=Server Port : ! button.showlog=Show Log ! message.serverport.restartrequired=You must Restart MrPostman for this to take effect. ! ! proxy.useproxy=use Proxy Configuration: ! proxy.usehttpsproxy=use HTTPS Proxy Configuration: ! proxy.addr=address: ! proxy.port=port: ! proxy.user=user: ! proxy.password=password: ! ! tab.main.title=Main ! tab.modules.title=Modules ! tab.proxy.title=Proxy ! ! menu.file.title=File ! menu.file.item.close=Close GUI ! menu.file.item.exit=Exit ! ! menu.help.title=Help ! menu.help.item.using=Using MrPostman ! menu.help.item.about=About ! ! about.title=About ! about.info=@APPNAME@ @VERSION@\nBuild @DSTAMP@\n(C) 2003 The MrPostman Development Team\n\nHector Urtubia\nChris Humphreys\nLucas Bruand\nThomas O'Dowd\n\nLicensed under the terms of the GNU Public License\nVisit http://mrbook.org/mrpostman for updates\nand see how you can contribute ! ! using.title=Using MrPostman ! using.info=Please refer to the README file packaged on the executable JAR.\nFor more information, visit http://mrbook.org/mrpostman ! ! button.help.home=Help Home ! button.help.back=Back ! ! #module info panel messages... ! ! modules.info.version.label=Version : ! modules.info.authors.label=Author(s) : ! modules.info.options.label=Options : ! button.apply.label=Apply ! button.help.label=Help ! ! #Module option messages... ! ! modules.hotmail.option.unread.label=Unread Only ! modules.hotmail.option.unread.desc=Collect only Unread mail ! modules.hotmail.option.markread.label=Mark read ! modules.hotmail.option.markread.desc=Flag the collected messages as read ! ! modules.another.option.markread.label=Mark read ! modules.another.option.markread.desc=Flag the collected messages as read ! modules.another.option.debugpagehtml.label=Debug HTML ! modules.another.option.debugpagehtml.desc=Developer option - when selected logs web page html to log file ! modules.another.option.summary.label=Log Summary ! modules.another.option.summary.desc=Developer option - Writes a summary of mail collection to log file ! ! modules.yahoo.option.https.label=Use HTTPS ! modules.yahoo.option.https.desc=Use HTTPS rather than HTTP for signon Index: messages_de.properties =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/gui/messages_de.properties,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** messages_de.properties 9 May 2003 19:31:56 -0000 1.1 --- messages_de.properties 29 May 2003 10:54:36 -0000 1.2 *************** *** 26,30 **** proxy.useproxy=Proxy verwenden: ! proxy.addr=Adresse: --- 26,30 ---- proxy.useproxy=Proxy verwenden: ! proxy.usehttpsproxy=HTTPS Proxy verwenden: proxy.addr=Adresse: Index: messages_es.properties =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/gui/messages_es.properties,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** messages_es.properties 8 May 2003 07:57:37 -0000 1.7 --- messages_es.properties 29 May 2003 10:54:36 -0000 1.8 *************** *** 1,65 **** ! # The GUI messages for Mr Postman ! # Please do not hard code user visible strings in the java code! ! ! application.title=MrPostman ! application.help.title=MrPostman Help ! ! option.otherhosts=Autorizar a otros para usar esta instancia de Mrpostman ! option.gui-startup=Mostrar la interfaz grafica al correr el programa ! option.log-startup=Abrir la ventana de mensajes al correr el programa ! labels.serverport=Puerto del Servidor: ! message.serverport.restartrequired=You must Restart MrPostman for this to take effect. ! ! button.showlog=Mostrar mensajes ! ! proxy.useproxy=use Proxy Configuration: ! proxy.addr=address: ! proxy.port=port: ! proxy.user=user: ! proxy.password=password: ! ! tab.main.title=Principal ! tab.modules.title=Modulos ! tab.proxy.title=Proxy ! ! menu.file.title=Archivo ! menu.file.item.close=Cerrar la ventana ! menu.file.item.exit=Salir ! ! menu.help.title=Ayuda ! menu.help.item.using=Usando MrPostman ! menu.help.item.about=Acerca del programa ! ! about.title=Acerca ! about.info=@APPNAME@ @VERSION@\nBuild @DSTAMP@\n(C) 2003 The MrPostman Development Team\nHector Urtubia\nChris Humphreys\nLucas Bruand\nThomas O'Dowd\nLicensiado bajo los terminos de la licensia GPL.\nVisite http://mrbook.org/mrpostman para actualizaciones\ny vea como ud. puede contribuir con el proyecto. ! ! using.title=Usando MrPostman ! using.info=Por favor vea el archivo README que viene empaquetado en el JAR ejecutable. Para mas informacion, visite http://mrbook.org/mrpostman ! ! button.help.home=Help Home ! button.help.back=Back ! ! #module info panel messages... ! ! modules.info.version.label=Version : ! modules.info.authors.label=Autor(es) : ! modules.info.options.label=Opciones : ! button.apply.label=Aplicar ! button.help.label=Help ! ! #Module option messages... ! ! modules.hotmail.option.unread.label=Unread Only ! modules.hotmail.option.unread.desc=Collect only Unread mail ! modules.hotmail.option.markread.label=Mark read ! modules.hotmail.option.markread.desc=Flag the collected messages as read ! ! modules.another.option.markread.label=Mark read ! modules.another.option.markread.desc=Flag the collected messages as read ! modules.another.option.debugpagehtml.label=Debug HTML ! modules.another.option.debugpagehtml.desc=Developer option - when selected logs web page html to log file ! modules.another.option.summary.label=Log Summary ! modules.another.option.summary.desc=Developer option - Writes a summary of mail collection to log file ! ! modules.yahoo.option.https.label=Use HTTPS ! modules.yahoo.option.https.desc=Use HTTPS rather than HTTP for signon --- 1,66 ---- ! # The GUI messages for Mr Postman ! # Please do not hard code user visible strings in the java code! ! ! application.title=MrPostman ! application.help.title=MrPostman Help ! ! option.otherhosts=Autorizar a otros para usar esta instancia de Mrpostman ! option.gui-startup=Mostrar la interfaz grafica al correr el programa ! option.log-startup=Abrir la ventana de mensajes al correr el programa ! labels.serverport=Puerto del Servidor: ! message.serverport.restartrequired=You must Restart MrPostman for this to take effect. ! ! button.showlog=Mostrar mensajes ! ! proxy.useproxy=use Proxy Configuration: ! proxy.usehttpsproxy=use HTTPS Proxy Configuration: ! proxy.addr=address: ! proxy.port=port: ! proxy.user=user: ! proxy.password=password: ! ! tab.main.title=Principal ! tab.modules.title=Modulos ! tab.proxy.title=Proxy ! ! menu.file.title=Archivo ! menu.file.item.close=Cerrar la ventana ! menu.file.item.exit=Salir ! ! menu.help.title=Ayuda ! menu.help.item.using=Usando MrPostman ! menu.help.item.about=Acerca del programa ! ! about.title=Acerca ! about.info=@APPNAME@ @VERSION@\nBuild @DSTAMP@\n(C) 2003 The MrPostman Development Team\nHector Urtubia\nChris Humphreys\nLucas Bruand\nThomas O'Dowd\nLicensiado bajo los terminos de la licensia GPL.\nVisite http://mrbook.org/mrpostman para actualizaciones\ny vea como ud. puede contribuir con el proyecto. ! ! using.title=Usando MrPostman ! using.info=Por favor vea el archivo README que viene empaquetado en el JAR ejecutable. Para mas informacion, visite http://mrbook.org/mrpostman ! ! button.help.home=Help Home ! button.help.back=Back ! ! #module info panel messages... ! ! modules.info.version.label=Version : ! modules.info.authors.label=Autor(es) : ! modules.info.options.label=Opciones : ! button.apply.label=Aplicar ! button.help.label=Help ! ! #Module option messages... ! ! modules.hotmail.option.unread.label=Unread Only ! modules.hotmail.option.unread.desc=Collect only Unread mail ! modules.hotmail.option.markread.label=Mark read ! modules.hotmail.option.markread.desc=Flag the collected messages as read ! ! modules.another.option.markread.label=Mark read ! modules.another.option.markread.desc=Flag the collected messages as read ! modules.another.option.debugpagehtml.label=Debug HTML ! modules.another.option.debugpagehtml.desc=Developer option - when selected logs web page html to log file ! modules.another.option.summary.label=Log Summary ! modules.another.option.summary.desc=Developer option - Writes a summary of mail collection to log file ! ! modules.yahoo.option.https.label=Use HTTPS ! modules.yahoo.option.https.desc=Use HTTPS rather than HTTP for signon Index: messages_fr.properties =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/gui/messages_fr.properties,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** messages_fr.properties 8 May 2003 08:39:26 -0000 1.13 --- messages_fr.properties 29 May 2003 10:54:36 -0000 1.14 *************** *** 32,35 **** --- 32,36 ---- proxy.useproxy=utiliser la configuration proxy: + proxy.usehttpsproxy=utiliser la configuration proxy HTTPS: proxy.addr=adresse: |
From: <lb...@us...> - 2003-05-11 14:28:02
|
Update of /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/maildotcom In directory sc8-pr-cvs1:/tmp/cvs-serv23116/src/org/mrbook/mrpostman/maildotcom Modified Files: MailDotComMailSession.java Log Message: Changed the logs so that I can understand reproduce [ 728283 ] Error in from: fields with mail.com module / by Pancho Villa Index: MailDotComMailSession.java =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/maildotcom/MailDotComMailSession.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** MailDotComMailSession.java 4 May 2003 22:28:52 -0000 1.25 --- MailDotComMailSession.java 11 May 2003 14:27:58 -0000 1.26 *************** *** 433,448 **** if (match.find()) { ! logger.fine("Found header: " + match.group(1)); pw.print(match.group(1)); line = br.readLine(); ! pw.print(unescape(line.substring(0, line.length() - 4))); pw.print("\r\n"); } else { match = bbfieldpattern.matcher(line); if (match.find()) { ! logger.fine("found header group:" + match.group(1)); pw.print(match.group(1)); pw.print(unescape(match.group(2))); pw.print("\r\n"); } --- 433,452 ---- if (match.find()) { ! pw.print(match.group(1)); line = br.readLine(); ! logger.finest("html: " + line); ! line = unescape(line.substring(0, line.length() - 4)); ! pw.print(line); pw.print("\r\n"); + logger.fine("Found header: " + match.group(1) + " = " + line); } else { match = bbfieldpattern.matcher(line); if (match.find()) { ! pw.print(match.group(1)); pw.print(unescape(match.group(2))); + logger.fine("found header group:" + match.group(1) + " " + unescape(match.group(2))); pw.print("\r\n"); } |
From: <lb...@us...> - 2003-05-11 13:57:54
|
Update of /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/gui In directory sc8-pr-cvs1:/tmp/cvs-serv13569/src/org/mrbook/mrpostman/gui Modified Files: MrPostmanGui.java Log Message: Added a few new features for Mac OS X ( See [ 729085 ] Mac OS X Oddities / Ben Engber Bug) Index: MrPostmanGui.java =================================================================== RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/gui/MrPostmanGui.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** MrPostmanGui.java 7 May 2003 13:17:33 -0000 1.19 --- MrPostmanGui.java 11 May 2003 13:57:51 -0000 1.20 *************** *** 1,665 **** ! /* ! * -*- mode: java; c-basic-indent: 4; indent-tabs-mode: nil -*- ! * :indentSize=4:noTabs=true:tabSize=4:indentOnTab=true:indentOnEnter=true:mode=java: ! * ex: set tabstop=4 expandtab: ! * ! * MrPostman - webmail <-> email gateway ! * Copyright (C) 2002-2003 MrPostman Development Group ! * Projectpage: http://mrbook.org/mrpostman/ ! * ! * [...1310 lines suppressed...] ! ! /** Exit the Application */ ! private void exitForm(java.awt.event.WindowEvent evt) { //GEN-FIRST:event_exitForm ! MrPostman.getMainInstance().userprefs.putBoolean("useProxy", useProxy.isSelected()); ! MrPostman.getMainInstance().userprefs.put("proxyAddr", proxyAddr.getText()); ! MrPostman.getMainInstance().userprefs.put("proxyPort", proxyPort.getText()); ! mpn.exit(); ! } ! ! //GEN-LAST:event_exitForm ! ! /** ! * @param args the command line arguments ! */ ! public static void main(String[] args) { ! new MrPostmanGui(null).show(); ! } ! // End of variables declaration//GEN-END:variables ! } ! |