geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r291352 [1/10] - in /geronimo/trunk: applications/console-core/ applications/console-ear/src/plan/ applications/console-standard/src/java/org/apache/geronimo/console/util/ applications/console-standard/src/webapp/WEB-INF/ assemblies/j2ee-se...
Date Sun, 25 Sep 2005 00:32:39 GMT
Author: djencks
Date: Sat Sep 24 17:31:10 2005
New Revision: 291352

URL: http://svn.apache.org/viewcvs?rev=291352&view=rev
Log:
GERONIMO-880 Copy some bouncy castle classes, don't depend on their jar

Added:
    geronimo/trunk/modules/util/
    geronimo/trunk/modules/util/LICENSE.txt
    geronimo/trunk/modules/util/NOTICE.txt
    geronimo/trunk/modules/util/project.xml
    geronimo/trunk/modules/util/src/
    geronimo/trunk/modules/util/src/java/
    geronimo/trunk/modules/util/src/java/org/
    geronimo/trunk/modules/util/src/java/org/apache/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Choice.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Encodable.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1EncodableVector.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1InputStream.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Null.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1OctetString.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1OutputStream.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Sequence.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Set.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1TaggedObject.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/BERConstructedOctetString.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/BERConstructedSequence.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/BERInputStream.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/BERNull.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/BEROutputStream.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/BERSequence.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/BERSet.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/BERTaggedObject.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERApplicationSpecific.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERBMPString.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERBitString.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERBoolean.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERConstructedSequence.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERConstructedSet.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DEREncodable.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DEREncodableVector.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DEREnumerated.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERGeneralString.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERGeneralizedTime.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERIA5String.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERInputStream.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERInteger.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERNull.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERNumericString.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERObject.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERObjectIdentifier.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DEROctetString.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DEROutputStream.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERPrintableString.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERSequence.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERSet.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERString.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERT61String.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERTaggedObject.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERTags.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERUTCTime.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERUTF8String.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERUniversalString.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERUnknownTag.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/DERVisibleString.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/OIDTokenizer.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/cryptopro/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/cryptopro/CryptoProObjectIdentifiers.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/misc/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/misc/MiscObjectIdentifiers.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/misc/NetscapeCertType.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/oiw/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/oiw/OIWObjectIdentifiers.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/pkcs/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/pkcs/CertificationRequest.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/pkcs/CertificationRequestInfo.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/pkcs/DHParameter.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/pkcs/PKCSObjectIdentifiers.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/pkcs/PrivateKeyInfo.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/pkcs/RSAPrivateKeyStructure.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/sec/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/sec/ECPrivateKeyStructure.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/util/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/util/ASN1Dump.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/util/DERDump.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/util/Dump.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/AccessDescription.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/AlgorithmIdentifier.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/AttCertIssuer.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/AttCertValidityPeriod.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/Attribute.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/AttributeCertificate.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/AttributeCertificateInfo.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/AuthorityInformationAccess.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/BasicConstraints.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/CRLDistPoint.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/CRLNumber.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/CRLReason.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/CertPolicyId.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/CertificateList.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/CertificatePolicies.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/DSAParameter.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/DigestInfo.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/DisplayText.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/DistributionPoint.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/DistributionPointName.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/ExtendedKeyUsage.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/GeneralName.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/GeneralNames.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/GeneralSubtree.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/Holder.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/IetfAttrSyntax.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/IssuerSerial.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/IssuingDistributionPoint.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/KeyPurposeId.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/KeyUsage.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/NameConstraints.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/NoticeReference.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/ObjectDigestInfo.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/PolicyInformation.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/PolicyMappings.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/PolicyQualifierId.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/PolicyQualifierInfo.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/RSAPublicKeyStructure.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/ReasonFlags.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/SubjectPublicKeyInfo.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/TBSCertList.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/TBSCertificateStructure.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/Time.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/UserNotice.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/V1TBSCertificateGenerator.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/V2AttributeCertificateInfoGenerator.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/V2Form.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/V2TBSCertListGenerator.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/V3TBSCertificateGenerator.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/X509CertificateStructure.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/X509DefaultEntryConverter.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/X509Extension.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/X509Extensions.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/X509Name.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/X509NameEntryConverter.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/X509NameTokenizer.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x509/X509ObjectIdentifiers.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x9/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/x9/X9ObjectIdentifiers.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/BlockCipher.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/CipherParameters.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/DSA.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/DataLengthException.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/Digest.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/RuntimeCryptoException.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/params/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/params/AsymmetricKeyParameter.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/params/DHKeyParameters.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/params/DHParameters.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/params/DHPrivateKeyParameters.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/params/DHPublicKeyParameters.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/params/DHValidationParameters.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/params/DSAKeyParameters.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/params/DSAParameters.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/params/DSAPrivateKeyParameters.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/params/DSAPublicKeyParameters.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/params/DSAValidationParameters.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/params/KeyParameter.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/params/ParametersWithSBox.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/params/RSAKeyParameters.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/crypto/params/RSAPrivateCrtKeyParameters.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/encoders/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/encoders/Base64.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/encoders/Base64Encoder.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/encoders/BufferedDecoder.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/encoders/BufferedEncoder.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/encoders/Encoder.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/encoders/Hex.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/encoders/HexEncoder.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/encoders/HexTranslator.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/encoders/Translator.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/encoders/UrlBase64.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/encoders/UrlBase64Encoder.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/PKCS10CertificationRequest.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/X509Principal.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/X509V1CertificateGenerator.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/interfaces/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/interfaces/PKCS12BagAttributeCarrier.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/provider/
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/provider/JCEDHPrivateKey.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/provider/JCEDHPublicKey.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/provider/JCERSAPrivateCrtKey.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/provider/JCERSAPrivateKey.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/provider/JCERSAPublicKey.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/provider/JDKDSAPrivateKey.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/provider/JDKDSAPublicKey.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/provider/JDKKeyFactory.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/provider/NetscapeRevocationURL.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/provider/VerisignCzagExtension.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/provider/X509CRLEntryObject.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/provider/X509CRLObject.java
    geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/jce/provider/X509CertificateObject.java
Modified:
    geronimo/trunk/applications/console-core/project.xml
    geronimo/trunk/applications/console-ear/src/plan/geronimo-application.xml
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/ObjectNameConstants.java
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/portlet.xml
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/web.xml
    geronimo/trunk/assemblies/j2ee-server/project.xml
    geronimo/trunk/etc/project.properties
    geronimo/trunk/modules/assembly/project.xml
    geronimo/trunk/sandbox/spring-assembly/src/conf/server-gbean.xml

Modified: geronimo/trunk/applications/console-core/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-core/project.xml?rev=291352&r1=291351&r2=291352&view=diff
==============================================================================
--- geronimo/trunk/applications/console-core/project.xml (original)
+++ geronimo/trunk/applications/console-core/project.xml Sat Sep 24 17:31:10 2005
@@ -79,7 +79,7 @@
             <artifactId>regexp</artifactId>
             <version>${regexp_version}</version>
         </dependency>
-        
+
         <!-- JMS dependencies -->
          <dependency>
             <groupId>geronimo-spec</groupId>
@@ -104,6 +104,12 @@
             <version>${mx4j_version}</version>
         </dependency>
 
+        <!-- Keystore dependency -->
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-util</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
     </dependencies>
 
     <build>

Modified: geronimo/trunk/applications/console-ear/src/plan/geronimo-application.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-ear/src/plan/geronimo-application.xml?rev=291352&r1=291351&r2=291352&view=diff
==============================================================================
--- geronimo/trunk/applications/console-ear/src/plan/geronimo-application.xml (original)
+++ geronimo/trunk/applications/console-ear/src/plan/geronimo-application.xml Sat Sep 24 17:31:10 2005
@@ -21,6 +21,12 @@
         <version>${geronimo_version}</version>
     </dependency>
 
+    <!-- Keystore dependency -->
+    <dependency>
+        <groupId>geronimo</groupId>
+        <artifactId>geronimo-util</artifactId>
+        <version>${geronimo_version}</version>
+    </dependency>
     <module>
         <web>geronimo-console-framework-${pom.currentVersion}.war</web>
         <web-app xmlns="http://geronimo.apache.org/xml/ns/web" configId="console">
@@ -70,4 +76,21 @@
             <gbean-name>geronimo.server:J2EEApplication=null,J2EEModule=org/apache/geronimo/Security,J2EEServer=geronimo,j2eeType=LoginModule,name=properties-login</gbean-name>
         </reference>
     </gbean>
+
+    <!-- Keystore configuration -->
+    <!-- I think this requires a modified GERONIMO-887 to be applied first -->
+<!--    <gbean gbeanName="geronimo.security:type=KeyStore" class="org.apache.geronimo.console.core.keystore.KeyStoreGBean">-->
+<!--        <attribute name="keyStoreLocation">var/security/ssl-keystore-1</attribute>-->
+<!--        <attribute name="keyStoreType">jks</attribute>-->
+<!--        <attribute name="keyStoreProvider">SUN</attribute>-->
+<!--        <attribute name="keyStorePassword">password</attribute>-->
+<!--        <reference name="serverInfo">-->
+<!--            <application>null</application>-->
+<!--            <moduleType>J2EEModule</moduleType>-->
+<!--            <module>org/apache/geronimo/System</module>-->
+<!--            <type>GBean</type>-->
+<!--            <name>ServerInfo</name>-->
+<!--        </reference>-->
+<!--    </gbean>-->
+
 </application>

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/ObjectNameConstants.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/ObjectNameConstants.java?rev=291352&r1=291351&r2=291352&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/ObjectNameConstants.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/ObjectNameConstants.java Sat Sep 24 17:31:10 2005
@@ -44,4 +44,6 @@
 
     public static final String CONFIG_GBEAN_PREFIX = "geronimo.config:name=";
 
+    public static final String KEYSTORE_OBJ_NAME = "geronimo.security:type=KeyStore";
+
 }

Modified: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/portlet.xml?rev=291352&r1=291351&r2=291352&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/portlet.xml (original)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/portlet.xml Sat Sep 24 17:31:10 2005
@@ -858,7 +858,7 @@
         <portlet-name>Keystore</portlet-name>
         <display-name>Keystore Portlet</display-name>
 
-        <portlet-class>org.apache.geronimo.console.EmptyPortlet</portlet-class>
+        <portlet-class>org.apache.geronimo.console.certmanager.CertManagerPortlet</portlet-class>
 
         <expiration-cache>-1</expiration-cache>
 

Modified: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/web.xml?rev=291352&r1=291351&r2=291352&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/web.xml (original)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/web.xml Sat Sep 24 17:31:10 2005
@@ -171,7 +171,7 @@
         <servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
         <init-param>
             <param-name>portlet-class</param-name>
-            <param-value>org.apache.geronimo.console.EmptyPortlet</param-value>
+            <param-value>org.apache.geronimo.console.certmanager.CertManagerPortlet</param-value>
         </init-param>
         <init-param>
             <param-name>portlet-guid</param-name>
@@ -184,7 +184,7 @@
         <servlet-class>org.apache.pluto.core.PortletServlet</servlet-class>
         <init-param>
             <param-name>portlet-class</param-name>
-            <param-value>org.apache.geronimo.console.EmptyPortlet</param-value>
+            <param-value>org.apache.geronimo.console.certmanager.CertManagerPortlet</param-value>
         </init-param>
         <init-param>
             <param-name>portlet-guid</param-name>

Modified: geronimo/trunk/assemblies/j2ee-server/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/assemblies/j2ee-server/project.xml?rev=291352&r1=291351&r2=291352&view=diff
==============================================================================
--- geronimo/trunk/assemblies/j2ee-server/project.xml (original)
+++ geronimo/trunk/assemblies/j2ee-server/project.xml Sat Sep 24 17:31:10 2005
@@ -594,15 +594,6 @@
             </properties>
         </dependency>
 
-        <dependency>
-            <groupId>bouncycastle</groupId>
-            <artifactId>bcprov</artifactId>
-            <version>${bouncycastle_version}</version>
-            <properties>
-               <geronimo.assemble>repository</geronimo.assemble>
-            </properties>
-        </dependency>
-
         <!-- end corba support-->
 
         <!-- spring support-->

Modified: geronimo/trunk/etc/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/etc/project.properties?rev=291352&r1=291351&r2=291352&view=diff
==============================================================================
--- geronimo/trunk/etc/project.properties (original)
+++ geronimo/trunk/etc/project.properties Sat Sep 24 17:31:10 2005
@@ -111,7 +111,6 @@
 asn1_version=0.3.2-SNAPSHOT
 axion_version=1.0-M3-dev
 axis_version=1.3-SNAPSHOT
-bouncycastle_version=jdk14-124
 cglib_version=2.1_2
 castor_version=0.9.5.3
 commons_beanutils_version=1.6.1

Modified: geronimo/trunk/modules/assembly/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/project.xml?rev=291352&r1=291351&r2=291352&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/project.xml (original)
+++ geronimo/trunk/modules/assembly/project.xml Sat Sep 24 17:31:10 2005
@@ -422,6 +422,15 @@
 
         <dependency>
             <groupId>geronimo</groupId>
+            <artifactId>geronimo-util</artifactId>
+            <version>${pom.currentVersion}</version>
+            <properties>
+                <repository>true</repository>
+            </properties>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
             <artifactId>geronimo-webservices</artifactId>
             <version>${pom.currentVersion}</version>
             <properties>
@@ -1304,17 +1313,6 @@
             <version>${stax_api_version}</version>
             <properties>
                 <repository>true</repository>
-            </properties>
-        </dependency>
-
-
-        <dependency>
-            <!-- used for corba asn1 security decoding -->
-            <groupId>bouncycastle</groupId>
-            <artifactId>bcprov</artifactId>
-            <version>${bouncycastle_version}</version>
-            <properties>
-               <repository>true</repository>
             </properties>
         </dependency>
 

Added: geronimo/trunk/modules/util/LICENSE.txt
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/util/LICENSE.txt?rev=291352&view=auto
==============================================================================
--- geronimo/trunk/modules/util/LICENSE.txt (added)
+++ geronimo/trunk/modules/util/LICENSE.txt Sat Sep 24 17:31:10 2005
@@ -0,0 +1,20 @@
+The Bouncy Castle License
+
+Copyright (c) 2000-2005 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+and associated documentation files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+

Added: geronimo/trunk/modules/util/NOTICE.txt
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/util/NOTICE.txt?rev=291352&view=auto
==============================================================================
--- geronimo/trunk/modules/util/NOTICE.txt (added)
+++ geronimo/trunk/modules/util/NOTICE.txt Sat Sep 24 17:31:10 2005
@@ -0,0 +1,4 @@
+"ASN1 codec suppllied by {package name} from :
+
+     Copyright (c) 2000-2005 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
+

Added: geronimo/trunk/modules/util/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/util/project.xml?rev=291352&view=auto
==============================================================================
--- geronimo/trunk/modules/util/project.xml (added)
+++ geronimo/trunk/modules/util/project.xml Sat Sep 24 17:31:10 2005
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    Copyright 2003-2004 The Apache Software Foundation
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<!-- $Rev: 169154 $ $Date: 2005-05-08 15:35:23 -0400 (Sun, 08 May 2005) $ -->
+
+<project>
+    <pomVersion>3</pomVersion>
+    <extend>../../etc/project.xml</extend>
+
+    <!-- ===================== -->
+    <!-- Module Identification -->
+    <!-- ===================== -->
+
+    <name>Geronimo :: Util</name>
+    <id>geronimo-util</id>
+    <shortDescription>Geronimo Util</shortDescription>
+    <description>Geronimo Util</description>
+    <url>http://incubator.apache.org/projects/geronimo/kernel/</url>
+    <siteDirectory>/www/incubator.apache.org/projects/geronimo/kernel</siteDirectory>
+    <distributionDirectory>/www/incubator.apache.org/projects/geronimo/builds/kernel</distributionDirectory>
+
+    <package>org.apache.geronimo.util</package>
+
+    <!-- ============ -->
+    <!-- Dependencies -->
+    <!-- ============ -->
+
+    <dependencies>
+        <!-- Module Dependencies -->
+        <dependency>
+            <groupId>geronimo-spec</groupId>
+            <artifactId>geronimo-spec-j2ee-management</artifactId>
+            <version>${geronimo_spec_j2ee_management_version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo-spec</groupId>
+            <artifactId>geronimo-spec-j2ee-deployment</artifactId>
+            <version>${geronimo_spec_j2ee_deployment_version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>${basedir}/src/java</directory>
+                <includes>
+                    <include>**/*.xml</include>
+                    <include>**/*.properties</include>
+                </includes>
+            </resource>
+        </resources>
+        <unitTest>
+            <includes>
+                <include>**/*Test.java</include>
+            </includes>
+            <excludes>
+                <exclude>**/Abstract*.java</exclude>
+            </excludes>
+        </unitTest>
+    </build>
+
+</project>

Added: geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Choice.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Choice.java?rev=291352&view=auto
==============================================================================
--- geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Choice.java (added)
+++ geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Choice.java Sat Sep 24 17:31:10 2005
@@ -0,0 +1,31 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.util.asn1;
+
+/**
+ * Marker interface for CHOICE objects - if you implement this in a role your
+ * own object any attempt to tag the object implicitly will convert the tag to
+ * an explicit one as the encoding rules require.
+ * <p>
+ * If you use this interface your class should also implement the getInstance
+ * pattern which takes a tag object and the tagging mode used.
+ */
+public interface ASN1Choice
+{
+    // marker interface
+}

Added: geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Encodable.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Encodable.java?rev=291352&view=auto
==============================================================================
--- geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Encodable.java (added)
+++ geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Encodable.java Sat Sep 24 17:31:10 2005
@@ -0,0 +1,61 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.util.asn1;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+public abstract class ASN1Encodable
+    implements DEREncodable
+{
+    public byte[] getEncoded()
+        throws IOException
+    {
+        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
+        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);
+
+        aOut.writeObject(this);
+
+        return bOut.toByteArray();
+    }
+
+    public int hashCode()
+    {
+        return this.toASN1Object().hashCode();
+    }
+
+    public boolean equals(
+        Object  o)
+    {
+        if ((o == null) || !(o instanceof ASN1Encodable))
+        {
+            return false;
+        }
+
+        ASN1Encodable other = (ASN1Encodable)o;
+
+        return this.toASN1Object().equals(other.toASN1Object());
+    }
+
+    public DERObject getDERObject()
+    {
+        return this.toASN1Object();
+    }
+
+    public abstract DERObject toASN1Object();
+}

Added: geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1EncodableVector.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1EncodableVector.java?rev=291352&view=auto
==============================================================================
--- geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1EncodableVector.java (added)
+++ geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1EncodableVector.java Sat Sep 24 17:31:10 2005
@@ -0,0 +1,27 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.util.asn1;
+
+/**
+ * the parent class for this will eventually disappear. Use this one!
+ */
+public class ASN1EncodableVector
+    extends DEREncodableVector
+{
+    // migrating from DEREncodeableVector
+}

Added: geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1InputStream.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1InputStream.java?rev=291352&view=auto
==============================================================================
--- geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1InputStream.java (added)
+++ geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1InputStream.java Sat Sep 24 17:31:10 2005
@@ -0,0 +1,495 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.util.asn1;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.EOFException;
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Vector;
+
+/**
+ * a general purpose ASN.1 decoder - note: this class differs from the
+ * others in that it returns null after it has read the last object in
+ * the stream. If an ASN.1 NULL is encountered a DER/BER Null object is
+ * returned.
+ */
+public class ASN1InputStream
+    extends FilterInputStream
+    implements DERTags
+{
+    private DERObject END_OF_STREAM = new DERObject() {
+                                        void encode(
+                                            DEROutputStream out)
+                                        throws IOException
+                                        {
+                                            throw new IOException("Eeek!");
+                                        }
+                                        public int hashCode()
+                                        {
+                                            return 0;
+                                        }
+                                        public boolean equals(
+                                            Object o)
+                                        {
+                                            return o == this;
+                                        }
+                                    };
+    boolean eofFound = false;
+
+    public ASN1InputStream(
+        InputStream is)
+    {
+        super(is);
+    }
+
+    public ASN1InputStream(
+        byte[] input)
+    {
+        super(new ByteArrayInputStream(input));
+    }
+
+    protected int readLength()
+        throws IOException
+    {
+        int length = read();
+        if (length < 0)
+        {
+            throw new IOException("EOF found when length expected");
+        }
+
+        if (length == 0x80)
+        {
+            return -1;      // indefinite-length encoding
+        }
+
+        if (length > 127)
+        {
+            int size = length & 0x7f;
+
+            if (size > 4)
+            {
+                throw new IOException("DER length more than 4 bytes");
+            }
+
+            length = 0;
+            for (int i = 0; i < size; i++)
+            {
+                int next = read();
+
+                if (next < 0)
+                {
+                    throw new IOException("EOF found reading length");
+                }
+
+                length = (length << 8) + next;
+            }
+
+            if (length < 0)
+            {
+                throw new IOException("corrupted steam - negative length found");
+            }
+        }
+
+        return length;
+    }
+
+    protected void readFully(
+        byte[]  bytes)
+        throws IOException
+    {
+        int     left = bytes.length;
+        int     len;
+
+        if (left == 0)
+        {
+            return;
+        }
+
+        while ((len = read(bytes, bytes.length - left, left)) > 0)
+        {
+            if ((left -= len) == 0)
+            {
+                return;
+            }
+        }
+
+        if (left != 0)
+        {
+            throw new EOFException("EOF encountered in middle of object");
+        }
+    }
+
+    /**
+     * build an object given its tag and a byte stream to construct it
+     * from.
+     */
+    protected DERObject buildObject(
+        int       tag,
+        byte[]    bytes)
+        throws IOException
+    {
+        if ((tag & APPLICATION) != 0)
+        {
+            return new DERApplicationSpecific(tag, bytes);
+        }
+
+        switch (tag)
+        {
+        case NULL:
+            return new DERNull();
+        case SEQUENCE | CONSTRUCTED:
+            ByteArrayInputStream    bIn = new ByteArrayInputStream(bytes);
+            ASN1InputStream         aIn = new ASN1InputStream(bIn);
+            ASN1EncodableVector     v = new ASN1EncodableVector();
+
+            DERObject   obj = aIn.readObject();
+
+            while (obj != null)
+            {
+                v.add(obj);
+                obj = aIn.readObject();
+            }
+
+            return new DERSequence(v);
+        case SET | CONSTRUCTED:
+            bIn = new ByteArrayInputStream(bytes);
+            aIn = new ASN1InputStream(bIn);
+            v = new ASN1EncodableVector();
+
+            obj = aIn.readObject();
+
+            while (obj != null)
+            {
+                v.add(obj);
+                obj = aIn.readObject();
+            }
+
+            return new DERSet(v, false);
+        case BOOLEAN:
+            return new DERBoolean(bytes);
+        case INTEGER:
+            return new DERInteger(bytes);
+        case ENUMERATED:
+            return new DEREnumerated(bytes);
+        case OBJECT_IDENTIFIER:
+            return new DERObjectIdentifier(bytes);
+        case BIT_STRING:
+            int     padBits = bytes[0];
+            byte[]  data = new byte[bytes.length - 1];
+
+            System.arraycopy(bytes, 1, data, 0, bytes.length - 1);
+
+            return new DERBitString(data, padBits);
+        case NUMERIC_STRING:
+            return new DERNumericString(bytes);
+        case UTF8_STRING:
+            return new DERUTF8String(bytes);
+        case PRINTABLE_STRING:
+            return new DERPrintableString(bytes);
+        case IA5_STRING:
+            return new DERIA5String(bytes);
+        case T61_STRING:
+            return new DERT61String(bytes);
+        case VISIBLE_STRING:
+            return new DERVisibleString(bytes);
+        case GENERAL_STRING:
+            return new DERGeneralString(bytes);
+        case UNIVERSAL_STRING:
+            return new DERUniversalString(bytes);
+        case BMP_STRING:
+            return new DERBMPString(bytes);
+        case OCTET_STRING:
+            return new DEROctetString(bytes);
+        case UTC_TIME:
+            return new DERUTCTime(bytes);
+        case GENERALIZED_TIME:
+            return new DERGeneralizedTime(bytes);
+        default:
+            //
+            // with tagged object tag number is bottom 5 bits
+            //
+            if ((tag & TAGGED) != 0)
+            {
+                int tagNo = tag & 0x1f;
+
+                if (tagNo == 0x1f)
+                {
+                    int idx = 0;
+
+                    tagNo = 0;
+
+                    while ((bytes[idx] & 0x80) != 0)
+                    {
+                        tagNo |= (bytes[idx++] & 0x7f);
+                        tagNo <<= 7;
+                    }
+
+                    tagNo |= (bytes[idx] & 0x7f);
+
+                    byte[]  tmp = bytes;
+
+                    bytes = new byte[tmp.length - (idx + 1)];
+                    System.arraycopy(tmp, idx + 1, bytes, 0, bytes.length);
+                }
+
+                if (bytes.length == 0)        // empty tag!
+                {
+                    if ((tag & CONSTRUCTED) == 0)
+                    {
+                        return new DERTaggedObject(false, tagNo, new DERNull());
+                    }
+                    else
+                    {
+                        return new DERTaggedObject(false, tagNo, new DERSequence());
+                    }
+                }
+
+                //
+                // simple type - implicit... return an octet string
+                //
+                if ((tag & CONSTRUCTED) == 0)
+                {
+                    return new DERTaggedObject(false, tagNo, new DEROctetString(bytes));
+                }
+
+                bIn = new ByteArrayInputStream(bytes);
+                aIn = new ASN1InputStream(bIn);
+
+                DEREncodable dObj = aIn.readObject();
+
+                //
+                // explicitly tagged (probably!) - if it isn't we'd have to
+                // tell from the context
+                //
+                if (aIn.available() == 0)
+                {
+                    return new DERTaggedObject(tagNo, dObj);
+                }
+
+                //
+                // another implicit object, we'll create a sequence...
+                //
+                v = new ASN1EncodableVector();
+
+                while (dObj != null)
+                {
+                    v.add(dObj);
+                    dObj = aIn.readObject();
+                }
+
+                return new DERTaggedObject(false, tagNo, new DERSequence(v));
+            }
+
+            return new DERUnknownTag(tag, bytes);
+        }
+    }
+
+    /**
+     * read a string of bytes representing an indefinite length object.
+     */
+    private byte[] readIndefiniteLengthFully()
+        throws IOException
+    {
+        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
+        int                     b, b1;
+
+        b1 = read();
+
+        while ((b = read()) >= 0)
+        {
+            if (b1 == 0 && b == 0)
+            {
+                break;
+            }
+
+            bOut.write(b1);
+            b1 = b;
+        }
+
+        return bOut.toByteArray();
+    }
+
+    private BERConstructedOctetString buildConstructedOctetString()
+        throws IOException
+    {
+        Vector               octs = new Vector();
+
+        for (;;)
+        {
+            DERObject        o = readObject();
+
+            if (o == END_OF_STREAM)
+            {
+                break;
+            }
+
+            octs.addElement(o);
+        }
+
+        return new BERConstructedOctetString(octs);
+    }
+
+    public DERObject readObject()
+        throws IOException
+    {
+        int tag = read();
+        if (tag == -1)
+        {
+            if (eofFound)
+            {
+                throw new EOFException("attempt to read past end of file.");
+            }
+
+            eofFound = true;
+
+            return null;
+        }
+
+        int     length = readLength();
+
+        if (length < 0)    // indefinite length method
+        {
+            switch (tag)
+            {
+            case NULL:
+                return new BERNull();
+            case SEQUENCE | CONSTRUCTED:
+                ASN1EncodableVector  v = new ASN1EncodableVector();
+
+                for (;;)
+                {
+                    DERObject   obj = readObject();
+
+                    if (obj == END_OF_STREAM)
+                    {
+                        break;
+                    }
+
+                    v.add(obj);
+                }
+                return new BERSequence(v);
+            case SET | CONSTRUCTED:
+                v = new ASN1EncodableVector();
+
+                for (;;)
+                {
+                    DERObject   obj = readObject();
+
+                    if (obj == END_OF_STREAM)
+                    {
+                        break;
+                    }
+
+                    v.add(obj);
+                }
+                return new BERSet(v, false);
+            case OCTET_STRING | CONSTRUCTED:
+                return buildConstructedOctetString();
+            default:
+                //
+                // with tagged object tag number is bottom 5 bits
+                //
+                if ((tag & TAGGED) != 0)
+                {
+                    int tagNo = tag & 0x1f;
+
+                    if (tagNo == 0x1f)
+                    {
+                        int b = read();
+
+                        tagNo = 0;
+
+                        while ((b >= 0) && ((b & 0x80) != 0))
+                        {
+                            tagNo |= (b & 0x7f);
+                            tagNo <<= 7;
+                            b = read();
+                        }
+
+                        tagNo |= (b & 0x7f);
+                    }
+
+                    //
+                    // simple type - implicit... return an octet string
+                    //
+                    if ((tag & CONSTRUCTED) == 0)
+                    {
+                        byte[]  bytes = readIndefiniteLengthFully();
+
+                        return new BERTaggedObject(false, tagNo, new DEROctetString(bytes));
+                    }
+
+                    //
+                    // either constructed or explicitly tagged
+                    //
+                    DERObject        dObj = readObject();
+
+                    if (dObj == END_OF_STREAM)     // empty tag!
+                    {
+                        return new DERTaggedObject(tagNo);
+                    }
+
+                    DERObject       next = readObject();
+
+                    //
+                    // explicitly tagged (probably!) - if it isn't we'd have to
+                    // tell from the context
+                    //
+                    if (next == END_OF_STREAM)
+                    {
+                        return new BERTaggedObject(tagNo, dObj);
+                    }
+
+                    //
+                    // another implicit object, we'll create a sequence...
+                    //
+                    v = new ASN1EncodableVector();
+
+                    v.add(dObj);
+
+                    do
+                    {
+                        v.add(next);
+                        next = readObject();
+                    }
+                    while (next != END_OF_STREAM);
+
+                    return new BERTaggedObject(false, tagNo, new BERSequence(v));
+                }
+
+                throw new IOException("unknown BER object encountered");
+            }
+        }
+        else
+        {
+            if (tag == 0 && length == 0)    // end of contents marker.
+            {
+                return END_OF_STREAM;
+            }
+
+            byte[]  bytes = new byte[length];
+
+            readFully(bytes);
+
+            return buildObject(tag, bytes);
+        }
+    }
+}

Added: geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Null.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Null.java?rev=291352&view=auto
==============================================================================
--- geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Null.java (added)
+++ geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Null.java Sat Sep 24 17:31:10 2005
@@ -0,0 +1,50 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.util.asn1;
+
+import java.io.IOException;
+
+/**
+ * A NULL object.
+ */
+public abstract class ASN1Null
+    extends DERObject
+{
+    public ASN1Null()
+    {
+    }
+
+    public int hashCode()
+    {
+        return 0;
+    }
+
+    public boolean equals(
+        Object o)
+    {
+        if ((o == null) || !(o instanceof ASN1Null))
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    abstract void encode(DEROutputStream out)
+        throws IOException;
+}

Added: geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1OctetString.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1OctetString.java?rev=291352&view=auto
==============================================================================
--- geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1OctetString.java (added)
+++ geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1OctetString.java Sat Sep 24 17:31:10 2005
@@ -0,0 +1,158 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.util.asn1;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Vector;
+
+public abstract class ASN1OctetString
+    extends DERObject
+{
+    byte[]  string;
+
+    /**
+     * return an Octet String from a tagged object.
+     *
+     * @param obj the tagged object holding the object we want.
+     * @param explicit true if the object is meant to be explicitly
+     *              tagged false otherwise.
+     * @exception IllegalArgumentException if the tagged object cannot
+     *              be converted.
+     */
+    public static ASN1OctetString getInstance(
+        ASN1TaggedObject    obj,
+        boolean             explicit)
+    {
+        return getInstance(obj.getObject());
+    }
+
+    /**
+     * return an Octet String from the given object.
+     *
+     * @param obj the object we want converted.
+     * @exception IllegalArgumentException if the object cannot be converted.
+     */
+    public static ASN1OctetString getInstance(
+        Object  obj)
+    {
+        if (obj == null || obj instanceof ASN1OctetString)
+        {
+            return (ASN1OctetString)obj;
+        }
+
+        if (obj instanceof ASN1TaggedObject)
+        {
+            return getInstance(((ASN1TaggedObject)obj).getObject());
+        }
+
+        if (obj instanceof ASN1Sequence)
+        {
+            Vector      v = new Vector();
+            Enumeration e = ((ASN1Sequence)obj).getObjects();
+
+            while (e.hasMoreElements())
+            {
+                v.addElement(e.nextElement());
+            }
+
+            return new BERConstructedOctetString(v);
+        }
+
+        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
+    }
+
+    /**
+     * @param string the octets making up the octet string.
+     */
+    public ASN1OctetString(
+        byte[]  string)
+    {
+        this.string = string;
+    }
+
+    public ASN1OctetString(
+        DEREncodable obj)
+    {
+        try
+        {
+            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
+            DEROutputStream         dOut = new DEROutputStream(bOut);
+
+            dOut.writeObject(obj);
+            dOut.close();
+
+            this.string = bOut.toByteArray();
+        }
+        catch (IOException e)
+        {
+            throw new IllegalArgumentException("Error processing object : " + e.toString());
+        }
+    }
+
+    public byte[] getOctets()
+    {
+        return string;
+    }
+
+    public int hashCode()
+    {
+        byte[]  b = this.getOctets();
+        int     value = 0;
+
+        for (int i = 0; i != b.length; i++)
+        {
+            value ^= (b[i] & 0xff) << (i % 4);
+        }
+
+        return value;
+    }
+
+    public boolean equals(
+        Object  o)
+    {
+        if (o == null || !(o instanceof DEROctetString))
+        {
+            return false;
+        }
+
+        DEROctetString  other = (DEROctetString)o;
+
+        byte[] b1 = other.getOctets();
+        byte[] b2 = this.getOctets();
+
+        if (b1.length != b2.length)
+        {
+            return false;
+        }
+
+        for (int i = 0; i != b1.length; i++)
+        {
+            if (b1[i] != b2[i])
+            {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    abstract void encode(DEROutputStream out)
+        throws IOException;
+}

Added: geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1OutputStream.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1OutputStream.java?rev=291352&view=auto
==============================================================================
--- geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1OutputStream.java (added)
+++ geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1OutputStream.java Sat Sep 24 17:31:10 2005
@@ -0,0 +1,53 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.util.asn1;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+public class ASN1OutputStream
+    extends DEROutputStream
+{
+    public ASN1OutputStream(
+        OutputStream    os)
+    {
+        super(os);
+    }
+
+    public void writeObject(
+        Object    obj)
+        throws IOException
+    {
+        if (obj == null)
+        {
+            writeNull();
+        }
+        else if (obj instanceof DERObject)
+        {
+            ((DERObject)obj).encode(this);
+        }
+        else if (obj instanceof DEREncodable)
+        {
+            ((DEREncodable)obj).getDERObject().encode(this);
+        }
+        else
+        {
+            throw new IOException("object not ASN1Encodable");
+        }
+    }
+}

Added: geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Sequence.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Sequence.java?rev=291352&view=auto
==============================================================================
--- geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Sequence.java (added)
+++ geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Sequence.java Sat Sep 24 17:31:10 2005
@@ -0,0 +1,202 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.util.asn1;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Vector;
+
+public abstract class ASN1Sequence
+    extends DERObject
+{
+    private Vector seq = new Vector();
+
+    /**
+     * return an ASN1Sequence from the given object.
+     *
+     * @param obj the object we want converted.
+     * @exception IllegalArgumentException if the object cannot be converted.
+     */
+    public static ASN1Sequence getInstance(
+        Object  obj)
+    {
+        if (obj == null || obj instanceof ASN1Sequence)
+        {
+            return (ASN1Sequence)obj;
+        }
+
+        throw new IllegalArgumentException("unknown object in getInstance");
+    }
+
+    /**
+     * Return an ASN1 sequence from a tagged object. There is a special
+     * case here, if an object appears to have been explicitly tagged on
+     * reading but we were expecting it to be implictly tagged in the
+     * normal course of events it indicates that we lost the surrounding
+     * sequence - so we need to add it back (this will happen if the tagged
+     * object is a sequence that contains other sequences). If you are
+     * dealing with implicitly tagged sequences you really <b>should</b>
+     * be using this method.
+     *
+     * @param obj the tagged object.
+     * @param explicit true if the object is meant to be explicitly tagged,
+     *          false otherwise.
+     * @exception IllegalArgumentException if the tagged object cannot
+     *          be converted.
+     */
+    public static ASN1Sequence getInstance(
+        ASN1TaggedObject    obj,
+        boolean             explicit)
+    {
+        if (explicit)
+        {
+            if (!obj.isExplicit())
+            {
+                throw new IllegalArgumentException("object implicit - explicit expected.");
+            }
+
+            return (ASN1Sequence)obj.getObject();
+        }
+        else
+        {
+            //
+            // constructed object which appears to be explicitly tagged
+            // when it should be implicit means we have to add the
+            // surrounding sequence.
+            //
+            if (obj.isExplicit())
+            {
+                if (obj instanceof BERTaggedObject)
+                {
+                    return new BERSequence(obj.getObject());
+                }
+                else
+                {
+                    return new DERSequence(obj.getObject());
+                }
+            }
+            else
+            {
+                if (obj.getObject() instanceof ASN1Sequence)
+                {
+                    return (ASN1Sequence)obj.getObject();
+                }
+            }
+        }
+
+        throw new IllegalArgumentException(
+                "unknown object in getInstanceFromTagged");
+    }
+
+    public Enumeration getObjects()
+    {
+        return seq.elements();
+    }
+
+    /**
+     * return the object at the sequence postion indicated by index.
+     *
+     * @param index the sequence number (starting at zero) of the object
+     * @return the object at the sequence postion indicated by index.
+     */
+    public DEREncodable getObjectAt(
+        int index)
+    {
+        return (DEREncodable)seq.elementAt(index);
+    }
+
+    /**
+     * return the number of objects in this sequence.
+     *
+     * @return the number of objects in this sequence.
+     */
+    public int size()
+    {
+        return seq.size();
+    }
+
+    public int hashCode()
+    {
+        Enumeration             e = this.getObjects();
+        int                     hashCode = 0;
+
+        while (e.hasMoreElements())
+        {
+            Object    o = e.nextElement();
+
+            if (o != null)
+            {
+                hashCode ^= o.hashCode();
+            }
+        }
+
+        return hashCode;
+    }
+
+    public boolean equals(
+        Object  o)
+    {
+        if (o == null || !(o instanceof ASN1Sequence))
+        {
+            return false;
+        }
+
+        ASN1Sequence   other = (ASN1Sequence)o;
+
+        if (this.size() != other.size())
+        {
+            return false;
+        }
+
+        Enumeration s1 = this.getObjects();
+        Enumeration s2 = other.getObjects();
+
+        while (s1.hasMoreElements())
+        {
+            Object  o1 = s1.nextElement();
+            Object  o2 = s2.nextElement();
+
+            if (o1 != null && o2 != null)
+            {
+                if (!o1.equals(o2))
+                {
+                    return false;
+                }
+            }
+            else if (o1 == null && o2 == null)
+            {
+                continue;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    protected void addObject(
+        DEREncodable obj)
+    {
+        seq.addElement(obj);
+    }
+
+    abstract void encode(DEROutputStream out)
+        throws IOException;
+}

Added: geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Set.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Set.java?rev=291352&view=auto
==============================================================================
--- geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Set.java (added)
+++ geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1Set.java Sat Sep 24 17:31:10 2005
@@ -0,0 +1,304 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.util.asn1;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Vector;
+
+abstract public class ASN1Set
+    extends DERObject
+{
+    protected Vector set = new Vector();
+
+    /**
+     * return an ASN1Set from the given object.
+     *
+     * @param obj the object we want converted.
+     * @exception IllegalArgumentException if the object cannot be converted.
+     */
+    public static ASN1Set getInstance(
+        Object  obj)
+    {
+        if (obj == null || obj instanceof ASN1Set)
+        {
+            return (ASN1Set)obj;
+        }
+
+        throw new IllegalArgumentException("unknown object in getInstance");
+    }
+
+    /**
+     * Return an ASN1 set from a tagged object. There is a special
+     * case here, if an object appears to have been explicitly tagged on
+     * reading but we were expecting it to be implictly tagged in the
+     * normal course of events it indicates that we lost the surrounding
+     * set - so we need to add it back (this will happen if the tagged
+     * object is a sequence that contains other sequences). If you are
+     * dealing with implicitly tagged sets you really <b>should</b>
+     * be using this method.
+     *
+     * @param obj the tagged object.
+     * @param explicit true if the object is meant to be explicitly tagged
+     *          false otherwise.
+     * @exception IllegalArgumentException if the tagged object cannot
+     *          be converted.
+     */
+    public static ASN1Set getInstance(
+        ASN1TaggedObject    obj,
+        boolean             explicit)
+    {
+        if (explicit)
+        {
+            if (!obj.isExplicit())
+            {
+                throw new IllegalArgumentException("object implicit - explicit expected.");
+            }
+
+            return (ASN1Set)obj.getObject();
+        }
+        else
+        {
+            //
+            // constructed object which appears to be explicitly tagged
+            // and it's really implicit means we have to add the
+            // surrounding sequence.
+            //
+            if (obj.isExplicit())
+            {
+                ASN1Set    set = new DERSet(obj.getObject());
+
+                return set;
+            }
+            else
+            {
+                if (obj.getObject() instanceof ASN1Set)
+                {
+                    return (ASN1Set)obj.getObject();
+                }
+
+                //
+                // in this case the parser returns a sequence, convert it
+                // into a set.
+                //
+                ASN1EncodableVector  v = new ASN1EncodableVector();
+
+                if (obj.getObject() instanceof ASN1Sequence)
+                {
+                    ASN1Sequence s = (ASN1Sequence)obj.getObject();
+                    Enumeration e = s.getObjects();
+
+                    while (e.hasMoreElements())
+                    {
+                        v.add((DEREncodable)e.nextElement());
+                    }
+
+                    return new DERSet(v, false);
+                }
+            }
+        }
+
+        throw new IllegalArgumentException(
+                    "unknown object in getInstanceFromTagged");
+    }
+
+    public ASN1Set()
+    {
+    }
+
+    public Enumeration getObjects()
+    {
+        return set.elements();
+    }
+
+    /**
+     * return the object at the set postion indicated by index.
+     *
+     * @param index the set number (starting at zero) of the object
+     * @return the object at the set postion indicated by index.
+     */
+    public DEREncodable getObjectAt(
+        int index)
+    {
+        return (DEREncodable)set.elementAt(index);
+    }
+
+    /**
+     * return the number of objects in this set.
+     *
+     * @return the number of objects in this set.
+     */
+    public int size()
+    {
+        return set.size();
+    }
+
+    public int hashCode()
+    {
+        Enumeration             e = this.getObjects();
+        int                     hashCode = 0;
+
+        while (e.hasMoreElements())
+        {
+            hashCode ^= e.nextElement().hashCode();
+        }
+
+        return hashCode;
+    }
+
+    public boolean equals(
+        Object  o)
+    {
+        if (o == null || !(o instanceof ASN1Set))
+        {
+            return false;
+        }
+
+        ASN1Set   other = (ASN1Set)o;
+
+        if (this.size() != other.size())
+        {
+            return false;
+        }
+
+        Enumeration s1 = this.getObjects();
+        Enumeration s2 = other.getObjects();
+
+        while (s1.hasMoreElements())
+        {
+            if (!s1.nextElement().equals(s2.nextElement()))
+            {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    /**
+     * return true if a <= b (arrays are assumed padded with zeros).
+     */
+    private boolean lessThanOrEqual(
+         byte[] a,
+         byte[] b)
+    {
+         if (a.length <= b.length)
+         {
+             for (int i = 0; i != a.length; i++)
+             {
+                 int    l = a[i] & 0xff;
+                 int    r = b[i] & 0xff;
+
+                 if (r > l)
+                 {
+                     return true;
+                 }
+                 else if (l > r)
+                 {
+                     return false;
+                 }
+             }
+
+             return true;
+         }
+         else
+         {
+             for (int i = 0; i != b.length; i++)
+             {
+                 int    l = a[i] & 0xff;
+                 int    r = b[i] & 0xff;
+
+                 if (r > l)
+                 {
+                     return true;
+                 }
+                 else if (l > r)
+                 {
+                     return false;
+                 }
+             }
+
+             return false;
+         }
+    }
+
+    private byte[] getEncoded(
+        DEREncodable obj)
+    {
+        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
+        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);
+
+        try
+        {
+            aOut.writeObject(obj);
+        }
+        catch (IOException e)
+        {
+            throw new IllegalArgumentException("cannot encode object added to SET");
+        }
+
+        return bOut.toByteArray();
+    }
+
+    protected void sort()
+    {
+        if (set.size() > 1)
+        {
+            boolean    swapped = true;
+
+            while (swapped)
+            {
+                int    index = 0;
+                byte[] a = getEncoded((DEREncodable)set.elementAt(0));
+
+                swapped = false;
+
+                while (index != set.size() - 1)
+                {
+                    byte[] b = getEncoded((DEREncodable)set.elementAt(index + 1));
+
+                    if (lessThanOrEqual(a, b))
+                    {
+                        a = b;
+                    }
+                    else
+                    {
+                        Object  o = set.elementAt(index);
+
+                        set.setElementAt(set.elementAt(index + 1), index);
+                        set.setElementAt(o, index + 1);
+
+                        swapped = true;
+                    }
+
+                    index++;
+                }
+            }
+        }
+    }
+
+    protected void addObject(
+        DEREncodable obj)
+    {
+        set.addElement(obj);
+    }
+
+    abstract void encode(DEROutputStream out)
+            throws IOException;
+}

Added: geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1TaggedObject.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1TaggedObject.java?rev=291352&view=auto
==============================================================================
--- geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1TaggedObject.java (added)
+++ geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/ASN1TaggedObject.java Sat Sep 24 17:31:10 2005
@@ -0,0 +1,178 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.util.asn1;
+
+import java.io.IOException;
+
+/**
+ * ASN.1 TaggedObject - in ASN.1 nottation this is any object proceeded by
+ * a [n] where n is some number - these are assume to follow the construction
+ * rules (as with sequences).
+ */
+public abstract class ASN1TaggedObject
+    extends DERObject
+{
+    int             tagNo;
+    boolean         empty = false;
+    boolean         explicit = true;
+    DEREncodable    obj = null;
+
+    static public ASN1TaggedObject getInstance(
+        ASN1TaggedObject    obj,
+        boolean             explicit)
+    {
+        if (explicit)
+        {
+            return (ASN1TaggedObject)obj.getObject();
+        }
+
+        throw new IllegalArgumentException("implicitly tagged tagged object");
+    }
+
+    /**
+     * Create a tagged object in the explicit style.
+     *
+     * @param tagNo the tag number for this object.
+     * @param obj the tagged object.
+     */
+    public ASN1TaggedObject(
+        int             tagNo,
+        DEREncodable    obj)
+    {
+        this.explicit = true;
+        this.tagNo = tagNo;
+        this.obj = obj;
+    }
+
+    /**
+     * Create a tagged object with the style given by the value of explicit.
+     * <p>
+     * If the object implements ASN1Choice the tag style will always be changed
+     * to explicit in accordance with the ASN.1 encoding rules.
+     * </p>
+     * @param explicit true if the object is explicitly tagged.
+     * @param tagNo the tag number for this object.
+     * @param obj the tagged object.
+     */
+    public ASN1TaggedObject(
+        boolean         explicit,
+        int             tagNo,
+        DEREncodable    obj)
+    {
+        if (obj instanceof ASN1Choice)
+        {
+            this.explicit = true;
+        }
+        else
+        {
+            this.explicit = explicit;
+        }
+
+        this.tagNo = tagNo;
+        this.obj = obj;
+    }
+
+    public boolean equals(
+        Object o)
+    {
+        if (o == null || !(o instanceof ASN1TaggedObject))
+        {
+            return false;
+        }
+
+        ASN1TaggedObject other = (ASN1TaggedObject)o;
+
+        if (tagNo != other.tagNo || empty != other.empty || explicit != other.explicit)
+        {
+            return false;
+        }
+
+        if(obj == null)
+        {
+            if(other.obj != null)
+            {
+                return false;
+            }
+        }
+        else
+        {
+            if(!(obj.equals(other.obj)))
+            {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    public int hashCode()
+    {
+        int code = tagNo;
+
+        if (obj != null)
+        {
+            code ^= obj.hashCode();
+        }
+
+        return code;
+    }
+
+    public int getTagNo()
+    {
+        return tagNo;
+    }
+
+    /**
+     * return whether or not the object may be explicitly tagged.
+     * <p>
+     * Note: if the object has been read from an input stream, the only
+     * time you can be sure if isExplicit is returning the true state of
+     * affairs is if it returns false. An implicitly tagged object may appear
+     * to be explicitly tagged, so you need to understand the context under
+     * which the reading was done as well, see getObject below.
+     */
+    public boolean isExplicit()
+    {
+        return explicit;
+    }
+
+    public boolean isEmpty()
+    {
+        return empty;
+    }
+
+    /**
+     * return whatever was following the tag.
+     * <p>
+     * Note: tagged objects are generally context dependent if you're
+     * trying to extract a tagged object you should be going via the
+     * appropriate getInstance method.
+     */
+    public DERObject getObject()
+    {
+        if (obj != null)
+        {
+            return obj.getDERObject();
+        }
+
+        return null;
+    }
+
+    abstract void encode(DEROutputStream  out)
+        throws IOException;
+}

Added: geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/BERConstructedOctetString.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/BERConstructedOctetString.java?rev=291352&view=auto
==============================================================================
--- geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/BERConstructedOctetString.java (added)
+++ geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/BERConstructedOctetString.java Sat Sep 24 17:31:10 2005
@@ -0,0 +1,189 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.util.asn1;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Vector;
+
+public class BERConstructedOctetString
+    extends DEROctetString
+{
+    /**
+     * convert a vector of octet strings into a single byte string
+     */
+    static private byte[] toBytes(
+        Vector  octs)
+    {
+        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
+
+        for (int i = 0; i != octs.size(); i++)
+        {
+            try
+            {
+                DEROctetString  o = (DEROctetString)octs.elementAt(i);
+
+                bOut.write(o.getOctets());
+            }
+            catch (ClassCastException e)
+            {
+                throw new IllegalArgumentException(octs.elementAt(i).getClass().getName() + " found in input should only contain DEROctetString");
+            }
+            catch (IOException e)
+            {
+                throw new IllegalArgumentException("exception converting octets " + e.toString());
+            }
+        }
+
+        return bOut.toByteArray();
+    }
+
+    private Vector  octs;
+
+    /**
+     * @param string the octets making up the octet string.
+     */
+    public BERConstructedOctetString(
+        byte[]  string)
+    {
+        super(string);
+    }
+
+    public BERConstructedOctetString(
+        Vector  octs)
+    {
+        super(toBytes(octs));
+
+        this.octs = octs;
+    }
+
+    public BERConstructedOctetString(
+        DERObject  obj)
+    {
+        super(obj);
+    }
+
+    public BERConstructedOctetString(
+        DEREncodable  obj)
+    {
+        super(obj.getDERObject());
+    }
+
+    public byte[] getOctets()
+    {
+        return string;
+    }
+
+    /**
+     * return the DER octets that make up this string.
+     */
+    public Enumeration getObjects()
+    {
+        if (octs == null)
+        {
+            return generateOcts().elements();
+        }
+
+        return octs.elements();
+    }
+
+    private Vector generateOcts()
+    {
+        int     start = 0;
+        int     end = 0;
+        Vector  vec = new Vector();
+
+        while ((end + 1) < string.length)
+        {
+            if (string[end] == 0 && string[end + 1] == 0)
+            {
+                byte[]  nStr = new byte[end - start + 1];
+
+                System.arraycopy(string, start, nStr, 0, nStr.length);
+
+                vec.addElement(new DEROctetString(nStr));
+                start = end + 1;
+            }
+            end++;
+        }
+
+        byte[]  nStr = new byte[string.length - start];
+
+        System.arraycopy(string, start, nStr, 0, nStr.length);
+
+        vec.addElement(new DEROctetString(nStr));
+
+        return vec;
+    }
+
+    public void encode(
+        DEROutputStream out)
+        throws IOException
+    {
+        if (out instanceof ASN1OutputStream || out instanceof BEROutputStream)
+        {
+            out.write(CONSTRUCTED | OCTET_STRING);
+
+            out.write(0x80);
+
+            //
+            // write out the octet array
+            //
+            if (octs != null)
+            {
+                for (int i = 0; i != octs.size(); i++)
+                {
+                    out.writeObject(octs.elementAt(i));
+                }
+            }
+            else
+            {
+                int     start = 0;
+                int     end = 0;
+
+                while ((end + 1) < string.length)
+                {
+                    if (string[end] == 0 && string[end + 1] == 0)
+                    {
+                        byte[]  nStr = new byte[end - start + 1];
+
+                        System.arraycopy(string, start, nStr, 0, nStr.length);
+
+                        out.writeObject(new DEROctetString(nStr));
+                        start = end + 1;
+                    }
+                    end++;
+                }
+
+                byte[]  nStr = new byte[string.length - start];
+
+                System.arraycopy(string, start, nStr, 0, nStr.length);
+
+                out.writeObject(new DEROctetString(nStr));
+            }
+
+            out.write(0x00);
+            out.write(0x00);
+        }
+        else
+        {
+            super.encode(out);
+        }
+    }
+}

Added: geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/BERConstructedSequence.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/BERConstructedSequence.java?rev=291352&view=auto
==============================================================================
--- geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/BERConstructedSequence.java (added)
+++ geronimo/trunk/modules/util/src/java/org/apache/geronimo/util/asn1/BERConstructedSequence.java Sat Sep 24 17:31:10 2005
@@ -0,0 +1,54 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.util.asn1;
+
+import java.io.IOException;
+import java.util.Enumeration;
+
+/**
+ * @deprecated use BERSequence
+ */
+public class BERConstructedSequence
+    extends DERConstructedSequence
+{
+    /*
+     */
+    void encode(
+        DEROutputStream out)
+        throws IOException
+    {
+        if (out instanceof ASN1OutputStream || out instanceof BEROutputStream)
+        {
+            out.write(SEQUENCE | CONSTRUCTED);
+            out.write(0x80);
+
+            Enumeration e = getObjects();
+            while (e.hasMoreElements())
+            {
+                out.writeObject(e.nextElement());
+            }
+
+            out.write(0x00);
+            out.write(0x00);
+        }
+        else
+        {
+            super.encode(out);
+        }
+    }
+}



Mime
View raw message