diff options
| author | Mark Wielaard <mark@gcc.gnu.org> | 2006-08-14 23:12:35 +0000 |
|---|---|---|
| committer | Mark Wielaard <mark@gcc.gnu.org> | 2006-08-14 23:12:35 +0000 |
| commit | ac1ed908de999523efc36f38e69bca1aadfe0808 (patch) | |
| tree | 97037d2c09c8384d80531f67ec36a01205df6bdb /libjava/classpath/gnu/java/security/jce/sig/SignatureAdapter.java | |
| parent | abab460491408e05ea93fb85e1975296a87df504 (diff) | |
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
Diffstat (limited to 'libjava/classpath/gnu/java/security/jce/sig/SignatureAdapter.java')
| -rw-r--r-- | libjava/classpath/gnu/java/security/jce/sig/SignatureAdapter.java | 75 |
1 files changed, 32 insertions, 43 deletions
diff --git a/libjava/classpath/gnu/java/security/jce/sig/SignatureAdapter.java b/libjava/classpath/gnu/java/security/jce/sig/SignatureAdapter.java index 4dcbe78e570..a65d727eed3 100644 --- a/libjava/classpath/gnu/java/security/jce/sig/SignatureAdapter.java +++ b/libjava/classpath/gnu/java/security/jce/sig/SignatureAdapter.java @@ -38,6 +38,7 @@ exception statement from your version. */ package gnu.java.security.jce.sig; +import gnu.java.security.Configuration; import gnu.java.security.sig.BaseSignature; import gnu.java.security.sig.ISignature; import gnu.java.security.sig.ISignatureCodec; @@ -57,38 +58,34 @@ import java.util.logging.Logger; /** * The implementation of a generic {@link java.security.Signature} adapter class - * to wrap gnu.crypto signature instances.<p> - * - * This class defines the <i>Service Provider Interface</i> (<b>SPI</b>) for the - * {@link java.security.Signature} class, which provides the functionality of a - * digital signature algorithm. Digital signatures are used for authentication - * and integrity assurance of digital data.<p> - * - * All the abstract methods in the {@link java.security.SignatureSpi} class are - * implemented by this class and all its sub-classes.<p> - * + * to wrap GNU signature instances. + * <p> + * This class defines the <i>Service Provider Interface</i> (<b>SPI</b>) for + * the {@link java.security.Signature} class, which provides the functionality + * of a digital signature algorithm. Digital signatures are used for + * authentication and integrity assurance of digital data. + * <p> + * All the abstract methods in the {@link SignatureSpi} class are implemented by + * this class and all its sub-classes. + * <p> * All the implementations which subclass this object, and which are serviced by - * the GNU Crypto provider implement the {@link java.lang.Cloneable} interface.<p> + * the GNU provider implement the {@link Cloneable} interface. */ -class SignatureAdapter extends SignatureSpi implements Cloneable +class SignatureAdapter + extends SignatureSpi + implements Cloneable { private static final Logger log = Logger.getLogger(SignatureAdapter.class.getName()); - // Constants and variables - // ------------------------------------------------------------------------- - /** Our underlying signature instance. */ private ISignature adaptee; /** Our underlying signature encoder/decoder engine. */ private ISignatureCodec codec; - // Constructor(s) - // ------------------------------------------------------------------------- - /** - * Trivial protected constructor.<p> - * + * Trivial protected constructor. + * * @param sigName the canonical name of the signature scheme. * @param codec the signature codec engine to use with this scheme. */ @@ -98,8 +95,8 @@ class SignatureAdapter extends SignatureSpi implements Cloneable } /** - * Private constructor for cloning purposes.<p> - * + * Private constructor for cloning purposes. + * * @param adaptee a clone of the underlying signature scheme instance. * @param codec the signature codec engine to use with this scheme. */ @@ -111,12 +108,6 @@ class SignatureAdapter extends SignatureSpi implements Cloneable this.codec = codec; } - // Class methods - // ------------------------------------------------------------------------- - - // java.security.SignatureSpi interface implementation - // ------------------------------------------------------------------------- - public Object clone() { return new SignatureAdapter((ISignature) adaptee.clone(), codec); @@ -132,7 +123,7 @@ class SignatureAdapter extends SignatureSpi implements Cloneable } catch (IllegalArgumentException x) { - throw new InvalidKeyException(String.valueOf(x)); + throw new InvalidKeyException(x.getMessage(), x); } } @@ -146,7 +137,7 @@ class SignatureAdapter extends SignatureSpi implements Cloneable } catch (IllegalArgumentException x) { - throw new InvalidKeyException(String.valueOf(x)); + throw new InvalidKeyException(x.getMessage(), x); } } @@ -162,7 +153,7 @@ class SignatureAdapter extends SignatureSpi implements Cloneable } catch (IllegalArgumentException x) { - throw new InvalidKeyException(String.valueOf(x)); + throw new InvalidKeyException(x.getMessage(), x); } } @@ -174,7 +165,7 @@ class SignatureAdapter extends SignatureSpi implements Cloneable } catch (IllegalStateException x) { - throw new SignatureException(String.valueOf(x)); + throw new SignatureException(x.getMessage(), x); } } @@ -187,7 +178,7 @@ class SignatureAdapter extends SignatureSpi implements Cloneable } catch (IllegalStateException x) { - throw new SignatureException(String.valueOf(x)); + throw new SignatureException(x.getMessage(), x); } } @@ -200,9 +191,8 @@ class SignatureAdapter extends SignatureSpi implements Cloneable } catch (IllegalStateException x) { - throw new SignatureException(String.valueOf(x)); + throw new SignatureException(x.getMessage(), x); } - byte[] result = codec.encodeSignature(signature); return result; } @@ -213,9 +203,7 @@ class SignatureAdapter extends SignatureSpi implements Cloneable byte[] signature = this.engineSign(); int result = signature.length; if (result > len) - { - throw new SignatureException("len"); - } + throw new SignatureException("Not enough room to store signature"); System.arraycopy(signature, 0, outbuf, offset, result); return result; @@ -223,8 +211,8 @@ class SignatureAdapter extends SignatureSpi implements Cloneable public boolean engineVerify(byte[] sigBytes) throws SignatureException { - log.entering("SignatureAdapter", "engineVerify"); - + if (Configuration.DEBUG) + log.entering(this.getClass().getName(), "engineVerify"); Object signature = codec.decodeSignature(sigBytes); boolean result = false; try @@ -233,10 +221,11 @@ class SignatureAdapter extends SignatureSpi implements Cloneable } catch (IllegalStateException x) { - throw new SignatureException(String.valueOf(x)); + throw new SignatureException(x.getMessage(), x); } - - log.exiting("SignatureAdapter", "engineVerify", new Boolean(result)); + if (Configuration.DEBUG) + log.exiting(this.getClass().getName(), "engineVerify", + Boolean.valueOf(result)); return result; } |
