|
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; } |