Commit 43905ff3 by Michael Koch Committed by Michael Koch

Engine.java, [...]: New files from classpath.

2003-04-30  Michael Koch  <konqueror@gmx.de>

	* gnu/java/security/Engine.java,
	gnu/java/security/OID.java,
	gnu/java/security/der/BitString.java,
	gnu/java/security/der/DER.java,
	gnu/java/security/der/DERReader.java,
	gnu/java/security/der/DERValue.java,
	gnu/java/security/der/DERWriter.java,
	gnu/java/security/provider/DSAKeyFactory.java,
	gnu/java/security/provider/X509CertificateFactory.java,
	gnu/java/security/x509/X500DistinguishedName.java,
	gnu/java/security/x509/X509CRL.java,
	gnu/java/security/x509/X509CRLEntry.java,
	gnu/java/security/x509/X509Certificate.java,
	java/security/cert/CRLSelector.java,
	java/security/cert/CertPathBuilder.java,
	java/security/cert/CertPathBuilderResult.java,
	java/security/cert/CertPathBuilderSpi.java,
	java/security/cert/CertPathParameters.java,
	java/security/cert/CertPathValidator.java,
	java/security/cert/CertPathValidatorResult.java,
	java/security/cert/CertPathValidatorSpi.java,
	java/security/cert/CertSelector.java,
	java/security/cert/CertStore.java,
	java/security/cert/CertStoreParameters.java,
	java/security/cert/CertStoreSpi.java,
	java/security/cert/CollectionCertStoreParameters.java,
	java/security/cert/LDAPCertStoreParameters.java,
	java/security/cert/PKIXBuilderParameters.java,
	java/security/cert/PKIXCertPathBuilderResult.java,
	java/security/cert/PKIXCertPathChecker.java,
	java/security/cert/PKIXCertPathValidatorResult.java,
	java/security/cert/PKIXParameters.java,
	java/security/cert/PolicyNode.java,
	java/security/cert/PolicyQualifierInfo.java,
	java/security/cert/TrustAnchor.java,
	javax/security/auth/x500/X500Principal.java:
	New files from classpath.
	* gnu/java/io/ASN1ParsingException.java,
	gnu/java/io/Base64InputStream.java,
	gnu/java/security/der/DEREncodingException.java,
	gnu/java/security/provider/DSAParameters.java,
	gnu/java/security/provider/DSASignature.java,
	gnu/java/security/provider/Gnu.java,
	gnu/java/security/provider/GnuDSAPrivateKey.java,
	gnu/java/security/provider/GnuDSAPublicKey.java,
	java/security/AlgorithmParameterGenerator.java,
	java/security/AlgorithmParameters.java,
	java/security/KeyFactory.java,
	java/security/KeyPairGenerator.java,
	java/security/KeyStore.java,
	java/security/MessageDigest.java,
	java/security/SecureClassLoader.java,
	java/security/SecureRandom.java,
	java/security/Security.java,
	java/security/Signature.java,
	java/security/cert/Certificate.java,
	java/security/cert/CertificateFactory.java,
	java/security/cert/CertificateFactorySpi.java,
	java/security/cert/X509CRL.java,
	java/security/cert/X509Certificate.java,
	java/security/spec/DSAPublicKeySpec.java:
	New versions from classpath.
	* gnu/java/security/provider/DERReader.java,
	gnu/java/security/provider/DERWriter.java,
	java/security/Engine.java: Removed.
	* Makefile.am
	(java_source_files, javax_source_files): Added new files.
	* Makefile.in: Regenerated.

From-SVN: r66283
parent 505b0fd6
2003-04-30 Michael Koch <konqueror@gmx.de>
* gnu/java/security/Engine.java,
gnu/java/security/OID.java,
gnu/java/security/der/BitString.java,
gnu/java/security/der/DER.java,
gnu/java/security/der/DERReader.java,
gnu/java/security/der/DERValue.java,
gnu/java/security/der/DERWriter.java,
gnu/java/security/provider/DSAKeyFactory.java,
gnu/java/security/provider/X509CertificateFactory.java,
gnu/java/security/x509/X500DistinguishedName.java,
gnu/java/security/x509/X509CRL.java,
gnu/java/security/x509/X509CRLEntry.java,
gnu/java/security/x509/X509Certificate.java,
java/security/cert/CRLSelector.java,
java/security/cert/CertPathBuilder.java,
java/security/cert/CertPathBuilderResult.java,
java/security/cert/CertPathBuilderSpi.java,
java/security/cert/CertPathParameters.java,
java/security/cert/CertPathValidator.java,
java/security/cert/CertPathValidatorResult.java,
java/security/cert/CertPathValidatorSpi.java,
java/security/cert/CertSelector.java,
java/security/cert/CertStore.java,
java/security/cert/CertStoreParameters.java,
java/security/cert/CertStoreSpi.java,
java/security/cert/CollectionCertStoreParameters.java,
java/security/cert/LDAPCertStoreParameters.java,
java/security/cert/PKIXBuilderParameters.java,
java/security/cert/PKIXCertPathBuilderResult.java,
java/security/cert/PKIXCertPathChecker.java,
java/security/cert/PKIXCertPathValidatorResult.java,
java/security/cert/PKIXParameters.java,
java/security/cert/PolicyNode.java,
java/security/cert/PolicyQualifierInfo.java,
java/security/cert/TrustAnchor.java,
javax/security/auth/x500/X500Principal.java:
New files from classpath.
* gnu/java/io/ASN1ParsingException.java,
gnu/java/io/Base64InputStream.java,
gnu/java/security/der/DEREncodingException.java,
gnu/java/security/provider/DSAParameters.java,
gnu/java/security/provider/DSASignature.java,
gnu/java/security/provider/Gnu.java,
gnu/java/security/provider/GnuDSAPrivateKey.java,
gnu/java/security/provider/GnuDSAPublicKey.java,
java/security/AlgorithmParameterGenerator.java,
java/security/AlgorithmParameters.java,
java/security/KeyFactory.java,
java/security/KeyPairGenerator.java,
java/security/KeyStore.java,
java/security/MessageDigest.java,
java/security/SecureClassLoader.java,
java/security/SecureRandom.java,
java/security/Security.java,
java/security/Signature.java,
java/security/cert/Certificate.java,
java/security/cert/CertificateFactory.java,
java/security/cert/CertificateFactorySpi.java,
java/security/cert/X509CRL.java,
java/security/cert/X509Certificate.java,
java/security/spec/DSAPublicKeySpec.java:
New versions from classpath.
* gnu/java/security/provider/DERReader.java,
gnu/java/security/provider/DERWriter.java,
java/security/Engine.java: Removed.
* Makefile.am
(java_source_files, javax_source_files): Added new files.
* Makefile.in: Regenerated.
2003-04-29 Michael Koch <konqueror@gmx.de> 2003-04-29 Michael Koch <konqueror@gmx.de>
* javax/swing/JTable.java * javax/swing/JTable.java
......
...@@ -1645,6 +1645,7 @@ javax/naming/OperationNotSupportedException.java \ ...@@ -1645,6 +1645,7 @@ javax/naming/OperationNotSupportedException.java \
javax/print/attribute/Attribute.java \ javax/print/attribute/Attribute.java \
javax/print/attribute/AttributeSet.java \ javax/print/attribute/AttributeSet.java \
javax/print/attribute/PrintRequestAttributeSet.java \ javax/print/attribute/PrintRequestAttributeSet.java \
javax/security/auth/x500/X500Principal.java \
javax/sql/ConnectionEvent.java \ javax/sql/ConnectionEvent.java \
javax/sql/ConnectionEventListener.java \ javax/sql/ConnectionEventListener.java \
javax/sql/ConnectionPoolDataSource.java \ javax/sql/ConnectionPoolDataSource.java \
...@@ -1946,6 +1947,8 @@ gnu/gcj/runtime/SharedLibLoader.java \ ...@@ -1946,6 +1947,8 @@ gnu/gcj/runtime/SharedLibLoader.java \
gnu/gcj/runtime/StackTrace.java \ gnu/gcj/runtime/StackTrace.java \
gnu/gcj/runtime/StringBuffer.java \ gnu/gcj/runtime/StringBuffer.java \
gnu/gcj/runtime/VMClassLoader.java \ gnu/gcj/runtime/VMClassLoader.java \
gnu/java/io/ASN1ParsingException.java \
gnu/java/io/Base64InputStream.java \
gnu/java/io/ClassLoaderObjectInputStream.java \ gnu/java/io/ClassLoaderObjectInputStream.java \
gnu/java/io/NullOutputStream.java \ gnu/java/io/NullOutputStream.java \
gnu/java/io/ObjectIdentityWrapper.java \ gnu/java/io/ObjectIdentityWrapper.java \
...@@ -2118,10 +2121,16 @@ gnu/java/nio/charset/UTF_16Decoder.java \ ...@@ -2118,10 +2121,16 @@ gnu/java/nio/charset/UTF_16Decoder.java \
gnu/java/nio/charset/UTF_16Encoder.java \ gnu/java/nio/charset/UTF_16Encoder.java \
gnu/java/nio/charset/UTF_16LE.java \ gnu/java/nio/charset/UTF_16LE.java \
gnu/java/nio/charset/UTF_8.java \ gnu/java/nio/charset/UTF_8.java \
gnu/java/security/Engine.java \
gnu/java/security/OID.java \
gnu/java/security/der/BitString.java \
gnu/java/security/der/DER.java \
gnu/java/security/der/DEREncodingException.java \ gnu/java/security/der/DEREncodingException.java \
gnu/java/security/provider/DERReader.java \ gnu/java/security/der/DERReader.java \
gnu/java/security/provider/DERWriter.java \ gnu/java/security/der/DERValue.java \
gnu/java/security/der/DERWriter.java \
gnu/java/security/provider/DefaultPolicy.java \ gnu/java/security/provider/DefaultPolicy.java \
gnu/java/security/provider/DSAKeyFactory.java \
gnu/java/security/provider/DSAKeyPairGenerator.java \ gnu/java/security/provider/DSAKeyPairGenerator.java \
gnu/java/security/provider/DSAParameterGenerator.java \ gnu/java/security/provider/DSAParameterGenerator.java \
gnu/java/security/provider/DSAParameters.java \ gnu/java/security/provider/DSAParameters.java \
...@@ -2132,7 +2141,12 @@ gnu/java/security/provider/GnuDSAPublicKey.java \ ...@@ -2132,7 +2141,12 @@ gnu/java/security/provider/GnuDSAPublicKey.java \
gnu/java/security/provider/MD5.java \ gnu/java/security/provider/MD5.java \
gnu/java/security/provider/SHA.java \ gnu/java/security/provider/SHA.java \
gnu/java/security/provider/SHA1PRNG.java \ gnu/java/security/provider/SHA1PRNG.java \
gnu/java/security/provider/X509CertificateFactory.java \
gnu/java/security/util/Prime.java \ gnu/java/security/util/Prime.java \
gnu/java/security/x509/X500DistinguishedName.java \
gnu/java/security/x509/X509Certificate.java \
gnu/java/security/x509/X509CRLEntry.java \
gnu/java/security/x509/X509CRL.java \
gnu/java/text/BaseBreakIterator.java \ gnu/java/text/BaseBreakIterator.java \
gnu/java/text/CharacterBreakIterator.java \ gnu/java/text/CharacterBreakIterator.java \
gnu/java/text/LineBreakIterator.java \ gnu/java/text/LineBreakIterator.java \
...@@ -2294,7 +2308,6 @@ java/security/DummySignature.java \ ...@@ -2294,7 +2308,6 @@ java/security/DummySignature.java \
java/security/DigestInputStream.java \ java/security/DigestInputStream.java \
java/security/DomainCombiner.java \ java/security/DomainCombiner.java \
java/security/DummyMessageDigest.java \ java/security/DummyMessageDigest.java \
java/security/Engine.java \
java/security/GeneralSecurityException.java \ java/security/GeneralSecurityException.java \
java/security/Guard.java \ java/security/Guard.java \
java/security/GuardedObject.java \ java/security/GuardedObject.java \
...@@ -2353,6 +2366,7 @@ java/security/acl/NotOwnerException.java \ ...@@ -2353,6 +2366,7 @@ java/security/acl/NotOwnerException.java \
java/security/acl/Permission.java \ java/security/acl/Permission.java \
java/security/cert/CRL.java \ java/security/cert/CRL.java \
java/security/cert/CRLException.java \ java/security/cert/CRLException.java \
java/security/cert/CRLSelector.java \
java/security/cert/Certificate.java \ java/security/cert/Certificate.java \
java/security/cert/CertificateEncodingException.java \ java/security/cert/CertificateEncodingException.java \
java/security/cert/CertificateException.java \ java/security/cert/CertificateException.java \
...@@ -2362,9 +2376,30 @@ java/security/cert/CertificateFactorySpi.java \ ...@@ -2362,9 +2376,30 @@ java/security/cert/CertificateFactorySpi.java \
java/security/cert/CertificateNotYetValidException.java \ java/security/cert/CertificateNotYetValidException.java \
java/security/cert/CertificateParsingException.java \ java/security/cert/CertificateParsingException.java \
java/security/cert/CertPath.java \ java/security/cert/CertPath.java \
java/security/cert/CertPathBuilder.java \
java/security/cert/CertPathBuilderException.java \ java/security/cert/CertPathBuilderException.java \
java/security/cert/CertPathBuilderResult.java \
java/security/cert/CertPathBuilderSpi.java \
java/security/cert/CertPathParameters.java \
java/security/cert/CertPathValidator.java \
java/security/cert/CertPathValidatorException.java \ java/security/cert/CertPathValidatorException.java \
java/security/cert/CertPathValidatorResult.java \
java/security/cert/CertPathValidatorSpi.java \
java/security/cert/CertSelector.java \
java/security/cert/CertStore.java \
java/security/cert/CertStoreException.java \ java/security/cert/CertStoreException.java \
java/security/cert/CertStoreParameters.java \
java/security/cert/CertStoreSpi.java \
java/security/cert/CollectionCertStoreParameters.java \
java/security/cert/LDAPCertStoreParameters.java \
java/security/cert/PKIXBuilderParameters.java \
java/security/cert/PKIXCertPathBuilderResult.java \
java/security/cert/PKIXCertPathChecker.java \
java/security/cert/PKIXCertPathValidatorResult.java \
java/security/cert/PKIXParameters.java \
java/security/cert/PolicyNode.java \
java/security/cert/PolicyQualifierInfo.java \
java/security/cert/TrustAnchor.java \
java/security/cert/X509CRL.java \ java/security/cert/X509CRL.java \
java/security/cert/X509CRLEntry.java \ java/security/cert/X509CRLEntry.java \
java/security/cert/X509Certificate.java \ java/security/cert/X509Certificate.java \
......
...@@ -1416,6 +1416,7 @@ javax/naming/OperationNotSupportedException.java \ ...@@ -1416,6 +1416,7 @@ javax/naming/OperationNotSupportedException.java \
javax/print/attribute/Attribute.java \ javax/print/attribute/Attribute.java \
javax/print/attribute/AttributeSet.java \ javax/print/attribute/AttributeSet.java \
javax/print/attribute/PrintRequestAttributeSet.java \ javax/print/attribute/PrintRequestAttributeSet.java \
javax/security/auth/x500/X500Principal.java \
javax/sql/ConnectionEvent.java \ javax/sql/ConnectionEvent.java \
javax/sql/ConnectionEventListener.java \ javax/sql/ConnectionEventListener.java \
javax/sql/ConnectionPoolDataSource.java \ javax/sql/ConnectionPoolDataSource.java \
...@@ -1708,6 +1709,8 @@ gnu/gcj/runtime/SharedLibLoader.java \ ...@@ -1708,6 +1709,8 @@ gnu/gcj/runtime/SharedLibLoader.java \
gnu/gcj/runtime/StackTrace.java \ gnu/gcj/runtime/StackTrace.java \
gnu/gcj/runtime/StringBuffer.java \ gnu/gcj/runtime/StringBuffer.java \
gnu/gcj/runtime/VMClassLoader.java \ gnu/gcj/runtime/VMClassLoader.java \
gnu/java/io/ASN1ParsingException.java \
gnu/java/io/Base64InputStream.java \
gnu/java/io/ClassLoaderObjectInputStream.java \ gnu/java/io/ClassLoaderObjectInputStream.java \
gnu/java/io/NullOutputStream.java \ gnu/java/io/NullOutputStream.java \
gnu/java/io/ObjectIdentityWrapper.java \ gnu/java/io/ObjectIdentityWrapper.java \
...@@ -1880,10 +1883,16 @@ gnu/java/nio/charset/UTF_16Decoder.java \ ...@@ -1880,10 +1883,16 @@ gnu/java/nio/charset/UTF_16Decoder.java \
gnu/java/nio/charset/UTF_16Encoder.java \ gnu/java/nio/charset/UTF_16Encoder.java \
gnu/java/nio/charset/UTF_16LE.java \ gnu/java/nio/charset/UTF_16LE.java \
gnu/java/nio/charset/UTF_8.java \ gnu/java/nio/charset/UTF_8.java \
gnu/java/security/Engine.java \
gnu/java/security/OID.java \
gnu/java/security/der/BitString.java \
gnu/java/security/der/DER.java \
gnu/java/security/der/DEREncodingException.java \ gnu/java/security/der/DEREncodingException.java \
gnu/java/security/provider/DERReader.java \ gnu/java/security/der/DERReader.java \
gnu/java/security/provider/DERWriter.java \ gnu/java/security/der/DERValue.java \
gnu/java/security/der/DERWriter.java \
gnu/java/security/provider/DefaultPolicy.java \ gnu/java/security/provider/DefaultPolicy.java \
gnu/java/security/provider/DSAKeyFactory.java \
gnu/java/security/provider/DSAKeyPairGenerator.java \ gnu/java/security/provider/DSAKeyPairGenerator.java \
gnu/java/security/provider/DSAParameterGenerator.java \ gnu/java/security/provider/DSAParameterGenerator.java \
gnu/java/security/provider/DSAParameters.java \ gnu/java/security/provider/DSAParameters.java \
...@@ -1894,7 +1903,12 @@ gnu/java/security/provider/GnuDSAPublicKey.java \ ...@@ -1894,7 +1903,12 @@ gnu/java/security/provider/GnuDSAPublicKey.java \
gnu/java/security/provider/MD5.java \ gnu/java/security/provider/MD5.java \
gnu/java/security/provider/SHA.java \ gnu/java/security/provider/SHA.java \
gnu/java/security/provider/SHA1PRNG.java \ gnu/java/security/provider/SHA1PRNG.java \
gnu/java/security/provider/X509CertificateFactory.java \
gnu/java/security/util/Prime.java \ gnu/java/security/util/Prime.java \
gnu/java/security/x509/X500DistinguishedName.java \
gnu/java/security/x509/X509Certificate.java \
gnu/java/security/x509/X509CRLEntry.java \
gnu/java/security/x509/X509CRL.java \
gnu/java/text/BaseBreakIterator.java \ gnu/java/text/BaseBreakIterator.java \
gnu/java/text/CharacterBreakIterator.java \ gnu/java/text/CharacterBreakIterator.java \
gnu/java/text/LineBreakIterator.java \ gnu/java/text/LineBreakIterator.java \
...@@ -2056,7 +2070,6 @@ java/security/DummySignature.java \ ...@@ -2056,7 +2070,6 @@ java/security/DummySignature.java \
java/security/DigestInputStream.java \ java/security/DigestInputStream.java \
java/security/DomainCombiner.java \ java/security/DomainCombiner.java \
java/security/DummyMessageDigest.java \ java/security/DummyMessageDigest.java \
java/security/Engine.java \
java/security/GeneralSecurityException.java \ java/security/GeneralSecurityException.java \
java/security/Guard.java \ java/security/Guard.java \
java/security/GuardedObject.java \ java/security/GuardedObject.java \
...@@ -2115,6 +2128,7 @@ java/security/acl/NotOwnerException.java \ ...@@ -2115,6 +2128,7 @@ java/security/acl/NotOwnerException.java \
java/security/acl/Permission.java \ java/security/acl/Permission.java \
java/security/cert/CRL.java \ java/security/cert/CRL.java \
java/security/cert/CRLException.java \ java/security/cert/CRLException.java \
java/security/cert/CRLSelector.java \
java/security/cert/Certificate.java \ java/security/cert/Certificate.java \
java/security/cert/CertificateEncodingException.java \ java/security/cert/CertificateEncodingException.java \
java/security/cert/CertificateException.java \ java/security/cert/CertificateException.java \
...@@ -2124,9 +2138,30 @@ java/security/cert/CertificateFactorySpi.java \ ...@@ -2124,9 +2138,30 @@ java/security/cert/CertificateFactorySpi.java \
java/security/cert/CertificateNotYetValidException.java \ java/security/cert/CertificateNotYetValidException.java \
java/security/cert/CertificateParsingException.java \ java/security/cert/CertificateParsingException.java \
java/security/cert/CertPath.java \ java/security/cert/CertPath.java \
java/security/cert/CertPathBuilder.java \
java/security/cert/CertPathBuilderException.java \ java/security/cert/CertPathBuilderException.java \
java/security/cert/CertPathBuilderResult.java \
java/security/cert/CertPathBuilderSpi.java \
java/security/cert/CertPathParameters.java \
java/security/cert/CertPathValidator.java \
java/security/cert/CertPathValidatorException.java \ java/security/cert/CertPathValidatorException.java \
java/security/cert/CertPathValidatorResult.java \
java/security/cert/CertPathValidatorSpi.java \
java/security/cert/CertSelector.java \
java/security/cert/CertStore.java \
java/security/cert/CertStoreException.java \ java/security/cert/CertStoreException.java \
java/security/cert/CertStoreParameters.java \
java/security/cert/CertStoreSpi.java \
java/security/cert/CollectionCertStoreParameters.java \
java/security/cert/LDAPCertStoreParameters.java \
java/security/cert/PKIXBuilderParameters.java \
java/security/cert/PKIXCertPathBuilderResult.java \
java/security/cert/PKIXCertPathChecker.java \
java/security/cert/PKIXCertPathValidatorResult.java \
java/security/cert/PKIXParameters.java \
java/security/cert/PolicyNode.java \
java/security/cert/PolicyQualifierInfo.java \
java/security/cert/TrustAnchor.java \
java/security/cert/X509CRL.java \ java/security/cert/X509CRL.java \
java/security/cert/X509CRLEntry.java \ java/security/cert/X509CRLEntry.java \
java/security/cert/X509Certificate.java \ java/security/cert/X509Certificate.java \
...@@ -2636,7 +2671,7 @@ libgcj-test.spec.in libgcj.spec.in ...@@ -2636,7 +2671,7 @@ libgcj-test.spec.in libgcj.spec.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar TAR = tar
GZIP_ENV = --best GZIP_ENV = --best
DIST_SUBDIRS = @DIRLTDL@ testsuite gcj include @DIRLTDL@ gcj include DIST_SUBDIRS = @DIRLTDL@ testsuite gcj include @DIRLTDL@ gcj include
DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
...@@ -2783,6 +2818,8 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -2783,6 +2818,8 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/java/beans/editors/NativeShortEditor.P \ .deps/gnu/java/beans/editors/NativeShortEditor.P \
.deps/gnu/java/beans/editors/StringEditor.P \ .deps/gnu/java/beans/editors/StringEditor.P \
.deps/gnu/java/beans/info/ComponentBeanInfo.P \ .deps/gnu/java/beans/info/ComponentBeanInfo.P \
.deps/gnu/java/io/ASN1ParsingException.P \
.deps/gnu/java/io/Base64InputStream.P \
.deps/gnu/java/io/ClassLoaderObjectInputStream.P \ .deps/gnu/java/io/ClassLoaderObjectInputStream.P \
.deps/gnu/java/io/NullOutputStream.P \ .deps/gnu/java/io/NullOutputStream.P \
.deps/gnu/java/io/ObjectIdentityWrapper.P \ .deps/gnu/java/io/ObjectIdentityWrapper.P \
...@@ -2983,9 +3020,14 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -2983,9 +3020,14 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/java/rmi/server/UnicastRemoteStub.P \ .deps/gnu/java/rmi/server/UnicastRemoteStub.P \
.deps/gnu/java/rmi/server/UnicastServer.P \ .deps/gnu/java/rmi/server/UnicastServer.P \
.deps/gnu/java/rmi/server/UnicastServerRef.P \ .deps/gnu/java/rmi/server/UnicastServerRef.P \
.deps/gnu/java/security/Engine.P .deps/gnu/java/security/OID.P \
.deps/gnu/java/security/der/BitString.P \
.deps/gnu/java/security/der/DER.P \
.deps/gnu/java/security/der/DEREncodingException.P \ .deps/gnu/java/security/der/DEREncodingException.P \
.deps/gnu/java/security/provider/DERReader.P \ .deps/gnu/java/security/der/DERReader.P \
.deps/gnu/java/security/provider/DERWriter.P \ .deps/gnu/java/security/der/DERValue.P \
.deps/gnu/java/security/der/DERWriter.P \
.deps/gnu/java/security/provider/DSAKeyFactory.P \
.deps/gnu/java/security/provider/DSAKeyPairGenerator.P \ .deps/gnu/java/security/provider/DSAKeyPairGenerator.P \
.deps/gnu/java/security/provider/DSAParameterGenerator.P \ .deps/gnu/java/security/provider/DSAParameterGenerator.P \
.deps/gnu/java/security/provider/DSAParameters.P \ .deps/gnu/java/security/provider/DSAParameters.P \
...@@ -2997,7 +3039,12 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -2997,7 +3039,12 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/java/security/provider/MD5.P \ .deps/gnu/java/security/provider/MD5.P \
.deps/gnu/java/security/provider/SHA.P \ .deps/gnu/java/security/provider/SHA.P \
.deps/gnu/java/security/provider/SHA1PRNG.P \ .deps/gnu/java/security/provider/SHA1PRNG.P \
.deps/gnu/java/security/provider/X509CertificateFactory.P \
.deps/gnu/java/security/util/Prime.P \ .deps/gnu/java/security/util/Prime.P \
.deps/gnu/java/security/x509/X500DistinguishedName.P \
.deps/gnu/java/security/x509/X509CRL.P \
.deps/gnu/java/security/x509/X509CRLEntry.P \
.deps/gnu/java/security/x509/X509Certificate.P \
.deps/gnu/java/text/BaseBreakIterator.P \ .deps/gnu/java/text/BaseBreakIterator.P \
.deps/gnu/java/text/CharacterBreakIterator.P \ .deps/gnu/java/text/CharacterBreakIterator.P \
.deps/gnu/java/text/LineBreakIterator.P \ .deps/gnu/java/text/LineBreakIterator.P \
...@@ -3576,7 +3623,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -3576,7 +3623,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/security/DomainCombiner.P \ .deps/java/security/DomainCombiner.P \
.deps/java/security/DummyKeyPairGenerator.P \ .deps/java/security/DummyKeyPairGenerator.P \
.deps/java/security/DummyMessageDigest.P \ .deps/java/security/DummyMessageDigest.P \
.deps/java/security/DummySignature.P .deps/java/security/Engine.P \ .deps/java/security/DummySignature.P \
.deps/java/security/GeneralSecurityException.P \ .deps/java/security/GeneralSecurityException.P \
.deps/java/security/Guard.P .deps/java/security/GuardedObject.P \ .deps/java/security/Guard.P .deps/java/security/GuardedObject.P \
.deps/java/security/Identity.P .deps/java/security/IdentityScope.P \ .deps/java/security/Identity.P .deps/java/security/IdentityScope.P \
...@@ -3619,10 +3666,22 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -3619,10 +3666,22 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/security/acl/NotOwnerException.P \ .deps/java/security/acl/NotOwnerException.P \
.deps/java/security/acl/Owner.P .deps/java/security/acl/Permission.P \ .deps/java/security/acl/Owner.P .deps/java/security/acl/Permission.P \
.deps/java/security/cert/CRL.P .deps/java/security/cert/CRLException.P \ .deps/java/security/cert/CRL.P .deps/java/security/cert/CRLException.P \
.deps/java/security/cert/CRLSelector.P \
.deps/java/security/cert/CertPath.P \ .deps/java/security/cert/CertPath.P \
.deps/java/security/cert/CertPathBuilder.P \
.deps/java/security/cert/CertPathBuilderException.P \ .deps/java/security/cert/CertPathBuilderException.P \
.deps/java/security/cert/CertPathBuilderResult.P \
.deps/java/security/cert/CertPathBuilderSpi.P \
.deps/java/security/cert/CertPathParameters.P \
.deps/java/security/cert/CertPathValidator.P \
.deps/java/security/cert/CertPathValidatorException.P \ .deps/java/security/cert/CertPathValidatorException.P \
.deps/java/security/cert/CertPathValidatorResult.P \
.deps/java/security/cert/CertPathValidatorSpi.P \
.deps/java/security/cert/CertSelector.P \
.deps/java/security/cert/CertStore.P \
.deps/java/security/cert/CertStoreException.P \ .deps/java/security/cert/CertStoreException.P \
.deps/java/security/cert/CertStoreParameters.P \
.deps/java/security/cert/CertStoreSpi.P \
.deps/java/security/cert/Certificate.P \ .deps/java/security/cert/Certificate.P \
.deps/java/security/cert/CertificateEncodingException.P \ .deps/java/security/cert/CertificateEncodingException.P \
.deps/java/security/cert/CertificateException.P \ .deps/java/security/cert/CertificateException.P \
...@@ -3631,6 +3690,16 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -3631,6 +3690,16 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/security/cert/CertificateFactorySpi.P \ .deps/java/security/cert/CertificateFactorySpi.P \
.deps/java/security/cert/CertificateNotYetValidException.P \ .deps/java/security/cert/CertificateNotYetValidException.P \
.deps/java/security/cert/CertificateParsingException.P \ .deps/java/security/cert/CertificateParsingException.P \
.deps/java/security/cert/CollectionCertStoreParameters.P \
.deps/java/security/cert/LDAPCertStoreParameters.P \
.deps/java/security/cert/PKIXBuilderParameters.P \
.deps/java/security/cert/PKIXCertPathBuilderResult.P \
.deps/java/security/cert/PKIXCertPathChecker.P \
.deps/java/security/cert/PKIXCertPathValidatorResult.P \
.deps/java/security/cert/PKIXParameters.P \
.deps/java/security/cert/PolicyNode.P \
.deps/java/security/cert/PolicyQualifierInfo.P \
.deps/java/security/cert/TrustAnchor.P \
.deps/java/security/cert/X509CRL.P \ .deps/java/security/cert/X509CRL.P \
.deps/java/security/cert/X509CRLEntry.P \ .deps/java/security/cert/X509CRLEntry.P \
.deps/java/security/cert/X509Certificate.P \ .deps/java/security/cert/X509Certificate.P \
...@@ -3868,6 +3937,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -3868,6 +3937,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/javax/rmi/CORBA/Util.P .deps/javax/rmi/CORBA/UtilDelegate.P \ .deps/javax/rmi/CORBA/Util.P .deps/javax/rmi/CORBA/UtilDelegate.P \
.deps/javax/rmi/CORBA/ValueHandler.P .deps/javax/rmi/ORB.P \ .deps/javax/rmi/CORBA/ValueHandler.P .deps/javax/rmi/ORB.P \
.deps/javax/rmi/PortableRemoteObject.P \ .deps/javax/rmi/PortableRemoteObject.P \
.deps/javax/security/auth/x500/X500Principal.P \
.deps/javax/sql/ConnectionEvent.P \ .deps/javax/sql/ConnectionEvent.P \
.deps/javax/sql/ConnectionEventListener.P \ .deps/javax/sql/ConnectionEventListener.P \
.deps/javax/sql/ConnectionPoolDataSource.P .deps/javax/sql/DataSource.P \ .deps/javax/sql/ConnectionPoolDataSource.P .deps/javax/sql/DataSource.P \
......
/* ASN1ParsingException.java -- ASN.1 parsing exception.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.io;
/**
* Signals a malformed ASN.1 sequence.
*/
public class ASN1ParsingException extends java.io.IOException
{
public ASN1ParsingException()
{
super();
}
public ASN1ParsingException(String msg)
{
super(msg);
}
}
/* Base64InputStream.java -- base-64 input stream.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.io;
import java.io.FilterInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.EOFException;
/**
* A filter input stream that decodes data encoded in the Base-64
* encoding scheme.
*
* @author Casey Marshall (rsdio@metastatic.org)
*/
public class Base64InputStream extends FilterInputStream
{
// Constants and fields.
// ------------------------------------------------------------------------
/** Base-64 digits. */
private static final String BASE_64 =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/** Base-64 padding character. */
private static final char BASE_64_PAD = '=';
/** Decoding state. */
private int state;
/** Intermediate decoded value. */
private int temp;
/** EOF flag. */
private boolean eof;
private final byte[] one = new byte[1];
// Constructors.
// ------------------------------------------------------------------------
/**
* Create a new Base-64 input stream. The input bytes must be the
* ASCII characters A-Z, a-z, 0-9, + and /, with optional whitespace,
* and will be decoded into a byte stream.
*
* @param in The source of Base-64 input.
*/
public Base64InputStream(InputStream in)
{
super(in);
state = 0;
temp = 0;
eof = false;
}
// Instance methods.
// ------------------------------------------------------------------------
public int available()
{
return 0;
}
public int read() throws IOException
{
if (read(one) == 1)
return one[0];
return -1;
}
public int read(byte[] buf, int off, int len) throws IOException
{
if (eof)
return -1;
int count = 0;
while (count < len)
{
int i;
while (Character.isWhitespace((char) (i = in.read())));
int pos = BASE_64.indexOf((char) i);
if (pos >= 0)
{
switch (state)
{
case 0:
temp = pos << 2;
state = 1;
break;
case 1:
buf[count++] = (byte) (temp | (pos >>> 4));
temp = (pos & 0x0F) << 4;
state = 2;
break;
case 2:
buf[count++] = (byte) (temp | (pos >>> 2));
temp = (pos & 0x03) << 6;
state = 3;
break;
case 3:
buf[count++] = (byte) (temp | pos);
state = 0;
break;
}
}
else if (i == BASE_64_PAD)
{
switch (state)
{
case 0:
case 1:
throw new IOException("malformed Base-64 input");
case 2:
while (Character.isWhitespace((char) (i = in.read())));
if (i != BASE_64_PAD)
throw new IOException("malformed Base-64 input");
case 3:
while (Character.isWhitespace((char) (i = in.read())));
}
eof = true;
break;
}
else // First non-Base-64 character, consider it end-of-stream.
{
if (state != 0)
throw new IOException("malformed Base-64 input");
eof = true;
break;
}
}
return count;
}
public boolean markSupported()
{
return false;
}
public void mark(int markLimit) { }
public void reset() throws IOException
{
throw new IOException("reset not supported");
}
public long skip(long n) throws IOException
{
long skipped;
for (skipped = 0; skipped < n; skipped++)
if (read() == -1)
break;
return skipped;
}
}
...@@ -35,7 +35,13 @@ this exception to your version of the library, but you are not ...@@ -35,7 +35,13 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */ exception statement from your version. */
package java.security; package gnu.java.security;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.security.NoSuchAlgorithmException;
import java.security.Provider;
/** /**
* Generic implementation of the getInstance methods in the various * Generic implementation of the getInstance methods in the various
...@@ -51,7 +57,7 @@ package java.security; ...@@ -51,7 +57,7 @@ package java.security;
* @see Provider * @see Provider
* @author Casey Marshall * @author Casey Marshall
*/ */
final class Engine public final class Engine
{ {
// Constants. // Constants.
...@@ -63,6 +69,9 @@ final class Engine ...@@ -63,6 +69,9 @@ final class Engine
/** Maximum number of aliases to try. */ /** Maximum number of aliases to try. */
private static final int MAX_ALIASES = 5; private static final int MAX_ALIASES = 5;
/** Argument list for no-argument constructors. */
private static final Object[] NO_ARGS = new Object[0];
// Constructor. // Constructor.
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
...@@ -85,13 +94,44 @@ final class Engine ...@@ -85,13 +94,44 @@ final class Engine
* service, but callers should check that this is so. * service, but callers should check that this is so.
* @throws NoSuchAlgorithmException If the implementation cannot be * @throws NoSuchAlgorithmException If the implementation cannot be
* found or cannot be instantiated. * found or cannot be instantiated.
* @throws InvocationTargetException If the SPI class's constructor
* throws an exception.
* @throws IllegalArgumentException If any of the three arguments are null. * @throws IllegalArgumentException If any of the three arguments are null.
*/ */
static Object public static Object getInstance(String service, String algorithm,
getInstance(String service, String algorithm, Provider provider) Provider provider)
throws NoSuchAlgorithmException throws InvocationTargetException, NoSuchAlgorithmException
{
return getInstance(service, algorithm, provider, NO_ARGS);
}
/**
* Get the implementation for <i>algorithm</i> for service
* <i>service</i> from <i>provider</i>, passing <i>initArgs</i> to the
* SPI class's constructor (which cannot be null; pass a zero-length
* array if the SPI takes no arguments). The service is e.g.
* "Signature", and the algorithm "DSA".
*
* @param service The service name.
* @param algorithm The name of the algorithm to get.
* @param provider The provider to get the implementation from.
* @param initArgs The arguments to pass to the SPI class's
* constructor (cannot be null).
* @return The engine class for the specified algorithm; the object
* returned is typically a subclass of the SPI class for that
* service, but callers should check that this is so.
* @throws NoSuchAlgorithmException If the implementation cannot be
* found or cannot be instantiated.
* @throws InvocationTargetException If the SPI class's constructor
* throws an exception.
* @throws IllegalArgumentException If any of the four arguments are null.
*/
public static Object getInstance(String service, String algorithm,
Provider provider, Object[] initArgs)
throws InvocationTargetException, NoSuchAlgorithmException
{ {
if (service == null || algorithm == null || provider == null) if (service == null || algorithm == null
|| provider == null || initArgs == null)
throw new IllegalArgumentException(); throw new IllegalArgumentException();
// If there is no property "service.algorithm" // If there is no property "service.algorithm"
...@@ -117,14 +157,17 @@ final class Engine ...@@ -117,14 +157,17 @@ final class Engine
// Find and instantiate the implementation. // Find and instantiate the implementation.
Class clazz = null; Class clazz = null;
ClassLoader loader = provider.getClass().getClassLoader(); ClassLoader loader = provider.getClass().getClassLoader();
Constructor constructor = null;
String error = algorithm; String error = algorithm;
try try
{ {
if (loader != null) if (loader != null)
clazz = loader.loadClass(provider.getProperty(service+"."+algorithm)); clazz = loader.loadClass(provider.getProperty(service+"."+algorithm));
else else
clazz = Class.forName(provider.getProperty(service+"."+algorithm)); clazz = Class.forName(provider.getProperty(service+"."+algorithm));
return clazz.newInstance(); constructor = getCompatibleConstructor(clazz, initArgs);
return constructor.newInstance(initArgs);
} }
catch (ClassNotFoundException cnfe) catch (ClassNotFoundException cnfe)
{ {
...@@ -146,7 +189,49 @@ final class Engine ...@@ -146,7 +189,49 @@ final class Engine
{ {
error = "security exception: " + se.getMessage(); error = "security exception: " + se.getMessage();
} }
catch (NoSuchMethodException nsme)
{
error = "no appropriate constructor found";
}
throw new NoSuchAlgorithmException(error); throw new NoSuchAlgorithmException(error);
} }
// Own methods.
// ------------------------------------------------------------------------
/**
* Find a constructor in the given class that can take the specified
* argument list, allowing any of which to be null.
*
* @param clazz The class from which to get the constructor.
* @param initArgs The argument list to be passed to the constructor.
* @return The constructor.
* @throws NoSuchMethodException If no constructor of the given class
* can take the specified argument array.
*/
private static Constructor getCompatibleConstructor(Class clazz,
Object[] initArgs)
throws NoSuchMethodException
{
Constructor[] c = clazz.getConstructors();
outer:for (int i = 0; i < c.length; i++)
{
Class[] argTypes = c[i].getParameterTypes();
if (argTypes.length != initArgs.length)
continue;
for (int j = 0; j < argTypes.length; j++)
{
if (initArgs[j] != null &&
!argTypes[j].isAssignableFrom(initArgs[j].getClass()))
continue outer;
}
// If we reach this point, we know this constructor (c[i]) has
// the same number of parameters as the target parameter list,
// and all our parameters are either (1) null, or (2) assignable
// to the target parameter type.
return c[i];
}
throw new NoSuchMethodException();
}
} }
/* BitString.java -- Java representation of the BIT STRING type.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.security.der;
import java.math.BigInteger;
import java.util.Arrays;
/**
* Immutable representation of a bit string, which is equivalent to a
* byte array except some number of the rightmost bits are ignored. For
* example, this could be the bit string:
*
* <pre> 00010101 11101101 11010xxx</pre>
*
* <p>Where the "xxx" represents three bits that should be ignored, and
* can have any value.
*
* @author Casey Marshall (rsdio@metastatic.org)
*/
public class BitString implements Cloneable, Comparable, java.io.Serializable
{
// Fields.
// ------------------------------------------------------------------------
/** The bits themselves. */
private final byte[] bytes;
/**
* The exportable byte array. This array has the ignored bits
* removed.
*/
private transient byte[] externBytes;
/** The number of bits ignored at the end of the byte array. */
private final int ignoredBits;
/** This bit string as a boolean array. */
private transient boolean[] boolVal;
// Constructors.
// ------------------------------------------------------------------------
/**
* Create a new bit string, shifting the given byte array if needed.
*
* @param bytes The byte array holding the bit string.
* @param ignoredBits The number of bits to ignore.
* @param doShift Pass true in this parameter if the byte array has
* not yet been shifted left by <i>ignoredBits</i>.
* @throws IllegalArgumentException If <i>ignoredBits</i> is negative
* or greater than 7.
* @throws NullPointerException If <i>bytes</i> is null.
*/
public BitString(byte[] bytes, int ignoredBits, boolean doShift)
{
this(bytes, 0, bytes.length, ignoredBits, doShift);
}
/**
* Create a new bit string, shifting the given byte array if needed.
*
* @param bytes The byte array holding the bit string.
* @param offset The offset where the meaningful bytes begin.
* @param length The number of meaningful bytes.
* @param ignoredBits The number of bits to ignore.
* @param doShift Pass true in this parameter if the byte array has
* not yet been shifted left by <i>ignoredBits</i>.
* @throws IllegalArgumentException If <i>ignoredBits</i> is negative
* or greater than 7.
* @throws NullPointerException If <i>bytes</i> is null.
*/
public BitString(byte[] bytes, int offset, int length,
int ignoredBits, boolean doShift)
{
if (ignoredBits < 0 || ignoredBits > 7)
throw new IllegalArgumentException();
if (bytes == null)
throw new NullPointerException();
if (doShift && ignoredBits > 0)
{
this.externBytes = new byte[length];
System.arraycopy(bytes, offset, externBytes, 0, length);
this.bytes = new BigInteger(externBytes).shiftLeft(ignoredBits)
.toByteArray();
}
else
{
this.bytes = new byte[length];
System.arraycopy(bytes, offset, this.bytes, 0, length);
}
this.ignoredBits = ignoredBits;
}
/**
* Create a new bit string.
*
* @param bytes The byte array holding the bit string.
* @param offset The offset where the meaningful bytes begin.
* @param length The number of meaningful bytes.
* @param ignoredBits The number of bits to ignore.
* @throws IllegalArgumentException If <i>ignoredBits</i> is negative
* or greater than 7.
* @throws NullPointerException If <i>bytes</i> is null.
*/
public BitString(byte[] bytes, int offset, int length, int ignoredBits)
{
this(bytes, offset, length, ignoredBits, false);
}
/**
* Create a new bit string.
*
* @param bytes The byte array holding the bit string.
* @param ignoredBits The number of bits to ignore.
* @throws IllegalArgumentException If <i>ignoredBits</i> is negative
* or greater than 7.
* @throws NullPointerException If <i>bytes</i> is null.
*/
public BitString(byte[] bytes, int ignoredBits)
{
this(bytes, 0, bytes.length, ignoredBits, false);
}
/**
* Create a new bit string.
*
* @param bytes The byte array holding the bit string.
* @param offset The offset where the meaningful bytes begin.
* @param length The number of meaningful bytes.
* @throws NullPointerException If <i>bytes</i> is null.
*/
public BitString(byte[] bytes, int offset, int length)
{
this(bytes, offset, length, 0, false);
}
/**
* Create a new bit string.
*
* @param bytes The byte array holding the bit string.
* @throws NullPointerException If <i>bytes</i> is null.
*/
public BitString(byte[] bytes)
{
this(bytes, 0, bytes.length, 0, false);
}
// Instance methods.
// ------------------------------------------------------------------------
/**
* Return this bit string as a byte array, with the ignored bits
* trimmed off. The byte array is cloned every time this method is
* called to prevent modification.
*
* @return The trimmed byte array.
*/
public byte[] toByteArray()
{
if (ignoredBits == 0)
return (byte[]) bytes.clone();
if (externBytes == null)
externBytes = new BigInteger(bytes).shiftRight(ignoredBits).toByteArray();
return (byte[]) externBytes.clone();
}
/**
* Returns this bit string as a byte array, with the ignored bits
* present. The byte array is cloned every time this method is
* called to prevent modification.
*
* @return The byte array.
*/
public byte[] getShiftedByteArray()
{
return (byte[]) bytes.clone();
}
/**
* Returns the number of ignored bits.
*
* @return The number of ignored bits.
*/
public int getIgnoredBits()
{
return ignoredBits;
}
/**
* Returns the size, in bits, of this bit string.
*
* @return The size of this bit string.
*/
public int size()
{
return (bytes.length << 3) - ignoredBits;
}
/**
* Return this bit string as a boolean array. The value returned is of
* size {@link #size()}, and each <code>true</code> value
* corresponding to each "1" in this bit string. The boolean array is
* cloned before it is returned.
*
* @return The boolean array.
*/
public boolean[] toBooleanArray()
{
if (boolVal == null)
{
boolVal = new boolean[size()];
for (int i = 0, j = 7, k = 0; i < boolVal.length; i++)
{
boolVal[i] = (bytes[k] & 1 << j--) != 0;
if (j < 0)
{
j = 7;
k++;
}
}
}
return (boolean[]) boolVal.clone();
}
public Object clone()
{
try
{
return super.clone();
}
catch (CloneNotSupportedException cce)
{
throw new InternalError(cce.getMessage());
}
}
public int compareTo(Object o)
{
BitString that = (BitString) o;
if (this.equals(that))
return 0;
if (this.bytes.length != that.bytes.length)
return (this.bytes.length < that.bytes.length) ? -1 : 1;
if (this.ignoredBits != that.ignoredBits)
return (this.ignoredBits < that.ignoredBits) ? -1 : 1;
for (int i = 0; i < this.bytes.length; i++)
if (this.bytes[i] != that.bytes[i])
return (this.bytes[i] < that.bytes[i]) ? -1 : 1;
return 0; // not reached.
}
public boolean equals(Object o)
{
if (this == o)
return true;
BitString that = (BitString) o;
// True for cloned instances.
if (this.bytes == that.bytes && this.ignoredBits == that.ignoredBits)
return true;
if (this.ignoredBits == that.ignoredBits)
return Arrays.equals(this.bytes, that.bytes);
return false;
}
public String toString()
{
StringBuffer sb = new StringBuffer();
for (int i = 0, j = 7, k = 0; i < size(); i++)
{
sb.append((bytes[k] & 1 << j) != 0 ? "1" : "0");
j--;
if (j < 0)
{
j = 7;
k++;
}
}
return sb.toString();
}
}
/* DER.java -- Basic constants in DER sequences.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.security.der;
/**
* The set of tags for DER types.
*
* @author Casey Marshall (rsdio@metastatic.org)
*/
public interface DER
{
// Constants.
// ------------------------------------------------------------------------
public static final int UNIVERSAL = 0x00;
public static final int APPLICATION = 0x40;
public static final int CONTEXT = 0x80;
public static final int PRIVATE = 0xC0;
public static final int CONSTRUCTED = 0x20;
public static final int ANY = 0x00;
public static final int BOOLEAN = 0x01;
public static final int INTEGER = 0x02;
public static final int BIT_STRING = 0x03;
public static final int OCTET_STRING = 0x04;
public static final int NULL = 0x05;
public static final int OBJECT_IDENTIFIER = 0x06;
public static final int REAL = 0x09;
public static final int ENUMERATED = 0x0a;
public static final int RELATIVE_OID = 0x0d;
public static final int SEQUENCE = 0x10;
public static final int SET = 0x11;
public static final Object CONSTRUCTED_VALUE = new Object();
public static final int NUMERIC_STRING = 0x12;
public static final int PRINTABLE_STRING = 0x13;
public static final int T61_STRING = 0x14;
public static final int VIDEOTEX_STRING = 0x15;
public static final int IA5_STRING = 0x16;
public static final int GRAPHIC_STRING = 0x19;
public static final int ISO646_STRING = 0x1A;
public static final int GENERAL_STRING = 0x1B;
public static final int UTF8_STRING = 0x0C;
public static final int UNIVERSAL_STRING = 0x1C;
public static final int BMP_STRING = 0x1E;
public static final int UTC_TIME = 0x17;
public static final int GENERALIZED_TIME = 0x18;
}
/* DEREncodingException.java --- DER Encoding Exception /* DEREncodingException.java --- DER Encoding Exception
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999,2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -38,9 +38,10 @@ exception statement from your version. */ ...@@ -38,9 +38,10 @@ exception statement from your version. */
package gnu.java.security.der; package gnu.java.security.der;
public class DEREncodingException extends Exception import java.io.IOException;
{
public class DEREncodingException extends IOException
{
public DEREncodingException() public DEREncodingException()
{ {
super (); super ();
......
/* DERValue.java -- a value read or written to a DER encoding.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.security.der;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
public class DERValue implements DER
{
// Fields.
// ------------------------------------------------------------------------
private final int tagClass;
private final boolean constructed;
private final int tag;
private int length;
private final Object value;
private byte[] encoded;
// Constructor.
// ------------------------------------------------------------------------
public DERValue(int tag, int length, Object value, byte[] encoded)
{
tagClass = tag & 0xC0;
this.tag = tag & 0x1F;
constructed = (tag & CONSTRUCTED) == CONSTRUCTED;
this.length = length;
this.value = value;
if (encoded != null)
this.encoded = (byte[]) encoded.clone();
}
public DERValue(int tag, Object value)
{
this(tag, 0, value, null);
}
// Instance methods.
// ------------------------------------------------------------------------
public int getExternalTag()
{
return tagClass | tag | (constructed ? 0x20 : 0x00);
}
public int getTag()
{
return tag;
}
public int getTagClass()
{
return tagClass;
}
public boolean isConstructed()
{
return constructed;
}
public int getLength()
{
if (encoded == null)
{
try
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
length = DERWriter.write(out, this);
encoded = out.toByteArray();
}
catch (IOException ioe)
{
encoded = new byte[0];
}
}
return length;
}
public Object getValue()
{
return value;
}
public byte[] getEncoded()
{
if (encoded == null)
{
try
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
length = DERWriter.write(out, this);
encoded = out.toByteArray();
}
catch (IOException ioe)
{
encoded = new byte[0];
}
}
return (byte[]) encoded.clone();
}
public int getEncodedLength()
{
if (encoded == null)
{
try
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
length = DERWriter.write(out, this);
encoded = out.toByteArray();
}
catch (IOException ioe)
{
encoded = new byte[0];
}
}
return encoded.length;
}
public String toString()
{
return "DERValue [ tag=" + tag + ", class=" + tagClass + ", constructed="
+ constructed + ", value=" + value + " ]";
}
}
/* DERWriter.java -- write Java types in DER format.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.security.der;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.text.SimpleDateFormat;
import java.util.BitSet;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.TimeZone;
import gnu.java.security.OID;
/**
* Methods that allow various Java types to be written as a DER
* (Distinguished Encoding Rules) stream to the specified output stream.
* DER is used to encode ASN.1 constructions, but this class provides no
* methods for interacting with ASN.1. Rather, callers should construct
* their output objects properly for whatever ASN.1 construct is being
* output.
*
* <p>This class only defines static methods; there are no instance
* variables needed.
*
* @author Casey Marshall (rsdio@metastatic.org)
*/
public class DERWriter implements DER
{
// Constructors.
// ------------------------------------------------------------------------
/** This class only has static methods. */
private DERWriter()
{
}
// Class methods.
// ------------------------------------------------------------------------
public static int write(OutputStream out, DERValue object)
throws IOException
{
out.write(object.getExternalTag());
Object value = object.getValue();
if (value == null)
{
writeLength(out, 0);
return 0;
}
if (value instanceof Boolean)
return writeBoolean(out, (Boolean) value);
else if (value instanceof BigInteger)
return writeInteger(out, (BigInteger) value);
else if (value instanceof Date)
return writeDate(out, object.getExternalTag(), (Date) value);
else if (value instanceof String)
return writeString(out, object.getExternalTag(), (String) value);
else if (value instanceof List)
return writeSequence(out, (List) value);
else if (value instanceof Set)
return writeSet(out, (Set) value);
else if (value instanceof BitString)
return writeBitString(out, (BitString) value);
else if (value instanceof OID)
return writeOID(out, (OID) value);
else if (value instanceof byte[])
{
writeLength(out, ((byte[]) value).length);
out.write((byte[]) value);
return ((byte[]) value).length;
}
else if (value instanceof DERValue)
{
ByteArrayOutputStream bout = new ByteArrayOutputStream();
write(bout, (DERValue) value);
byte[] buf = bout.toByteArray();
writeLength(out, buf.length);
out.write(buf);
return buf.length;
}
else
throw new DEREncodingException("cannot encode " + value.getClass().getName());
}
public static int definiteEncodingSize(int length)
{
if (length < 128)
return 1;
else if (length < 256)
return 2;
else if (length < 65536)
return 3;
else if (length < 16777216)
return 4;
else
return 5;
}
// Own methods.
// ------------------------------------------------------------------------
/**
* Write a BOOLEAN type to the given output stream.
*
* @param out The sink output stream.
* @param b The boolean value to write.
*/
private static int writeBoolean(OutputStream out, Boolean b)
throws IOException
{
writeLength(out, 1);
if (b.booleanValue())
out.write(0xFF);
else
out.write(0);
return 1;
}
/**
* Write an INTEGER type to the given output stream.
*
* @param out The sink output stream.
* @param integer The integer to write.
*/
private static int writeInteger(OutputStream out, BigInteger integer)
throws IOException
{
byte[] bytes = integer.toByteArray();
writeLength(out, bytes.length);
out.write(bytes);
return bytes.length;
}
private static int writeSequence(OutputStream out, List sequence)
throws IOException
{
ByteArrayOutputStream bout = new ByteArrayOutputStream();
for (Iterator i = sequence.iterator(); i.hasNext(); )
{
write(bout, (DERValue) i.next());
}
byte[] buf = bout.toByteArray();
writeLength(out, buf.length);
out.write(buf);
return buf.length;
}
private static int writeSet(OutputStream out, Set set)
throws IOException
{
ByteArrayOutputStream bout = new ByteArrayOutputStream();
for (Iterator i = set.iterator(); i.hasNext(); )
{
write(bout, (DERValue) i.next());
}
byte[] buf = bout.toByteArray();
writeLength(out, buf.length);
out.write(buf);
return buf.length;
}
private static int writeOID(OutputStream out, OID oid)
throws IOException
{
byte[] der = oid.getDER();
writeLength(out, der.length);
out.write(der);
return der.length;
}
private static int writeBitString(OutputStream out, BitString bs)
throws IOException
{
byte[] buf = bs.getShiftedByteArray();
out.write(buf.length + 1);
out.write(bs.getIgnoredBits());
out.write(buf);
return buf.length;
}
private static int writeString(OutputStream out, int tag, String str)
throws IOException
{
Charset charset = null;
byte[] b = null;
switch (tag & 0x1F)
{
case NUMERIC_STRING:
case PRINTABLE_STRING:
case T61_STRING:
case VIDEOTEX_STRING:
case IA5_STRING:
case GRAPHIC_STRING:
case ISO646_STRING:
case GENERAL_STRING:
charset = Charset.forName("ISO-8859-1");
break;
case UNIVERSAL_STRING:
case BMP_STRING:
charset = Charset.forName("UTF-16BE");
break;
case UTF8_STRING:
default:
charset = Charset.forName("UTF-8");
break;
}
if (charset == null)
throw new DEREncodingException("no charset");
CharsetEncoder encoder = charset.newEncoder();
ByteBuffer result = encoder.encode(CharBuffer.wrap(str));
if (result.hasArray())
{
b = result.array();
}
else
{
b = new byte[result.remaining()];
result.get(b);
}
writeLength(out, b.length);
out.write(b);
return b.length;
}
private static int writeDate(OutputStream out, int tag, Date date)
throws IOException
{
SimpleDateFormat sdf = null;
if ((tag & 0x1F) == UTC_TIME)
sdf = new SimpleDateFormat("yyMMddHHmmss'Z'");
else
sdf = new SimpleDateFormat("yyyyMMddHHmmss'.'SSS'Z'");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
byte[] b = sdf.format(date).getBytes("ISO-8859-1");
writeLength(out, b.length);
out.write(b);
return b.length;
}
// Package method.
// ------------------------------------------------------------------------
static void writeLength(OutputStream out, int len) throws IOException
{
if (len < 128)
out.write(len);
else if (len < 256)
{
out.write(0x81);
out.write(len);
}
else if (len < 65536)
{
out.write(0x82);
out.write(len >> 8);
out.write(len);
}
else if (len < 16777216)
{
out.write(0x83);
out.write(len >> 16);
out.write(len >> 8);
out.write(len);
}
else
{
out.write(0x84);
out.write(len >> 24);
out.write(len >> 16);
out.write(len >> 8);
out.write(len);
}
}
}
/* DERReader.java
Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.security.provider;
import java.math.BigInteger;
import gnu.java.security.der.DEREncodingException;
public class DERReader
{
byte source[];
int pos;
static final int UNIVERSAL = 1;
static final int APPLICATION = 2;
static final int CONTEXT_SPECIFIC = 3;
static final int PRIVATE = 4;
public DERReader()
{
source = null;
pos = 0;
}
public DERReader( byte source[] )
{
init( source );
}
public void init( String source )
{
init( source.getBytes() );
}
public void init( byte source[] )
{
this.source = source;
pos = 0;
}
public BigInteger getBigInteger() throws DEREncodingException
{
return new BigInteger( getPrimitive() );
}
//Reads Primitive, definite-length method
private byte[] getPrimitive() throws DEREncodingException
{
int tmp = pos;
//Read Identifier
byte identifier = source[tmp++];
if( (0x20 & identifier) != 0)
throw new DEREncodingException();
int type = translateLeadIdentifierByte(identifier);
//System.out.println("Type: " + type);
//get tag
int tag = (0x1f & identifier);
//if( tag == 0x1f)
// tag = getIdentifier(tmp);
//System.out.println("Tag: " + tag);
//get length
byte len = source[tmp]; //may be length of length parameter
long length = 0x7f & len;
int i;
if( (0x80 & len) != 0 ) {
//System.out.println("Extra Long Length");
len &= 0x7f;
//System.out.println("Length of Length: " + len);
//get length here
length = 0;
for( i = 0; i < len; i++ ) {
tmp++;
length <<= 8;
length += (source[tmp] < 0 ) ?
(256 + source[tmp]) :
source[tmp];
//System.out.println("Length of Length: " + length);
}
tmp++;
} else
tmp++;
/*System.out.println("Position: " + tmp);
System.out.println("Length: " + length);
for( i = 0; i < 10; i++)
System.out.print(source[tmp + i] + " ");
System.out.println();*/
byte tmpb[] = new byte[ (int)length ];
System.arraycopy( source, tmp, tmpb, 0, (int)length);
pos = (int)(tmp + length);
return tmpb;
}
private int translateLeadIdentifierByte(byte b)
{
if( (0x3f & b ) == b)
return UNIVERSAL;
else if( (0x7f & b ) == b)
return APPLICATION;
else if( (0xbf & b ) == b)
return CONTEXT_SPECIFIC;
else
return PRIVATE;
}
private int getIdentifier(int tpos)
{
while( (0x80 & source[tpos]) != 0)
tpos++;
return tpos;
}
}
/* DERWriter.java
Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.security.provider;
import java.math.BigInteger;
public class DERWriter
{
static final int UNIVERSAL = 1;
static final int APPLICATION = 2;
static final int CONTEXT_SPECIFIC = 3;
static final int PRIVATE = 4;
public DERWriter()
{}
public byte[] writeBigInteger( BigInteger i)
{
return writePrimitive( 0x02, UNIVERSAL, (int)Math.ceil((double)i.bitLength() / 8), i.toByteArray() );
}
private byte[] writePrimitive( int identifier, int identifierencoding,
int length, byte contents[])
{
return joinarrays( generateIdentifier( identifier, identifierencoding ), generateLength( length ), contents);
}
public byte[] joinarrays( byte a[], byte b[])
{
byte d[] = new byte[ a.length + b.length];
System.arraycopy( a, 0, d, 0, a.length);
System.arraycopy( b, 0, d, a.length, b.length);
return d;
}
public byte[] joinarrays( byte a[], byte b[], byte c[])
{
byte d[] = new byte[ a.length + b.length + c.length];
System.arraycopy( a, 0, d, 0, a.length);
System.arraycopy( b, 0, d, a.length, b.length);
System.arraycopy( c, 0, d, a.length + b.length, c.length);
return d;
}
private byte[] generateIdentifier(int identifier,
int identifierencoding)
{
byte b[];
if( identifier > 31 ) {
int count = (int)(Math.log( identifier ) / Math.log( 256 ));
b = new byte[ count + 1 ];
b[0] = (byte)(translateLeadIdentifierByte(identifierencoding)
| 0x1f);
int i;
for( i = 1; i < (count + 1); i++) {
b[i] = (byte)(0x7f & ( identifier >> (7 * (count - i)) ));
b[i] |= 0x80;
}
b[i - 1] ^= 0x80;
//System.out.println("Identifier1: " + b[0]);
return b;
} else {
b = new byte[1];
b[0] = (byte)((translateLeadIdentifierByte(identifierencoding)
| (byte)( identifier & 0x1f )) & 0xdf);
//System.out.println("Identifier2: " + b[0]);
return b;
}
}
private byte translateLeadIdentifierByte(int b)
{
if( b == UNIVERSAL)
return (byte)0x3f;
else if( b == APPLICATION)
return (byte)0x7f;
else if( b == CONTEXT_SPECIFIC)
return (byte)0xbf;
else
return (byte)0xC0;
}
private byte[] generateLength( int length )
{
byte b[];
if( length > 127 ) {
int count = (int)Math.ceil(Math.log( length ) / Math.log( 256 ));
//System.out.println("Length byte count: " + count);
b = new byte[ count + 1 ];
b[0] = (byte)((count & 0x7f) | 0x80);
for( int i = 1; i < (count + 1); i++) {
b[i] = (byte)( length >>> (8 * ( count - i) ));
//System.out.println("Length1 byte1: " + (length >>> (8 * ( count - i) )));
//System.out.println("Length1 byte2: " + b[i]);
}
//System.out.println("Length1: " + length);
return b;
} else {
b = new byte[1];
b[0] = (byte)( length & 0x7f );
//System.out.println("Length2: " + length);
return b;
}
}
}
/* DSAKeyFactory.java -- DSA key factory.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.security.provider;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.KeyFactorySpi;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.interfaces.DSAPrivateKey;
import java.security.interfaces.DSAPublicKey;
import java.security.spec.DSAPrivateKeySpec;
import java.security.spec.DSAPublicKeySpec;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
/**
* DSA key factory.
*
* @author Casey Marshall (rsdio@metastatic.org)
*/
public class DSAKeyFactory extends KeyFactorySpi
{
// Constructor.
// ------------------------------------------------------------------------
public DSAKeyFactory()
{
super();
}
// Instance methods.
// ------------------------------------------------------------------------
protected PrivateKey engineGeneratePrivate(KeySpec keySpec)
throws InvalidKeySpecException
{
if (!(keySpec instanceof DSAPrivateKeySpec))
throw new InvalidKeySpecException();
return new GnuDSAPrivateKey(
((DSAPrivateKeySpec) keySpec).getX(),
((DSAPrivateKeySpec) keySpec).getP(),
((DSAPrivateKeySpec) keySpec).getQ(),
((DSAPrivateKeySpec) keySpec).getG());
}
protected PublicKey engineGeneratePublic(KeySpec keySpec)
throws InvalidKeySpecException
{
if (!(keySpec instanceof DSAPublicKeySpec))
throw new InvalidKeySpecException();
return new GnuDSAPublicKey(
((DSAPublicKeySpec) keySpec).getY(),
((DSAPublicKeySpec) keySpec).getP(),
((DSAPublicKeySpec) keySpec).getQ(),
((DSAPublicKeySpec) keySpec).getG());
}
protected KeySpec engineGetKeySpec(Key key, Class keySpec)
throws InvalidKeySpecException
{
if ((key instanceof DSAPublicKey) &&
keySpec.isAssignableFrom(DSAPublicKeySpec.class))
{
return new DSAPublicKeySpec(((DSAPublicKey) key).getY(),
((DSAPublicKey) key).getParams().getP(),
((DSAPublicKey) key).getParams().getQ(),
((DSAPublicKey) key).getParams().getG());
}
if ((key instanceof DSAPrivateKey) &&
keySpec.isAssignableFrom(DSAPrivateKeySpec.class))
{
return new DSAPrivateKeySpec(((DSAPrivateKey) key).getX(),
((DSAPrivateKey) key).getParams().getP(),
((DSAPrivateKey) key).getParams().getQ(),
((DSAPrivateKey) key).getParams().getG());
}
throw new InvalidKeySpecException();
}
protected Key engineTranslateKey(Key key) throws InvalidKeyException
{
if ((key instanceof GnuDSAPublicKey) || (key instanceof GnuDSAPrivateKey))
return key;
if (key instanceof DSAPublicKey)
return new GnuDSAPublicKey(((DSAPublicKey) key).getY(),
((DSAPublicKey) key).getParams().getP(),
((DSAPublicKey) key).getParams().getQ(),
((DSAPublicKey) key).getParams().getG());
if (key instanceof DSAPrivateKey)
return new GnuDSAPrivateKey(((DSAPrivateKey) key).getX(),
((DSAPrivateKey) key).getParams().getP(),
((DSAPrivateKey) key).getParams().getQ(),
((DSAPrivateKey) key).getParams().getG());
throw new InvalidKeyException();
}
}
/* DSAParameters.java --- DSA Parameters Implementation /* DSAParameters.java --- DSA Parameters Implementation
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999,2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -38,15 +38,28 @@ exception statement from your version. */ ...@@ -38,15 +38,28 @@ exception statement from your version. */
package gnu.java.security.provider; package gnu.java.security.provider;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.math.BigInteger; import java.math.BigInteger;
import java.security.AlgorithmParametersSpi; import java.security.AlgorithmParametersSpi;
import java.security.InvalidAlgorithmParameterException; import java.security.InvalidAlgorithmParameterException;
import java.security.spec.AlgorithmParameterSpec; import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.DSAParameterSpec; import java.security.spec.DSAParameterSpec;
import java.security.spec.InvalidParameterSpecException; import java.security.spec.InvalidParameterSpecException;
import java.util.ArrayList;
import java.util.List;
import java.util.Random; import java.util.Random;
import gnu.java.io.ASN1ParsingException;
import gnu.java.security.der.DER;
import gnu.java.security.der.DEREncodingException; import gnu.java.security.der.DEREncodingException;
import gnu.java.security.der.DERReader;
import gnu.java.security.der.DERValue;
import gnu.java.security.der.DERWriter;
import gnu.java.security.util.Prime; import gnu.java.security.util.Prime;
...@@ -76,7 +89,7 @@ public void engineInit(AlgorithmParameterSpec paramSpec) ...@@ -76,7 +89,7 @@ public void engineInit(AlgorithmParameterSpec paramSpec)
DSAParameterSpec dsaParamSpec = (DSAParameterSpec)paramSpec; DSAParameterSpec dsaParamSpec = (DSAParameterSpec)paramSpec;
p = dsaParamSpec.getP(); p = dsaParamSpec.getP();
q = dsaParamSpec.getQ(); q = dsaParamSpec.getQ();
q = dsaParamSpec.getG(); g = dsaParamSpec.getG();
} }
else else
throw new InvalidParameterSpecException("Only accepts DSAParameterSpec"); throw new InvalidParameterSpecException("Only accepts DSAParameterSpec");
...@@ -85,16 +98,20 @@ public void engineInit(AlgorithmParameterSpec paramSpec) ...@@ -85,16 +98,20 @@ public void engineInit(AlgorithmParameterSpec paramSpec)
public void engineInit(byte[] params) public void engineInit(byte[] params)
throws IOException throws IOException
{ {
DERReader reader = new DERReader( params ); DERReader in = new DERReader(params);
try { DERValue val = in.read();
if (val.getValue() != DER.CONSTRUCTED_VALUE)
p = reader.getBigInteger(); throw new ASN1ParsingException("badly formed parameters");
q = reader.getBigInteger(); try
g = reader.getBigInteger(); {
p = (BigInteger) in.read().getValue();
} catch ( DEREncodingException DERee) { q = (BigInteger) in.read().getValue();
throw new IOException("Invalid Format: Only accepts ASN.1"); g = (BigInteger) in.read().getValue();
} }
catch (Exception x)
{
throw new ASN1ParsingException("badly formed parameters");
}
} }
public void engineInit(byte[] params, String format) public void engineInit(byte[] params, String format)
...@@ -117,10 +134,13 @@ public AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec) ...@@ -117,10 +134,13 @@ public AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
public byte[] engineGetEncoded() public byte[] engineGetEncoded()
throws IOException throws IOException
{ {
DERWriter writer = new DERWriter(); ByteArrayOutputStream bout = new ByteArrayOutputStream();
return writer.joinarrays( writer.writeBigInteger(p), ArrayList seq = new ArrayList(3);
writer.writeBigInteger(q), seq.add(new DERValue(DER.INTEGER, p));
writer.writeBigInteger(g) ); seq.add(new DERValue(DER.INTEGER, q));
seq.add(new DERValue(DER.INTEGER, g));
DERWriter.write(bout, new DERValue(DER.CONSTRUCTED | DER.SEQUENCE, seq));
return bout.toByteArray();
} }
...@@ -135,7 +155,7 @@ public byte[] engineGetEncoded(String format) ...@@ -135,7 +155,7 @@ public byte[] engineGetEncoded(String format)
public String engineToString() public String engineToString()
{ {
String lineSeparator = System.getProperty("line.seperator"); String lineSeparator = System.getProperty("line.seperator");
return ("q: " + q + lineSeparator + "p: " + p + lineSeparator + "g:" + g); return ("q: " + q + " p: " + p + " g: " + g);
} }
} }
/* DSASignature.java /* DSASignature.java
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999,2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -37,7 +37,12 @@ exception statement from your version. */ ...@@ -37,7 +37,12 @@ exception statement from your version. */
package gnu.java.security.provider; package gnu.java.security.provider;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.math.BigInteger; import java.math.BigInteger;
import java.security.InvalidAlgorithmParameterException; import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException; import java.security.InvalidKeyException;
import java.security.InvalidParameterException; import java.security.InvalidParameterException;
...@@ -52,8 +57,17 @@ import java.security.SignatureSpi; ...@@ -52,8 +57,17 @@ import java.security.SignatureSpi;
import java.security.interfaces.DSAPrivateKey; import java.security.interfaces.DSAPrivateKey;
import java.security.interfaces.DSAPublicKey; import java.security.interfaces.DSAPublicKey;
import java.security.spec.AlgorithmParameterSpec; import java.security.spec.AlgorithmParameterSpec;
import java.util.ArrayList;
import java.util.List;
import java.util.Random; import java.util.Random;
import gnu.java.io.ASN1ParsingException;
import gnu.java.security.der.DER;
import gnu.java.security.der.DEREncodingException; import gnu.java.security.der.DEREncodingException;
import gnu.java.security.der.DERReader;
import gnu.java.security.der.DERValue;
import gnu.java.security.der.DERWriter;
public class DSASignature extends SignatureSpi public class DSASignature extends SignatureSpi
{ {
...@@ -157,9 +171,14 @@ public class DSASignature extends SignatureSpi ...@@ -157,9 +171,14 @@ public class DSASignature extends SignatureSpi
BigInteger s = sha.add( x.multiply( r ) ); BigInteger s = sha.add( x.multiply( r ) );
s = s.multiply( k.modInverse(q) ).mod( q ); s = s.multiply( k.modInverse(q) ).mod( q );
DERWriter writer = new DERWriter(); ByteArrayOutputStream bout = new ByteArrayOutputStream();
return writer.joinarrays( writer.writeBigInteger( r ), writer.writeBigInteger( s ) ); ArrayList seq = new ArrayList(2);
seq.set(0, new DERValue(DER.INTEGER, r));
seq.set(1, new DERValue(DER.INTEGER, s));
DERWriter.write(bout, new DERValue(DER.CONSTRUCTED | DER.SEQUENCE, seq));
return bout.toByteArray();
} catch (IOException ioe) {
throw new SignatureException();
} catch ( ArithmeticException ae ) { } catch ( ArithmeticException ae ) {
throw new SignatureException(); throw new SignatureException();
} }
...@@ -180,9 +199,12 @@ public class DSASignature extends SignatureSpi ...@@ -180,9 +199,12 @@ public class DSASignature extends SignatureSpi
{ {
//Decode sigBytes from ASN.1 DER encoding //Decode sigBytes from ASN.1 DER encoding
try { try {
DERReader reader = new DERReader( sigBytes ); DERReader in = new DERReader(sigBytes);
BigInteger r = reader.getBigInteger(); DERValue val = in.read();
BigInteger s = reader.getBigInteger(); if (!val.isConstructed())
throw new SignatureException("badly formed signature");
BigInteger r = (BigInteger) in.read().getValue();
BigInteger s = (BigInteger) in.read().getValue();
BigInteger g = publicKey.getParams().getG(); BigInteger g = publicKey.getParams().getG();
BigInteger p = publicKey.getParams().getP(); BigInteger p = publicKey.getParams().getP();
...@@ -206,8 +228,8 @@ public class DSASignature extends SignatureSpi ...@@ -206,8 +228,8 @@ public class DSASignature extends SignatureSpi
return true; return true;
else else
return false; return false;
} catch ( DEREncodingException deree ) { } catch (IOException ioe) {
throw new SignatureException(); throw new SignatureException("badly formed signature");
} }
} }
......
/* Gnu.java --- Gnu provider main class /* Gnu.java --- Gnu provider main class
Copyright (C) 1999, 2002 Free Software Foundation, Inc. Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -43,7 +43,7 @@ public final class Gnu extends Provider ...@@ -43,7 +43,7 @@ public final class Gnu extends Provider
{ {
public Gnu() public Gnu()
{ {
super( "GNU", 1.0, "GNU provider v1.0 implementing SHA-1, MD5, DSA"); super("GNU", 1.0, "GNU provider v1.0 implementing SHA-1, MD5, DSA, X.509 Certificates");
// Note that all implementation class names are referenced by using // Note that all implementation class names are referenced by using
// Class.getName(). That way when we staticly link the Gnu provider // Class.getName(). That way when we staticly link the Gnu provider
...@@ -51,7 +51,7 @@ public final class Gnu extends Provider ...@@ -51,7 +51,7 @@ public final class Gnu extends Provider
// Signature // Signature
put("Signature.SHA1withDSA", put("Signature.SHA1withDSA",
gnu.java.security.provider.DSASignature.class.getName()); gnu.java.security.provider.DSASignature.class.getName());
put("Alg.Alias.Signature.DSS", "SHA1withDSA"); put("Alg.Alias.Signature.DSS", "SHA1withDSA");
put("Alg.Alias.Signature.DSA", "SHA1withDSA"); put("Alg.Alias.Signature.DSA", "SHA1withDSA");
...@@ -68,12 +68,20 @@ public final class Gnu extends Provider ...@@ -68,12 +68,20 @@ public final class Gnu extends Provider
// Key Pair Generator // Key Pair Generator
put("KeyPairGenerator.DSA", put("KeyPairGenerator.DSA",
gnu.java.security.provider.DSAKeyPairGenerator.class.getName()); gnu.java.security.provider.DSAKeyPairGenerator.class.getName());
put("Alg.Alias.KeyPairGenerator.OID.1.2.840.10040.4.1", "DSA"); put("Alg.Alias.KeyPairGenerator.OID.1.2.840.10040.4.1", "DSA");
put("Alg.Alias.KeyPairGenerator.1.2.840.10040.4.1", "DSA"); put("Alg.Alias.KeyPairGenerator.1.2.840.10040.4.1", "DSA");
put("Alg.Alias.KeyPairGenerator.1.3.14.3.2.12", "DSA"); put("Alg.Alias.KeyPairGenerator.1.3.14.3.2.12", "DSA");
// Key Factory
put("KeyFactory.DSA",
gnu.java.security.provider.DSAKeyFactory.class.getName());
put("Alg.Alias.KeyFactory.OID.1.2.840.10040.4.1", "DSA");
put("Alg.Alias.KeyFactory.1.2.840.10040.4.1", "DSA");
put("Alg.Alias.KeyFactory.1.3.14.3.2.12", "DSA");
// Message Digests // Message Digests
put("MessageDigest.SHA", gnu.java.security.provider.SHA.class.getName()); put("MessageDigest.SHA", gnu.java.security.provider.SHA.class.getName());
put("MessageDigest.MD5", gnu.java.security.provider.MD5.class.getName()); put("MessageDigest.MD5", gnu.java.security.provider.MD5.class.getName());
...@@ -84,15 +92,20 @@ public final class Gnu extends Provider ...@@ -84,15 +92,20 @@ public final class Gnu extends Provider
// Algorithm Parameters // Algorithm Parameters
put("AlgorithmParameters.DSA", put("AlgorithmParameters.DSA",
gnu.java.security.provider.DSAParameters.class.getName()); gnu.java.security.provider.DSAParameters.class.getName());
// Algorithm Parameter Generator // Algorithm Parameter Generator
put("AlgorithmParameterGenerator.DSA", put("AlgorithmParameterGenerator.DSA",
gnu.java.security.provider.DSAParameterGenerator.class.getName()); gnu.java.security.provider.DSAParameterGenerator.class.getName());
// SecureRandom // SecureRandom
put("SecureRandom.SHA1PRNG", put("SecureRandom.SHA1PRNG",
gnu.java.security.provider.SHA1PRNG.class.getName()); gnu.java.security.provider.SHA1PRNG.class.getName());
// CertificateFactory
put("CertificateFactory.X.509",
gnu.java.security.provider.X509CertificateFactory.class.getName());
put("Alg.Alias.CertificateFactory.X509", "X.509");
} }
} }
...@@ -82,4 +82,10 @@ public class GnuDSAPrivateKey implements DSAPrivateKey ...@@ -82,4 +82,10 @@ public class GnuDSAPrivateKey implements DSAPrivateKey
{ {
return x; return x;
} }
public String toString()
{
return "GnuDSAPrivateKey: x=" + x.toString(16) + " p=" + p.toString(16)
+ " q=" + q.toString(16) + " g=" + g.toString(16);
}
} }
/* GnuDSAPublicKey.java --- Gnu DSA Public Key /* GnuDSAPublicKey.java --- Gnu DSA Public Key
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999,2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -82,4 +82,10 @@ public class GnuDSAPublicKey implements DSAPublicKey ...@@ -82,4 +82,10 @@ public class GnuDSAPublicKey implements DSAPublicKey
{ {
return y; return y;
} }
public String toString()
{
return "GnuDSAPublicKey: y=" + y.toString(16) + " p=" + p.toString(16)
+ " q=" + q.toString(16) + " g=" + g.toString(16);
}
} }
/* X509CertificateFactory.java -- generates X.509 certificates.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.security.provider;
import java.io.BufferedInputStream;
import java.io.EOFException;
import java.io.InputStream;
import java.io.IOException;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactorySpi;
import java.security.cert.CRL;
import java.security.cert.CRLException;
import java.util.Collection;
import java.util.LinkedList;
import gnu.java.io.Base64InputStream;
import gnu.java.security.x509.X509Certificate;
import gnu.java.security.x509.X509CRL;
public class X509CertificateFactory extends CertificateFactorySpi
{
// Constants.
// ------------------------------------------------------------------------
public static final String BEGIN_CERTIFICATE = "-----BEGIN CERTIFICATE-----";
public static final String END_CERTIFICATE = "-----END CERTIFICATE-----";
public static final String BEGIN_X509_CRL = "-----BEGIN X509 CRL-----";
public static final String END_X509_CRL = "-----END X509 CRL-----";
// Constructors.
// ------------------------------------------------------------------------
public X509CertificateFactory()
{
super();
}
// Instance methods.
// ------------------------------------------------------------------------
public Certificate engineGenerateCertificate(InputStream inStream)
throws CertificateException
{
try
{
return generateCert(inStream);
}
catch (IOException ioe)
{
throw new CertificateException(ioe.toString());
}
}
public Collection engineGenerateCertificates(InputStream inStream)
throws CertificateException
{
LinkedList certs = new LinkedList();
while (true)
{
try
{
certs.add(generateCert(inStream));
}
catch (EOFException eof)
{
break;
}
catch (IOException ioe)
{
throw new CertificateException(ioe.toString());
}
}
return certs;
}
public CRL engineGenerateCRL(InputStream inStream) throws CRLException
{
try
{
return generateCRL(inStream);
}
catch (IOException ioe)
{
throw new CRLException(ioe.toString());
}
}
public Collection engineGenerateCRLs(InputStream inStream)
throws CRLException
{
LinkedList crls = new LinkedList();
while (true)
{
try
{
crls.add(generateCRL(inStream));
}
catch (EOFException eof)
{
break;
}
catch (IOException ioe)
{
throw new CRLException(ioe.toString());
}
}
return crls;
}
// Own methods.
// ------------------------------------------------------------------------
private X509Certificate generateCert(InputStream inStream)
throws IOException, CertificateException
{
if (!inStream.markSupported())
inStream = new BufferedInputStream(inStream, 8192);
inStream.mark(20);
int i = inStream.read();
if (i == -1)
throw new EOFException();
// If the input is in binary DER format, the first byte MUST be
// 0x30, which stands for the ASN.1 [UNIVERSAL 16], which is the
// UNIVERSAL SEQUENCE, with the CONSTRUCTED bit (0x20) set.
//
// So if we do not see 0x30 here we will assume it is in Base-64.
if (i != 0x30)
{
inStream.reset();
StringBuffer line = new StringBuffer(80);
do
{
line.setLength(0);
do
{
i = inStream.read();
if (i == -1)
throw new EOFException();
if (i != '\n' && i != '\r')
line.append((char) i);
}
while (i != '\n' && i != '\r');
}
while (!line.toString().equals(BEGIN_CERTIFICATE));
X509Certificate ret = new X509Certificate(
new BufferedInputStream(new Base64InputStream(inStream), 8192));
line.setLength(0);
line.append('-'); // Base64InputStream will eat this.
do
{
i = inStream.read();
if (i == -1)
throw new EOFException();
if (i != '\n' && i != '\r')
line.append((char) i);
}
while (i != '\n' && i != '\r');
// XXX ???
if (!line.toString().equals(END_CERTIFICATE))
throw new CertificateException("no end-of-certificate marker");
return ret;
}
else
{
inStream.reset();
return new X509Certificate(inStream);
}
}
private X509CRL generateCRL(InputStream inStream)
throws IOException, CRLException
{
if (!inStream.markSupported())
inStream = new BufferedInputStream(inStream, 8192);
inStream.mark(20);
int i = inStream.read();
if (i == -1)
throw new EOFException();
// If the input is in binary DER format, the first byte MUST be
// 0x30, which stands for the ASN.1 [UNIVERSAL 16], which is the
// UNIVERSAL SEQUENCE, with the CONSTRUCTED bit (0x20) set.
//
// So if we do not see 0x30 here we will assume it is in Base-64.
if (i != 0x30)
{
inStream.reset();
StringBuffer line = new StringBuffer(80);
do
{
line.setLength(0);
do
{
i = inStream.read();
if (i == -1)
throw new EOFException();
if (i != '\n' && i != '\r')
line.append((char) i);
}
while (i != '\n' && i != '\r');
}
while (!line.toString().startsWith(BEGIN_X509_CRL));
X509CRL ret = new X509CRL(
new BufferedInputStream(new Base64InputStream(inStream), 8192));
line.setLength(0);
line.append('-'); // Base64InputStream will eat this.
do
{
i = inStream.read();
if (i == -1)
throw new EOFException();
if (i != '\n' && i != '\r')
line.append((char) i);
}
while (i != '\n' && i != '\r');
// XXX ???
if (!line.toString().startsWith(END_X509_CRL))
throw new CRLException("no end-of-CRL marker");
return ret;
}
else
{
inStream.reset();
return new X509CRL(inStream);
}
}
}
/* X509CRLEntry.java -- entry in a X.509 CRL.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.security.x509;
import java.io.InputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.security.cert.CRLException;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import gnu.java.io.ASN1ParsingException;
import gnu.java.security.OID;
import gnu.java.security.der.DERReader;
import gnu.java.security.der.DERValue;
import gnu.java.security.der.DERWriter;
/**
* A single entry in a X.509 certificate revocation list.
*
* @see X509CRL
* @author Casey Marshall
*/
class X509CRLEntry extends java.security.cert.X509CRLEntry
{
// Constants and fields.
// ------------------------------------------------------------------------
/** The DER encoded form of this CRL entry. */
private byte[] encoded;
/** The revoked certificate's serial number. */
private BigInteger serialNo;
/** The date the certificate was revoked. */
private Date revocationDate;
/** The encoded extensions. */
private HashMap extensions;
/** The set of critical extension OIDs. */
private HashSet critOids;
/** the set of non-critical extension OIDs. */
private HashSet nonCritOids;
// Constructor.
// ------------------------------------------------------------------------
/**
* Create a new X.509 certificate revocation list entry from the given
* input stream and CRL version number.
*
* @param version The CRL version.
* @param encoded The stream of DER bytes.
* @throws CRLException If the ASN.1 structure is invalid.
* @throws IOException If the bytes cannot be read.
*/
X509CRLEntry(int version, InputStream encoded)
throws CRLException, IOException
{
super();
extensions = new HashMap();
critOids = new HashSet();
nonCritOids = new HashSet();
try
{
parse(version, encoded);
}
catch (IOException ioe)
{
throw ioe;
}
catch (Exception x)
{
throw new CRLException(x.toString());
}
}
// X509CRLEntry methods.
// ------------------------------------------------------------------------
public boolean equals(Object o)
{
return ((X509CRLEntry) o).serialNo.equals(serialNo) &&
((X509CRLEntry) o).revocationDate.equals(revocationDate);
}
public int hashCode()
{
return serialNo.hashCode();
}
public byte[] getEncoded() throws CRLException
{
return (byte[]) encoded.clone();
}
public BigInteger getSerialNumber()
{
return serialNo;
}
public Date getRevocationDate()
{
return (Date) revocationDate.clone();
}
public boolean hasExtensions()
{
return ! extensions.isEmpty();
}
public String toString()
{
return "X509CRLEntry serial=" + serialNo + " revocation date="
+ revocationDate + " critExt=" + critOids + " ext=" + nonCritOids;
}
// X509Extension methods.
// ------------------------------------------------------------------------
public boolean hasUnsupportedCriticalExtension()
{
return false; // XXX
}
public Set getCriticalExtensionOIDs()
{
return Collections.unmodifiableSet(critOids);
}
public Set getNonCriticalExtensionOIDs()
{
return Collections.unmodifiableSet(nonCritOids);
}
public byte[] getExtensionValue(String oid)
{
byte[] ext = (byte[]) extensions.get(oid);
if (ext != null)
return (byte[]) ext.clone();
return null;
}
// Own methods.
// ------------------------------------------------------------------------
private void parse(int version, InputStream in) throws Exception
{
DERReader der = new DERReader(in);
DERValue entry = der.read();
if (!entry.isConstructed())
throw new ASN1ParsingException("malformed revokedCertificate");
encoded = entry.getEncoded();
int len = 0;
DERValue val = der.read();
serialNo = (BigInteger) val.getValue();
len += DERWriter.definiteEncodingSize(val.getLength())
+ val.getLength() + 1;
val = der.read();
revocationDate = (Date) val.getValue();
len += DERWriter.definiteEncodingSize(val.getLength())
+ val.getLength() + 1;
if (len < entry.getLength())
{
if (version < 2)
throw new ASN1ParsingException("extra data in CRL entry");
while (len < entry.getLength())
{
val = der.read();
if (!val.isConstructed())
throw new ASN1ParsingException("malformed Extension");
OID extOid = (OID) der.read().getValue();
Boolean critical = Boolean.valueOf(false);
DERValue val2 = der.read();
if (val2.getValue() instanceof Boolean)
{
critical = (Boolean) val2.getValue();
val2 = der.read();
}
byte[] ext = (byte[]) val2.getValue();
extensions.put(extOid.toString(), ext);
if (critical.booleanValue())
critOids.add(extOid.toString());
else
nonCritOids.add(extOid.toString());
len += val.getEncodedLength();
}
}
}
}
...@@ -39,6 +39,8 @@ package java.security; ...@@ -39,6 +39,8 @@ package java.security;
import java.security.spec.AlgorithmParameterSpec; import java.security.spec.AlgorithmParameterSpec;
import gnu.java.security.Engine;
/** /**
* <p>The <code>AlgorithmParameterGenerator</code> class is used to generate a * <p>The <code>AlgorithmParameterGenerator</code> class is used to generate a
* set of parameters to be used with a certain algorithm. Parameter generators * set of parameters to be used with a certain algorithm. Parameter generators
...@@ -201,7 +203,11 @@ public class AlgorithmParameterGenerator ...@@ -201,7 +203,11 @@ public class AlgorithmParameterGenerator
(AlgorithmParameterGeneratorSpi) Engine.getInstance( (AlgorithmParameterGeneratorSpi) Engine.getInstance(
ALGORITHM_PARAMETER_GENERATOR, algorithm, provider), ALGORITHM_PARAMETER_GENERATOR, algorithm, provider),
provider, algorithm); provider, algorithm);
} }
catch (java.lang.reflect.InvocationTargetException ite)
{
throw new NoSuchAlgorithmException(algorithm);
}
catch (ClassCastException cce) catch (ClassCastException cce)
{ {
throw new NoSuchAlgorithmException(algorithm); throw new NoSuchAlgorithmException(algorithm);
......
...@@ -41,6 +41,8 @@ import java.security.spec.InvalidParameterSpecException; ...@@ -41,6 +41,8 @@ import java.security.spec.InvalidParameterSpecException;
import java.security.spec.AlgorithmParameterSpec; import java.security.spec.AlgorithmParameterSpec;
import java.io.IOException; import java.io.IOException;
import gnu.java.security.Engine;
/** /**
* <p>This class is used as an opaque representation of cryptographic * <p>This class is used as an opaque representation of cryptographic
* parameters.</p> * parameters.</p>
...@@ -204,6 +206,10 @@ public class AlgorithmParameters ...@@ -204,6 +206,10 @@ public class AlgorithmParameters
Engine.getInstance(ALGORITHM_PARAMETERS, algorithm, provider), Engine.getInstance(ALGORITHM_PARAMETERS, algorithm, provider),
provider, algorithm); provider, algorithm);
} }
catch (java.lang.reflect.InvocationTargetException ite)
{
throw new NoSuchAlgorithmException(algorithm);
}
catch (ClassCastException cce) catch (ClassCastException cce)
{ {
throw new NoSuchAlgorithmException(algorithm); throw new NoSuchAlgorithmException(algorithm);
......
...@@ -41,6 +41,8 @@ import java.security.spec.KeySpec; ...@@ -41,6 +41,8 @@ import java.security.spec.KeySpec;
import java.security.spec.InvalidKeySpecException; import java.security.spec.InvalidKeySpecException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import gnu.java.security.Engine;
/** /**
* <p>Key factories are used to convert keys (opaque cryptographic keys of type * <p>Key factories are used to convert keys (opaque cryptographic keys of type
* {@link Key}) into key specifications (transparent representations of the * {@link Key}) into key specifications (transparent representations of the
...@@ -192,6 +194,10 @@ public class KeyFactory ...@@ -192,6 +194,10 @@ public class KeyFactory
Engine.getInstance(KEY_FACTORY, algorithm, provider), Engine.getInstance(KEY_FACTORY, algorithm, provider),
provider, algorithm); provider, algorithm);
} }
catch (java.lang.reflect.InvocationTargetException ite)
{
throw new NoSuchAlgorithmException(algorithm);
}
catch (ClassCastException cce) catch (ClassCastException cce)
{ {
throw new NoSuchAlgorithmException(algorithm); throw new NoSuchAlgorithmException(algorithm);
......
...@@ -39,6 +39,8 @@ package java.security; ...@@ -39,6 +39,8 @@ package java.security;
import java.security.spec.AlgorithmParameterSpec; import java.security.spec.AlgorithmParameterSpec;
import gnu.java.security.Engine;
/** /**
* <p>The <code>KeyPairGenerator</code> class is used to generate pairs of * <p>The <code>KeyPairGenerator</code> class is used to generate pairs of
* public and private keys. Key pair generators are constructed using the * public and private keys. Key pair generators are constructed using the
...@@ -231,7 +233,16 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi ...@@ -231,7 +233,16 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
if (provider == null) if (provider == null)
throw new IllegalArgumentException("Illegal provider"); throw new IllegalArgumentException("Illegal provider");
Object o = Engine.getInstance(KEY_PAIR_GENERATOR, algorithm, provider); Object o = null;
try
{
o = Engine.getInstance(KEY_PAIR_GENERATOR, algorithm, provider);
}
catch (java.lang.reflect.InvocationTargetException ite)
{
throw new NoSuchAlgorithmException(algorithm);
}
KeyPairGenerator result = null; KeyPairGenerator result = null;
if (o instanceof KeyPairGeneratorSpi) if (o instanceof KeyPairGeneratorSpi)
{ {
......
...@@ -43,6 +43,8 @@ import java.security.cert.CertificateException; ...@@ -43,6 +43,8 @@ import java.security.cert.CertificateException;
import java.util.Date; import java.util.Date;
import java.util.Enumeration; import java.util.Enumeration;
import gnu.java.security.Engine;
/** /**
* Keystore represents an in-memory collection of keys and * Keystore represents an in-memory collection of keys and
* certificates. There are two types of entries: * certificates. There are two types of entries:
...@@ -194,6 +196,10 @@ public class KeyStore ...@@ -194,6 +196,10 @@ public class KeyStore
{ {
throw new KeyStoreException(type); throw new KeyStoreException(type);
} }
catch (java.lang.reflect.InvocationTargetException ite)
{
throw new KeyStoreException(type);
}
catch (ClassCastException cce) catch (ClassCastException cce)
{ {
throw new KeyStoreException(type); throw new KeyStoreException(type);
......
...@@ -37,6 +37,8 @@ exception statement from your version. */ ...@@ -37,6 +37,8 @@ exception statement from your version. */
package java.security; package java.security;
import gnu.java.security.Engine;
/** /**
* <p>This <code>MessageDigest</code> class provides applications the * <p>This <code>MessageDigest</code> class provides applications the
* functionality of a message digest algorithm, such as <i>MD5</i> or <i>SHA</i>. * functionality of a message digest algorithm, such as <i>MD5</i> or <i>SHA</i>.
...@@ -197,7 +199,15 @@ public abstract class MessageDigest extends MessageDigestSpi ...@@ -197,7 +199,15 @@ public abstract class MessageDigest extends MessageDigestSpi
throw new IllegalArgumentException("Illegal provider"); throw new IllegalArgumentException("Illegal provider");
MessageDigest result = null; MessageDigest result = null;
Object o = Engine.getInstance(MESSAGE_DIGEST, algorithm, provider); Object o = null;
try
{
o = Engine.getInstance(MESSAGE_DIGEST, algorithm, provider);
}
catch (java.lang.reflect.InvocationTargetException ite)
{
throw new NoSuchAlgorithmException(algorithm);
}
if (o instanceof MessageDigestSpi) if (o instanceof MessageDigestSpi)
{ {
......
...@@ -93,7 +93,7 @@ public class SecureClassLoader extends ClassLoader ...@@ -93,7 +93,7 @@ public class SecureClassLoader extends ClassLoader
/** /**
Returns a PermissionCollection for the specified CodeSource. Returns a PermissionCollection for the specified CodeSource.
The default implmentation invokes The default implementation invokes
java.security.Policy.getPermissions. java.security.Policy.getPermissions.
This method is called by defineClass that takes a CodeSource This method is called by defineClass that takes a CodeSource
......
/* SecureRandom.java --- Secure Random class implmentation /* SecureRandom.java --- Secure Random class implementation
Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc. Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -41,6 +41,8 @@ import java.io.Serializable; ...@@ -41,6 +41,8 @@ import java.io.Serializable;
import java.util.Random; import java.util.Random;
import java.util.Enumeration; import java.util.Enumeration;
import gnu.java.security.Engine;
/** /**
* An interface to a cryptographically secure pseudo-random number * An interface to a cryptographically secure pseudo-random number
* generator (PRNG). Random (or at least unguessable) numbers are used * generator (PRNG). Random (or at least unguessable) numbers are used
...@@ -162,7 +164,7 @@ public class SecureRandom extends Random ...@@ -162,7 +164,7 @@ public class SecureRandom extends Random
* the first provider that implements it. * the first provider that implements it.
* *
* @param algorithm The algorithm name. * @param algorithm The algorithm name.
* @return A new SecureRandom implmenting the given algorithm. * @return A new SecureRandom implementing the given algorithm.
* @throws NoSuchAlgorithmException If no installed provider implements * @throws NoSuchAlgorithmException If no installed provider implements
* the given algorithm. * the given algorithm.
*/ */
...@@ -191,7 +193,7 @@ public class SecureRandom extends Random ...@@ -191,7 +193,7 @@ public class SecureRandom extends Random
* *
* @param algorithm The algorithm name. * @param algorithm The algorithm name.
* @param provider The provider name. * @param provider The provider name.
* @return A new SecureRandom implmenting the chosen algorithm. * @return A new SecureRandom implementing the chosen algorithm.
* @throws NoSuchAlgorithmException If the named provider does not implement * @throws NoSuchAlgorithmException If the named provider does not implement
* the algorithm, or if the implementation cannot be * the algorithm, or if the implementation cannot be
* instantiated. * instantiated.
...@@ -234,6 +236,10 @@ public class SecureRandom extends Random ...@@ -234,6 +236,10 @@ public class SecureRandom extends Random
Engine.getInstance(SECURE_RANDOM, algorithm, provider), Engine.getInstance(SECURE_RANDOM, algorithm, provider),
provider); provider);
} }
catch (java.lang.reflect.InvocationTargetException ite)
{
throw new NoSuchAlgorithmException(algorithm);
}
catch (ClassCastException cce) catch (ClassCastException cce)
{ {
throw new NoSuchAlgorithmException(algorithm); throw new NoSuchAlgorithmException(algorithm);
......
/* Security.java --- Java base security class implmentation /* Security.java --- Java base security class implementation
Copyright (C) 1999, 2001, 2002, 2003, Free Software Foundation, Inc. Copyright (C) 1999, 2001, 2002, 2003, Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
......
...@@ -41,6 +41,8 @@ import java.security.cert.Certificate; ...@@ -41,6 +41,8 @@ import java.security.cert.Certificate;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import java.security.spec.AlgorithmParameterSpec; import java.security.spec.AlgorithmParameterSpec;
import gnu.java.security.Engine;
/** /**
* <p>This <code>Signature</code> class is used to provide applications the * <p>This <code>Signature</code> class is used to provide applications the
* functionality of a digital signature algorithm. Digital signatures are used * functionality of a digital signature algorithm. Digital signatures are used
...@@ -237,7 +239,15 @@ public abstract class Signature extends SignatureSpi ...@@ -237,7 +239,15 @@ public abstract class Signature extends SignatureSpi
throw new IllegalArgumentException("Illegal provider"); throw new IllegalArgumentException("Illegal provider");
Signature result = null; Signature result = null;
Object o = Engine.getInstance(SIGNATURE, algorithm, provider); Object o = null;
try
{
o = Engine.getInstance(SIGNATURE, algorithm, provider);
}
catch (java.lang.reflect.InvocationTargetException ite)
{
throw new NoSuchAlgorithmException(algorithm);
}
if (o instanceof SignatureSpi) if (o instanceof SignatureSpi)
{ {
......
/* CRLSelector.java -- matches CRLs against criteria.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.security.cert;
/**
* A generic interface to classes that match certificate revocation
* lists (CRLs) to some given criteria. Implementations of this
* interface are useful for finding {@link CRL} objects in a {@link
* CertStore}.
*
* @see CertStore
* @see CertSelector
* @see X509CRLSelector
*/
public interface CRLSelector extends Cloneable
{
/**
* Returns a clone of this instance.
*
* @return The clone.
*/
Object clone();
/**
* Match a given certificate revocation list to this selector's
* criteria, returning true if it matches, false otherwise.
*
* @param crl The certificate revocation list to test.
* @return The boolean result of this test.
*/
boolean match(CRL crl);
}
/* CertPathBuilder.java -- bulids CertPath objects from Certificates.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.security.cert;
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.Provider;
import java.security.Security;
import gnu.java.security.Engine;
/**
* This class builds certificate paths (also called certificate chains),
* which can be used to establish trust for a particular certificate by
* building a path from a trusted certificate (a trust anchor) to the
* untrusted certificate.
*
* @see CertPath
*/
public class CertPathBuilder
{
// Constants and fields.
// ------------------------------------------------------------------------
/** Service name for CertPathBuilder. */
private static final String CERT_PATH_BUILDER = "CertPathBuilder";
/** The underlying implementation. */
private CertPathBuilderSpi cpbSpi;
/** The provider of this implementation. */
private Provider provider;
/** The name of this implementation. */
private String algorithm;
// Constructor.
// ------------------------------------------------------------------------
/**
* Creates a new CertPathBuilder.
*
* @param cpbSpi The underlying implementation.
* @param provider The provider of the implementation.
* @param algorithm This implementation's name.
*/
protected CertPathBuilder(CertPathBuilderSpi cpbSpi, Provider provider,
String algorithm)
{
this.cpbSpi = cpbSpi;
this.provider = provider;
this.algorithm = algorithm;
}
// Class methods.
// ------------------------------------------------------------------------
/**
* Get the default cert path builder type.
*
* <p>This value can be set at run-time by the security property
* <code>"certpathbuilder.type"</code>. If this property is not set,
* then the value returned is <code>"PKIX"</code>.
*
* @return The default CertPathBuilder algorithm.
*/
public static final String getDefaultType()
{
String type = Security.getProperty("certpathbuilder.type");
if (type == null)
type = "PKIX";
return type;
}
/**
* Get an instance of a named CertPathBuilder, from the first provider
* that implements it.
*
* @param algorithm The name of the CertPathBuilder to create.
* @return The new instance.
* @throws NoSuchAlgorithmException If no installed provider
* implements the named algorithm.
*/
public static CertPathBuilder getInstance(String algorithm)
throws NoSuchAlgorithmException
{
Provider[] p = Security.getProviders();
for (int i = 0; i < p.length; i++)
{
try
{
return getInstance(algorithm, p[i]);
}
catch (NoSuchAlgorithmException ignored)
{
}
}
throw new NoSuchAlgorithmException(algorithm);
}
/**
* Get an instance of a named CertPathBuilder from the named
* provider.
*
* @param algorithm The name of the CertPathBuilder to create.
* @param provider The name of the provider from which to get the
* implementation.
* @return The new instance.
* @throws NoSuchAlgorithmException If no installed provider
* implements the named algorithm.
* @throws NoSuchProviderException If the named provider does not
* exist.
*/
public static CertPathBuilder getInstance(String algorithm, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException
{
Provider p = Security.getProvider(provider);
if (p == null)
throw new NoSuchProviderException(provider);
return getInstance(algorithm, p);
}
/**
* Get an instance of a named CertPathBuilder from the specified
* provider.
*
* @param algorithm The name of the CertPathBuilder to create.
* @param provider The provider from which to get the implementation.
* @return The new instance.
* @throws NoSuchAlgorithmException If no installed provider
* implements the named algorithm.
* @throws IllegalArgumentException If <i>provider</i> in
* <tt>null</tt>.
*/
public static CertPathBuilder getInstance(String algorithm, Provider provider)
throws NoSuchAlgorithmException
{
if (provider == null)
throw new IllegalArgumentException("null provider");
try
{
return new CertPathBuilder((CertPathBuilderSpi)
Engine.getInstance(CERT_PATH_BUILDER, algorithm, provider),
provider, algorithm);
}
catch (java.lang.reflect.InvocationTargetException ite)
{
throw new NoSuchAlgorithmException(algorithm);
}
catch (ClassCastException cce)
{
throw new NoSuchAlgorithmException(algorithm);
}
}
// Instance methods.
// ------------------------------------------------------------------------
/**
* Return the name of this CertPathBuilder algorithm.
*
* @return The algorithm name.
*/
public final String getAlgorithm()
{
return algorithm;
}
/**
* Return the provider of this instance's implementation.
*
* @return The provider.
*/
public final Provider getProvider()
{
return provider;
}
/**
* Builds a certificate path. The {@link CertPathParameters} parameter
* passed to this method is implementation-specific, but in general
* should contain some number of certificates and some number of
* trusted certificates (or "trust anchors").
*
* @param params The parameters.
* @retrun The certificate path result.
* @throws CertPathBuilderException If the certificate path cannot be
* built.
* @throws InvalidAlgorithmParameterException If the implementation
* rejects the specified parameters.
*/
public final CertPathBuilderResult build(CertPathParameters params)
throws CertPathBuilderException, InvalidAlgorithmParameterException
{
return cpbSpi.engineBuild(params);
}
}
/* CertPathBuilderResult -- results from building cert paths.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.security.cert;
/**
* A standard interface for the result of building a certificate path.
* All implementations of this class must provide a way to get the
* certificate path, but may also define additional methods for
* returning other result data generated by the certificate path
* builder.
*/
public interface CertPathBuilderResult extends Cloneable {
/**
* Creates a copy of this builder result.
*
* @return The copy.
*/
Object clone();
/**
* Get the certificate path that was built.
*
* @retrn The certificate path.
*/
CertPath getCertPath();
}
/* CertPathBuilderSpi -- CertPathBuilder service provider interface.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.security.cert;
/**
* The {@link CertPathBuilder} <i>Service Provider Interface</i>
* (<b>SPI</b>).
*
* @see CertPathBuilder
*/
public abstract class CertPathBuilderSpi {
// Constructors.
// ------------------------------------------------------------------------
/**
* Creates a new CertPathBuilderSpi.
*/
public CertPathBuilderSpi() {
super();
}
// Abstract methods.
// ------------------------------------------------------------------------
/**
* Creates a certificate path from the specified parameters.
*
* @param params The parameters to use.
* @return The certificate path result.
* @throws CertPathBuilderException If the certificate path cannot be
* built.
* @throws java.security.InvalidAlgorithmParameterException If the
* implementation rejects the specified parameters.
*/
public abstract CertPathBuilderResult engineBuild(CertPathParameters params)
throws CertPathBuilderException,
java.security.InvalidAlgorithmParameterException;
}
/* CertPathParameters.java -- parameters for CertPathBuilder.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.security.cert;
/**
* Parameters for generating and validating certificate paths. This
* class does not define any methods (except a required cloneable
* interface) and is provided only to provide type safety for
* implementations. Concrete implementations implement this interface
* in accord with thier own needs.
*
* @see CertPathBuilder
* @see CertPathValidator
*/
public interface CertPathParameters extends Cloneable {
/**
* Makes a copy of this CertPathParameters instance.
*
* @return The copy.
*/
Object clone();
}
/* CertPathValidator -- validates certificate paths.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.security.cert;
import java.security.AccessController;
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivilegedAction;
import java.security.Provider;
import java.security.Security;
import gnu.java.security.Engine;
/**
* Generic interface to classes that validate certificate paths.
*
* <p>Using this class is similar to all the provider-based security
* classes; the method of interest, {@link
* #validate(java.security.cert.CertPath,java.security.cert.CertPathParameters)},
* which takes provider-specific implementations of {@link
* CertPathParameters}, and return provider-specific implementations of
* {@link CertPathValidatorResult}.
*
* @since JDK 1.4
* @see CertPath
*/
public class CertPathValidator {
// Constants and fields.
// ------------------------------------------------------------------------
/** Service name for CertPathValidator. */
private static final String CERT_PATH_VALIDATOR = "CertPathValidator";
/** The underlying implementation. */
private final CertPathValidatorSpi validatorSpi;
/** The provider of this implementation. */
private final Provider provider;
/** The algorithm's name. */
private final String algorithm;
// Constructor.
// ------------------------------------------------------------------------
/**
* Creates a new CertPathValidator.
*
* @param validatorSpi The underlying implementation.
* @param provider The provider of the implementation.
* @param algorithm The algorithm name.
*/
protected CertPathValidator(CertPathValidatorSpi validatorSpi,
Provider provider, String algorithm)
{
this.validatorSpi = validatorSpi;
this.provider = provider;
this.algorithm = algorithm;
}
// Class methods.
// ------------------------------------------------------------------------
/**
* Returns the default validator type.
*
* <p>This value may be set at run-time via the security property
* "certpathvalidator.type", or the value "PKIX" if this property is
* not set.
*
* @return The default validator type.
*/
public static synchronized String getDefaultType() {
String type = (String) AccessController.doPrivileged(
new PrivilegedAction()
{
public Object run()
{
return Security.getProperty("certpathvalidator.type");
}
}
);
if (type == null)
type = "PKIX";
return type;
}
/**
* Get an instance of the given validator from the first provider that
* implements it.
*
* @param algorithm The name of the algorithm to get.
* @return The new instance.
* @throws NoSuchAlgorithmException If no installed provider
* implements the requested algorithm.
*/
public static CertPathValidator getInstance(String algorithm)
throws NoSuchAlgorithmException
{
Provider[] p = Security.getProviders();
for (int i = 0; i < p.length; i++)
{
try
{
return getInstance(algorithm, p[i]);
}
catch (NoSuchAlgorithmException ignored)
{
}
}
throw new NoSuchAlgorithmException(algorithm);
}
/**
* Get an instance of the given validator from the named provider.
*
* @param algorithm The name of the algorithm to get.
* @param provider The name of the provider from which to get the
* implementation.
* @return The new instance.
* @throws NoSuchAlgorithmException If the named provider does not
* implement the algorithm.
* @throws NoSuchProviderException If no provider named
* <i>provider</i> is installed.
*/
public static CertPathValidator getInstance(String algorithm,
String provider)
throws NoSuchAlgorithmException, NoSuchProviderException
{
Provider p = Security.getProvider(provider);
if (p == null)
throw new NoSuchProviderException(provider);
return getInstance(algorithm, p);
}
/**
* Get an instance of the given validator from the given provider.
*
* @param algorithm The name of the algorithm to get.
* @param provider The provider from which to get the implementation.
* @return The new instance.
* @throws NoSuchAlgorithmException If the provider does not implement
* the algorithm.
* @throws IllegalArgumentException If <i>provider</i> is null.
*/
public static CertPathValidator getInstance(String algorithm,
Provider provider)
throws NoSuchAlgorithmException
{
if (provider == null)
throw new IllegalArgumentException("null provider");
try
{
return new CertPathValidator((CertPathValidatorSpi)
Engine.getInstance(CERT_PATH_VALIDATOR, algorithm, provider),
provider, algorithm);
}
catch (java.lang.reflect.InvocationTargetException ite)
{
throw new NoSuchAlgorithmException(algorithm);
}
catch (ClassCastException cce)
{
throw new NoSuchAlgorithmException(algorithm);
}
}
// Instance methods.
// ------------------------------------------------------------------------
/**
* Return the name of this validator.
*
* @return This validator's name.
*/
public final String getAlgorithm()
{
return algorithm;
}
/**
* Return the provider of this implementation.
*
* @return The provider.
*/
public final Provider getProvider()
{
return provider;
}
/**
* Attempt to validate a certificate path.
*
* @param certPath The path to validate.
* @param params The algorithm-specific parameters.
* @return The result of this validation attempt.
* @throws CertPathValidatorException If the certificate path cannot
* be validated.
* @throws InvalidAlgorithmParameterException If this implementation
* rejects the specified parameters.
*/
public final CertPathValidatorResult validate(CertPath certPath,
CertPathParameters params)
throws CertPathValidatorException, InvalidAlgorithmParameterException
{
return validatorSpi.engineValidate(certPath, params);
}
}
/* CertPathValidatorResult -- result of validating certificate paths
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.security.cert;
/**
* Interface to the result of calling {@link
* CertPathValidator#validate(java.security.cert.CertPath,java.security.cert.CertPathParameters)}.
*
* <p>This interface defines no methods other than the required
* {@link java.lang.Cloneable} interface, and is intended to group and
* provide type safety for validator results. Providers that implement
* a certificate path validator must also provide an implementation of
* this interface, possibly defining additional methods.
*
* @since JDK 1.4
* @see CertPathValidator
*/
public interface CertPathValidatorResult extends Cloneable
{
/**
* Returns a copy of this validator result.
*
* @return The copy.
*/
Object clone();
}
/* CertPathValidatorSpi -- cert path validator service provider interface
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.security.cert;
/**
* The <i>service provider interface</i> (<b>SPI</b>) for the {@link
* CertPathValidator} class. Providers implementing certificate path
* validators must subclass this class and implement its abstract
* methods.
*/
public abstract class CertPathValidatorSpi
{
// Constructor.
// ------------------------------------------------------------------------
/**
* Default constructor.
*/
public CertPathValidatorSpi()
{
super();
}
// Abstract methods.
// ------------------------------------------------------------------------
/**
* Attempt to validate a certificate path.
*
* @param certPath The path to validate.
* @param params The algorithm-specific parameters.
* @return The result of this validation attempt.
* @throws CertPathValidatorException If the certificate path cannot
* be validated.
* @throws InvalidAlgorithmParameterException If this implementation
* rejects the specified parameters.
*/
public abstract CertPathValidatorResult
engineValidate(CertPath certPath, CertPathParameters params)
throws CertPathValidatorException,
java.security.InvalidAlgorithmParameterException;
}
/* CertSelector.java -- certificate selector interface.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.security.cert;
public interface CertSelector extends Cloneable
{
/**
* Returns a copy of this CertSelector.
*
* @return The copy.
*/
Object clone();
/**
* Match a certificate according to this selector's criteria.
*
* @param cert The certificate to match.
* @return true if the certificate matches thin criteria.
*/
boolean match(Certificate cert);
}
/* CertStore -- stores and retrieves certificates.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.security.cert;
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivilegedAction;
import java.security.Provider;
import java.security.Security;
import java.util.Collection;
import gnu.java.security.Engine;
/**
* A CertStore is a read-only repository for certificates and
* certificate revocation lists.
*
* @since JDK 1.4
*/
public class CertStore
{
// Constants and fields.
// ------------------------------------------------------------------------
/** Service name for CertStore. */
private static final String CERT_STORE = "CertStore";
/** The underlying implementation. */
private CertStoreSpi storeSpi;
/** This implementation's provider. */
private Provider provider;
/** The name of this key store type. */
private String type;
/** The parameters used to initialize this instance, if any. */
private CertStoreParameters params;
// Constructor.
// ------------------------------------------------------------------------
/**
* Create a new CertStore.
*
* @param storeSpi The underlying implementation.
* @param provider The provider of this implementation.
* @param type The type of CertStore this class represents.
* @param params The parameters used to initialize this instance, if any.
*/
protected CertStore(CertStoreSpi storeSpi, Provider provider, String type,
CertStoreParameters params)
{
this.storeSpi = storeSpi;
this.provider = provider;
this.type = type;
this.params = params;
}
// Class methods.
// ------------------------------------------------------------------------
/**
* Returns the default certificate store type.
*
* <p>This value can be set at run-time via the security property
* "certstore.type"; if not specified than the default type will be
* "LDAP".
*
* @return The default CertStore type.
*/
public static final synchronized String getDefaultType()
{
String type = null;
type = (String) java.security.AccessController.doPrivileged(
new PrivilegedAction() {
public Object run() {
return Security.getProperty("certstore.type");
}
}
);
if (type == null)
type = "LDAP";
return type;
}
/**
* Get an instance of the given certificate store from the first
* installed provider.
*
* @param type The type of CertStore to create.
* @param params The parameters to initialize this cert store with.
* @return The new instance.
* @throws InvalidAlgorithmParameterException If the instance rejects
* the specified parameters.
* @throws NoSuchAlgorithmException If no installed provider
* implements the specified CertStore.
* @throws IllegalArgumentException If <i>provider</i> is null.
*/
public static CertStore getInstance(String type, CertStoreParameters params)
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException
{
Provider[] p = Security.getProviders();
for (int i = 0; i < p.length; i++)
{
try
{
return getInstance(type, params, p[i]);
}
catch (NoSuchAlgorithmException ignored)
{
}
}
throw new NoSuchAlgorithmException(type);
}
/**
* Get an instance of the given certificate store from the named
* provider.
*
* @param type The type of CertStore to create.
* @param params The parameters to initialize this cert store with.
* @param provider The name of the provider from which to get the
* implementation.
* @return The new instance.
* @throws InvalidAlgorithmParameterException If the instance rejects
* the specified parameters.
* @throws NoSuchAlgorithmException If the specified provider does not
* implement the specified CertStore.
* @throws NoSuchProviderException If no provider named
* <i>provider</i> is installed.
* @throws IllegalArgumentException If <i>provider</i> is null.
*/
public static CertStore getInstance(String type, CertStoreParameters params,
String provider)
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException,
NoSuchProviderException
{
Provider p = Security.getProvider(provider);
if (p == null)
throw new NoSuchProviderException(provider);
return getInstance(type, params, p);
}
/**
* Get an instance of the given certificate store from the given
* provider.
*
* @param type The type of CertStore to create.
* @param params The parameters to initialize this cert store with.
* @param provider The provider from which to get the implementation.
* @return The new instance.
* @throws InvalidAlgorithmParameterException If the instance rejects
* the specified parameters.
* @throws NoSuchAlgorithmException If the specified provider does not
* implement the specified CertStore.
* @throws IllegalArgumentException If <i>provider</i> is null.
*/
public static CertStore getInstance(String type, CertStoreParameters params,
Provider provider)
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException
{
if (provider == null)
throw new IllegalArgumentException("null provider");
try
{
return new CertStore((CertStoreSpi) Engine.getInstance(CERT_STORE,
type, provider, new Object[] { params }), provider, type, params);
}
catch (ClassCastException cce)
{
throw new NoSuchAlgorithmException(type);
}
catch (java.lang.reflect.InvocationTargetException ite)
{
Throwable cause = ite.getCause();
if (cause != null &&
(cause instanceof InvalidAlgorithmParameterException))
throw (InvalidAlgorithmParameterException) cause;
else
throw new NoSuchAlgorithmException(type);
}
}
// Instance methods.
// ------------------------------------------------------------------------
/**
* Return the type of certificate store this instance represents.
*
* @return The CertStore type.
*/
public final String getType()
{
return type;
}
/**
* Return the provider of this implementation.
*
* @return The provider.
*/
public final Provider getProvider()
{
return provider;
}
/**
* Get the parameters this instance was created with, if any. The
* parameters will be cloned before they are returned.
*
* @return The parameters, or null.
*/
public final CertStoreParameters getCertStoreParameters()
{
return params != null ? (CertStoreParameters) params.clone() : null;
}
/**
* Get a collection of certificates from this CertStore, optionally
* filtered by the specified CertSelector. The Collection returned may
* be empty, but will never be null.
*
* <p>Implementations may not allow a null argument, even if no
* filtering is desired.
*
* @param selector The certificate selector.
* @return The collection of certificates.
* @throws CertStoreException If the certificates cannot be retrieved.
*/
public final Collection getCertificates(CertSelector selector)
throws CertStoreException
{
return storeSpi.engineGetCertificates(selector);
}
/**
* Get a collection of certificate revocation lists from this CertStore,
* optionally filtered by the specified CRLSelector. The Collection
* returned may be empty, but will never be null.
*
* <p>Implementations may not allow a null argument, even if no
* filtering is desired.
*
* @param selector The certificate selector.
* @return The collection of certificate revocation lists.
* @throws CertStoreException If the CRLs cannot be retrieved.
*/
public final Collection getCRLs(CRLSelector selector)
throws CertStoreException
{
return storeSpi.engineGetCRLs(selector);
}
}
/* CertStoreParameters -- interface to CertStore parameters.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.security.cert;
/**
* Parameters used when creating instances of {@link CertStore}. This
* class does not define any methods (except a required cloneable
* interface) and is provided only to provide type safety for
* implementations. Concrete implementations implement this interface
* in accord with thier own needs.
*
* @see LDAPCertStoreParameters
* @see CollectionCertStoreParameters
*/
public interface CertStoreParameters extends Cloneable
{
/**
* Create a copy of these parameters.
*
* @return The copy.
*/
Object clone();
}
/* CertStoreSpi -- certificate store service provider interface.
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.security.cert;
import java.util.Collection;
/**
* The <i>service provider interface</i> (<b>SPI</b>) for the {@link
* CertStore} class.
*
* <p>Providers wishing to implement a CertStore must subclass this
* class, implementing all the abstract methods. Providers may also
* implement the {@link CertStoreParameters} interface, if they require
* parameters.
*
* @since JDK 1.4
* @see CertStore
* @see CollectionCertStoreParameters
* @see LDAPCertStoreParameters
*/
public abstract class CertStoreSpi
{
// Constructors.
// ------------------------------------------------------------------------
/**
* Creates a new CertStoreSpi.
*
* @param params The parameters to initialize this instance with, or
* null if no parameters are required.
* @throws InvalidAlgorithmParameterException If the specified
* parameters are inappropriate for this class.
*/
public CertStoreSpi(CertStoreParameters params)
throws java.security.InvalidAlgorithmParameterException
{
super();
}
// Abstract methods.
// ------------------------------------------------------------------------
/**
* Get the certificates from this store, filtering them through the
* specified CertSelector.
*
* @param selector The CertSelector to filter certificates.
* @return A (non-null) collection of certificates.
* @throws CertStoreException If the certificates cannot be retrieved.
*/
public abstract Collection engineGetCertificates(CertSelector selector)
throws CertStoreException;
/**
* Get the certificate revocation list from this store, filtering them
* through the specified CRLSelector.
*
* @param selector The CRLSelector to filter certificate revocation
* lists.
* @return A (non-null) collection of certificate revocation list.
* @throws CertStoreException If the CRLs cannot be retrieved.
*/
public abstract Collection engineGetCRLs(CRLSelector selector)
throws CertStoreException;
}
/* Certificate.java --- Certificate class /* Certificate.java --- Certificate class
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999,2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -37,6 +37,7 @@ exception statement from your version. */ ...@@ -37,6 +37,7 @@ exception statement from your version. */
package java.security.cert; package java.security.cert;
import java.security.PublicKey; import java.security.PublicKey;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.security.InvalidKeyException; import java.security.InvalidKeyException;
...@@ -44,34 +45,38 @@ import java.security.NoSuchProviderException; ...@@ -44,34 +45,38 @@ import java.security.NoSuchProviderException;
import java.security.SignatureException; import java.security.SignatureException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.InvalidObjectException;
import java.io.ObjectStreamException; import java.io.ObjectStreamException;
/** /**
The Certificate class is an abstract class used to manage * The Certificate class is an abstract class used to manage
identity certificates. An identity certificate is a * identity certificates. An identity certificate is a
combination of a principal and a public key which is * combination of a principal and a public key which is
certified by another principal. This is the puprose of * certified by another principal. This is the puprose of
Certificate Authorities (CA). * Certificate Authorities (CA).
*
This class is used to manage different types of certificates * <p>This class is used to manage different types of certificates
but have important common puposes. Different types of * but have important common puposes. Different types of
certificates like X.509 and OpenPGP share general certificate * certificates like X.509 and OpenPGP share general certificate
functions (like encoding and verifying) and information like * functions (like encoding and verifying) and information like
public keys. * public keys.
*
X.509, OpenPGP, and SDSI can be implemented by subclassing this * <p>X.509, OpenPGP, and SDSI can be implemented by subclassing this
class even though they differ in storage methods and information * class even though they differ in storage methods and information
stored. * stored.
*
@since JDK 1.2 * @see CertificateFactory
* @see X509Certificate
@author Mark Benvenuto * @since JDK 1.2
*/ * @author Mark Benvenuto
* @author Casey Marshall
*/
public abstract class Certificate public abstract class Certificate
{ {
static final long serialVersionUID = -6751606818319535583L; static final long serialVersionUID = -6751606818319535583L;
private String type; private String type;
/** /**
Constructs a new certificate of the specified type. An example Constructs a new certificate of the specified type. An example
is "X.509". is "X.509".
...@@ -203,47 +208,99 @@ public abstract class Certificate ...@@ -203,47 +208,99 @@ public abstract class Certificate
*/ */
public abstract PublicKey getPublicKey(); public abstract PublicKey getPublicKey();
// Protected methods.
// ------------------------------------------------------------------------
/**
* Returns a replacement for this certificate to be serialized. This
* method returns the equivalent to the following for this class:
*
* <blockquote>
* <pre>new CertificateRep(getType(), getEncoded());</pre>
* </blockquote>
*
* <p>This thusly replaces the certificate with its name and its
* encoded form, which can be deserialized later with the {@link
* CertificateFactory} implementation for this certificate's type.
*
* @return The replacement object to be serialized.
* @throws ObjectStreamException If the replacement could not be
* created.
*/
public Object writeReplace() throws ObjectStreamException
{
try
{
return new CertificateRep(getType(), getEncoded());
}
catch (CertificateEncodingException cee)
{
throw new InvalidObjectException(cee.toString());
}
}
// Inner class.
// ------------------------------------------------------------------------
/* INNER CLASS */
/** /**
Certificate.CertificateRep is an inner class used to provide an alternate Certificate.CertificateRep is an inner class used to provide an alternate
storage mechanism for serialized Certificates. storage mechanism for serialized Certificates.
*/ */
protected static class CertificateRep implements java.io.Serializable protected static class CertificateRep implements java.io.Serializable
{ {
/** From JDK1.4. */
private static final long serialVersionUID = -8563758940495660020L;
/** The certificate type, e.g. "X.509". */
private String type; private String type;
/** The encoded certificate data. */
private byte[] data; private byte[] data;
/** /**
Create an alternate Certificate class to store a serialized Certificate * Create an alternative representation of this certificate. The
* <code>(type, data)</code> pair is typically the certificate's
@param type the name of certificate type * type as returned by {@link Certificate#getType()} (i.e. the
@param data the certificate data * canonical name of the certificate type) and the encoded form as
*/ * returned by {@link Certificate#getEncoded()}.
protected CertificateRep(String type, *
byte[] data) * <p>For example, X.509 certificates would create an instance of
* this class with the parameters "X.509" and the ASN.1
* representation of the certificate, encoded as DER bytes.
*
* @param type The certificate type.
* @param data The encoded certificate data.
*/
protected CertificateRep(String type, byte[] data)
{ {
this.type = type; this.type = type;
this.data = data; this.data = data;
} }
/** /**
Return the stored Certificate * Deserialize this certificate replacement into the appropriate
* certificate object. That is, this method attempts to create a
@return the stored certificate * {@link CertificateFactory} for this certificate's type, then
* attempts to parse the encoded data with that factory, returning
@throws ObjectStreamException if certificate cannot be resolved * the resulting certificate.
*/ *
protected Object readResolve() * @return The deserialized certificate.
throws ObjectStreamException * @throws ObjectStreamException If there is no appropriate
* certificate factory for the given type, or if the encoded form
* cannot be parsed.
*/
protected Object readResolve() throws ObjectStreamException
{ {
try { try
return new ObjectInputStream( new ByteArrayInputStream( data ) ).readObject(); {
} catch ( Exception e ) { CertificateFactory fact = CertificateFactory.getInstance(type);
e.printStackTrace(); return fact.generateCertificate(new ByteArrayInputStream(data));
throw new RuntimeException ( e.toString() ); }
} catch (Exception e)
{
throw new InvalidObjectException(e.toString());
}
} }
} }
} }
/* CertificateFactorySpi.java --- Certificate Factory Class /* CertificateFactorySpi.java --- Certificate Factory Class
Copyright (C) 1999 Free Software Foundation, Inc. Copyright (C) 1999,2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -37,13 +37,17 @@ exception statement from your version. */ ...@@ -37,13 +37,17 @@ exception statement from your version. */
package java.security.cert; package java.security.cert;
import java.io.InputStream; import java.io.InputStream;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator;
import java.util.List;
/** /**
CertificateFactorySpi is the abstract class Service Provider CertificateFactorySpi is the abstract class Service Provider
Interface (SPI) for the CertificateFactory class. A provider Interface (SPI) for the CertificateFactory class. A provider
must implment all the abstract methods if they wish to must implement all the abstract methods if they wish to
supply a certificate factory for a particular certificate supply a certificate factory for a particular certificate
type. Ex: X.509 type. Ex: X.509
...@@ -53,16 +57,22 @@ import java.util.Collection; ...@@ -53,16 +57,22 @@ import java.util.Collection;
@since JDK 1.2 @since JDK 1.2
@author Mark Benvenuto @author Mark Benvenuto
*/ */
public abstract class CertificateFactorySpi public abstract class CertificateFactorySpi
{ {
// Constructor.
// ------------------------------------------------------------------------
/** /**
Constructs a new CertificateFactorySpi * Constructs a new CertificateFactorySpi
*/ */
public CertificateFactorySpi() public CertificateFactorySpi()
{} {}
// Abstract methods.
// ------------------------------------------------------------------------
/** /**
Generates a Certificate based on the encoded data read Generates a Certificate based on the encoded data read
from the InputStream. from the InputStream.
...@@ -77,7 +87,7 @@ public abstract class CertificateFactorySpi ...@@ -77,7 +87,7 @@ public abstract class CertificateFactorySpi
For X.509 certificates, the certificate in inStream must be For X.509 certificates, the certificate in inStream must be
DER encoded and supplied in binary or printable (Base64) DER encoded and supplied in binary or printable (Base64)
encoding. If the certificate is in Base64 encoding, it must be encoding. If the certificate is in Base64 encoding, it must be
bounded by -----BEGINCERTIFICATE-----, and bounded by -----BEGIN CERTIFICATE-----, and
-----END CERTIFICATE-----. -----END CERTIFICATE-----.
@param inStream an input stream containing the certificate data @param inStream an input stream containing the certificate data
...@@ -149,5 +159,67 @@ public abstract class CertificateFactorySpi ...@@ -149,5 +159,67 @@ public abstract class CertificateFactorySpi
*/ */
public abstract Collection engineGenerateCRLs(InputStream inStream) public abstract Collection engineGenerateCRLs(InputStream inStream)
throws CRLException; throws CRLException;
// 1.4 instance methods.
// ------------------------------------------------------------------------
/**
* Generate a {@link CertPath} and initialize it with data parsed from
* the input stream. The default encoding of this factory is used.
*
* @param inStream The InputStream containing the CertPath data.
* @return A CertPath initialized from the input stream data.
* @throws CertificateException If an error occurs decoding the
* CertPath.
*/
public CertPath engineGenerateCertPath(InputStream inStream)
throws CertificateException
{
throw new UnsupportedOperationException("not implemented");
}
/**
* Generate a {@link CertPath} and initialize it with data parsed from
* the input stream, using the specified encoding.
*
* @param inStream The InputStream containing the CertPath data.
* @param encoding The encoding of the InputStream data.
* @return A CertPath initialized from the input stream data.
* @throws CertificateException If an error occurs decoding the
* CertPath.
*/
public CertPath engineGenerateCertPath(InputStream inStream, String encoding)
throws CertificateException
{
throw new UnsupportedOperationException("not implemented");
}
/**
* Generate a {@link CertPath} and initialize it with the certificates
* in the {@link java.util.List} argument.
*
* @param certificates The list of certificates with which to create
* the CertPath.
* @return A CertPath initialized from the certificates.
* @throws CertificateException If an error occurs generating the
* CertPath.
*/
public CertPath engineGenerateCertPath(List certificates)
throws CertificateException
{
throw new UnsupportedOperationException("not implemented");
}
/**
* Returns an Iterator of CertPath encodings supported by this
* factory, with the default encoding first. The returned Iterator
* cannot be modified.
*
* @return The Iterator of supported encodings.
*/
public Iterator engineGetCertPathEncodings()
{
throw new UnsupportedOperationException("not implemented");
}
} }
/* CollectionCertStoreParameters -- collection-based cert store parameters
Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.security.cert;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
/**
* An implementation of {@link CertStoreParameters} with a simple,
* in-memory {@link Collection} of certificates and certificate
* revocation list.
*
* <p>Note that this class is not thread-safe, and its underlying
* collection may be changed at any time.
*
* @see CertStore
*/
public class CollectionCertStoreParameters implements CertStoreParameters
{
// Constants and fields.
// ------------------------------------------------------------------------
/** The underlying collection. */
private final Collection collection;
// Constructors.
// ------------------------------------------------------------------------
/**
* Creates a new CollectionCertStoreParameters with an empty,
* immutable collection.
*/
public CollectionCertStoreParameters()
{
this(Collections.EMPTY_LIST);
}
/**
* Create a new CollectionCertStoreParameters with the specified
* collection. The argument is not copied, and subsequent changes to
* the collection will change this class's collection.
*
* @param collection The collection.
* @throws NullPointerException If <i>collection</i> is null.
*/
public CollectionCertStoreParameters(Collection collection)
{
if (collection == null)
throw new NullPointerException();
this.collection = collection;
}
// Instance methods.
// ------------------------------------------------------------------------
public Object clone()
{
return new CollectionCertStoreParameters(new ArrayList(collection));
}
/**
* Return the underlying collection. The collection is not copied
* before being returned, so callers may update the collection that is
* returned.
*
* @return The collection.
*/
public Collection getCollection()
{
return collection;
}
/**
* Return a string representation of these parameters.
*
* @return The string representation of these parameters.
*/
public String toString()
{
return "CollectionCertStoreParameters: [ collection: "
+ collection + " ]";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment