You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(119) |
Oct
(111) |
Nov
(238) |
Dec
(395) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(239) |
Feb
(59) |
Mar
(354) |
Apr
(489) |
May
(23) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
(5) |
Jun
(2) |
Jul
|
Aug
|
Sep
(3) |
Oct
(14) |
Nov
(17) |
Dec
(9) |
| 2007 |
Jan
(4) |
Feb
(3) |
Mar
|
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
(1) |
Oct
(2) |
Nov
(1) |
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(7) |
May
(3) |
Jun
(6) |
Jul
(4) |
Aug
(3) |
Sep
(15) |
Oct
(13) |
Nov
(35) |
Dec
(40) |
| 2009 |
Jan
(19) |
Feb
(21) |
Mar
(16) |
Apr
(18) |
May
(36) |
Jun
(20) |
Jul
(32) |
Aug
(11) |
Sep
(3) |
Oct
(2) |
Nov
(2) |
Dec
(13) |
| 2010 |
Jan
(5) |
Feb
(5) |
Mar
(7) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
(4) |
Nov
|
Dec
(3) |
| 2012 |
Jan
(3) |
Feb
(3) |
Mar
(1) |
Apr
(4) |
May
(8) |
Jun
(4) |
Jul
(9) |
Aug
(2) |
Sep
(8) |
Oct
(3) |
Nov
(8) |
Dec
(4) |
| 2013 |
Jan
(2) |
Feb
(1) |
Mar
(5) |
Apr
(6) |
May
(10) |
Jun
(5) |
Jul
(6) |
Aug
(7) |
Sep
(5) |
Oct
(2) |
Nov
(4) |
Dec
(4) |
| 2014 |
Jan
(13) |
Feb
(4) |
Mar
(7) |
Apr
(9) |
May
(20) |
Jun
(13) |
Jul
(10) |
Aug
(3) |
Sep
(5) |
Oct
(2) |
Nov
(2) |
Dec
(2) |
| 2015 |
Jan
(3) |
Feb
(3) |
Mar
(5) |
Apr
(4) |
May
(3) |
Jun
(2) |
Jul
(4) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(3) |
| 2016 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(4) |
Sep
(3) |
Oct
(3) |
Nov
(4) |
Dec
(2) |
| 2017 |
Jan
|
Feb
(2) |
Mar
|
Apr
(2) |
May
(1) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Update of /cvsroot/neuclear/neuclear-pay/src/test/org/neuclear/asset/controllers/currency In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11839/src/test/org/neuclear/asset/controllers/currency Modified Files: CurrencyTests.java Added Files: HibernateCurrencyTests.java PrevalentCurrencyTests.java Removed Files: PersistentCurrencyTests.java Log Message: Added Hibernate and Prevalent tests for Currency Controllers Index: CurrencyTests.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-pay/src/test/org/neuclear/asset/controllers/currency/CurrencyTests.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** CurrencyTests.java 6 Apr 2004 23:01:01 -0000 1.10 --- CurrencyTests.java 12 Apr 2004 15:27:52 -0000 1.11 *************** *** 28,31 **** --- 28,32 ---- import org.neuclear.tests.AbstractSigningTest; + import java.io.IOException; import java.security.GeneralSecurityException; import java.util.Date; *************** *** 37,55 **** */ public class CurrencyTests extends AbstractSigningTest { - public CurrencyTests(final String s) throws GeneralSecurityException, LowlevelLedgerException, NeuClearException { - this(s, new SimpleLedger("asset"), new SimpleLedger("test")); - } ! public CurrencyTests(final String s, final Ledger assetLedger, final Ledger auditLedger) throws LowlevelLedgerException, GeneralSecurityException, NeuClearException { super(s); asset = createTestAsset(); shoes = createShoeAsset(); agent = createTestExchangeAgent(); ! ledger = assetLedger; proc = new CurrencyController(ledger, asset, getSigner(), "neu://test/bux"); - this.auditLedger = auditLedger; auditor = new Auditor(asset, auditLedger); } public void testTransfer() throws InvalidTransferException, NeuClearException, InvalidTransactionException, LowlevelLedgerException { fundAccount(); --- 38,81 ---- */ public class CurrencyTests extends AbstractSigningTest { ! public CurrencyTests(final String s) throws LowlevelLedgerException, GeneralSecurityException, NeuClearException { super(s); asset = createTestAsset(); shoes = createShoeAsset(); agent = createTestExchangeAgent(); ! } ! ! /** ! * Sets up the fixture, for example, open a network connection. ! * This method is called before a test is executed. ! */ ! protected void setUp() throws Exception { ! ledger = createControllerLedger(); ! auditLedger = createAuditLedger(); proc = new CurrencyController(ledger, asset, getSigner(), "neu://test/bux"); auditor = new Auditor(asset, auditLedger); } + protected Ledger createControllerLedger() throws IOException, ClassNotFoundException, LowlevelLedgerException { + return new SimpleLedger("asset"); + } + + protected Ledger createAuditLedger() { + return new SimpleLedger("audit"); + } + + /** + * Tears down the fixture, for example, close a network connection. + * This method is called after a test is executed. + */ + protected void tearDown() throws Exception { + proc = null; + auditor = null; + ledger.close(); + auditLedger.close(); + ledger = null; + auditLedger = null; + } + public void testTransfer() throws InvalidTransferException, NeuClearException, InvalidTransactionException, LowlevelLedgerException { fundAccount(); --- NEW FILE: PrevalentCurrencyTests.java --- package org.neuclear.asset.controllers.currency; import org.neuclear.commons.NeuClearException; import org.neuclear.ledger.Ledger; import org.neuclear.ledger.LowlevelLedgerException; import org.neuclear.ledger.prevalent.PrevalentLedger; import java.io.IOException; import java.security.GeneralSecurityException; /* NeuClear Distributed Transaction Clearing Platform (C) 2003 Pelle Braendgaard This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: PrevalentCurrencyTests.java,v 1.1 2004/04/12 15:27:52 pelle Exp $ $Log: PrevalentCurrencyTests.java,v $ Revision 1.1 2004/04/12 15:27:52 pelle Added Hibernate and Prevalent tests for Currency Controllers Revision 1.1 2004/04/06 23:01:01 pelle Create new PrevalentCurrencyTests TestCase for doing integration testing with various persistent ledgers. */ /** * User: pelleb * Date: Apr 6, 2004 * Time: 8:11:02 PM */ public class PrevalentCurrencyTests extends CurrencyTests { public PrevalentCurrencyTests(String s) throws GeneralSecurityException, LowlevelLedgerException, NeuClearException, IOException, ClassNotFoundException { super(s); } protected Ledger createControllerLedger() throws IOException, ClassNotFoundException { return new PrevalentLedger("asset", "target/test-data/pl"); } } --- PersistentCurrencyTests.java DELETED --- --- NEW FILE: HibernateCurrencyTests.java --- package org.neuclear.asset.controllers.currency; import org.neuclear.commons.NeuClearException; import org.neuclear.ledger.Ledger; import org.neuclear.ledger.LowlevelLedgerException; import org.neuclear.ledger.hibernate.HibernateLedger; import java.io.IOException; import java.security.GeneralSecurityException; /* NeuClear Distributed Transaction Clearing Platform (C) 2003 Pelle Braendgaard This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: HibernateCurrencyTests.java,v 1.1 2004/04/12 15:27:52 pelle Exp $ $Log: HibernateCurrencyTests.java,v $ Revision 1.1 2004/04/12 15:27:52 pelle Added Hibernate and Prevalent tests for Currency Controllers Revision 1.1 2004/04/06 23:01:01 pelle Create new PrevalentCurrencyTests TestCase for doing integration testing with various persistent ledgers. */ /** * User: pelleb * Date: Apr 6, 2004 * Time: 8:11:02 PM */ public class HibernateCurrencyTests extends CurrencyTests { public HibernateCurrencyTests(String s) throws GeneralSecurityException, LowlevelLedgerException, NeuClearException, IOException, ClassNotFoundException { super(s); } protected Ledger createControllerLedger() throws IOException, ClassNotFoundException, LowlevelLedgerException { return new HibernateLedger("test"); } } |
|
From: Pelle B. <pe...@us...> - 2004-04-12 15:14:48
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/signers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6848/src/java/org/neuclear/id/signers Modified Files: SigningServlet.java Log Message: Now have a slightly better way of handling the waiting for input using the WaitForInput class. This will later be put into a command queue for execution. Index: SigningServlet.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/signers/SigningServlet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SigningServlet.java 22 Mar 2004 20:09:47 -0000 1.3 --- SigningServlet.java 12 Apr 2004 15:00:54 -0000 1.4 *************** *** 2,5 **** --- 2,9 ---- * $Id$ * $Log$ + * Revision 1.4 2004/04/12 15:00:54 pelle + * Now have a slightly better way of handling the waiting for input using the WaitForInput class. + * This will later be put into a command queue for execution. + * * Revision 1.3 2004/03/22 20:09:47 pelle * Added simple ledger for unit testing and in memory use *************** *** 339,349 **** final String endpoint = request.getParameter("endpoint"); final Builder named = sigreq.getUnsigned(); ! final String username = sigreq.getUserid(); boolean isSigned = false; ! if (!signer.canSignFor(username)) { ! out.println("<h3>Can not Sign for:"); ! out.println(username); ! out.println("</h3>"); ! } out.println("<table bgcolor=\"#708070\"><tr><td><h4 style=\"color: white\">"); if (isSigned) --- 343,353 ---- final String endpoint = request.getParameter("endpoint"); final Builder named = sigreq.getUnsigned(); ! // final String username = sigreq.getUserid(); boolean isSigned = false; ! // if (!signer.canSignFor(username)) { ! // out.println("<h3>Can not Sign for:"); ! // out.println(username); ! // out.println("</h3>"); ! // } out.println("<table bgcolor=\"#708070\"><tr><td><h4 style=\"color: white\">"); if (isSigned) *************** *** 370,374 **** out.flush(); try { ! isSigned = sign(named, username, out); } catch (InvalidNamedObjectException e) { --- 374,378 ---- out.flush(); try { ! isSigned = sign(named, out); } catch (InvalidNamedObjectException e) { |
|
From: Pelle B. <pe...@us...> - 2004-04-12 15:14:44
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6848/src/java/org/neuclear/id/builders Modified Files: Builder.java Log Message: Now have a slightly better way of handling the waiting for input using the WaitForInput class. This will later be put into a command queue for execution. Index: Builder.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/builders/Builder.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Builder.java 3 Mar 2004 23:26:42 -0000 1.6 --- Builder.java 12 Apr 2004 15:00:54 -0000 1.7 *************** *** 3,6 **** --- 3,7 ---- import org.dom4j.*; import org.neuclear.commons.crypto.passphraseagents.UserCancellationException; + import org.neuclear.commons.crypto.signers.BrowsableSigner; import org.neuclear.commons.crypto.signers.NonExistingSignerException; import org.neuclear.commons.crypto.signers.Signer; *************** *** 8,12 **** import org.neuclear.id.InvalidNamedObjectException; import org.neuclear.id.NSTools; - import org.neuclear.id.NameResolutionException; import org.neuclear.id.SignedNamedObject; import org.neuclear.id.verifier.VerifyingReader; --- 9,12 ---- *************** *** 34,43 **** public Builder(final Element elem) throws XMLSecurityException { super(elem); ! createDocument(); } ! final public SignedNamedObject convert() throws InvalidNamedObjectException{ return VerifyingReader.getInstance().read(getElement()); } private void createDocument() { final Element elem = getElement(); --- 34,45 ---- public Builder(final Element elem) throws XMLSecurityException { super(elem); ! createDocument(); ! } ! final public SignedNamedObject convert() throws InvalidNamedObjectException { return VerifyingReader.getInstance().read(getElement()); } + private void createDocument() { final Element elem = getElement(); *************** *** 46,49 **** --- 48,52 ---- } } + /** * Sign NamedObject using given PrivateKey. This also adds a timestamp to the root element prior to signing *************** *** 53,57 **** getElement().addAttribute(DocumentHelper.createQName("timestamp", NSTools.NS_NEUID), TimeTools.createTimeStamp()); } ! public Object clone() { try { final Element elem = (Element) getElement().clone(); --- 56,61 ---- getElement().addAttribute(DocumentHelper.createQName("timestamp", NSTools.NS_NEUID), TimeTools.createTimeStamp()); } ! ! public Object clone() { try { final Element elem = (Element) getElement().clone(); *************** *** 63,75 **** } ! public final SignedNamedObject convert(String name,Signer signer) throws InvalidNamedObjectException { try { ! sign(name,signer); } catch (XMLSecurityException e) { ! throw new InvalidNamedObjectException("Problem in XML Sig",e); } catch (NonExistingSignerException e) { ! throw new InvalidNamedObjectException("Can not Sign with "+name,e); } catch (UserCancellationException e) { ! throw new InvalidNamedObjectException("User Cancelled Signing",e); } return convert(); --- 67,90 ---- } ! public final SignedNamedObject convert(String name, Signer signer) throws InvalidNamedObjectException { try { ! sign(name, signer); } catch (XMLSecurityException e) { ! throw new InvalidNamedObjectException("Problem in XML Sig", e); } catch (NonExistingSignerException e) { ! throw new InvalidNamedObjectException("Can not Sign with " + name, e); } catch (UserCancellationException e) { ! throw new InvalidNamedObjectException("User Cancelled Signing", e); ! } ! return convert(); ! } ! ! public final SignedNamedObject convert(BrowsableSigner signer) throws InvalidNamedObjectException { ! try { ! sign(signer); ! } catch (XMLSecurityException e) { ! throw new InvalidNamedObjectException("Problem in XML Sig", e); ! } catch (UserCancellationException e) { ! throw new InvalidNamedObjectException("User Cancelled Signing", e); } return convert(); |
|
From: Pelle B. <pe...@us...> - 2004-04-12 15:14:33
|
Update of /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6806/src/java/org/neuclear/xml/xmlsec Modified Files: EnvelopedSignature.java SignedElement.java SignedInfo.java XMLSignature.java Log Message: Now have a slightly better way of handling the waiting for input using the WaitForInput class. This will later be put into a command queue for execution. Index: EnvelopedSignature.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/EnvelopedSignature.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EnvelopedSignature.java 7 Apr 2004 17:22:22 -0000 1.3 --- EnvelopedSignature.java 12 Apr 2004 15:00:42 -0000 1.4 *************** *** 53,61 **** * @param elem * @throws XMLSecurityException ! * @throws UserCancellationException ! * @throws NonExistingSignerException * @see Signer */ ! public EnvelopedSignature(BrowsableSigner signer, Element elem) throws XMLSecurityException, UserCancellationException, NonExistingSignerException { super(new SignedInfo(SignedInfo.SIG_ALG_RSA, 1)); si.setEnvelopedReference(elem); --- 53,60 ---- * @param elem * @throws XMLSecurityException ! * @throws UserCancellationException * @see Signer */ ! public EnvelopedSignature(BrowsableSigner signer, Element elem) throws XMLSecurityException, UserCancellationException { super(new SignedInfo(SignedInfo.SIG_ALG_RSA, 1)); si.setEnvelopedReference(elem); Index: SignedElement.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/SignedElement.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** SignedElement.java 19 Mar 2004 22:21:51 -0000 1.12 --- SignedElement.java 12 Apr 2004 15:00:42 -0000 1.13 *************** *** 1,4 **** --- 1,8 ---- /* $Id$ * $Log$ + * Revision 1.13 2004/04/12 15:00:42 pelle + * Now have a slightly better way of handling the waiting for input using the WaitForInput class. + * This will later be put into a command queue for execution. + * * Revision 1.12 2004/03/19 22:21:51 pelle * Changes in the XMLSignature class, which is now Abstract there are currently 3 implementations for: *************** *** 157,160 **** --- 161,165 ---- import org.dom4j.QName; import org.neuclear.commons.crypto.passphraseagents.UserCancellationException; + import org.neuclear.commons.crypto.signers.BrowsableSigner; import org.neuclear.commons.crypto.signers.NonExistingSignerException; import org.neuclear.commons.crypto.signers.Signer; *************** *** 245,247 **** --- 250,258 ---- } + public final void sign(final BrowsableSigner signer) throws XMLSecurityException, UserCancellationException { + preSign(); + sig = new EnvelopedSignature(signer, getElement()); + postSign(); + } + } Index: SignedInfo.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/SignedInfo.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SignedInfo.java 7 Apr 2004 17:22:22 -0000 1.8 --- SignedInfo.java 12 Apr 2004 15:00:42 -0000 1.9 *************** *** 1,4 **** --- 1,8 ---- /* $Id$ * $Log$ + * Revision 1.9 2004/04/12 15:00:42 pelle + * Now have a slightly better way of handling the waiting for input using the WaitForInput class. + * This will later be put into a command queue for execution. + * * Revision 1.8 2004/04/07 17:22:22 pelle * Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. *************** *** 307,311 **** } ! public final byte[] sign(BrowsableSigner signer, KeyInfo.CreateKeyInfoCallBack cb) throws XMLSecurityException, NonExistingSignerException, UserCancellationException { return signer.sign(canonicalize(), cb); } --- 311,315 ---- } ! public final byte[] sign(BrowsableSigner signer, KeyInfo.CreateKeyInfoCallBack cb) throws XMLSecurityException, UserCancellationException { return signer.sign(canonicalize(), cb); } Index: XMLSignature.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/XMLSignature.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** XMLSignature.java 7 Apr 2004 17:22:22 -0000 1.20 --- XMLSignature.java 12 Apr 2004 15:00:42 -0000 1.21 *************** *** 1,4 **** --- 1,8 ---- /* $Id$ * $Log$ + * Revision 1.21 2004/04/12 15:00:42 pelle + * Now have a slightly better way of handling the waiting for input using the WaitForInput class. + * This will later be put into a command queue for execution. + * * Revision 1.20 2004/04/07 17:22:22 pelle * Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. *************** *** 368,372 **** * * @param alias ! * @param signer * @throws XMLSecurityException * @throws NonExistingSignerException --- 372,376 ---- * * @param alias ! * @param signer * @throws XMLSecurityException * @throws NonExistingSignerException *************** *** 377,381 **** } ! protected void sign(BrowsableSigner signer) throws XMLSecurityException, NonExistingSignerException, UserCancellationException { KeyInfo.CreateKeyInfoCallBack cb = new KeyInfo.CreateKeyInfoCallBack(); sigval.setText(Base64.encode(si.sign(signer, cb))); --- 381,385 ---- } ! protected void sign(BrowsableSigner signer) throws XMLSecurityException, UserCancellationException { KeyInfo.CreateKeyInfoCallBack cb = new KeyInfo.CreateKeyInfoCallBack(); sigval.setText(Base64.encode(si.sign(signer, cb))); |
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6720/src/java/org/neuclear/commons/crypto/passphraseagents/swing Modified Files: NewAliasDialog.java SimpleDialog.java SwingAgent.java Added Files: KeyStoreDialog.java WaitForInput.java Log Message: Now have a slightly better way of handling the waiting for input using the WaitForInput class. This will later be put into a command queue for execution. --- NEW FILE: KeyStoreDialog.java --- package org.neuclear.commons.crypto.passphraseagents.swing; import com.jgoodies.forms.builder.ButtonBarBuilder; import com.jgoodies.forms.builder.PanelBuilder; import com.jgoodies.forms.layout.CellConstraints; import com.jgoodies.forms.layout.FormLayout; import com.jgoodies.plaf.Options; import org.neuclear.commons.crypto.signers.BrowsableSigner; import org.neuclear.commons.crypto.signers.InvalidPassphraseException; import org.neuclear.commons.crypto.signers.SetPublicKeyCallBack; import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.net.URL; import java.security.KeyStoreException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Vector; /* $Id: KeyStoreDialog.java,v 1.1 2004/04/12 15:00:29 pelle Exp $ $Log: KeyStoreDialog.java,v $ Revision 1.1 2004/04/12 15:00:29 pelle Now have a slightly better way of handling the waiting for input using the WaitForInput class. This will later be put into a command queue for execution. Revision 1.2 2004/04/09 22:56:44 pelle SwingAgent now manages key creation as well through the NewAliasDialog. Many small uservalidation features have also been added. Revision 1.1 2004/04/07 17:22:08 pelle Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. The XMLSig classes have also been updated to support this. */ /** * User: pelleb * Date: Apr 7, 2004 * Time: 9:55:37 AM */ public class KeyStoreDialog { public KeyStoreDialog() { try { UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"); UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE); } catch (Exception e) { // Likely PlasticXP is not in the class path; ignore. } cache = new HashMap(); sign = new JButton("Sign"); sign.setEnabled(false); cancel = new JButton("Cancel"); newId = new JButton("New ..."); list = new JList(new String[]{"bob", "carol", "alice"}); list.setBorder(BorderFactory.createLoweredBevelBorder()); passphrase = new JPasswordField(); final URL imageurl = this.getClass().getClassLoader().getResource("org/neuclear/commons/crypto/passphraseagents/neuclear.png"); if (imageurl != null) icon = new JLabel(new ImageIcon(imageurl)); else icon = new JLabel("NeuClear"); dialog = new JDialog(); dialog.setTitle("NeuClear Signing Agent"); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.getContentPane().add(buildPanel()); dialog.pack(); nad = new NewAliasDialog(this); cancel.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent actionEvent) { synchronized (passphrase) { passphrase.setText(""); dialog.hide(); runner.cancel(); } } }); final ActionListener action = new ActionListener() { public void actionPerformed(final ActionEvent actionEvent) { synchronized (passphrase) { if (validate()) { runner.execute(); } } } }; sign.addActionListener(action); passphrase.addActionListener(action); final KeyListener validate = new KeyListener() { public void keyPressed(KeyEvent e) { } public void keyReleased(KeyEvent e) { sign.setEnabled(validate()); } public void keyTyped(KeyEvent e) { } }; passphrase.addKeyListener(validate); list.addListSelectionListener(new ListSelectionListener() { /** * Called whenever the value of the selection changes. * * @param e the event that characterizes the change. */ public void valueChanged(ListSelectionEvent e) { sign.setEnabled(validate()); } }); newId.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent actionEvent) { SwingUtilities.invokeLater(nad); } }); // dialog.show(); } void updateList(String alias) { if (alias != null) { fillAliasList(); list.setSelectedValue(alias, true); dialog.pack(); } } private Component buildPanel() { FormLayout layout = new FormLayout("right:pref, 3dlu, pref:grow ", "pref,3dlu,pref, 3dlu, fill:pref:grow, 3dlu, pref, 7dlu, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); builder.setDefaultDialogBorder(); builder.add(icon, cc.xyw(1, 5, 1, CellConstraints.LEFT, CellConstraints.TOP)); builder.addSeparator("Identities", cc.xyw(1, 3, 3)); builder.add(list, cc.xyw(3, 5, 1)); builder.addLabel("Passphrase:", cc.xy(1, 7)); builder.add(passphrase, cc.xy(3, 7)); ButtonBarBuilder bb = new ButtonBarBuilder(); bb.addGridded(newId); bb.addGlue(); bb.addUnrelatedGap(); bb.addGridded(sign); bb.addGridded(cancel); builder.add(bb.getPanel(), cc.xyw(1, 9, 3)); return builder.getPanel(); } private void fillAliasList() { try { Iterator iter = signer.iterator(); Vector vector = new Vector(); while (iter.hasNext()) { Object o = iter.next(); vector.add(o); } list.setListData(vector); } catch (KeyStoreException e) { e.printStackTrace(); } } BrowsableSigner getSigner() { return signer; } JDialog getDialog() { return dialog; } private boolean validate() { return (list.getSelectedIndex() > 0 && passphrase.getPassword().length > 0); } WaitForInput createSigningTask(BrowsableSigner bs, byte data[], SetPublicKeyCallBack cb) { return new DialogRunner(bs, data, cb); } private BrowsableSigner signer; private final JButton sign; private final JButton cancel; private final JButton newId; private final JList list; private final JPasswordField passphrase; private final JDialog dialog; private final NewAliasDialog nad; private final Map cache; private final JLabel icon; private DialogRunner runner; class DialogRunner extends WaitForInput { public DialogRunner(BrowsableSigner bs, byte data[], SetPublicKeyCallBack cb) { this.data = data; this.cb = cb; this.bs = bs; } public void run() { runner = this; signer = bs; fillAliasList(); passphrase.setText(""); dialog.pack(); dialog.show(); sign.setEnabled(false); } public void execute() { dialog.hide(); char phrase[] = passphrase.getPassword(); passphrase.setText(""); try { //Todo handle when an alias hasnt been selected setResult(signer.sign(list.getSelectedValue().toString(), phrase, data, cb)); } catch (InvalidPassphraseException e) { run(); } } private final byte data[]; private final SetPublicKeyCallBack cb; private final BrowsableSigner bs; } } Index: SwingAgent.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/swing/SwingAgent.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SwingAgent.java 9 Apr 2004 22:56:44 -0000 1.2 --- SwingAgent.java 12 Apr 2004 15:00:29 -0000 1.3 *************** *** 1,8 **** package org.neuclear.commons.crypto.passphraseagents.swing; - import com.jgoodies.forms.builder.ButtonBarBuilder; - import com.jgoodies.forms.builder.PanelBuilder; - import com.jgoodies.forms.layout.CellConstraints; - import com.jgoodies.forms.layout.FormLayout; import com.jgoodies.plaf.Options; import org.neuclear.commons.crypto.Base64; --- 1,4 ---- *************** *** 15,36 **** import javax.swing.*; - import javax.swing.event.ListSelectionEvent; - import javax.swing.event.ListSelectionListener; - import java.awt.*; - import java.awt.event.ActionEvent; - import java.awt.event.ActionListener; - import java.awt.event.KeyEvent; - import java.awt.event.KeyListener; - import java.net.URL; - import java.security.KeyStoreException; import java.security.PublicKey; import java.util.HashMap; - import java.util.Iterator; import java.util.Map; - import java.util.Vector; /* $Id$ $Log$ Revision 1.2 2004/04/09 22:56:44 pelle SwingAgent now manages key creation as well through the NewAliasDialog. --- 11,25 ---- import javax.swing.*; import java.security.PublicKey; import java.util.HashMap; import java.util.Map; /* $Id$ $Log$ + Revision 1.3 2004/04/12 15:00:29 pelle + Now have a slightly better way of handling the waiting for input using the WaitForInput class. + This will later be put into a command queue for execution. + Revision 1.2 2004/04/09 22:56:44 pelle SwingAgent now manages key creation as well through the NewAliasDialog. *************** *** 56,304 **** // Likely PlasticXP is not in the class path; ignore. } cache = new HashMap(); - sign = new JButton("Sign"); - sign.setEnabled(false); - cancel = new JButton("Cancel"); - newId = new JButton("New ..."); - list = new JList(new String[]{"bob", "carol", "alice"}); - list.setBorder(BorderFactory.createLoweredBevelBorder()); - passphrase = new JPasswordField(); - final URL imageurl = this.getClass().getClassLoader().getResource("org/neuclear/commons/crypto/passphraseagents/neuclear.png"); - if (imageurl != null) - icon = new JLabel(new ImageIcon(imageurl)); - else - icon = new JLabel("NeuClear"); - - dialog = new JDialog(); - dialog.setTitle("NeuClear Signing Agent"); - dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - dialog.getContentPane().add(buildPanel()); - dialog.pack(); - nad = new NewAliasDialog(this); - - cancel.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent actionEvent) { - synchronized (passphrase) { - passphrase.setText(""); - isCancel = true; - passphrase.notifyAll(); - } - - } - }); - - final ActionListener action = new ActionListener() { - public void actionPerformed(final ActionEvent actionEvent) { - synchronized (passphrase) { - if (validate()) { - isCancel = false; - passphrase.notifyAll(); - } - } - - } - }; - sign.addActionListener(action); - passphrase.addActionListener(action); - final KeyListener validate = new KeyListener() { - public void keyPressed(KeyEvent e) { - - } - - public void keyReleased(KeyEvent e) { - sign.setEnabled(validate()); - - } - - public void keyTyped(KeyEvent e) { - - } - }; - passphrase.addKeyListener(validate); - list.addListSelectionListener(new ListSelectionListener() { - /** - * Called whenever the value of the selection changes. - * - * @param e the event that characterizes the change. - */ - public void valueChanged(ListSelectionEvent e) { - sign.setEnabled(validate()); - } - - }); - - newId.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent actionEvent) { - SwingUtilities.invokeLater(nad); - } - }); - - - // dialog.show(); - - - } - - void updateList(String alias) { - if (alias != null) { - fillAliasList(); - list.setSelectedValue(alias, true); - dialog.pack(); - } - } - - private Component buildPanel() { - FormLayout layout = new FormLayout("right:pref, 3dlu, pref:grow ", - "pref,3dlu,pref, 3dlu, fill:pref:grow, 3dlu, pref, 7dlu, pref"); - PanelBuilder builder = new PanelBuilder(layout); - CellConstraints cc = new CellConstraints(); - - builder.setDefaultDialogBorder(); - - builder.add(icon, cc.xyw(1, 5, 1, CellConstraints.LEFT, CellConstraints.TOP)); - builder.addSeparator("Identities", cc.xyw(1, 3, 3)); - builder.add(list, cc.xyw(3, 5, 1)); - builder.addLabel("Passphrase:", cc.xy(1, 7)); - builder.add(passphrase, cc.xy(3, 7)); - - ButtonBarBuilder bb = new ButtonBarBuilder(); - bb.addGridded(newId); - bb.addGlue(); - bb.addUnrelatedGap(); - bb.addGridded(sign); - bb.addGridded(cancel); - builder.add(bb.getPanel(), cc.xyw(1, 9, 3)); - - return builder.getPanel(); - } - - /** - * The User is asked to pick a name by the PassPhraseAgent. The PassPhraseAgent can query the given signer for - * a list of included aliases or even create a new keypair. - * - * @return - * @throws org.neuclear.commons.crypto.passphraseagents.UserCancellationException - * - */ - public byte[] sign(BrowsableSigner signer, byte data[], SetPublicKeyCallBack callback) throws UserCancellationException { - synchronized (passphrase) {//We dont want multiple agents popping up at the same time - this.signer = signer; - fillAliasList(); - - // if (cache.containsKey(name)) - // passphrase.setText((String) cache.get(name)); - // else - passphrase.setText(""); - isCancel = true; - // if (incorrect) - // System.err.println("Incorrect passphrase"); - // incorrectLabel.setVisible(incorrect); - // nameLabel.setVisible(true); - // - // nameLabel.setText(name); - dialog.pack(); - dialog.show(); - sign.setEnabled(false); - // dialog.setVisible(true); - try { - passphrase.wait(); - } catch (InterruptedException e) { - ; - } - dialog.hide(); - // dialog.setVisible(false); - final String phrase = passphrase.getText(); - // if (remember.getState()) - // cache.put(name, phrase); - passphrase.setText(""); - try { - //Todo handle when an alias hasnt been selected - return signer.sign(list.getSelectedValue().toString(), phrase.toCharArray(), data, callback); - } catch (InvalidPassphraseException e) { - return sign(signer, data, callback); - } - } - } - - private void fillAliasList() { - try { - - Iterator iter = signer.iterator(); - Vector vector = new Vector(); - while (iter.hasNext()) { - Object o = iter.next(); - vector.add(o); - } - list.setListData(vector); - } catch (KeyStoreException e) { - e.printStackTrace(); - } - } - - /** - * Retrieve the PassPhrase for a given name/alias - * - * @param name - * @return - */ - public char[] getPassPhrase(String name) throws UserCancellationException { - - return getPassPhrase(name, false); - } - - public char[] getPassPhrase(String name, boolean incorrect) throws UserCancellationException { - synchronized (passphrase) {//We dont want multiple agents popping up at the same time - if (cache.containsKey(name)) - passphrase.setText((String) cache.get(name)); - else - passphrase.setText(""); - isCancel = true; - // if (incorrect) - // System.err.println("Incorrect passphrase"); - // incorrectLabel.setVisible(incorrect); - // nameLabel.setVisible(true); - // - // nameLabel.setText(name); - dialog.pack(); - dialog.setVisible(true); - try { - passphrase.wait(); - } catch (InterruptedException e) { - ; - } - dialog.setVisible(false); - if (isCancel) - throw new UserCancellationException(name); - final String phrase = passphrase.getText(); - // if (remember.getState()) - // cache.put(name, phrase); - passphrase.setText(""); - return phrase.toCharArray(); - } - } - - BrowsableSigner getSigner() { - return signer; - } - - JDialog getDialog() { - return dialog; - } - - private boolean validate() { - return (list.getSelectedIndex() > 0 && passphrase.getPassword().length > 0); } private BrowsableSigner signer; - private final JButton sign; - private final JButton cancel; - private final JButton newId; - private final JList list; - private final JPasswordField passphrase; - private final JDialog dialog; private final NewAliasDialog nad; private final Map cache; private boolean isCancel; - private final JLabel icon; public static void main(final String[] args) { --- 45,60 ---- // Likely PlasticXP is not in the class path; ignore. } + ksd = new KeyStoreDialog(); + simple = new SimpleDialog(); + nad = new NewAliasDialog(ksd); cache = new HashMap(); } private BrowsableSigner signer; private final NewAliasDialog nad; + private final SimpleDialog simple; + private final KeyStoreDialog ksd; private final Map cache; private boolean isCancel; public static void main(final String[] args) { *************** *** 327,330 **** --- 83,116 ---- } + /** + * Retrieve the PassPhrase for a given name/alias + * + * @param name + * @return + */ + public char[] getPassPhrase(String name) throws UserCancellationException { + return getPassPhrase(name, false); + } + + public char[] getPassPhrase(String name, boolean incorrect) throws UserCancellationException { + WaitForInput waiter = simple.createGetPassphraseTask(name, incorrect); + new Thread(waiter).start(); + return (char[]) waiter.getResult(); + } + + /** + * The User is asked to pick a name by the PassPhraseAgent. The PassPhraseAgent can query the given signer for + * a list of included aliases or even create a new keypair. + * + * @return + * @throws org.neuclear.commons.crypto.passphraseagents.UserCancellationException + * + */ + public byte[] sign(BrowsableSigner signer, byte data[], SetPublicKeyCallBack callback) throws UserCancellationException { + WaitForInput waiter = ksd.createSigningTask(signer, data, callback); + new Thread(waiter).start(); + return (byte[]) waiter.getResult(); + } + } Index: NewAliasDialog.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/swing/NewAliasDialog.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NewAliasDialog.java 9 Apr 2004 22:56:44 -0000 1.2 --- NewAliasDialog.java 12 Apr 2004 15:00:29 -0000 1.3 *************** *** 18,21 **** --- 18,25 ---- $Id$ $Log$ + Revision 1.3 2004/04/12 15:00:29 pelle + Now have a slightly better way of handling the waiting for input using the WaitForInput class. + This will later be put into a command queue for execution. + Revision 1.2 2004/04/09 22:56:44 pelle SwingAgent now manages key creation as well through the NewAliasDialog. *************** *** 34,38 **** */ public class NewAliasDialog implements Runnable { ! public NewAliasDialog(SwingAgent agent) { try { UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"); --- 38,42 ---- */ public class NewAliasDialog implements Runnable { ! public NewAliasDialog(KeyStoreDialog agent) { try { UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"); *************** *** 173,188 **** ok.setEnabled(false); cancel.setEnabled(true); ! try { ! System.out.println("Generating Key"); ! agent.getSigner().createKeyPair(alias.getText(), passphrase1.getPassword()); ! agent.updateList(alias.getText()); ! } catch (CryptoException e) { ! e.printStackTrace(); ! } ! dialog.hide(); } ! private SwingAgent agent; private JDialog dialog; private JButton ok; --- 177,208 ---- ok.setEnabled(false); cancel.setEnabled(true); ! new Thread(new Runnable() { ! /** ! * When an object implementing interface <code>Runnable</code> is used ! * to create a thread, starting the thread causes the object's ! * <code>run</code> method to be called in that separately executing ! * thread. ! * <p/> ! * The general contract of the method <code>run</code> is that it may ! * take any action whatsoever. ! * ! * @see Thread#run() ! */ ! public void run() { ! try { ! System.out.println("Generating Key"); ! agent.getSigner().createKeyPair(alias.getText(), passphrase1.getPassword()); ! agent.updateList(alias.getText()); ! dialog.hide(); ! } catch (CryptoException e) { ! e.printStackTrace(); ! } ! ! } ! }).start(); } ! private KeyStoreDialog agent; private JDialog dialog; private JButton ok; Index: SimpleDialog.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/swing/SimpleDialog.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SimpleDialog.java 9 Apr 2004 22:56:44 -0000 1.1 --- SimpleDialog.java 12 Apr 2004 15:00:29 -0000 1.2 *************** *** 6,11 **** import com.jgoodies.forms.layout.FormLayout; import com.jgoodies.plaf.Options; - import org.neuclear.commons.crypto.passphraseagents.UserCancellationException; - import org.neuclear.commons.crypto.signers.BrowsableSigner; import javax.swing.*; --- 6,9 ---- *************** *** 20,23 **** --- 18,25 ---- $Id$ $Log$ + Revision 1.2 2004/04/12 15:00:29 pelle + Now have a slightly better way of handling the waiting for input using the WaitForInput class. + This will later be put into a command queue for execution. + Revision 1.1 2004/04/09 22:56:44 pelle SwingAgent now manages key creation as well through the NewAliasDialog. *************** *** 36,40 **** */ public class SimpleDialog { ! public SimpleDialog(SwingAgent agent) { try { UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"); --- 38,42 ---- */ public class SimpleDialog { ! public SimpleDialog() { try { UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"); *************** *** 43,50 **** // Likely PlasticXP is not in the class path; ignore. } - this.agent = agent; ok = new JButton("Open"); ok.setEnabled(false); cancel = new JButton("Cancel"); passphrase = new JPasswordField(); final URL imageurl = this.getClass().getClassLoader().getResource("org/neuclear/commons/crypto/passphraseagents/neuclear.png"); --- 45,52 ---- // Likely PlasticXP is not in the class path; ignore. } ok = new JButton("Open"); ok.setEnabled(false); cancel = new JButton("Cancel"); + alias = new JLabel(); passphrase = new JPasswordField(); final URL imageurl = this.getClass().getClassLoader().getResource("org/neuclear/commons/crypto/passphraseagents/neuclear.png"); *************** *** 64,69 **** synchronized (passphrase) { passphrase.setText(""); ! isCancel = true; ! passphrase.notifyAll(); } --- 66,70 ---- synchronized (passphrase) { passphrase.setText(""); ! runner.cancel(); } *************** *** 75,80 **** synchronized (passphrase) { if (validate()) { ! isCancel = false; ! passphrase.notifyAll(); } } --- 76,80 ---- synchronized (passphrase) { if (validate()) { ! runner.execute(); } } *************** *** 110,115 **** builder.setDefaultDialogBorder(); ! builder.add(icon, cc.xyw(1, 5, 1, CellConstraints.LEFT, CellConstraints.TOP)); builder.addSeparator("Enter passphrase", cc.xyw(1, 3, 3)); builder.addLabel("Passphrase:", cc.xy(1, 7)); builder.add(passphrase, cc.xy(3, 7)); --- 110,117 ---- builder.setDefaultDialogBorder(); ! builder.add(icon, cc.xyw(1, 1, 1, CellConstraints.LEFT, CellConstraints.TOP)); builder.addSeparator("Enter passphrase", cc.xyw(1, 3, 3)); + builder.addLabel("open:", cc.xy(1, 5)); + builder.add(alias, cc.xy(3, 5)); builder.addLabel("Passphrase:", cc.xy(1, 7)); builder.add(passphrase, cc.xy(3, 7)); *************** *** 125,173 **** } - /** - * Retrieve the PassPhrase for a given name/alias - * - * @param name - * @return - */ - public char[] getPassPhrase(String name) throws UserCancellationException { - - return getPassPhrase(name, false); - } - - public char[] getPassPhrase(String name, boolean incorrect) throws UserCancellationException { - synchronized (passphrase) {//We dont want multiple agents popping up at the same time - isCancel = true; - // if (incorrect) - // System.err.println("Incorrect passphrase"); - // incorrectLabel.setVisible(incorrect); - // nameLabel.setVisible(true); - // - // nameLabel.setText(name); - dialog.pack(); - dialog.setVisible(true); - try { - passphrase.wait(); - } catch (InterruptedException e) { - ; - } - dialog.setVisible(false); - if (isCancel) - throw new UserCancellationException(name); - final String phrase = passphrase.getText(); - // if (remember.getState()) - // cache.put(name, phrase); - passphrase.setText(""); - return phrase.toCharArray(); - } - } - - BrowsableSigner getSigner() { - return signer; - } - - JDialog getDialog() { - return dialog; - } private boolean validate() { --- 127,130 ---- *************** *** 175,188 **** } ! private BrowsableSigner signer; private final JButton ok; private final JButton cancel; private final JPasswordField passphrase; private final JDialog dialog; - private boolean isCancel; - private SwingAgent agent; private final JLabel icon; } --- 132,172 ---- } ! WaitForInput createGetPassphraseTask(final String name, final boolean incorrect) { ! return new DialogRunner(name, incorrect); ! } private final JButton ok; private final JButton cancel; + private final JLabel alias; private final JPasswordField passphrase; private final JDialog dialog; private final JLabel icon; + private DialogRunner runner; + class DialogRunner extends WaitForInput { + public DialogRunner(final String alias, final boolean incorrect) { + this.req = alias; + this.incorrect = incorrect; + } + + public void run() { + runner = this; + alias.setText(req); + dialog.pack(); + dialog.show(); + } + + public void execute() { + dialog.hide(); + final char[] phrase = passphrase.getPassword(); + // if (remember.getState()) + // cache.put(name, phrase); + passphrase.setText(""); + setResult(phrase); + } + + private final String req; + private final boolean incorrect; + } } --- NEW FILE: WaitForInput.java --- package org.neuclear.commons.crypto.passphraseagents.swing; import org.neuclear.commons.crypto.passphraseagents.UserCancellationException; /* $Id: WaitForInput.java,v 1.1 2004/04/12 15:00:29 pelle Exp $ $Log: WaitForInput.java,v $ Revision 1.1 2004/04/12 15:00:29 pelle Now have a slightly better way of handling the waiting for input using the WaitForInput class. This will later be put into a command queue for execution. */ /** * User: pelleb * Date: Apr 10, 2004 * Time: 3:13:10 PM */ public abstract class WaitForInput implements Runnable { public Object getResult() throws UserCancellationException { synchronized (monitor) { try { monitor.wait(); } catch (InterruptedException e) { ; } if (cancelled) throw new UserCancellationException("User Cancelled"); return result; } } protected void setResult(Object result) { this.result = result; synchronized (monitor) { monitor.notifyAll(); } } protected void cancel() { cancelled = true; synchronized (monitor) { monitor.notifyAll(); } } private Object result; private boolean cancelled = false; private final Object monitor = new Object(); } |
|
From: <bug...@ve...> - 2004-04-10 18:47:56
|
Message: The following issue has been closed. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/COM-14 Here is an overview of the issue: --------------------------------------------------------------------- Key: COM-14 Summary: Use different screen layout for normal passphrase in SwingAgent Type: Bug Status: Closed Priority: Major Resolution: FIXED Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Commons Fix Fors: r_0_7 Versions: r_0_7 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Wed, 7 Apr 2004 10:31 AM Updated: Sat, 10 Apr 2004 11:47 AM Description: Currently the SwingAgent displays the Alias list even when an alias has been specified such as for keystore passphrases. This should be disabled. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: Pelle B. <pe...@us...> - 2004-04-09 23:10:09
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/signers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5482/src/java/org/neuclear/commons/crypto/signers Modified Files: BrowsableSigner.java JCESigner.java Log Message: SwingAgent now manages key creation as well through the NewAliasDialog. Many small uservalidation features have also been added. Index: JCESigner.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/signers/JCESigner.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** JCESigner.java 9 Apr 2004 18:40:45 -0000 1.20 --- JCESigner.java 9 Apr 2004 22:56:45 -0000 1.21 *************** *** 2,5 **** --- 2,9 ---- * $Id$ * $Log$ + * Revision 1.21 2004/04/09 22:56:45 pelle + * SwingAgent now manages key creation as well through the NewAliasDialog. + * Many small uservalidation features have also been added. + * * Revision 1.20 2004/04/09 18:40:45 pelle * BrowsableSigner now inherits Signer and PublicKeySource, which means implementations only need to implement BrowsableSigner now. *************** *** 437,443 **** public byte[] sign(String name, char pass[], byte data[], SetPublicKeyCallBack callback) throws InvalidPassphraseException { try { if (callback != null) callback.setPublicKey(getPublicKey(name)); ! return CryptoTools.sign(getKey(name, pass), data); } catch (UnrecoverableKeyException e) { throw new InvalidPassphraseException(name); --- 441,448 ---- public byte[] sign(String name, char pass[], byte data[], SetPublicKeyCallBack callback) throws InvalidPassphraseException { try { + final byte[] bytes = CryptoTools.sign(getKey(name, pass), data); if (callback != null) callback.setPublicKey(getPublicKey(name)); ! return bytes; } catch (UnrecoverableKeyException e) { throw new InvalidPassphraseException(name); *************** *** 452,455 **** --- 457,474 ---- } + public void createKeyPair(String alias, char passphrase[]) throws CryptoException { + try { + final KeyPair kp = kpg.generateKeyPair(); + ks.setKeyEntry(alias, kp.getPrivate(), passphrase, new Certificate[]{CryptoTools.createCertificate(alias, kp)}); + if (!Utility.isEmpty(filename)) save(); + } catch (KeyStoreException e) { + throw new LowLevelException(e); + } catch (SignatureException e) { + throw new LowLevelException(e); + } catch (InvalidKeyException e) { + throw new LowLevelException(e); + } + } + public void save() { try { Index: BrowsableSigner.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/signers/BrowsableSigner.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BrowsableSigner.java 9 Apr 2004 18:40:45 -0000 1.3 --- BrowsableSigner.java 9 Apr 2004 22:56:44 -0000 1.4 *************** *** 1,4 **** --- 1,5 ---- package org.neuclear.commons.crypto.signers; + import org.neuclear.commons.crypto.CryptoException; import org.neuclear.commons.crypto.passphraseagents.UserCancellationException; *************** *** 26,29 **** --- 27,34 ---- $Id$ $Log$ + Revision 1.4 2004/04/09 22:56:44 pelle + SwingAgent now manages key creation as well through the NewAliasDialog. + Many small uservalidation features have also been added. + Revision 1.3 2004/04/09 18:40:45 pelle BrowsableSigner now inherits Signer and PublicKeySource, which means implementations only need to implement BrowsableSigner now. *************** *** 53,55 **** --- 58,61 ---- byte[] sign(String alias, char passphrase[], byte data[], SetPublicKeyCallBack callback) throws InvalidPassphraseException; + void createKeyPair(String alias, char passphrase[]) throws CryptoException; } |
|
From: Pelle B. <pe...@us...> - 2004-04-09 23:10:09
|
Update of /cvsroot/neuclear/neuclear-commons In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5482 Modified Files: project.xml Log Message: SwingAgent now manages key creation as well through the NewAliasDialog. Many small uservalidation features have also been added. Index: project.xml =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/project.xml,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** project.xml 7 Apr 2004 17:22:10 -0000 1.26 --- project.xml 9 Apr 2004 22:56:45 -0000 1.27 *************** *** 83,86 **** --- 83,112 ---- </properties> </dependency> + <dependency> + <groupId>jgoodies</groupId> + <artifactId>forms</artifactId> + + <version>1.0.4</version> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + <dependency> + <groupId>jgoodies</groupId> + <artifactId>looks</artifactId> + + <version>1.2.0</version> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + <dependency> + <groupId>jgoodies</groupId> + <artifactId>plastic</artifactId> + <version>1.2.0</version> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> <!-- <dependency> <id>nanocontainer</id> |
|
From: Pelle B. <pe...@us...> - 2004-04-09 23:10:08
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5482/src/java/org/neuclear/commons/crypto/passphraseagents/swing Modified Files: NewAliasDialog.java SwingAgent.java Added Files: SimpleDialog.java Log Message: SwingAgent now manages key creation as well through the NewAliasDialog. Many small uservalidation features have also been added. Index: SwingAgent.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/swing/SwingAgent.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SwingAgent.java 7 Apr 2004 17:22:08 -0000 1.1 --- SwingAgent.java 9 Apr 2004 22:56:44 -0000 1.2 *************** *** 5,8 **** --- 5,9 ---- import com.jgoodies.forms.layout.CellConstraints; import com.jgoodies.forms.layout.FormLayout; + import com.jgoodies.plaf.Options; import org.neuclear.commons.crypto.Base64; import org.neuclear.commons.crypto.passphraseagents.InteractiveAgent; *************** *** 14,20 **** --- 15,25 ---- import javax.swing.*; + import javax.swing.event.ListSelectionEvent; + import javax.swing.event.ListSelectionListener; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; + import java.awt.event.KeyEvent; + import java.awt.event.KeyListener; import java.net.URL; import java.security.KeyStoreException; *************** *** 28,31 **** --- 33,40 ---- $Id$ $Log$ + Revision 1.2 2004/04/09 22:56:44 pelle + SwingAgent now manages key creation as well through the NewAliasDialog. + Many small uservalidation features have also been added. + Revision 1.1 2004/04/07 17:22:08 pelle Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. *************** *** 43,46 **** --- 52,56 ---- try { UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"); + UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE); } catch (Exception e) { // Likely PlasticXP is not in the class path; ignore. *************** *** 48,51 **** --- 58,62 ---- cache = new HashMap(); sign = new JButton("Sign"); + sign.setEnabled(false); cancel = new JButton("Cancel"); newId = new JButton("New ..."); *************** *** 59,67 **** icon = new JLabel("NeuClear"); ! frame = new JFrame(); ! frame.setTitle("NeuClear Signing Agent"); ! frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); ! frame.getContentPane().add(buildPanel()); ! frame.pack(); cancel.addActionListener(new ActionListener() { --- 70,79 ---- icon = new JLabel("NeuClear"); ! dialog = new JDialog(); ! dialog.setTitle("NeuClear Signing Agent"); ! dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); ! dialog.getContentPane().add(buildPanel()); ! dialog.pack(); ! nad = new NewAliasDialog(this); cancel.addActionListener(new ActionListener() { *************** *** 79,84 **** public void actionPerformed(final ActionEvent actionEvent) { synchronized (passphrase) { ! isCancel = false; ! passphrase.notifyAll(); } --- 91,98 ---- public void actionPerformed(final ActionEvent actionEvent) { synchronized (passphrase) { ! if (validate()) { ! isCancel = false; ! passphrase.notifyAll(); ! } } *************** *** 87,96 **** sign.addActionListener(action); passphrase.addActionListener(action); ! // frame.show(); } --- 101,149 ---- sign.addActionListener(action); passphrase.addActionListener(action); + final KeyListener validate = new KeyListener() { + public void keyPressed(KeyEvent e) { + } + public void keyReleased(KeyEvent e) { + sign.setEnabled(validate()); ! } ! ! public void keyTyped(KeyEvent e) { ! ! } ! }; ! passphrase.addKeyListener(validate); ! list.addListSelectionListener(new ListSelectionListener() { ! /** ! * Called whenever the value of the selection changes. ! * ! * @param e the event that characterizes the change. ! */ ! public void valueChanged(ListSelectionEvent e) { ! sign.setEnabled(validate()); ! } ! ! }); + newId.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent actionEvent) { + SwingUtilities.invokeLater(nad); + } + }); + + + // dialog.show(); + + } + + void updateList(String alias) { + if (alias != null) { + fillAliasList(); + list.setSelectedValue(alias, true); + dialog.pack(); + } } *************** *** 130,145 **** public byte[] sign(BrowsableSigner signer, byte data[], SetPublicKeyCallBack callback) throws UserCancellationException { synchronized (passphrase) {//We dont want multiple agents popping up at the same time ! try { ! ! Iterator iter = signer.iterator(); ! Vector vector = new Vector(); ! while (iter.hasNext()) { ! Object o = iter.next(); ! vector.add(o); ! } ! list.setListData(vector); ! } catch (KeyStoreException e) { ! e.printStackTrace(); ! } // if (cache.containsKey(name)) --- 183,188 ---- public byte[] sign(BrowsableSigner signer, byte data[], SetPublicKeyCallBack callback) throws UserCancellationException { synchronized (passphrase) {//We dont want multiple agents popping up at the same time ! this.signer = signer; ! fillAliasList(); // if (cache.containsKey(name)) *************** *** 154,160 **** // // nameLabel.setText(name); ! frame.pack(); ! frame.show(); ! // frame.setVisible(true); try { passphrase.wait(); --- 197,204 ---- // // nameLabel.setText(name); ! dialog.pack(); ! dialog.show(); ! sign.setEnabled(false); ! // dialog.setVisible(true); try { passphrase.wait(); *************** *** 162,167 **** ; } ! frame.hide(); ! // frame.setVisible(false); final String phrase = passphrase.getText(); // if (remember.getState()) --- 206,211 ---- ; } ! dialog.hide(); ! // dialog.setVisible(false); final String phrase = passphrase.getText(); // if (remember.getState()) *************** *** 172,177 **** return signer.sign(list.getSelectedValue().toString(), phrase.toCharArray(), data, callback); } catch (InvalidPassphraseException e) { ! return new byte[0];//TODO handle invalid passphrase } } } --- 216,236 ---- return signer.sign(list.getSelectedValue().toString(), phrase.toCharArray(), data, callback); } catch (InvalidPassphraseException e) { ! return sign(signer, data, callback); ! } ! } ! } ! ! private void fillAliasList() { ! try { ! ! Iterator iter = signer.iterator(); ! Vector vector = new Vector(); ! while (iter.hasNext()) { ! Object o = iter.next(); ! vector.add(o); } + list.setListData(vector); + } catch (KeyStoreException e) { + e.printStackTrace(); } } *************** *** 201,206 **** // // nameLabel.setText(name); ! frame.pack(); ! frame.setVisible(true); try { passphrase.wait(); --- 260,265 ---- // // nameLabel.setText(name); ! dialog.pack(); ! dialog.setVisible(true); try { passphrase.wait(); *************** *** 208,212 **** ; } ! frame.setVisible(false); if (isCancel) throw new UserCancellationException(name); --- 267,271 ---- ; } ! dialog.setVisible(false); if (isCancel) throw new UserCancellationException(name); *************** *** 219,229 **** } private final JButton sign; private final JButton cancel; private final JButton newId; private final JList list; ! private final JTextField passphrase; ! private final JFrame frame; private final Map cache; private boolean isCancel; --- 278,301 ---- } + BrowsableSigner getSigner() { + return signer; + } + + JDialog getDialog() { + return dialog; + } + + private boolean validate() { + return (list.getSelectedIndex() > 0 && passphrase.getPassword().length > 0); + } + private BrowsableSigner signer; private final JButton sign; private final JButton cancel; private final JButton newId; private final JList list; ! private final JPasswordField passphrase; ! private final JDialog dialog; ! private final NewAliasDialog nad; private final Map cache; private boolean isCancel; *************** *** 233,238 **** final InteractiveAgent dia = new SwingAgent(); try { - final BrowsableSigner signer = new TestCaseSigner(dia); try { byte sig[] = signer.sign("testdata".getBytes(), new SetPublicKeyCallBack() { public void setPublicKey(PublicKey pub) { --- 305,310 ---- final InteractiveAgent dia = new SwingAgent(); try { try { + final BrowsableSigner signer = new TestCaseSigner(dia); byte sig[] = signer.sign("testdata".getBytes(), new SetPublicKeyCallBack() { public void setPublicKey(PublicKey pub) { --- NEW FILE: SimpleDialog.java --- package org.neuclear.commons.crypto.passphraseagents.swing; import com.jgoodies.forms.builder.ButtonBarBuilder; import com.jgoodies.forms.builder.PanelBuilder; import com.jgoodies.forms.layout.CellConstraints; import com.jgoodies.forms.layout.FormLayout; import com.jgoodies.plaf.Options; import org.neuclear.commons.crypto.passphraseagents.UserCancellationException; import org.neuclear.commons.crypto.signers.BrowsableSigner; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.net.URL; /* $Id: SimpleDialog.java,v 1.1 2004/04/09 22:56:44 pelle Exp $ $Log: SimpleDialog.java,v $ Revision 1.1 2004/04/09 22:56:44 pelle SwingAgent now manages key creation as well through the NewAliasDialog. Many small uservalidation features have also been added. Revision 1.1 2004/04/07 17:22:08 pelle Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. The XMLSig classes have also been updated to support this. */ /** * User: pelleb * Date: Apr 7, 2004 * Time: 9:55:37 AM */ public class SimpleDialog { public SimpleDialog(SwingAgent agent) { try { UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"); UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE); } catch (Exception e) { // Likely PlasticXP is not in the class path; ignore. } this.agent = agent; ok = new JButton("Open"); ok.setEnabled(false); cancel = new JButton("Cancel"); passphrase = new JPasswordField(); final URL imageurl = this.getClass().getClassLoader().getResource("org/neuclear/commons/crypto/passphraseagents/neuclear.png"); if (imageurl != null) icon = new JLabel(new ImageIcon(imageurl)); else icon = new JLabel("NeuClear"); dialog = new JDialog(); dialog.setTitle("NeuClear Signing Agent"); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.getContentPane().add(buildPanel()); dialog.pack(); cancel.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent actionEvent) { synchronized (passphrase) { passphrase.setText(""); isCancel = true; passphrase.notifyAll(); } } }); final ActionListener action = new ActionListener() { public void actionPerformed(final ActionEvent actionEvent) { synchronized (passphrase) { if (validate()) { isCancel = false; passphrase.notifyAll(); } } } }; ok.addActionListener(action); passphrase.addActionListener(action); final KeyListener validate = new KeyListener() { public void keyPressed(KeyEvent e) { } public void keyReleased(KeyEvent e) { ok.setEnabled(validate()); } public void keyTyped(KeyEvent e) { } }; passphrase.addKeyListener(validate); } private Component buildPanel() { FormLayout layout = new FormLayout("right:pref, 3dlu, pref:grow ", "pref,3dlu,pref, 3dlu, fill:pref:grow, 3dlu, pref, 7dlu, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); builder.setDefaultDialogBorder(); builder.add(icon, cc.xyw(1, 5, 1, CellConstraints.LEFT, CellConstraints.TOP)); builder.addSeparator("Enter passphrase", cc.xyw(1, 3, 3)); builder.addLabel("Passphrase:", cc.xy(1, 7)); builder.add(passphrase, cc.xy(3, 7)); ButtonBarBuilder bb = new ButtonBarBuilder(); bb.addGlue(); bb.addUnrelatedGap(); bb.addGridded(ok); bb.addGridded(cancel); builder.add(bb.getPanel(), cc.xyw(1, 9, 3)); return builder.getPanel(); } /** * Retrieve the PassPhrase for a given name/alias * * @param name * @return */ public char[] getPassPhrase(String name) throws UserCancellationException { return getPassPhrase(name, false); } public char[] getPassPhrase(String name, boolean incorrect) throws UserCancellationException { synchronized (passphrase) {//We dont want multiple agents popping up at the same time isCancel = true; // if (incorrect) // System.err.println("Incorrect passphrase"); // incorrectLabel.setVisible(incorrect); // nameLabel.setVisible(true); // // nameLabel.setText(name); dialog.pack(); dialog.setVisible(true); try { passphrase.wait(); } catch (InterruptedException e) { ; } dialog.setVisible(false); if (isCancel) throw new UserCancellationException(name); final String phrase = passphrase.getText(); // if (remember.getState()) // cache.put(name, phrase); passphrase.setText(""); return phrase.toCharArray(); } } BrowsableSigner getSigner() { return signer; } JDialog getDialog() { return dialog; } private boolean validate() { return (passphrase.getPassword().length > 0); } private BrowsableSigner signer; private final JButton ok; private final JButton cancel; private final JPasswordField passphrase; private final JDialog dialog; private boolean isCancel; private SwingAgent agent; private final JLabel icon; } Index: NewAliasDialog.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/swing/NewAliasDialog.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NewAliasDialog.java 9 Apr 2004 18:40:45 -0000 1.1 --- NewAliasDialog.java 9 Apr 2004 22:56:44 -0000 1.2 *************** *** 5,15 **** --- 5,25 ---- import com.jgoodies.forms.layout.CellConstraints; import com.jgoodies.forms.layout.FormLayout; + import com.jgoodies.plaf.Options; + import org.neuclear.commons.crypto.CryptoException; import javax.swing.*; import java.awt.*; + import java.awt.event.ActionEvent; + import java.awt.event.ActionListener; + import java.awt.event.KeyEvent; + import java.awt.event.KeyListener; /* $Id$ $Log$ + Revision 1.2 2004/04/09 22:56:44 pelle + SwingAgent now manages key creation as well through the NewAliasDialog. + Many small uservalidation features have also been added. + Revision 1.1 2004/04/09 18:40:45 pelle BrowsableSigner now inherits Signer and PublicKeySource, which means implementations only need to implement BrowsableSigner now. *************** *** 23,45 **** * Time: 5:58:38 PM */ ! public class NewAliasDialog { ! public NewAliasDialog() { ok = new JButton("Create"); ok.setEnabled(false); cancel = new JButton("Cancel"); alias = new JTextField(); passphrase1 = new JPasswordField(); passphrase2 = new JPasswordField(); ! frame = new JFrame(); ! frame.setTitle("NeuClear Signing Agent"); ! frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); ! frame.getContentPane().add(buildPanel()); ! frame.pack(); } private Component buildPanel() { ! FormLayout layout = new FormLayout("right:pref, 3dlu, pref:grow ", "pref,3dlu,pref, 3dlu, pref, 3dlu, pref, 7dlu, pref"); PanelBuilder builder = new PanelBuilder(layout); --- 33,121 ---- * Time: 5:58:38 PM */ ! public class NewAliasDialog implements Runnable { ! public NewAliasDialog(SwingAgent agent) { ! try { ! UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"); ! UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE); ! } catch (Exception e) { ! // Likely PlasticXP is not in the class path; ignore. ! } ! this.agent = agent; ok = new JButton("Create"); ok.setEnabled(false); cancel = new JButton("Cancel"); alias = new JTextField(); + passphrase1 = new JPasswordField(); passphrase2 = new JPasswordField(); ! dialog = new JDialog(agent.getDialog(), true); ! dialog.setTitle("NeuClear Signing Agent"); ! dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); ! dialog.getContentPane().add(buildPanel()); ! dialog.pack(); ! ! cancel.addActionListener(new ActionListener() { ! public void actionPerformed(final ActionEvent actionEvent) { ! synchronized (alias) { ! passphrase1.setText(""); ! passphrase2.setText(""); ! alias.setText(""); ! dialog.hide(); ! } ! ! } ! }); ! ! final KeyListener validate = new KeyListener() { ! public void keyPressed(KeyEvent e) { ! ! } ! ! public void keyReleased(KeyEvent e) { ! ok.setEnabled(validate()); ! ! } ! ! public void keyTyped(KeyEvent e) { ! ! } ! }; ! alias.addKeyListener(validate); ! passphrase1.addKeyListener(validate); ! passphrase2.addKeyListener(validate); ! ! final ActionListener action = new ActionListener() { ! public void actionPerformed(final ActionEvent actionEvent) { ! synchronized (alias) { ! if (validate()) { ! createAlias(); ! } ! } ! ! } ! }; ! ! ok.addActionListener(action); ! passphrase2.addActionListener(action); } + private boolean validate() { + if (alias.getText().length() == 0) + return false; + char[] p1 = passphrase1.getPassword(); + char[] p2 = passphrase2.getPassword(); + if (p1 == null || p2 == null) + return false; + if (p1.length != p2.length) + return false; + if (p1.length == 0) + return false; + return true;//new String(p1).equals(new String(p2)); + } + private Component buildPanel() { ! FormLayout layout = new FormLayout("right:pref, 3dlu, 100dlu:grow ", "pref,3dlu,pref, 3dlu, pref, 3dlu, pref, 7dlu, pref"); PanelBuilder builder = new PanelBuilder(layout); *************** *** 67,71 **** } ! private JFrame frame; private JButton ok; private JButton cancel; --- 143,189 ---- } ! ! /** ! * When an object implementing interface <code>Runnable</code> is used ! * to create a thread, starting the thread causes the object's ! * <code>run</code> method to be called in that separately executing ! * thread. ! * <p/> ! * The general contract of the method <code>run</code> is that it may ! * take any action whatsoever. ! * ! * @see Thread#run() ! */ ! public void run() { ! ok.setEnabled(false); ! cancel.setEnabled(true); ! passphrase1.setEnabled(true); ! alias.setEnabled(true); ! passphrase2.setEnabled(true); ! dialog.pack(); ! dialog.show(); ! ! } ! ! private void createAlias() { ! dialog.setEnabled(false); ! passphrase1.setEnabled(false); ! alias.setEnabled(false); ! passphrase2.setEnabled(false); ! ok.setEnabled(false); ! cancel.setEnabled(true); ! try { ! System.out.println("Generating Key"); ! agent.getSigner().createKeyPair(alias.getText(), passphrase1.getPassword()); ! agent.updateList(alias.getText()); ! } catch (CryptoException e) { ! e.printStackTrace(); ! } ! ! dialog.hide(); ! } ! ! private SwingAgent agent; ! private JDialog dialog; private JButton ok; private JButton cancel; *************** *** 74,80 **** private JPasswordField passphrase2; - public static void main(String args[]) { - NewAliasDialog dg = new NewAliasDialog(); - dg.frame.show(); - } } --- 192,194 ---- |
|
From: <bug...@ve...> - 2004-04-09 23:02:55
|
Message:
The following issue has been closed.
Resolver: Pelle Braendgaard
Date: Fri, 9 Apr 2004 4:02 PM
This has been added in NewAliasDialog
---------------------------------------------------------------------
View the issue:
http://jira.neuclear.org//browse/COM-12
Here is an overview of the issue:
---------------------------------------------------------------------
Key: COM-12
Summary: Add Identity Generator to SwingAgent
Type: New Feature
Status: Closed
Priority: Major
Resolution: FIXED
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: NeuClear Commons
Fix Fors:
r_0_7
Versions:
r_0_7
Assignee: Pelle Braendgaard
Reporter: Pelle Braendgaard
Created: Wed, 7 Apr 2004 10:28 AM
Updated: Fri, 9 Apr 2004 4:02 PM
Description:
The SwingAgent should be able to generate a new Key and store it in the signer store.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://jira.neuclear.org//secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|
|
From: <bug...@ve...> - 2004-04-09 20:23:55
|
The following issue has been updated:
Updater: Pelle Braendgaard (mailto:pe...@ve...)
Date: Fri, 9 Apr 2004 1:23 PM
Changes:
Version changed to r_0_7
Fix Version changed to r_0_7
---------------------------------------------------------------------
For a full history of the issue, see:
http://jira.neuclear.org//browse/COM-15?page=history
---------------------------------------------------------------------
View the issue:
http://jira.neuclear.org//browse/COM-15
Here is an overview of the issue:
---------------------------------------------------------------------
Key: COM-15
Summary: Update project.xml with latest dependencies
Type: Task
Status: Open
Priority: Major
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: NeuClear Commons
Fix Fors:
r_0_7
Versions:
r_0_7
Assignee: Pelle Braendgaard
Reporter: Pelle Braendgaard
Created: Wed, 7 Apr 2004 10:32 AM
Updated: Fri, 9 Apr 2004 1:23 PM
Description:
We need to add the Jgoodies stuff.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://jira.neuclear.org//secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|
|
From: <bug...@ve...> - 2004-04-09 20:23:55
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/COM-18 Here is an overview of the issue: --------------------------------------------------------------------- Key: COM-18 Summary: Make DefaultSigner an intelligent wrapper for end user signing front ends Type: New Feature Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Commons Fix Fors: r_0_7 Versions: r_0_7 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Fri, 9 Apr 2004 1:22 PM Updated: Fri, 9 Apr 2004 1:22 PM Description: DefaultSigner should be able to be instantiated without parameters and automatically sense if a keystore exists or create a new one based on user input. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-04-09 20:22:03
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/COM-17 Here is an overview of the issue: --------------------------------------------------------------------- Key: COM-17 Summary: Create SQLSigner Type: New Feature Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Commons Fix Fors: r_0_8 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Fri, 9 Apr 2004 1:21 PM Updated: Fri, 9 Apr 2004 1:21 PM Description: This should be a server based signer implementation that can manage large amounts of keypairs stored on a SQL database. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-04-09 20:19:59
|
Message: The following issue has been closed. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/COM-16 Here is an overview of the issue: --------------------------------------------------------------------- Key: COM-16 Summary: add Password encrypted private key methods to CryptoTools Type: New Feature Status: Closed Priority: Major Resolution: FIXED Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Commons Fix Fors: r_0_7 Versions: r_0_7 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Fri, 9 Apr 2004 1:18 PM Updated: Fri, 9 Apr 2004 1:18 PM Description: We need a simple quick way for password encrypting and decrypting private keys. You should be able to use simple code like this: byte wrapped[] = CryptoTools.wrapKey(password, kp.getPrivate()); PrivateKey priv = CryptoTools.unWrapRSAKey(password, wrapped); --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-04-09 20:19:58
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/COM-16 Here is an overview of the issue: --------------------------------------------------------------------- Key: COM-16 Summary: add Password encrypted private key methods to CryptoTools Type: New Feature Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Commons Fix Fors: r_0_7 Versions: r_0_7 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Fri, 9 Apr 2004 1:18 PM Updated: Fri, 9 Apr 2004 1:18 PM Description: We need a simple quick way for password encrypting and decrypting private keys. You should be able to use simple code like this: byte wrapped[] = CryptoTools.wrapKey(password, kp.getPrivate()); PrivateKey priv = CryptoTools.unWrapRSAKey(password, wrapped); --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: Pelle B. <pe...@us...> - 2004-04-09 20:16:17
|
Update of /cvsroot/neuclear/neuclear-commons/src/test/org/neuclear/commons/crypto In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4281/src/test/org/neuclear/commons/crypto Modified Files: CryptoToolsTest.java Log Message: Added PrivateKey wrapping and unwrapping to CryptoTools with the methods: byte [] wrapKey(char passphrase[], PrivateKey key) and PrivateKey unWrapKey(char passphrase[],byte wrapped[],String algorithm) PrivateKey unWrapRSAKey(char passphrase[],byte wrapped[]) Index: CryptoToolsTest.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/test/org/neuclear/commons/crypto/CryptoToolsTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CryptoToolsTest.java 21 Nov 2003 04:43:42 -0000 1.2 --- CryptoToolsTest.java 9 Apr 2004 20:02:55 -0000 1.3 *************** *** 2,5 **** --- 2,12 ---- $Id$ $Log$ + Revision 1.3 2004/04/09 20:02:55 pelle + Added PrivateKey wrapping and unwrapping to CryptoTools with the methods: + byte [] wrapKey(char passphrase[], PrivateKey key) + and + PrivateKey unWrapKey(char passphrase[],byte wrapped[],String algorithm) + PrivateKey unWrapRSAKey(char passphrase[],byte wrapped[]) + Revision 1.2 2003/11/21 04:43:42 pelle EncryptedFileStore now works. It uses the PBECipher with DES3 afair. *************** *** 92,96 **** import junit.framework.TestCase; import junit.framework.TestSuite; ! import org.neuclear.commons.NeuClearException; --- 99,106 ---- import junit.framework.TestCase; import junit.framework.TestSuite; ! ! import java.security.KeyPair; ! import java.security.NoSuchAlgorithmException; ! import java.security.PrivateKey; *************** *** 132,136 **** } ! public final void testSymmetricKeyEncryption() throws CryptoException { final String contentString = "<xml>Hello</xml>"; final byte[] password = "Three Brown Geese sledded down the hill".getBytes(); --- 142,146 ---- } ! public final void testSymmetricKeyEncryption() throws CryptoException { final String contentString = "<xml>Hello</xml>"; final byte[] password = "Three Brown Geese sledded down the hill".getBytes(); *************** *** 149,152 **** --- 159,176 ---- } + public final void testKeyWrapping() throws NoSuchAlgorithmException, CryptoException { + KeyPair kp = CryptoTools.createTinyRSAKeyPair(); + assertNotNull(kp); + assertNotNull(kp.getPrivate()); + char password[] = "the secrets of the world are mine".toCharArray(); + byte wrapped[] = CryptoTools.wrapKey(password, kp.getPrivate()); + assertNotNull(wrapped); + PrivateKey priv = CryptoTools.unWrapRSAKey(password, wrapped); + + byte[] data = "the quick brown fox jumped over the lazy dog".getBytes(); + byte[] sig = CryptoTools.sign(priv, data); + assertNotNull(sig); + assertTrue(CryptoTools.verify(kp.getPublic(), data, sig)); + } } |
|
From: Pelle B. <pe...@us...> - 2004-04-09 20:16:16
|
Update of /cvsroot/neuclear/neuclear-commons/src/test/org/neuclear/commons/crypto/streams In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4281/src/test/org/neuclear/commons/crypto/streams Modified Files: CryptoStreamTest.java Log Message: Added PrivateKey wrapping and unwrapping to CryptoTools with the methods: byte [] wrapKey(char passphrase[], PrivateKey key) and PrivateKey unWrapKey(char passphrase[],byte wrapped[],String algorithm) PrivateKey unWrapRSAKey(char passphrase[],byte wrapped[]) Index: CryptoStreamTest.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/test/org/neuclear/commons/crypto/streams/CryptoStreamTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CryptoStreamTest.java 31 Mar 2004 18:48:27 -0000 1.1 --- CryptoStreamTest.java 9 Apr 2004 20:02:55 -0000 1.2 *************** *** 15,18 **** --- 15,25 ---- $Id$ $Log$ + Revision 1.2 2004/04/09 20:02:55 pelle + Added PrivateKey wrapping and unwrapping to CryptoTools with the methods: + byte [] wrapKey(char passphrase[], PrivateKey key) + and + PrivateKey unWrapKey(char passphrase[],byte wrapped[],String algorithm) + PrivateKey unWrapRSAKey(char passphrase[],byte wrapped[]) + Revision 1.1 2004/03/31 18:48:27 pelle Added various Streams for simplified crypto operations. *************** *** 29,34 **** public CryptoStreamTest(String name) throws NoSuchAlgorithmException { super(name); ! rsa = CryptoTools.createTinyRSAKeyPair(); ! dsa = CryptoTools.createTinyDSAKeyPair(); } --- 36,42 ---- public CryptoStreamTest(String name) throws NoSuchAlgorithmException { super(name); ! // rsa = CryptoTools.createTinyRSAKeyPair(); ! // dsa = CryptoTools.createTinyDSAKeyPair(); ! CryptoTools.ensureProvider(); } |
|
From: Pelle B. <pe...@us...> - 2004-04-09 20:16:16
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4281/src/java/org/neuclear/commons/crypto Modified Files: CryptoTools.java Log Message: Added PrivateKey wrapping and unwrapping to CryptoTools with the methods: byte [] wrapKey(char passphrase[], PrivateKey key) and PrivateKey unWrapKey(char passphrase[],byte wrapped[],String algorithm) PrivateKey unWrapRSAKey(char passphrase[],byte wrapped[]) Index: CryptoTools.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/CryptoTools.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** CryptoTools.java 31 Mar 2004 18:48:25 -0000 1.19 --- CryptoTools.java 9 Apr 2004 20:02:54 -0000 1.20 *************** *** 2,5 **** --- 2,12 ---- * $Id$ * $Log$ + * Revision 1.20 2004/04/09 20:02:54 pelle + * Added PrivateKey wrapping and unwrapping to CryptoTools with the methods: + * byte [] wrapKey(char passphrase[], PrivateKey key) + * and + * PrivateKey unWrapKey(char passphrase[],byte wrapped[],String algorithm) + * PrivateKey unWrapRSAKey(char passphrase[],byte wrapped[]) + * * Revision 1.19 2004/03/31 18:48:25 pelle * Added various Streams for simplified crypto operations. *************** *** 267,270 **** --- 274,278 ---- import org.neuclear.commons.time.TimeTools; + import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.NoSuchPaddingException; *************** *** 689,692 **** --- 697,701 ---- } + /** * Adapted from BouncyCastle's JDKKeyStore class.<p> *************** *** 704,707 **** --- 713,741 ---- } + public static byte[] wrapKey(final char password[], final PrivateKey key) throws CryptoException { + try { + Cipher cipher = makePBECipher(Cipher.WRAP_MODE, password); + return cipher.wrap(key); + } catch (BadPaddingException e) { + throw new CryptoException(e); + } catch (GeneralSecurityException e) { + throw new CryptoException(e); + } + } + + public static PrivateKey unWrapKey(final char password[], final byte data[], final String algorithm) throws CryptoException { + try { + Cipher cipher = makePBECipher(Cipher.UNWRAP_MODE, password); + return (PrivateKey) cipher.unwrap(data, algorithm, Cipher.PRIVATE_KEY); + } catch (BadPaddingException e) { + throw new CryptoException(e); + } catch (GeneralSecurityException e) { + throw new CryptoException(e); + } + } + + public static PrivateKey unWrapRSAKey(final char password[], final byte data[]) throws CryptoException { + return unWrapKey(password, data, "RSA"); + } public static PublicKey createPK(final String mod, final String exp) throws CryptoException { |
|
From: Pelle B. <pe...@us...> - 2004-04-09 18:54:08
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/signers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19535/src/java/org/neuclear/commons/crypto/signers Modified Files: BrowsableSigner.java JCESigner.java Log Message: BrowsableSigner now inherits Signer and PublicKeySource, which means implementations only need to implement BrowsableSigner now. Added NewAliasDialog, which isnt yet complete. Index: JCESigner.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/signers/JCESigner.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** JCESigner.java 7 Apr 2004 17:22:10 -0000 1.19 --- JCESigner.java 9 Apr 2004 18:40:45 -0000 1.20 *************** *** 2,5 **** --- 2,9 ---- * $Id$ * $Log$ + * Revision 1.20 2004/04/09 18:40:45 pelle + * BrowsableSigner now inherits Signer and PublicKeySource, which means implementations only need to implement BrowsableSigner now. + * Added NewAliasDialog, which isnt yet complete. + * * Revision 1.19 2004/04/07 17:22:10 pelle * Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. *************** *** 181,185 **** * Wrapper around JCE KeyStore */ ! public class JCESigner implements org.neuclear.commons.crypto.signers.Signer, BrowsableSigner, PublicKeySource { /** --- 185,189 ---- * Wrapper around JCE KeyStore */ ! public class JCESigner implements BrowsableSigner { /** Index: BrowsableSigner.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/signers/BrowsableSigner.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BrowsableSigner.java 7 Apr 2004 17:22:10 -0000 1.2 --- BrowsableSigner.java 9 Apr 2004 18:40:45 -0000 1.3 *************** *** 4,8 **** import java.security.KeyStoreException; - import java.security.PublicKey; import java.util.Iterator; --- 4,7 ---- *************** *** 27,30 **** --- 26,33 ---- $Id$ $Log$ + Revision 1.3 2004/04/09 18:40:45 pelle + BrowsableSigner now inherits Signer and PublicKeySource, which means implementations only need to implement BrowsableSigner now. + Added NewAliasDialog, which isnt yet complete. + Revision 1.2 2004/04/07 17:22:10 pelle Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. *************** *** 43,51 **** * provide an iterator of the keys held within. */ ! public interface BrowsableSigner { Iterator iterator() throws KeyStoreException; - PublicKey getPublicKey(String name) throws NonExistingSignerException; - byte[] sign(byte data[], SetPublicKeyCallBack callback) throws UserCancellationException; --- 46,52 ---- * provide an iterator of the keys held within. */ ! public interface BrowsableSigner extends Signer, PublicKeySource { Iterator iterator() throws KeyStoreException; byte[] sign(byte data[], SetPublicKeyCallBack callback) throws UserCancellationException; |
|
From: Pelle B. <pe...@us...> - 2004-04-09 18:54:08
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19535/src/java/org/neuclear/commons/crypto/passphraseagents/swing Added Files: NewAliasDialog.java Log Message: BrowsableSigner now inherits Signer and PublicKeySource, which means implementations only need to implement BrowsableSigner now. Added NewAliasDialog, which isnt yet complete. --- NEW FILE: NewAliasDialog.java --- package org.neuclear.commons.crypto.passphraseagents.swing; import com.jgoodies.forms.builder.ButtonBarBuilder; import com.jgoodies.forms.builder.PanelBuilder; import com.jgoodies.forms.layout.CellConstraints; import com.jgoodies.forms.layout.FormLayout; import javax.swing.*; import java.awt.*; /* $Id: NewAliasDialog.java,v 1.1 2004/04/09 18:40:45 pelle Exp $ $Log: NewAliasDialog.java,v $ Revision 1.1 2004/04/09 18:40:45 pelle BrowsableSigner now inherits Signer and PublicKeySource, which means implementations only need to implement BrowsableSigner now. Added NewAliasDialog, which isnt yet complete. */ /** * User: pelleb * Date: Apr 8, 2004 * Time: 5:58:38 PM */ public class NewAliasDialog { public NewAliasDialog() { ok = new JButton("Create"); ok.setEnabled(false); cancel = new JButton("Cancel"); alias = new JTextField(); passphrase1 = new JPasswordField(); passphrase2 = new JPasswordField(); frame = new JFrame(); frame.setTitle("NeuClear Signing Agent"); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.getContentPane().add(buildPanel()); frame.pack(); } private Component buildPanel() { FormLayout layout = new FormLayout("right:pref, 3dlu, pref:grow ", "pref,3dlu,pref, 3dlu, pref, 3dlu, pref, 7dlu, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); builder.setDefaultDialogBorder(); builder.addSeparator("Create alias", cc.xyw(1, 1, 3)); builder.addLabel("Alias:", cc.xy(1, 3)); builder.add(alias, cc.xy(3, 3)); builder.addLabel("Passphrase:", cc.xy(1, 5)); builder.add(passphrase1, cc.xy(3, 5)); builder.addLabel("(Repeat) Passphrase:", cc.xy(1, 7)); builder.add(passphrase2, cc.xy(3, 7)); ButtonBarBuilder bb = new ButtonBarBuilder(); bb.addGlue(); bb.addUnrelatedGap(); bb.addGridded(ok); bb.addGridded(cancel); builder.add(bb.getPanel(), cc.xyw(1, 9, 3)); return builder.getPanel(); } private JFrame frame; private JButton ok; private JButton cancel; private JTextField alias; private JPasswordField passphrase1; private JPasswordField passphrase2; public static void main(String args[]) { NewAliasDialog dg = new NewAliasDialog(); dg.frame.show(); } } |
|
From: Pelle B. <pe...@us...> - 2004-04-09 18:53:56
|
Update of /cvsroot/neuclear/neuclear-signer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19487 Modified Files: project.xml Log Message: BrowsableSigner now inherits Signer and PublicKeySource, which means implementations only need to implement BrowsableSigner now. Added NewAliasDialog, which isnt yet complete. |
|
From: Pelle B. <pe...@us...> - 2004-04-09 18:53:56
|
Update of /cvsroot/neuclear/neuclear-signer/src/java/org/neuclear/signers/standalone In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19487/src/java/org/neuclear/signers/standalone Modified Files: StandaloneSigningServlet.java Log Message: BrowsableSigner now inherits Signer and PublicKeySource, which means implementations only need to implement BrowsableSigner now. Added NewAliasDialog, which isnt yet complete. Index: StandaloneSigningServlet.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-signer/src/java/org/neuclear/signers/standalone/StandaloneSigningServlet.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** StandaloneSigningServlet.java 31 Mar 2004 23:13:55 -0000 1.6 --- StandaloneSigningServlet.java 9 Apr 2004 18:40:35 -0000 1.7 *************** *** 1,7 **** package org.neuclear.signers.standalone; - import org.neuclear.commons.crypto.passphraseagents.GuiDialogAgent; import org.neuclear.commons.crypto.passphraseagents.InteractiveAgent; import org.neuclear.commons.crypto.passphraseagents.UserCancellationException; import org.neuclear.commons.crypto.signers.DefaultSigner; import org.neuclear.commons.crypto.signers.InvalidPassphraseException; --- 1,7 ---- package org.neuclear.signers.standalone; import org.neuclear.commons.crypto.passphraseagents.InteractiveAgent; import org.neuclear.commons.crypto.passphraseagents.UserCancellationException; + import org.neuclear.commons.crypto.passphraseagents.swing.SwingAgent; import org.neuclear.commons.crypto.signers.DefaultSigner; import org.neuclear.commons.crypto.signers.InvalidPassphraseException; *************** *** 26,30 **** public class StandaloneSigningServlet extends SigningServlet { public StandaloneSigningServlet() { ! this.agent = new GuiDialogAgent(); } --- 26,30 ---- public class StandaloneSigningServlet extends SigningServlet { public StandaloneSigningServlet() { ! this.agent = new SwingAgent(); } |
|
From: Pelle B. <pe...@us...> - 2004-04-07 17:35:27
|
Update of /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14729/src/java/org/neuclear/xml/xmlsec Modified Files: EnvelopedSignature.java KeyInfo.java SignedInfo.java XMLSignature.java Log Message: Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. The XMLSig classes have also been updated to support this. Index: KeyInfo.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/KeyInfo.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** KeyInfo.java 19 Mar 2004 22:21:51 -0000 1.10 --- KeyInfo.java 7 Apr 2004 17:22:22 -0000 1.11 *************** *** 7,10 **** --- 7,11 ---- import org.neuclear.commons.crypto.CryptoTools; import org.neuclear.commons.crypto.keyresolvers.KeyResolverFactory; + import org.neuclear.commons.crypto.signers.SetPublicKeyCallBack; import java.io.ByteArrayInputStream; *************** *** 213,216 **** --- 214,229 ---- } + public static class CreateKeyInfoCallBack implements SetPublicKeyCallBack { + private PublicKey pub; + + public void setPublicKey(PublicKey pub) { + this.pub = pub; + } + + public KeyInfo createKeyInfo() { + return new KeyInfo(pub); + } + + } private static final String TAG_NAME = "KeyInfo"; Index: EnvelopedSignature.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/EnvelopedSignature.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EnvelopedSignature.java 23 Mar 2004 20:51:00 -0000 1.2 --- EnvelopedSignature.java 7 Apr 2004 17:22:22 -0000 1.3 *************** *** 4,7 **** --- 4,8 ---- import org.neuclear.commons.Utility; import org.neuclear.commons.crypto.passphraseagents.UserCancellationException; + import org.neuclear.commons.crypto.signers.BrowsableSigner; import org.neuclear.commons.crypto.signers.NonExistingSignerException; import org.neuclear.commons.crypto.signers.Signer; *************** *** 47,50 **** --- 48,70 ---- /** * Creates a standard Enveloped Signature within the given Element. + * Uses the provided Signer and Alias to sign it. + * + * @param signer + * @param elem + * @throws XMLSecurityException + * @throws UserCancellationException + * @throws NonExistingSignerException + * @see Signer + */ + public EnvelopedSignature(BrowsableSigner signer, Element elem) throws XMLSecurityException, UserCancellationException, NonExistingSignerException { + super(new SignedInfo(SignedInfo.SIG_ALG_RSA, 1)); + si.setEnvelopedReference(elem); + elem.add(getElement()); + sign(signer); + } + + + /** + * Creates a standard Enveloped Signature within the given Element. * Uses the provided KeyPair to sign it. * Index: SignedInfo.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/SignedInfo.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SignedInfo.java 23 Mar 2004 20:51:00 -0000 1.7 --- SignedInfo.java 7 Apr 2004 17:22:22 -0000 1.8 *************** *** 1,4 **** --- 1,8 ---- /* $Id$ * $Log$ + * Revision 1.8 2004/04/07 17:22:22 pelle + * Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. + * The XMLSig classes have also been updated to support this. + * * Revision 1.7 2004/03/23 20:51:00 pelle * Added ExternalSignature and further Javadocs. *************** *** 129,132 **** --- 133,137 ---- import org.neuclear.commons.crypto.CryptoTools; import org.neuclear.commons.crypto.passphraseagents.UserCancellationException; + import org.neuclear.commons.crypto.signers.BrowsableSigner; import org.neuclear.commons.crypto.signers.NonExistingSignerException; import org.neuclear.commons.crypto.signers.Signer; *************** *** 302,305 **** --- 307,315 ---- } + public final byte[] sign(BrowsableSigner signer, KeyInfo.CreateKeyInfoCallBack cb) throws XMLSecurityException, NonExistingSignerException, UserCancellationException { + return signer.sign(canonicalize(), cb); + } + + public final boolean verify(PublicKey pub, byte[] sig) throws XMLSecurityException { try { Index: XMLSignature.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/xmlsec/XMLSignature.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** XMLSignature.java 23 Mar 2004 20:51:00 -0000 1.19 --- XMLSignature.java 7 Apr 2004 17:22:22 -0000 1.20 *************** *** 1,4 **** --- 1,8 ---- /* $Id$ * $Log$ + * Revision 1.20 2004/04/07 17:22:22 pelle + * Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. + * The XMLSig classes have also been updated to support this. + * * Revision 1.19 2004/03/23 20:51:00 pelle * Added ExternalSignature and further Javadocs. *************** *** 217,220 **** --- 221,225 ---- import org.neuclear.commons.crypto.CryptoTools; import org.neuclear.commons.crypto.passphraseagents.UserCancellationException; + import org.neuclear.commons.crypto.signers.BrowsableSigner; import org.neuclear.commons.crypto.signers.NonExistingSignerException; import org.neuclear.commons.crypto.signers.PublicKeySource; *************** *** 255,264 **** private XMLSignature(final PublicKey pub, final SignedInfo si) { super(XMLSignature.TAG_NAME); this.si = si; addElement(si); sigval = addElement("SignatureValue"); - if (pub != null) - addElement(new KeyInfo(pub)); } --- 260,273 ---- private XMLSignature(final PublicKey pub, final SignedInfo si) { + this(si); + if (pub != null) + addElement(new KeyInfo(pub)); + } + + protected XMLSignature(final SignedInfo si) { super(XMLSignature.TAG_NAME); this.si = si; addElement(si); sigval = addElement("SignatureValue"); } *************** *** 359,363 **** * * @param alias ! * @param signer * @throws XMLSecurityException * @throws NonExistingSignerException --- 368,372 ---- * * @param alias ! * @param signer * @throws XMLSecurityException * @throws NonExistingSignerException *************** *** 368,371 **** --- 377,385 ---- } + protected void sign(BrowsableSigner signer) throws XMLSecurityException, NonExistingSignerException, UserCancellationException { + KeyInfo.CreateKeyInfoCallBack cb = new KeyInfo.CreateKeyInfoCallBack(); + sigval.setText(Base64.encode(si.sign(signer, cb))); + addElement(cb.createKeyInfo()); + } private static PublicKey getPublicKey(final String alias, final Signer signer) throws XMLSecurityException, NonExistingSignerException { |
|
From: Pelle B. <pe...@us...> - 2004-04-07 17:35:27
|
Update of /cvsroot/neuclear/neuclear-xmlsig/src/test/org/neuclear/xml/xmlsec In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14729/src/test/org/neuclear/xml/xmlsec Added Files: InteractiveXMLSignature.java Log Message: Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. The XMLSig classes have also been updated to support this. --- NEW FILE: InteractiveXMLSignature.java --- package org.neuclear.xml.xmlsec; import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.neuclear.commons.crypto.passphraseagents.UserCancellationException; import org.neuclear.commons.crypto.passphraseagents.swing.SwingAgent; import org.neuclear.commons.crypto.signers.BrowsableSigner; import org.neuclear.commons.crypto.signers.InvalidPassphraseException; import org.neuclear.commons.crypto.signers.NonExistingSignerException; import org.neuclear.commons.crypto.signers.TestCaseSigner; /* $Id: InteractiveXMLSignature.java,v 1.1 2004/04/07 17:22:23 pelle Exp $ $Log: InteractiveXMLSignature.java,v $ Revision 1.1 2004/04/07 17:22:23 pelle Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. The XMLSig classes have also been updated to support this. */ /** * User: pelleb * Date: Apr 7, 2004 * Time: 12:07:19 PM */ public class InteractiveXMLSignature { public static void main(String args[]) { try { BrowsableSigner signer = new TestCaseSigner(new SwingAgent()); final Element element = DocumentHelper.parseText(COMPLEX_XML).getRootElement(); XMLSignature sig = new EnvelopedSignature(signer, element); System.out.println(element.asXML()); System.exit(0); } catch (InvalidPassphraseException e) { e.printStackTrace(); } catch (XMLSecurityException e) { e.printStackTrace(); } catch (DocumentException e) { e.printStackTrace(); } catch (NonExistingSignerException e) { e.printStackTrace(); } catch (UserCancellationException e) { e.printStackTrace(); } } final static String COMPLEX_XML = "<test xmlns=\"http://talk.org\"><test2></test2></test>"; } |
|
From: Pelle B. <pe...@us...> - 2004-04-07 17:35:27
|
Update of /cvsroot/neuclear/neuclear-xmlsig In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14729 Modified Files: project.xml Log Message: Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. The XMLSig classes have also been updated to support this. Index: project.xml =================================================================== RCS file: /cvsroot/neuclear/neuclear-xmlsig/project.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** project.xml 23 Mar 2004 20:51:01 -0000 1.12 --- project.xml 7 Apr 2004 17:22:23 -0000 1.13 *************** *** 4,8 **** <name>NeuClear XML Signature API</name> <id>neuclear-xmlsig</id> ! <currentVersion>0.12</currentVersion> <inceptionYear>2002</inceptionYear> <package>org.neuclear</package> --- 4,8 ---- <name>NeuClear XML Signature API</name> <id>neuclear-xmlsig</id> ! <currentVersion>0.13-SNAPSHOT</currentVersion> <inceptionYear>2002</inceptionYear> <package>org.neuclear</package> *************** *** 76,80 **** <id>neuclear-commons</id> <name>neuclear-commons</name> ! <version>0.6</version> <properties> <war.bundle>true</war.bundle> --- 76,80 ---- <id>neuclear-commons</id> <name>neuclear-commons</name> ! <version>0.7-SNAPSHOT</version> <properties> <war.bundle>true</war.bundle> |