[azureus] 03/03: Updated azureus packing for new upstream version.

Stephen Nelson stephenonelson-guest at moszumanska.debian.org
Tue Jun 24 11:59:01 UTC 2014


This is an automated email from the git hooks/post-receive script.

stephenonelson-guest pushed a commit to branch vuze5.3
in repository azureus.

commit 6d34987acf6b0d67a81b1048142159e596cc704f
Author: Stephen Nelson <stephen at eccostudio.com>
Date:   Wed Jun 18 15:16:55 2014 +0100

    Updated azureus packing for new upstream version.
    
     - New upstream release 5.3.0.0.
     - Remove deprecated source version and set source and target to Java 1.6.
     - Check out and build source from upstream VCS to utilise upstream build file.
     - Use dh with javahelper to build package.
     - Removed binaries from upstream tarball.
     - Unbundle modified json simple embedded in upstream.
     - Unbundle modified commons lang embedded in upstream and replaced with commons lang 3.
     - Unbundle modified Bouncycastle JCE embedded in upstream.
     - Refreshed patches.
---
 azureus2/src/org/bouncycastle/LICENSE.java         |   63 --
 azureus2/src/org/bouncycastle/asn1/ASN1Choice.java |   14 -
 .../src/org/bouncycastle/asn1/ASN1Encodable.java   |   86 --
 .../org/bouncycastle/asn1/ASN1EncodableVector.java |   14 -
 .../src/org/bouncycastle/asn1/ASN1Generator.java   |   15 -
 .../src/org/bouncycastle/asn1/ASN1InputStream.java |  481 --------
 azureus2/src/org/bouncycastle/asn1/ASN1Null.java   |   38 -
 azureus2/src/org/bouncycastle/asn1/ASN1Object.java |   38 -
 .../org/bouncycastle/asn1/ASN1ObjectParser.java    |   64 --
 .../src/org/bouncycastle/asn1/ASN1OctetString.java |  161 ---
 .../bouncycastle/asn1/ASN1OctetStringParser.java   |    9 -
 .../org/bouncycastle/asn1/ASN1OutputStream.java    |   36 -
 .../src/org/bouncycastle/asn1/ASN1Sequence.java    |  218 ----
 .../org/bouncycastle/asn1/ASN1SequenceParser.java  |   10 -
 azureus2/src/org/bouncycastle/asn1/ASN1Set.java    |  339 ------
 .../src/org/bouncycastle/asn1/ASN1SetParser.java   |   10 -
 .../org/bouncycastle/asn1/ASN1StreamParser.java    |  222 ----
 .../org/bouncycastle/asn1/ASN1TaggedObject.java    |  205 ----
 .../bouncycastle/asn1/ASN1TaggedObjectParser.java  |   12 -
 .../asn1/BERConstructedOctetString.java            |  171 ---
 .../bouncycastle/asn1/BERConstructedSequence.java  |   37 -
 .../src/org/bouncycastle/asn1/BERGenerator.java    |  100 --
 .../src/org/bouncycastle/asn1/BERInputStream.java  |  209 ----
 azureus2/src/org/bouncycastle/asn1/BERNull.java    |   30 -
 .../bouncycastle/asn1/BEROctetStringGenerator.java |  100 --
 .../bouncycastle/asn1/BEROctetStringParser.java    |   43 -
 .../src/org/bouncycastle/asn1/BEROutputStream.java |   36 -
 .../src/org/bouncycastle/asn1/BERSequence.java     |   59 -
 .../bouncycastle/asn1/BERSequenceGenerator.java    |   41 -
 .../org/bouncycastle/asn1/BERSequenceParser.java   |   25 -
 azureus2/src/org/bouncycastle/asn1/BERSet.java     |   69 --
 .../src/org/bouncycastle/asn1/BERSetParser.java    |   25 -
 .../src/org/bouncycastle/asn1/BERTaggedObject.java |  119 --
 .../bouncycastle/asn1/BERTaggedObjectParser.java   |  154 ---
 .../bouncycastle/asn1/ConstructedOctetStream.java  |  111 --
 .../bouncycastle/asn1/DERApplicationSpecific.java  |  170 ---
 .../src/org/bouncycastle/asn1/DERBMPString.java    |  126 ---
 .../src/org/bouncycastle/asn1/DERBitString.java    |  289 -----
 azureus2/src/org/bouncycastle/asn1/DERBoolean.java |  113 --
 .../bouncycastle/asn1/DERConstructedSequence.java  |   53 -
 .../org/bouncycastle/asn1/DERConstructedSet.java   |   79 --
 .../src/org/bouncycastle/asn1/DEREncodable.java    |    6 -
 .../org/bouncycastle/asn1/DEREncodableVector.java  |   38 -
 .../src/org/bouncycastle/asn1/DEREnumerated.java   |  113 --
 .../org/bouncycastle/asn1/DERGeneralString.java    |   92 --
 .../org/bouncycastle/asn1/DERGeneralizedTime.java  |  294 -----
 .../src/org/bouncycastle/asn1/DERGenerator.java    |  130 ---
 .../src/org/bouncycastle/asn1/DERIA5String.java    |  170 ---
 .../src/org/bouncycastle/asn1/DERInputStream.java  |  272 -----
 azureus2/src/org/bouncycastle/asn1/DERInteger.java |  134 ---
 azureus2/src/org/bouncycastle/asn1/DERNull.java    |   25 -
 .../org/bouncycastle/asn1/DERNumericString.java    |  177 ---
 azureus2/src/org/bouncycastle/asn1/DERObject.java  |   20 -
 .../org/bouncycastle/asn1/DERObjectIdentifier.java |  293 -----
 .../src/org/bouncycastle/asn1/DEROctetString.java  |   29 -
 .../src/org/bouncycastle/asn1/DEROutputStream.java |   93 --
 .../org/bouncycastle/asn1/DERPrintableString.java  |  204 ----
 .../src/org/bouncycastle/asn1/DERSequence.java     |   79 --
 .../bouncycastle/asn1/DERSequenceGenerator.java    |   45 -
 azureus2/src/org/bouncycastle/asn1/DERSet.java     |   99 --
 azureus2/src/org/bouncycastle/asn1/DERString.java  |    9 -
 .../src/org/bouncycastle/asn1/DERT61String.java    |  126 ---
 .../src/org/bouncycastle/asn1/DERTaggedObject.java |   88 --
 azureus2/src/org/bouncycastle/asn1/DERTags.java    |   36 -
 azureus2/src/org/bouncycastle/asn1/DERUTCTime.java |  254 -----
 .../src/org/bouncycastle/asn1/DERUTF8String.java   |  109 --
 .../org/bouncycastle/asn1/DERUniversalString.java  |  120 --
 .../src/org/bouncycastle/asn1/DERUnknownTag.java   |   86 --
 .../org/bouncycastle/asn1/DERVisibleString.java    |  126 ---
 .../asn1/DefiniteLengthInputStream.java            |   95 --
 .../asn1/IndefiniteLengthInputStream.java          |  111 --
 .../org/bouncycastle/asn1/LimitedInputStream.java  |   28 -
 .../src/org/bouncycastle/asn1/OIDTokenizer.java    |   48 -
 .../asn1/cms/CMSObjectIdentifiers.java             |   15 -
 .../src/org/bouncycastle/asn1/cms/ContentInfo.java |   90 --
 .../bouncycastle/asn1/misc/CAST5CBCParameters.java |   71 --
 .../src/org/bouncycastle/asn1/misc/IDEACBCPar.java |   75 --
 .../asn1/misc/MiscObjectIdentifiers.java           |   30 -
 .../bouncycastle/asn1/misc/NetscapeCertType.java   |   54 -
 .../asn1/misc/NetscapeRevocationURL.java           |   18 -
 .../asn1/misc/VerisignCzagExtension.java           |   18 -
 .../src/org/bouncycastle/asn1/misc/package.html    |    5 -
 azureus2/src/org/bouncycastle/asn1/package.html    |    5 -
 .../src/org/bouncycastle/asn1/pkcs/Attribute.java  |   82 --
 .../bouncycastle/asn1/pkcs/AuthenticatedSafe.java  |   47 -
 .../src/org/bouncycastle/asn1/pkcs/CertBag.java    |   53 -
 .../asn1/pkcs/CertificationRequest.java            |   76 --
 .../asn1/pkcs/CertificationRequestInfo.java        |  129 ---
 .../org/bouncycastle/asn1/pkcs/ContentInfo.java    |   88 --
 .../org/bouncycastle/asn1/pkcs/DHParameter.java    |   88 --
 .../org/bouncycastle/asn1/pkcs/EncryptedData.java  |  104 --
 .../asn1/pkcs/EncryptedPrivateKeyInfo.java         |   71 --
 .../bouncycastle/asn1/pkcs/EncryptionScheme.java   |   38 -
 .../asn1/pkcs/IssuerAndSerialNumber.java           |   76 --
 .../bouncycastle/asn1/pkcs/KeyDerivationFunc.java  |   14 -
 .../src/org/bouncycastle/asn1/pkcs/MacData.java    |   89 --
 .../bouncycastle/asn1/pkcs/PBES2Algorithms.java    |   77 --
 .../bouncycastle/asn1/pkcs/PBES2Parameters.java    |   54 -
 .../org/bouncycastle/asn1/pkcs/PBKDF2Params.java   |   86 --
 .../bouncycastle/asn1/pkcs/PKCS12PBEParams.java    |   69 --
 .../asn1/pkcs/PKCSObjectIdentifiers.java           |  142 ---
 azureus2/src/org/bouncycastle/asn1/pkcs/Pfx.java   |   70 --
 .../org/bouncycastle/asn1/pkcs/PrivateKeyInfo.java |  144 ---
 .../bouncycastle/asn1/pkcs/RC2CBCParameter.java    |   89 --
 .../asn1/pkcs/RSAPrivateKeyStructure.java          |  186 ---
 .../src/org/bouncycastle/asn1/pkcs/SafeBag.java    |   78 --
 .../src/org/bouncycastle/asn1/pkcs/SignedData.java |  165 ---
 .../src/org/bouncycastle/asn1/pkcs/SignerInfo.java |  168 ---
 .../src/org/bouncycastle/asn1/pkcs/package.html    |    5 -
 .../asn1/sec/ECPrivateKeyStructure.java            |  102 --
 .../src/org/bouncycastle/asn1/sec/package.html     |    5 -
 .../asn1/teletrust/TeleTrusTObjectIdentifiers.java |   18 -
 .../src/org/bouncycastle/asn1/util/ASN1Dump.java   |  274 -----
 .../src/org/bouncycastle/asn1/util/DERDump.java    |   33 -
 azureus2/src/org/bouncycastle/asn1/util/Dump.java  |   22 -
 .../src/org/bouncycastle/asn1/util/package.html    |    5 -
 .../bouncycastle/asn1/x509/AccessDescription.java  |   98 --
 .../asn1/x509/AlgorithmIdentifier.java             |  126 ---
 .../org/bouncycastle/asn1/x509/AttCertIssuer.java  |   90 --
 .../asn1/x509/AttCertValidityPeriod.java           |   84 --
 .../src/org/bouncycastle/asn1/x509/Attribute.java  |   87 --
 .../asn1/x509/AttributeCertificate.java            |   94 --
 .../asn1/x509/AttributeCertificateInfo.java        |  165 ---
 .../asn1/x509/AuthorityInformationAccess.java      |  101 --
 .../asn1/x509/AuthorityKeyIdentifier.java          |  231 ----
 .../bouncycastle/asn1/x509/BasicConstraints.java   |  181 ---
 .../org/bouncycastle/asn1/x509/CRLDistPoint.java   |  100 --
 .../src/org/bouncycastle/asn1/x509/CRLNumber.java  |   32 -
 .../src/org/bouncycastle/asn1/x509/CRLReason.java  |  111 --
 .../org/bouncycastle/asn1/x509/CertPolicyId.java   |   20 -
 .../bouncycastle/asn1/x509/CertificateList.java    |  119 --
 .../bouncycastle/asn1/x509/CertificatePair.java    |  169 ---
 .../asn1/x509/CertificatePolicies.java             |  147 ---
 .../org/bouncycastle/asn1/x509/DSAParameter.java   |   92 --
 .../src/org/bouncycastle/asn1/x509/DigestInfo.java |   86 --
 .../org/bouncycastle/asn1/x509/DisplayText.java    |  165 ---
 .../bouncycastle/asn1/x509/DistributionPoint.java  |  158 ---
 .../asn1/x509/DistributionPointName.java           |  143 ---
 .../bouncycastle/asn1/x509/ExtendedKeyUsage.java   |  128 ---
 .../org/bouncycastle/asn1/x509/GeneralName.java    |  258 -----
 .../org/bouncycastle/asn1/x509/GeneralNames.java   |   94 --
 .../org/bouncycastle/asn1/x509/GeneralSubtree.java |  200 ----
 .../src/org/bouncycastle/asn1/x509/Holder.java     |  242 ----
 .../org/bouncycastle/asn1/x509/IetfAttrSyntax.java |  174 ---
 .../org/bouncycastle/asn1/x509/IssuerSerial.java   |  106 --
 .../asn1/x509/IssuingDistributionPoint.java        |  256 -----
 .../org/bouncycastle/asn1/x509/KeyPurposeId.java   |   37 -
 .../src/org/bouncycastle/asn1/x509/KeyUsage.java   |   77 --
 .../bouncycastle/asn1/x509/NameConstraints.java    |  104 --
 .../bouncycastle/asn1/x509/NoticeReference.java    |  155 ---
 .../bouncycastle/asn1/x509/ObjectDigestInfo.java   |  192 ----
 .../bouncycastle/asn1/x509/PolicyInformation.java  |   87 --
 .../org/bouncycastle/asn1/x509/PolicyMappings.java |   68 --
 .../bouncycastle/asn1/x509/PolicyQualifierId.java  |   31 -
 .../asn1/x509/PolicyQualifierInfo.java             |  114 --
 .../asn1/x509/PrivateKeyUsagePeriod.java           |   89 --
 .../asn1/x509/RSAPublicKeyStructure.java           |   95 --
 .../org/bouncycastle/asn1/x509/ReasonFlags.java    |   85 --
 .../src/org/bouncycastle/asn1/x509/RoleSyntax.java |  236 ----
 .../asn1/x509/SubjectDirectoryAttributes.java      |  144 ---
 .../asn1/x509/SubjectKeyIdentifier.java            |   95 --
 .../asn1/x509/SubjectPublicKeyInfo.java            |  126 ---
 .../org/bouncycastle/asn1/x509/TBSCertList.java    |  212 ----
 .../asn1/x509/TBSCertificateStructure.java         |  193 ----
 .../src/org/bouncycastle/asn1/x509/Target.java     |  138 ---
 .../bouncycastle/asn1/x509/TargetInformation.java  |  121 --
 .../src/org/bouncycastle/asn1/x509/Targets.java    |  122 --
 azureus2/src/org/bouncycastle/asn1/x509/Time.java  |  133 ---
 .../src/org/bouncycastle/asn1/x509/UserNotice.java |  117 --
 .../asn1/x509/V1TBSCertificateGenerator.java       |  125 --
 .../x509/V2AttributeCertificateInfoGenerator.java  |  148 ---
 .../src/org/bouncycastle/asn1/x509/V2Form.java     |  130 ---
 .../asn1/x509/V2TBSCertListGenerator.java          |  213 ----
 .../asn1/x509/V3TBSCertificateGenerator.java       |  158 ---
 .../org/bouncycastle/asn1/x509/X509Attributes.java |    8 -
 .../asn1/x509/X509CertificateStructure.java        |  127 ---
 .../asn1/x509/X509DefaultEntryConverter.java       |   57 -
 .../org/bouncycastle/asn1/x509/X509Extension.java  |   87 --
 .../org/bouncycastle/asn1/x509/X509Extensions.java |  393 -------
 .../asn1/x509/X509ExtensionsGenerator.java         |   99 --
 .../src/org/bouncycastle/asn1/x509/X509Name.java   | 1158 -------------------
 .../asn1/x509/X509NameEntryConverter.java          |  113 --
 .../bouncycastle/asn1/x509/X509NameTokenizer.java  |   91 --
 .../asn1/x509/X509ObjectIdentifiers.java           |   59 -
 .../src/org/bouncycastle/asn1/x509/package.html    |    5 -
 .../org/bouncycastle/asn1/x9/KeySpecificInfo.java  |   68 --
 .../src/org/bouncycastle/asn1/x9/OtherInfo.java    |   96 --
 .../org/bouncycastle/asn1/x9/X962NamedCurves.java  |  211 ----
 .../org/bouncycastle/asn1/x9/X962Parameters.java   |   54 -
 azureus2/src/org/bouncycastle/asn1/x9/X9Curve.java |   96 --
 .../org/bouncycastle/asn1/x9/X9ECParameters.java   |  154 ---
 .../src/org/bouncycastle/asn1/x9/X9ECPoint.java    |   48 -
 .../org/bouncycastle/asn1/x9/X9FieldElement.java   |   65 --
 .../src/org/bouncycastle/asn1/x9/X9FieldID.java    |   66 --
 .../bouncycastle/asn1/x9/X9IntegerConverter.java   |   47 -
 .../bouncycastle/asn1/x9/X9ObjectIdentifiers.java  |   87 --
 azureus2/src/org/bouncycastle/asn1/x9/package.html |    5 -
 .../bouncycastle/crypto/AsymmetricBlockCipher.java |   45 -
 .../crypto/AsymmetricCipherKeyPair.java            |   44 -
 .../crypto/AsymmetricCipherKeyPairGenerator.java   |   22 -
 .../org/bouncycastle/crypto/BasicAgreement.java    |   21 -
 .../src/org/bouncycastle/crypto/BlockCipher.java   |   56 -
 .../crypto/BufferedAsymmetricBlockCipher.java      |  170 ---
 .../bouncycastle/crypto/BufferedBlockCipher.java   |  324 ------
 .../bouncycastle/crypto/CipherKeyGenerator.java    |   38 -
 .../org/bouncycastle/crypto/CipherParameters.java  |    8 -
 .../org/bouncycastle/crypto/CryptoException.java   |   27 -
 azureus2/src/org/bouncycastle/crypto/DSA.java      |   36 -
 .../bouncycastle/crypto/DataLengthException.java   |   30 -
 .../bouncycastle/crypto/DerivationFunction.java    |   17 -
 .../bouncycastle/crypto/DerivationParameters.java  |    8 -
 azureus2/src/org/bouncycastle/crypto/Digest.java   |   51 -
 .../crypto/InvalidCipherTextException.java         |   27 -
 .../crypto/KeyGenerationParameters.java            |   48 -
 azureus2/src/org/bouncycastle/crypto/Mac.java      |   71 --
 .../crypto/PBEParametersGenerator.java             |  142 ---
 .../crypto/RuntimeCryptoException.java             |   26 -
 .../org/bouncycastle/crypto/StreamBlockCipher.java |  108 --
 .../src/org/bouncycastle/crypto/StreamCipher.java  |   53 -
 azureus2/src/org/bouncycastle/crypto/Wrapper.java  |   18 -
 .../crypto/agreement/ECDHBasicAgreement.java       |   47 -
 .../crypto/agreement/srp/SRP6Client.java           |   93 --
 .../crypto/agreement/srp/SRP6Server.java           |   90 --
 .../crypto/agreement/srp/SRP6Util.java             |   91 --
 .../agreement/srp/SRP6VerifierGenerator.java       |   47 -
 .../bouncycastle/crypto/digests/GeneralDigest.java |  128 ---
 .../bouncycastle/crypto/digests/LongDigest.java    |  346 ------
 .../org/bouncycastle/crypto/digests/MD2Digest.java |  230 ----
 .../org/bouncycastle/crypto/digests/MD4Digest.java |  270 -----
 .../org/bouncycastle/crypto/digests/MD5Digest.java |  302 -----
 .../crypto/digests/RIPEMD128Digest.java            |  461 --------
 .../crypto/digests/RIPEMD160Digest.java            |  422 -------
 .../crypto/digests/RIPEMD256Digest.java            |  476 --------
 .../crypto/digests/RIPEMD320Digest.java            |  461 --------
 .../bouncycastle/crypto/digests/SHA1Digest.java    |  258 -----
 .../bouncycastle/crypto/digests/SHA256Digest.java  |  268 -----
 .../bouncycastle/crypto/digests/SHA384Digest.java  |   86 --
 .../bouncycastle/crypto/digests/SHA512Digest.java  |   88 --
 .../bouncycastle/crypto/digests/TigerDigest.java   |  859 --------------
 .../crypto/encodings/ISO9796d1Encoding.java        |  251 ----
 .../crypto/encodings/OAEPEncoding.java             |  342 ------
 .../crypto/encodings/PKCS1Encoding.java            |  194 ----
 .../org/bouncycastle/crypto/encodings/package.html |    5 -
 .../org/bouncycastle/crypto/engines/IESEngine.java |  245 ----
 .../org/bouncycastle/crypto/engines/RC4Engine.java |  156 ---
 .../org/bouncycastle/crypto/engines/RSAEngine.java |  188 ---
 .../crypto/generators/BaseKDFBytesGenerator.java   |  142 ---
 .../crypto/generators/DESKeyGenerator.java         |   23 -
 .../crypto/generators/DESedeKeyGenerator.java      |   55 -
 .../crypto/generators/DHBasicKeyPairGenerator.java |   53 -
 .../crypto/generators/DHKeyPairGenerator.java      |   53 -
 .../crypto/generators/DHParametersGenerator.java   |   74 --
 .../crypto/generators/DSAKeyPairGenerator.java     |   58 -
 .../crypto/generators/DSAParametersGenerator.java  |  178 ---
 .../crypto/generators/ECKeyPairGenerator.java      |   53 -
 .../crypto/generators/ElGamalKeyPairGenerator.java |   53 -
 .../generators/ElGamalParametersGenerator.java     |   85 --
 .../crypto/generators/KDF2BytesGenerator.java      |   24 -
 .../crypto/generators/MGF1BytesGenerator.java      |  107 --
 .../generators/OpenSSLPBEParametersGenerator.java  |  131 ---
 .../generators/PKCS12ParametersGenerator.java      |  233 ----
 .../generators/PKCS5S1ParametersGenerator.java     |  119 --
 .../crypto/generators/RSAKeyPairGenerator.java     |  141 ---
 .../src/org/bouncycastle/crypto/macs/HMac.java     |  135 ---
 .../bouncycastle/crypto/modes/CBCBlockCipher.java  |  233 ----
 .../bouncycastle/crypto/modes/CFBBlockCipher.java  |  250 ----
 .../bouncycastle/crypto/modes/CTSBlockCipher.java  |  260 -----
 .../bouncycastle/crypto/modes/OFBBlockCipher.java  |  182 ---
 .../crypto/modes/OpenPGPCFBBlockCipher.java        |  322 ------
 .../crypto/modes/PGPCFBBlockCipher.java            |  439 -------
 .../crypto/modes/PaddedBlockCipher.java            |  253 -----
 .../bouncycastle/crypto/modes/SICBlockCipher.java  |  108 --
 .../src/org/bouncycastle/crypto/modes/package.html |    5 -
 .../crypto/params/AsymmetricKeyParameter.java      |   20 -
 .../bouncycastle/crypto/params/DESParameters.java  |  107 --
 .../crypto/params/DESedeParameters.java            |   57 -
 .../crypto/params/DHKeyGenerationParameters.java   |   25 -
 .../crypto/params/DHKeyParameters.java             |   35 -
 .../bouncycastle/crypto/params/DHParameters.java   |  116 --
 .../crypto/params/DHPrivateKeyParameters.java      |   41 -
 .../crypto/params/DHPublicKeyParameters.java       |   41 -
 .../crypto/params/DHValidationParameters.java      |   46 -
 .../crypto/params/DSAKeyGenerationParameters.java  |   25 -
 .../crypto/params/DSAKeyParameters.java            |   21 -
 .../bouncycastle/crypto/params/DSAParameters.java  |   69 --
 .../crypto/params/DSAPrivateKeyParameters.java     |   23 -
 .../crypto/params/DSAPublicKeyParameters.java      |   23 -
 .../crypto/params/DSAValidationParameters.java     |   56 -
 .../crypto/params/ECDomainParameters.java          |   81 --
 .../crypto/params/ECKeyGenerationParameters.java   |   25 -
 .../crypto/params/ECKeyParameters.java             |   21 -
 .../crypto/params/ECPrivateKeyParameters.java      |   22 -
 .../crypto/params/ECPublicKeyParameters.java       |   22 -
 .../params/ElGamalKeyGenerationParameters.java     |   25 -
 .../crypto/params/ElGamalKeyParameters.java        |   35 -
 .../crypto/params/ElGamalParameters.java           |   46 -
 .../crypto/params/ElGamalPrivateKeyParameters.java |   41 -
 .../crypto/params/ElGamalPublicKeyParameters.java  |   41 -
 .../bouncycastle/crypto/params/IESParameters.java  |   44 -
 .../crypto/params/IESWithCipherParameters.java     |   30 -
 .../crypto/params/ISO18033KDFParameters.java       |   23 -
 .../bouncycastle/crypto/params/KDFParameters.java  |   31 -
 .../bouncycastle/crypto/params/KeyParameter.java   |   30 -
 .../bouncycastle/crypto/params/MGFParameters.java  |   32 -
 .../crypto/params/ParametersWithIV.java            |   39 -
 .../crypto/params/ParametersWithRandom.java        |   41 -
 .../bouncycastle/crypto/params/RC2Parameters.java  |   36 -
 .../bouncycastle/crypto/params/RC5Parameters.java  |   35 -
 .../crypto/params/RSAKeyGenerationParameters.java  |   35 -
 .../crypto/params/RSAKeyParameters.java            |   31 -
 .../crypto/params/RSAPrivateCrtKeyParameters.java  |   67 --
 .../org/bouncycastle/crypto/params/package.html    |    5 -
 .../bouncycastle/crypto/signers/ECDSASigner.java   |  144 ---
 .../org/bouncycastle/jce/ECNamedCurveTable.java    |   49 -
 .../jce/PKCS10CertificationRequest.java            |  311 -----
 .../src/org/bouncycastle/jce/PKCS7SignedData.java  |  597 ----------
 .../src/org/bouncycastle/jce/PrincipalUtil.java    |   82 --
 .../src/org/bouncycastle/jce/X509KeyUsage.java     |   57 -
 .../src/org/bouncycastle/jce/X509Principal.java    |  138 ---
 .../jce/X509V1CertificateGenerator.java            |  261 -----
 .../org/bouncycastle/jce/X509V2CRLGenerator.java   |  323 ------
 .../jce/X509V3CertificateGenerator.java            |  342 ------
 .../bouncycastle/jce/interfaces/BCKeyStore.java    |   14 -
 .../src/org/bouncycastle/jce/interfaces/ECKey.java |   15 -
 .../bouncycastle/jce/interfaces/ECPrivateKey.java  |   16 -
 .../bouncycastle/jce/interfaces/ECPublicKey.java   |   17 -
 .../bouncycastle/jce/interfaces/ElGamalKey.java    |    8 -
 .../jce/interfaces/ElGamalPrivateKey.java          |   10 -
 .../jce/interfaces/ElGamalPublicKey.java           |   10 -
 .../org/bouncycastle/jce/interfaces/IESKey.java    |   22 -
 .../jce/interfaces/PKCS12BagAttributeCarrier.java  |   21 -
 .../jce/provider/BouncyCastleProvider.java         |  588 ----------
 .../jce/provider/CertStoreCollectionSpi.java       |  104 --
 .../src/org/bouncycastle/jce/provider/DHUtil.java  |   50 -
 .../src/org/bouncycastle/jce/provider/DSAUtil.java |   49 -
 .../src/org/bouncycastle/jce/provider/ECUtil.java  |   54 -
 .../org/bouncycastle/jce/provider/ElGamalUtil.java |   49 -
 .../jce/provider/JCEECDHKeyAgreement.java          |  173 ---
 .../bouncycastle/jce/provider/JCEECPrivateKey.java |  270 -----
 .../bouncycastle/jce/provider/JCEECPublicKey.java  |  273 -----
 .../bouncycastle/jce/provider/JCEIESCipher.java    |  371 ------
 .../bouncycastle/jce/provider/JCERSAPublicKey.java |  140 ---
 .../provider/JDKAlgorithmParameterGenerator.java   |  385 -------
 .../bouncycastle/jce/provider/JDKDSASigner.java    |  269 -----
 .../jce/provider/JDKDigestSignature.java           |  271 -----
 .../bouncycastle/jce/provider/JDKKeyFactory.java   |  348 ------
 .../jce/provider/JDKKeyPairGenerator.java          |  381 -------
 .../jce/provider/JDKMessageDigest.java             |  279 -----
 .../jce/provider/JDKX509CertificateFactory.java    |  360 ------
 .../bouncycastle/jce/provider/PKIXCertPath.java    |  222 ----
 .../bouncycastle/jce/provider/PKIXPolicyNode.java  |  167 ---
 .../src/org/bouncycastle/jce/provider/RSAUtil.java |   41 -
 .../jce/provider/X509CRLEntryObject.java           |  168 ---
 .../bouncycastle/jce/provider/X509CRLObject.java   |  379 -------
 .../jce/provider/X509CertificateObject.java        |  679 -----------
 .../src/org/bouncycastle/jce/spec/ECKeySpec.java   |   26 -
 .../jce/spec/ECNamedCurveParameterSpec.java        |   60 -
 .../org/bouncycastle/jce/spec/ECParameterSpec.java |   99 --
 .../bouncycastle/jce/spec/ECPrivateKeySpec.java    |   35 -
 .../org/bouncycastle/jce/spec/ECPublicKeySpec.java |   35 -
 .../jce/spec/ElGamalGenParameterSpec.java          |   28 -
 .../org/bouncycastle/jce/spec/ElGamalKeySpec.java  |   20 -
 .../jce/spec/ElGamalParameterSpec.java             |   46 -
 .../jce/spec/ElGamalPrivateKeySpec.java            |   33 -
 .../jce/spec/ElGamalPublicKeySpec.java             |   33 -
 .../src/org/bouncycastle/jce/spec/IEKeySpec.java   |   70 --
 .../bouncycastle/jce/spec/IESParameterSpec.java    |   52 -
 .../src/org/bouncycastle/math/ec/ECConstants.java  |   12 -
 azureus2/src/org/bouncycastle/math/ec/ECCurve.java |  660 -----------
 .../org/bouncycastle/math/ec/ECFieldElement.java   | 1194 --------------------
 .../src/org/bouncycastle/math/ec/ECMultiplier.java |   19 -
 azureus2/src/org/bouncycastle/math/ec/ECPoint.java |  594 ----------
 .../org/bouncycastle/math/ec/FpNafMultiplier.java  |   39 -
 .../src/org/bouncycastle/math/ec/IntArray.java     |  518 ---------
 .../src/org/bouncycastle/math/ec/PreCompInfo.java  |   10 -
 .../org/bouncycastle/math/ec/SimpleBigDecimal.java |  253 -----
 azureus2/src/org/bouncycastle/math/ec/Tnaf.java    |  844 --------------
 .../src/org/bouncycastle/math/ec/ZTauElement.java  |   37 -
 .../src/org/bouncycastle/openssl/PEMReader.java    |  543 ---------
 .../src/org/bouncycastle/openssl/PEMUtilities.java |  185 ---
 .../src/org/bouncycastle/openssl/PEMWriter.java    |  312 -----
 .../org/bouncycastle/openssl/PasswordFinder.java   |    9 -
 azureus2/src/org/bouncycastle/util/Arrays.java     |  135 ---
 .../src/org/bouncycastle/util/BigIntegers.java     |   78 --
 azureus2/src/org/bouncycastle/util/IPAddress.java  |  120 --
 azureus2/src/org/bouncycastle/util/Selector.java   |    9 -
 azureus2/src/org/bouncycastle/util/Strings.java    |  241 ----
 .../src/org/bouncycastle/util/encoders/Base64.java |  345 ------
 .../util/encoders/BufferedDecoder.java             |   96 --
 .../util/encoders/BufferedEncoder.java             |   96 --
 .../src/org/bouncycastle/util/encoders/Hex.java    |   78 --
 .../bouncycastle/util/encoders/HexTranslator.java  |   87 --
 .../org/bouncycastle/util/encoders/Translator.java |   23 -
 .../x509/AttributeCertificateHolder.java           |  419 -------
 .../x509/AttributeCertificateIssuer.java           |  206 ----
 .../src/org/bouncycastle/x509/X509Attribute.java   |   78 --
 .../x509/X509AttributeCertificate.java             |  101 --
 azureus2/src/org/bouncycastle/x509/X509Util.java   |  411 -------
 .../x509/X509V2AttributeCertificate.java           |  346 ------
 azureus2/src/org/json/simple/AUTHORS.txt           |    1 -
 azureus2/src/org/json/simple/ItemList.java         |  205 ----
 azureus2/src/org/json/simple/JSONArray.java        |   72 --
 azureus2/src/org/json/simple/JSONObject.java       |  208 ----
 azureus2/src/org/json/simple/JSONValue.java        |   36 -
 azureus2/src/org/json/simple/LICENSE.txt           |  504 ---------
 azureus2/src/org/json/simple/README.txt            |  144 ---
 azureus2/src/org/json/simple/Test.java             |   54 -
 .../src/org/json/simple/parser/JSONParser.java     |  192 ----
 azureus2/src/org/json/simple/parser/Yylex.java     |  428 -------
 azureus2/src/org/json/simple/parser/Yytoken.java   |   31 -
 azureus3/src/org/apache/commons/lang/Entities.java |  681 -----------
 .../src/org/apache/commons/lang/IntHashMap.java    |  362 ------
 debian/NEWS.Debian                                 |   16 -
 debian/azureus.desktop                             |    9 -
 debian/azureus.install                             |    1 +
 debian/azureus.manifest                            |    4 +
 debian/{wrappers => bin}/azureus                   |    7 +-
 debian/build.properties                            |   11 -
 debian/build.xml                                   |  105 --
 debian/changelog                                   |   20 +
 debian/compat                                      |    2 +-
 debian/control                                     |   51 +-
 debian/copyright                                   |   13 +-
 debian/{ => man}/azureus.1                         |    4 +-
 debian/manpages                                    |    1 -
 debian/menu                                        |    4 -
 debian/orig-tar.sh                                 |   16 +
 debian/patches/01_amend_build_classpath.patch      |   46 +
 .../{debian/speedtest.diff => 02_speedtest.patch}  |   18 +-
 debian/patches/03_update_disable.patch             |   73 ++
 debian/patches/04_unbundle_json.patch              |   66 ++
 debian/patches/05_unbundle_commons_lang.patch      |  136 +++
 debian/patches/06_unbundle_bouncy_castle.patch     |  237 ++++
 debian/patches/07_platform.patch                   |   86 ++
 debian/patches/08_multi_user.patch                 |  183 +++
 ...o-auto-update.patch => 09_no_auto_update.patch} |   44 +-
 debian/patches/debian/update-disable.diff          |  116 --
 debian/patches/fixes/multiuser.diff                |  521 ---------
 debian/patches/fixes/platform.diff                 |  142 ---
 debian/patches/series                              |   14 +-
 debian/rules                                       |   26 +-
 debian/vuze.desktop                                |    4 +-
 debian/{install => vuze.install}                   |    5 +-
 debian/vuze.manpages                               |    1 +
 debian/vuze.menu                                   |    6 +
 debian/watch                                       |    3 +-
 446 files changed, 971 insertions(+), 55853 deletions(-)

diff --git a/azureus2/src/org/bouncycastle/LICENSE.java b/azureus2/src/org/bouncycastle/LICENSE.java
deleted file mode 100644
index f3573c4..0000000
--- a/azureus2/src/org/bouncycastle/LICENSE.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.bouncycastle;
-
-/**
- * The Bouncy Castle License
- *
- * Copyright (c) 2000 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
- * <p>
- * 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:
- * <p>
- * The above copyright notice and this permission notice shall be included in all copies or substantial
- * portions of the Software.
- * <p>
- * 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.
- */
-public class LICENSE
-{
-    public static String licenseText =
-      "Copyright (c) 2000 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) "
-      + System.getProperty("line.separator")
-      + System.getProperty("line.separator")
-      + "Permission is hereby granted, free of charge, to any person obtaining a copy of this software "
-      + System.getProperty("line.separator")
-      + "and associated documentation files (the \"Software\"), to deal in the Software without restriction, "
-      + System.getProperty("line.separator")
-      + "including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, "
-      + System.getProperty("line.separator")
-      + "and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,"
-      + System.getProperty("line.separator")
-      + "subject to the following conditions:"
-      + System.getProperty("line.separator")
-      + System.getProperty("line.separator")
-      + "The above copyright notice and this permission notice shall be included in all copies or substantial"
-      + System.getProperty("line.separator")
-      + "portions of the Software."
-      + System.getProperty("line.separator")
-      + System.getProperty("line.separator")
-      + "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,"
-      + System.getProperty("line.separator")
-      + "INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR"
-      + System.getProperty("line.separator")
-      + "PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE"
-      + System.getProperty("line.separator")
-      + "LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR"
-      + System.getProperty("line.separator")
-      + "OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER"
-      + System.getProperty("line.separator")
-      + "DEALINGS IN THE SOFTWARE.";
-
-    public static void main(
-        String[]    args)
-    {
-        System.out.println(licenseText);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1Choice.java b/azureus2/src/org/bouncycastle/asn1/ASN1Choice.java
deleted file mode 100644
index 603131d..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1Choice.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.bouncycastle.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
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1Encodable.java b/azureus2/src/org/bouncycastle/asn1/ASN1Encodable.java
deleted file mode 100644
index 34b1b8f..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1Encodable.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-public abstract class ASN1Encodable
-    implements DEREncodable
-{
-    public static final String DER = "DER";
-    public static final String BER = "BER";
-    
-    public byte[] getEncoded() 
-        throws IOException
-    {
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-        ASN1OutputStream        aOut = new ASN1OutputStream(bOut);
-        
-        aOut.writeObject(this);
-        
-        return bOut.toByteArray();
-    }
-    
-    public byte[] getEncoded(
-        String encoding) 
-        throws IOException
-    {
-        if (encoding.equals(DER))
-        {
-            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-            DEROutputStream         dOut = new DEROutputStream(bOut);
-            
-            dOut.writeObject(this);
-            
-            return bOut.toByteArray();
-        }
-        
-        return this.getEncoded();
-    }
-    
-    /**
-     * Return the DER encoding of the object, null if the DER encoding can not be made.
-     * 
-     * @return a DER byte array, null otherwise.
-     */
-    public byte[] getDEREncoded()
-    {
-        try
-        {
-            return this.getEncoded(DER);
-        }
-        catch (IOException e)
-        {
-            return null;
-        }
-    }
-    
-    public int hashCode()
-    {
-        return this.toASN1Object().hashCode();
-    }
-
-    public boolean equals(
-        Object  o)
-    {
-        if (this == o)
-        {
-            return true;
-        }
-        
-        if (!(o instanceof DEREncodable))
-        {
-            return false;
-        }
-
-        DEREncodable other = (DEREncodable)o;
-
-        return this.toASN1Object().equals(other.getDERObject());
-    }
-
-    public DERObject getDERObject()
-    {        
-        return this.toASN1Object();
-    }
-
-    public abstract DERObject toASN1Object();
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1EncodableVector.java b/azureus2/src/org/bouncycastle/asn1/ASN1EncodableVector.java
deleted file mode 100644
index 1f50ddf..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1EncodableVector.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.bouncycastle.asn1;
-
-/**
- * the parent class for this will eventually disappear. Use this one!
- */
-public class ASN1EncodableVector
-    extends DEREncodableVector
-{
-    // migrating from DEREncodeableVector
-    public ASN1EncodableVector()
-    {
-        
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1Generator.java b/azureus2/src/org/bouncycastle/asn1/ASN1Generator.java
deleted file mode 100644
index 50cb705..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1Generator.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.OutputStream;
-
-public abstract class ASN1Generator
-{
-    protected OutputStream _out;
-    
-    public ASN1Generator(OutputStream out)
-    {
-        _out = out;
-    }
-    
-    public abstract OutputStream getRawOutputStream();
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1InputStream.java b/azureus2/src/org/bouncycastle/asn1/ASN1InputStream.java
deleted file mode 100644
index 44c0332..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1InputStream.java
+++ /dev/null
@@ -1,481 +0,0 @@
-package org.bouncycastle.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 static final 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;
-    int     limit = Integer.MAX_VALUE;
-
-    public ASN1InputStream(
-        InputStream is)
-    {
-        super(is);
-    }
-
-    /**
-     * Create an ASN1InputStream based on the input byte array. The length of DER objects in
-     * the stream is automatically limited to the length of the input array.
-     * 
-     * @param input array containing ASN.1 encoded data.
-     */
-    public ASN1InputStream(
-        byte[] input)
-    {
-        this(new ByteArrayInputStream(input), input.length);
-    }
-    
-    /**
-     * Create an ASN1InputStream where no DER object will be longer than limit.
-     * 
-     * @param input stream containing ASN.1 encoded data.
-     * @param limit maximum size of a DER encoded object.
-     */
-    public ASN1InputStream(
-        InputStream input,
-        int         limit)
-    {
-        super(input);
-        this.limit = limit;
-    }
-    
-    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 stream - negative length found");
-            }
-            
-            if (length >= limit)   // after all we must have read at least 1 byte
-            {
-                throw new IOException("corrupted stream - out of bounds 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 the number of bytes to construct it from.
-     */
-    protected DERObject buildObject(
-        int       tag,
-        int       tagNo,
-        int       length)
-        throws IOException
-    {
-        if ((tag & APPLICATION) != 0)
-        {
-            return new DERApplicationSpecific(tagNo, readDefiniteLengthFully(length));
-        }
-
-        boolean isConstructed = (tag & CONSTRUCTED) != 0;
-
-        if (isConstructed)
-        {
-            switch (tag)
-            {
-            case SEQUENCE | CONSTRUCTED:
-                return new DERSequence(buildDerEncodableVector(length));
-            case SET | CONSTRUCTED:
-                return new DERSet(buildDerEncodableVector(length), false);
-            case OCTET_STRING | CONSTRUCTED:
-                return buildDerConstructedOctetString(length);
-            default:
-            {
-                //
-                // with tagged object tag number is bottom 5 bits
-                //
-                if ((tag & TAGGED) != 0)  
-                {
-                    if (length == 0)     // empty tag!
-                    {
-                        return new DERTaggedObject(false, tagNo, new DERSequence());
-                    }
-
-                    ASN1EncodableVector v = buildDerEncodableVector(length);
-
-                    if (v.size() == 1)
-                    {
-                        //
-                        // explicitly tagged (probably!) - if it isn't we'd have to
-                        // tell from the context
-                        //
-                        return new DERTaggedObject(tagNo, v.get(0));
-                    }
-
-                    return new DERTaggedObject(false, tagNo, new DERSequence(v));
-                }
-
-                return new DERUnknownTag(tag, readDefiniteLengthFully(length));
-            }
-            }
-        }
-
-        byte[] bytes = readDefiniteLengthFully(length);
-
-        switch (tag)
-        {
-        case NULL:
-            return DERNull.INSTANCE;   
-        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)  
-            {
-                if (bytes.length == 0)     // empty tag!
-                {
-                    return new DERTaggedObject(false, tagNo, DERNull.INSTANCE);
-                }
-
-                //
-                // simple type - implicit... return an octet string
-                //
-                return new DERTaggedObject(false, tagNo, new DEROctetString(bytes));
-            }
-
-            return new DERUnknownTag(tag, bytes);
-        }
-        }
-    }
-
-    private byte[] readDefiniteLengthFully(int length)
-        throws IOException
-    {
-        byte[] bytes = new byte[length];
-        readFully(bytes);
-        return 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(DERObject sentinel)
-        throws IOException
-    {
-        Vector octs = new Vector();
-        DERObject o;
-
-        while ((o = readObject()) != sentinel)
-        {
-            octs.addElement(o);
-        }
-
-        return new BERConstructedOctetString(octs);
-    }
-
-    //
-    // yes, people actually do this...
-    //
-    private BERConstructedOctetString buildDerConstructedOctetString(int length)
-        throws IOException
-    {
-        DefiniteLengthInputStream dIn = new DefiniteLengthInputStream(this, length);
-        ASN1InputStream aIn = new ASN1InputStream(dIn, length);
-
-        return aIn.buildConstructedOctetString(null);
-    }
-
-    private ASN1EncodableVector buildEncodableVector(DERObject sentinel)
-        throws IOException
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-        DERObject o;
-
-        while ((o = readObject()) != sentinel)
-        {
-            v.add(o);
-        }
-
-        return v;
-    }
-
-    private ASN1EncodableVector buildDerEncodableVector(int length)
-        throws IOException
-    {
-        DefiniteLengthInputStream dIn = new DefiniteLengthInputStream(this, length);
-        ASN1InputStream aIn = new ASN1InputStream(dIn, length);
-
-        return aIn.buildEncodableVector(null);
-    }
-
-    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 tagNo = 0;
-        
-        if ((tag & TAGGED) != 0 || (tag & APPLICATION) != 0)
-        {
-            tagNo = readTagNumber(tag);
-        }
-        
-        int     length = readLength();
-
-        if (length < 0)    // indefinite length method
-        {
-            switch (tag)
-            {
-            case NULL:
-                return BERNull.INSTANCE;
-            case SEQUENCE | CONSTRUCTED:
-                return new BERSequence(buildEncodableVector(END_OF_STREAM));
-            case SET | CONSTRUCTED:
-                return new BERSet(buildEncodableVector(END_OF_STREAM), false);
-            case OCTET_STRING | CONSTRUCTED:
-                return buildConstructedOctetString(END_OF_STREAM);
-            default:
-            {
-                //
-                // with tagged object tag number is bottom 5 bits
-                //
-                if ((tag & TAGGED) != 0)  
-                {
-                    //
-                    // 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
-                    //
-                    ASN1EncodableVector v = buildEncodableVector(END_OF_STREAM);
-
-                    if (v.size() == 0)     // empty tag!
-                    {
-                        return new DERTaggedObject(tagNo);
-                    }
-
-                    if (v.size() == 1)
-                    {
-                        //
-                        // explicitly tagged (probably!) - if it isn't we'd have to
-                        // tell from the context
-                        //
-                        return new BERTaggedObject(tagNo, v.get(0));
-                    }
-
-                    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;
-            }
-
-            return buildObject(tag, tagNo, length);
-        }
-    }
-
-    private int readTagNumber(int tag) 
-        throws IOException
-    {
-        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();
-            }
-
-            if (b < 0)
-            {
-                eofFound = true;
-                throw new EOFException("EOF found inside tag value.");
-            }
-            
-            tagNo |= (b & 0x7f);
-        }
-        
-        return tagNo;
-    }
-}
-
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1Null.java b/azureus2/src/org/bouncycastle/asn1/ASN1Null.java
deleted file mode 100644
index 302d063..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1Null.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-/**
- * A NULL object.
- */
-public abstract class ASN1Null
-    extends ASN1Object
-{
-    public ASN1Null()
-    {
-    }
-
-    public int hashCode()
-    {
-        return 0;
-    }
-
-    boolean asn1Equals(
-        DERObject o)
-    {
-        if (!(o instanceof ASN1Null))
-        {
-            return false;
-        }
-        
-        return true;
-    }
-
-    abstract void encode(DEROutputStream out)
-        throws IOException;
-
-    public String toString()
-    {
-         return "NULL";
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1Object.java b/azureus2/src/org/bouncycastle/asn1/ASN1Object.java
deleted file mode 100644
index 7a0b113..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1Object.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-public abstract  class ASN1Object
-    extends DERObject
-{
-    /**
-     * Create a base ASN.1 object from a byte stream.
-     *
-     * @param data the byte stream to parse.
-     * @return the base ASN.1 object represented by the byte stream.
-     * @exception IOException if there is a problem parsing the data.
-     */
-    public static ASN1Object fromByteArray(byte[] data)
-        throws IOException
-    {
-        ASN1InputStream aIn = new ASN1InputStream(data);
-
-        return (ASN1Object)aIn.readObject();
-    }
-
-    public final boolean equals(Object o)
-    {
-        if (this == o)
-        {
-            return true;
-        }
-        
-        return (o instanceof DEREncodable) && asn1Equals(((DEREncodable)o).getDERObject());
-    }
-
-    public abstract int hashCode();
-
-    abstract void encode(DEROutputStream out) throws IOException;
-
-    abstract boolean asn1Equals(DERObject o);
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1ObjectParser.java b/azureus2/src/org/bouncycastle/asn1/ASN1ObjectParser.java
deleted file mode 100644
index 2bd5489..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1ObjectParser.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.InputStream;
-import java.io.IOException;
-
-public class ASN1ObjectParser
-{
-    private int              _baseTag;
-    private int              _tagNumber;
-
-    private ASN1StreamParser _aIn;
-
-    protected ASN1ObjectParser(
-        int         baseTag,
-        int         tagNumber,
-        InputStream contentStream)
-    {
-        _baseTag = baseTag;
-        _tagNumber = tagNumber;
-        _aIn = new ASN1StreamParser(contentStream);
-    }
-
-    /**
-     * Return the tag number for this object.
-     *
-     * @return the tag number.
-     */
-    int getTagNumber()
-    {
-        return _tagNumber;
-    }
-
-    int getBaseTag()
-    {
-        return _baseTag;
-    }
-
-    DEREncodable readObject()
-        throws IOException
-    {
-        return _aIn.readObject();
-    }
-
-    ASN1EncodableVector readVector()
-        throws IllegalStateException
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-        DEREncodable obj;
-
-        try
-        {
-            while ((obj = readObject()) != null)
-            {
-                v.add(obj.getDERObject());
-            }
-        }
-        catch (IOException e)
-        {
-            throw new IllegalStateException(e.getMessage());
-        }
-
-        return v;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1OctetString.java b/azureus2/src/org/bouncycastle/asn1/ASN1OctetString.java
deleted file mode 100644
index 6a8f69f..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1OctetString.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package org.bouncycastle.asn1;
-
-import org.bouncycastle.util.encoders.Hex;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Enumeration;
-import java.util.Vector;
-
-public abstract class ASN1OctetString
-    extends ASN1Object
-    implements ASN1OctetStringParser
-{
-    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 InputStream getOctetStream()
-    {
-        return new ByteArrayInputStream(string);
-    }
-
-    public ASN1OctetStringParser parser()
-    {
-        return this;
-    }
-
-    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;
-    }
-
-    boolean asn1Equals(
-        DERObject  o)
-    {
-        if (!(o instanceof ASN1OctetString))
-        {
-            return false;
-        }
-
-        ASN1OctetString  other = (ASN1OctetString)o;
-
-        byte[] b1 = other.string;
-        byte[] b2 = this.string;
-
-        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;
-
-    public String toString()
-    {
-      return "#"+new String(Hex.encode(string));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1OctetStringParser.java b/azureus2/src/org/bouncycastle/asn1/ASN1OctetStringParser.java
deleted file mode 100644
index 641020c..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1OctetStringParser.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.InputStream;
-
-public interface ASN1OctetStringParser
-    extends DEREncodable
-{
-    public InputStream getOctetStream();
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1OutputStream.java b/azureus2/src/org/bouncycastle/asn1/ASN1OutputStream.java
deleted file mode 100644
index 5897d09..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1OutputStream.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.bouncycastle.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");
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1Sequence.java b/azureus2/src/org/bouncycastle/asn1/ASN1Sequence.java
deleted file mode 100644
index ff79cb4..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1Sequence.java
+++ /dev/null
@@ -1,218 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Vector;
-
-public abstract class ASN1Sequence
-    extends ASN1Object
-{
-    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();
-    }
-
-    public ASN1SequenceParser parser()
-    {
-        final ASN1Sequence outer = this;
-
-        return new ASN1SequenceParser()
-        {
-            private final int max = size();
-
-            private int index;
-
-            public DEREncodable readObject() throws IOException
-            {
-                if (index == max)
-                {
-                    return null;
-                }
-                
-                DEREncodable obj = getObjectAt(index++);
-                if (obj instanceof ASN1Sequence)
-                {
-                    return ((ASN1Sequence)obj).parser();
-                }
-                if (obj instanceof ASN1Set)
-                {
-                    return ((ASN1Set)obj).parser();
-                }
-
-                return obj;
-            }
-
-            public DERObject getDERObject()
-            {
-                return outer;
-            }
-        };
-    }
-
-    /**
-     * 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;
-    }
-
-    boolean asn1Equals(
-        DERObject  o)
-    {
-        if (!(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())
-        {
-            DERObject  o1 = ((DEREncodable)s1.nextElement()).getDERObject();
-            DERObject  o2 = ((DEREncodable)s2.nextElement()).getDERObject();
-
-            if (o1 == o2 || (o1 != null && o1.equals(o2)))
-            {
-                continue;
-            }
-
-            return false;
-        }
-
-        return true;
-    }
-
-    protected void addObject(
-        DEREncodable obj)
-    {
-        seq.addElement(obj);
-    }
-
-    abstract void encode(DEROutputStream out)
-        throws IOException;
-
-    public String toString() 
-    {
-      return seq.toString();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1SequenceParser.java b/azureus2/src/org/bouncycastle/asn1/ASN1SequenceParser.java
deleted file mode 100644
index ceda6bd..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1SequenceParser.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-public interface ASN1SequenceParser
-    extends DEREncodable
-{
-    DEREncodable readObject()
-        throws IOException;
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1Set.java b/azureus2/src/org/bouncycastle/asn1/ASN1Set.java
deleted file mode 100644
index 444158e..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1Set.java
+++ /dev/null
@@ -1,339 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Vector;
-
-abstract public class ASN1Set
-    extends ASN1Object
-{
-    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 ASN1SetParser parser()
-    {
-        final ASN1Set outer = this;
-
-        return new ASN1SetParser()
-        {
-            private final int max = size();
-
-            private int index;
-
-            public DEREncodable readObject() throws IOException
-            {
-                if (index == max)
-                {
-                    return null;
-                }
-
-                DEREncodable obj = getObjectAt(index++);
-                if (obj instanceof ASN1Sequence)
-                {
-                    return ((ASN1Sequence)obj).parser();
-                }
-                if (obj instanceof ASN1Set)
-                {
-                    return ((ASN1Set)obj).parser();
-                }
-
-                return obj;
-            }
-
-            public DERObject getDERObject()
-            {
-                return outer;
-            }
-        };
-    }
-
-    public int hashCode()
-    {
-        Enumeration             e = this.getObjects();
-        int                     hashCode = 0;
-
-        while (e.hasMoreElements())
-        {
-            hashCode ^= e.nextElement().hashCode();
-        }
-
-        return hashCode;
-    }
-
-    boolean asn1Equals(
-        DERObject  o)
-    {
-        if (!(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())
-        {
-            DERObject  o1 = ((DEREncodable)s1.nextElement()).getDERObject();
-            DERObject  o2 = ((DEREncodable)s2.nextElement()).getDERObject();
-
-            if (o1 == o2 || (o1 != null && o1.equals(o2)))
-            {
-                continue;
-            }
-
-            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;
-            int        lastSwap = set.size() - 1;
-
-            while (swapped)
-            {
-                int    index = 0;
-                int    swapIndex = 0;
-                byte[] a = getEncoded((DEREncodable)set.elementAt(0));
-                
-                swapped = false;
-
-                while (index != lastSwap)
-                {
-                    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;
-                        swapIndex = index;
-                    }
-
-                    index++;
-                }
-
-                lastSwap = swapIndex;
-            }
-        }
-    }
-
-    protected void addObject(
-        DEREncodable obj)
-    {
-        set.addElement(obj);
-    }
-
-    abstract void encode(DEROutputStream out)
-            throws IOException;
-
-    public String toString() 
-    {
-      return set.toString();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1SetParser.java b/azureus2/src/org/bouncycastle/asn1/ASN1SetParser.java
deleted file mode 100644
index b09a170..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1SetParser.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-public interface ASN1SetParser
-    extends DEREncodable
-{
-    public DEREncodable readObject()
-        throws IOException;
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1StreamParser.java b/azureus2/src/org/bouncycastle/asn1/ASN1StreamParser.java
deleted file mode 100644
index 2acafeb..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1StreamParser.java
+++ /dev/null
@@ -1,222 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.ByteArrayInputStream;
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
-
-public class ASN1StreamParser
-{
-    InputStream _in;
-
-    private int     _limit;
-    private boolean _eofFound;
-
-    public ASN1StreamParser(
-        InputStream in)
-    {
-        this(in, Integer.MAX_VALUE);
-    }
-
-    public ASN1StreamParser(
-        InputStream in,
-        int         limit)
-    {
-        this._in = in;
-        this._limit = limit;
-    }
-
-    public ASN1StreamParser(
-        byte[] encoding)
-    {
-        this(new ByteArrayInputStream(encoding), encoding.length);
-    }
-
-    InputStream getParentStream()
-    {
-        return _in;
-    }
-
-    private int readLength()
-        throws IOException
-    {
-        int length = _in.read();
-        if (length < 0)
-        {
-            throw new EOFException("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 = _in.read();
-
-                if (next < 0)
-                {
-                    throw new EOFException("EOF found reading length");
-                }
-
-                length = (length << 8) + next;
-            }
-
-            if (length < 0)
-            {
-                throw new IOException("corrupted stream - negative length found");
-            }
-
-            if (length >= _limit)   // after all we must have read at least 1 byte
-            {
-                throw new IOException("corrupted stream - out of bounds length found");
-            }
-        }
-
-        return length;
-    }
-
-    public DEREncodable readObject()
-        throws IOException
-    {
-        int tag = _in.read();
-        if (tag == -1)
-        {
-            if (_eofFound)
-            {
-                throw new EOFException("attempt to read past end of file.");
-            }
-
-            _eofFound = true;
-
-            return null;
-        }
-
-        //
-        // turn of looking for "00" while we resolve the tag
-        //
-        set00Check(false);
-
-        //
-        // calculate tag number
-        //
-        int baseTagNo = tag & ~DERTags.CONSTRUCTED;
-        int tagNo = baseTagNo;
-
-        if ((tag & DERTags.TAGGED) != 0)
-        {
-            tagNo = tag & 0x1f;
-
-            //
-            // with tagged object tag number is bottom 5 bits, or stored at the start of the content
-            //
-            if (tagNo == 0x1f)
-            {
-                tagNo = 0;
-
-                int b = _in.read();
-
-                while ((b >= 0) && ((b & 0x80) != 0))
-                {
-                    tagNo |= (b & 0x7f);
-                    tagNo <<= 7;
-                    b = _in.read();
-                }
-
-                if (b < 0)
-                {
-                    _eofFound = true;
-
-                    throw new EOFException("EOF encountered inside tag value.");
-                }
-
-                tagNo |= (b & 0x7f);
-            }
-        }
-
-        //
-        // calculate length
-        //
-        int length = readLength();
-
-        if (length < 0)  // indefinite length
-        {
-            IndefiniteLengthInputStream indIn = new IndefiniteLengthInputStream(_in);
-
-            switch (baseTagNo)
-            {
-            case DERTags.NULL:
-                while (indIn.read() >= 0)
-                {
-                    // make sure we skip to end of object
-                }
-                return BERNull.INSTANCE;
-            case DERTags.OCTET_STRING:
-                return new BEROctetStringParser(new ASN1ObjectParser(tag, tagNo, indIn));
-            case DERTags.SEQUENCE:
-                return new BERSequenceParser(new ASN1ObjectParser(tag, tagNo, indIn));
-            case DERTags.SET:
-                return new BERSetParser(new ASN1ObjectParser(tag, tagNo, indIn));
-            default:
-                return new BERTaggedObjectParser(tag, tagNo, indIn);
-            }
-        }
-        else
-        {
-            DefiniteLengthInputStream defIn = new DefiniteLengthInputStream(_in, length);
-
-            switch (baseTagNo)
-            {
-            case DERTags.INTEGER:
-                return new DERInteger(defIn.toByteArray());
-            case DERTags.NULL:
-                defIn.toByteArray(); // make sure we read to end of object bytes.
-                return DERNull.INSTANCE;
-            case DERTags.OBJECT_IDENTIFIER:
-                return new DERObjectIdentifier(defIn.toByteArray());
-            case DERTags.OCTET_STRING:
-                return new DEROctetString(defIn.toByteArray());
-            case DERTags.SEQUENCE:
-                return new DERSequence(loadVector(defIn, length)).parser();
-            case DERTags.SET:
-                return new DERSet(loadVector(defIn, length)).parser();
-            default:
-                return new BERTaggedObjectParser(tag, tagNo, defIn);
-            }
-        }
-    }
-
-    private void set00Check(boolean enabled)
-    {
-        if (_in instanceof IndefiniteLengthInputStream)
-        {
-            ((IndefiniteLengthInputStream)_in).setEofOn00(enabled);
-        }
-    }
-
-    private ASN1EncodableVector loadVector(InputStream in, int length)
-        throws IOException
-    {
-        ASN1InputStream         aIn = new ASN1InputStream(in, length);
-        ASN1EncodableVector     v = new ASN1EncodableVector();
-
-        DERObject obj;
-        while ((obj = aIn.readObject()) != null)
-        {
-            v.add(obj);
-        }
-
-        return v;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1TaggedObject.java b/azureus2/src/org/bouncycastle/asn1/ASN1TaggedObject.java
deleted file mode 100644
index a4e792a..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1TaggedObject.java
+++ /dev/null
@@ -1,205 +0,0 @@
-package org.bouncycastle.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 ASN1Object
-    implements ASN1TaggedObjectParser
-{
-    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");
-    }
-
-    static public ASN1TaggedObject getInstance(
-        Object obj) 
-    {
-        if (obj == null || obj instanceof ASN1TaggedObject) 
-        {
-                return (ASN1TaggedObject)obj;
-        }
-
-        throw new IllegalArgumentException("unknown object in getInstance");
-    }
-
-    /**
-     * 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;
-    }
-    
-    boolean asn1Equals(
-        DERObject o)
-    {
-        if (!(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.getDERObject().equals(other.obj.getDERObject())))
-            {
-                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;
-    }
-
-    /**
-     * Return the object held in this tagged object as a parser assuming it has
-     * the type of the passed in tag. If the object doesn't have a parser
-     * associated with it, the base object is returned.
-     */
-    public DEREncodable getObjectParser(
-        int     tag,
-        boolean isExplicit)
-    {
-        switch (tag)
-        {
-        case DERTags.SET:
-            return ASN1Set.getInstance(this, isExplicit).parser();
-        case DERTags.SEQUENCE:
-            return ASN1Sequence.getInstance(this, isExplicit).parser();
-        case DERTags.OCTET_STRING:
-            return ASN1OctetString.getInstance(this, isExplicit).parser();
-        }
-
-        if (isExplicit)
-        {
-            return getObject();
-        }
-
-        throw new RuntimeException("implicit tagging not implemented for tag: " + tag);
-    }
-
-    abstract void encode(DEROutputStream  out)
-        throws IOException;
-
-    public String toString()
-    {
-        return "[" + tagNo + "]" + obj;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ASN1TaggedObjectParser.java b/azureus2/src/org/bouncycastle/asn1/ASN1TaggedObjectParser.java
deleted file mode 100644
index 5574bf8..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ASN1TaggedObjectParser.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-public interface ASN1TaggedObjectParser
-    extends DEREncodable
-{
-    public int getTagNo();
-    
-    public DEREncodable getObjectParser(int tag, boolean isExplicit)
-        throws IOException;
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/BERConstructedOctetString.java b/azureus2/src/org/bouncycastle/asn1/BERConstructedOctetString.java
deleted file mode 100644
index 8693d8b..0000000
--- a/azureus2/src/org/bouncycastle/asn1/BERConstructedOctetString.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Vector;
-
-public class BERConstructedOctetString
-    extends DEROctetString
-{
-    private static final int MAX_LENGTH = 1000;
-
-    /**
-     * 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
-            {
-                for (int i = 0; i < string.length; i += MAX_LENGTH)
-                {
-                    int end;
-
-                    if (i + MAX_LENGTH > string.length)
-                    {
-                        end = string.length;
-                    }
-                    else
-                    {
-                        end = i + MAX_LENGTH;
-                    }
-
-                    byte[]  nStr = new byte[end - i];
-
-                    System.arraycopy(string, i, nStr, 0, nStr.length);
-
-                    out.writeObject(new DEROctetString(nStr));
-                }
-            }
-
-            out.write(0x00);
-            out.write(0x00);
-        }
-        else
-        {
-            super.encode(out);
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/BERConstructedSequence.java b/azureus2/src/org/bouncycastle/asn1/BERConstructedSequence.java
deleted file mode 100644
index 998eaeb..0000000
--- a/azureus2/src/org/bouncycastle/asn1/BERConstructedSequence.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.bouncycastle.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);
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/BERGenerator.java b/azureus2/src/org/bouncycastle/asn1/BERGenerator.java
deleted file mode 100644
index 6b32741..0000000
--- a/azureus2/src/org/bouncycastle/asn1/BERGenerator.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-public class BERGenerator
-    extends ASN1Generator
-{
-    private boolean      _tagged = false;
-    private boolean      _isExplicit;
-    private int          _tagNo;
-    
-    protected BERGenerator(
-        OutputStream out)
-    {
-        super(out);
-    }
-
-    public BERGenerator(
-        OutputStream out,
-        int tagNo,
-        boolean isExplicit) 
-    {
-        super(out);
-        
-        _tagged = true;
-        _isExplicit = isExplicit;
-        _tagNo = tagNo;
-    }
-
-    public OutputStream getRawOutputStream()
-    {
-        return _out;
-    }
-    
-    private void writeHdr(
-        int tag)
-        throws IOException
-    {
-        _out.write(tag);
-        _out.write(0x80);
-    }
-    
-    protected void writeBERHeader(
-        int tag) 
-        throws IOException
-    {
-        if (_tagged)
-        {
-            int tagNum = _tagNo | DERTags.TAGGED;
-
-            if (_isExplicit)
-            {
-                writeHdr(tagNum | DERTags.CONSTRUCTED);
-                writeHdr(tag);
-            }
-            else
-            {   
-                if ((tag & DERTags.CONSTRUCTED) != 0)
-                {
-                    writeHdr(tagNum | DERTags.CONSTRUCTED);
-                }
-                else
-                {
-                    writeHdr(tagNum);
-                }
-            }
-        }
-        else
-        {
-            writeHdr(tag);
-        }
-    }
-    
-    protected void writeBERBody(
-        InputStream contentStream)
-        throws IOException
-    {
-        int ch;
-        
-        while ((ch = contentStream.read()) >= 0)
-        {
-            _out.write(ch);
-        }
-    }
-
-    protected void writeBEREnd()
-        throws IOException
-    {
-        _out.write(0x00);
-        _out.write(0x00);
-        
-        if (_tagged && _isExplicit)  // write extra end for tag header
-        {
-            _out.write(0x00);
-            _out.write(0x00);
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/BERInputStream.java b/azureus2/src/org/bouncycastle/asn1/BERInputStream.java
deleted file mode 100644
index 397fc06..0000000
--- a/azureus2/src/org/bouncycastle/asn1/BERInputStream.java
+++ /dev/null
@@ -1,209 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.ByteArrayOutputStream;
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Vector;
-
-/**
- * @deprecated use ASN1InputStream
- */
-public class BERInputStream
-    extends DERInputStream
-{
-    private static final 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;
-                                        }
-                                    };
-    public BERInputStream(
-        InputStream is)
-    {
-        super(is);
-    }
-
-    /**
-     * 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)
-        {
-            throw new EOFException();
-        }
-    
-        int     length = readLength();
-
-        if (length < 0)    // indefinite length method
-        {
-            switch (tag)
-            {
-            case NULL:
-                return null;
-            case SEQUENCE | CONSTRUCTED:
-                BERConstructedSequence  seq = new BERConstructedSequence();
-    
-                for (;;)
-                {
-                    DERObject   obj = readObject();
-
-                    if (obj == END_OF_STREAM)
-                    {
-                        break;
-                    }
-
-                    seq.addObject(obj);
-                }
-                return seq;
-            case OCTET_STRING | CONSTRUCTED:
-                return buildConstructedOctetString();
-            case SET | CONSTRUCTED:
-                ASN1EncodableVector  v = new ASN1EncodableVector();
-    
-                for (;;)
-                {
-                    DERObject   obj = readObject();
-
-                    if (obj == END_OF_STREAM)
-                    {
-                        break;
-                    }
-
-                    v.add(obj);
-                }
-                return new BERSet(v);
-            default:
-                //
-                // with tagged object tag number is bottom 5 bits
-                //
-                if ((tag & TAGGED) != 0)  
-                {
-                    if ((tag & 0x1f) == 0x1f)
-                    {
-                        throw new IOException("unsupported high tag encountered");
-                    }
-
-                    //
-                    // simple type - implicit... return an octet string
-                    //
-                    if ((tag & CONSTRUCTED) == 0)
-                    {
-                        byte[]  bytes = readIndefiniteLengthFully();
-
-                        return new BERTaggedObject(false, tag & 0x1f, new DEROctetString(bytes));
-                    }
-
-                    //
-                    // either constructed or explicitly tagged
-                    //
-                    DERObject        dObj = readObject();
-
-                    if (dObj == END_OF_STREAM)     // empty tag!
-                    {
-                        return new DERTaggedObject(tag & 0x1f);
-                    }
-
-                    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(tag & 0x1f, dObj);
-                    }
-
-                    //
-                    // another implicit object, we'll create a sequence...
-                    //
-                    seq = new BERConstructedSequence();
-
-                    seq.addObject(dObj);
-
-                    do
-                    {
-                        seq.addObject(next);
-                        next = readObject();
-                    }
-                    while (next != END_OF_STREAM);
-
-                    return new BERTaggedObject(false, tag & 0x1f, seq);
-                }
-
-                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);
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/BERNull.java b/azureus2/src/org/bouncycastle/asn1/BERNull.java
deleted file mode 100644
index 92bc10d..0000000
--- a/azureus2/src/org/bouncycastle/asn1/BERNull.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-/**
- * A BER NULL object.
- */
-public class BERNull
-    extends DERNull
-{
-    public static final BERNull INSTANCE = new BERNull();
-
-    public BERNull()
-    {
-    }
-
-    void encode(
-        DEROutputStream  out)
-        throws IOException
-    {
-        if (out instanceof ASN1OutputStream || out instanceof BEROutputStream)
-        {
-            out.write(NULL);
-        }
-        else
-        {
-            super.encode(out);
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/BEROctetStringGenerator.java b/azureus2/src/org/bouncycastle/asn1/BEROctetStringGenerator.java
deleted file mode 100644
index aa511de..0000000
--- a/azureus2/src/org/bouncycastle/asn1/BEROctetStringGenerator.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-public class BEROctetStringGenerator
-    extends BERGenerator
-{
-    public BEROctetStringGenerator(OutputStream out) 
-        throws IOException
-    {
-        super(out);
-        
-        writeBERHeader(DERTags.CONSTRUCTED | DERTags.OCTET_STRING);
-    }
-
-    public BEROctetStringGenerator(
-        OutputStream out,
-        int tagNo,
-        boolean isExplicit) 
-        throws IOException
-    {
-        super(out, tagNo, isExplicit);
-        
-        writeBERHeader(DERTags.CONSTRUCTED | DERTags.OCTET_STRING);
-    }
-    
-    public OutputStream getOctetOutputStream()
-    {
-        return getOctetOutputStream(new byte[1000]); // limit for CER encoding.
-    }
-
-    public OutputStream getOctetOutputStream(
-        byte[] buf)
-    {
-        return new BufferedBEROctetStream(buf);
-    }
-   
-    private class BufferedBEROctetStream
-        extends OutputStream
-    {
-        private byte[] _buf;
-        private int    _off;
-    
-        BufferedBEROctetStream(
-            byte[] buf)
-        {
-            _buf = buf;
-            _off = 0;
-        }
-        
-        public void write(
-            int b)
-            throws IOException
-        {
-            _buf[_off++] = (byte)b;
-
-            if (_off == _buf.length)
-            {
-                _out.write(new DEROctetString(_buf).getEncoded());
-                _off = 0;
-            }
-        }
-
-        public void write(byte[] b, int off, int len) throws IOException
-        {
-            while (len > 0)
-            {
-                int numToCopy = Math.min(len, _buf.length - _off);
-                System.arraycopy(b, off, _buf, _off, numToCopy);
-
-                _off += numToCopy;
-                if (_off < _buf.length)
-                {
-                    break;
-                }
-
-                _out.write(new DEROctetString(_buf).getEncoded());
-                _off = 0;
-
-                off += numToCopy;
-                len -= numToCopy;
-            }
-        }
-
-        public void close() 
-            throws IOException
-        {
-            if (_off != 0)
-            {
-                byte[] bytes = new byte[_off];
-                System.arraycopy(_buf, 0, bytes, 0, _off);
-                
-                _out.write(new DEROctetString(bytes).getEncoded());
-            }
-            
-             writeBEREnd();
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/BEROctetStringParser.java b/azureus2/src/org/bouncycastle/asn1/BEROctetStringParser.java
deleted file mode 100644
index e3e8d61..0000000
--- a/azureus2/src/org/bouncycastle/asn1/BEROctetStringParser.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.InputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-public class BEROctetStringParser
-    implements ASN1OctetStringParser
-{
-    private ASN1ObjectParser _parser;
-
-    protected BEROctetStringParser(
-        ASN1ObjectParser parser)
-    {
-        _parser = parser;
-    }
-
-    public InputStream getOctetStream()
-    {
-        return new ConstructedOctetStream(_parser);
-    }
-
-    public DERObject getDERObject()
-    {
-        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
-        InputStream in = this.getOctetStream();
-        int         ch;
-
-        try
-        {
-            while ((ch = in.read()) >= 0)
-            {
-                bOut.write(ch);
-            }
-        }
-        catch (IOException e)
-        {
-            throw new IllegalStateException("IOException converting stream to byte array: " + e.getMessage());
-        }
-
-        return new BERConstructedOctetString(bOut.toByteArray());
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/BEROutputStream.java b/azureus2/src/org/bouncycastle/asn1/BEROutputStream.java
deleted file mode 100644
index c2e8da4..0000000
--- a/azureus2/src/org/bouncycastle/asn1/BEROutputStream.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-public class BEROutputStream
-    extends DEROutputStream
-{
-    public BEROutputStream(
-        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 BEREncodable");
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/BERSequence.java b/azureus2/src/org/bouncycastle/asn1/BERSequence.java
deleted file mode 100644
index c389fa8..0000000
--- a/azureus2/src/org/bouncycastle/asn1/BERSequence.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-import java.util.Enumeration;
-
-public class BERSequence
-    extends DERSequence
-{
-    /**
-     * create an empty sequence
-     */
-    public BERSequence()
-    {
-    }
-
-    /**
-     * create a sequence containing one object
-     */
-    public BERSequence(
-        DEREncodable    obj)
-    {
-        super(obj);
-    }
-
-    /**
-     * create a sequence containing a vector of objects.
-     */
-    public BERSequence(
-        DEREncodableVector   v)
-    {
-        super(v);
-    }
-
-    /*
-     */
-    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);
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/BERSequenceGenerator.java b/azureus2/src/org/bouncycastle/asn1/BERSequenceGenerator.java
deleted file mode 100644
index 88b4a10..0000000
--- a/azureus2/src/org/bouncycastle/asn1/BERSequenceGenerator.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-public class BERSequenceGenerator
-    extends BERGenerator
-{
-    public BERSequenceGenerator(
-        OutputStream out) 
-        throws IOException
-    {
-        super(out);
-
-        writeBERHeader(DERTags.CONSTRUCTED | DERTags.SEQUENCE);
-    }
-
-    public BERSequenceGenerator(
-        OutputStream out,
-        int tagNo,
-        boolean isExplicit) 
-        throws IOException
-    {
-        super(out, tagNo, isExplicit);
-        
-        writeBERHeader(DERTags.CONSTRUCTED | DERTags.SEQUENCE);
-    }
-
-    public void addObject(
-        DEREncodable object)
-        throws IOException
-    {
-        object.getDERObject().encode(new DEROutputStream(_out));
-    }
-    
-    public void close() 
-        throws IOException
-    {
-        writeBEREnd();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/BERSequenceParser.java b/azureus2/src/org/bouncycastle/asn1/BERSequenceParser.java
deleted file mode 100644
index af76c60..0000000
--- a/azureus2/src/org/bouncycastle/asn1/BERSequenceParser.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-public class BERSequenceParser
-    implements ASN1SequenceParser
-{
-    private ASN1ObjectParser _parser;
-
-    BERSequenceParser(ASN1ObjectParser parser)
-    {
-        this._parser = parser;
-    }
-
-    public DEREncodable readObject()
-        throws IOException
-    {
-        return _parser.readObject();
-    }
-
-    public DERObject getDERObject()
-    {
-        return new BERSequence(_parser.readVector());
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/BERSet.java b/azureus2/src/org/bouncycastle/asn1/BERSet.java
deleted file mode 100644
index 1ccf0fd..0000000
--- a/azureus2/src/org/bouncycastle/asn1/BERSet.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-import java.util.Enumeration;
-
-public class BERSet
-    extends DERSet
-{
-    /**
-     * create an empty sequence
-     */
-    public BERSet()
-    {
-    }
-
-    /**
-     * create a set containing one object
-     */
-    public BERSet(
-        DEREncodable    obj)
-    {
-        super(obj);
-    }
-
-    /**
-     * @param v - a vector of objects making up the set.
-     */
-    public BERSet(
-        DEREncodableVector   v)
-    {
-        super(v, false);
-    }
-
-    /**
-     * @param v - a vector of objects making up the set.
-     */
-    BERSet(
-        DEREncodableVector   v,
-        boolean              needsSorting)
-    {
-        super(v, needsSorting);
-    }
-
-    /*
-     */
-    void encode(
-        DEROutputStream out)
-        throws IOException
-    {
-        if (out instanceof ASN1OutputStream || out instanceof BEROutputStream)
-        {
-            out.write(SET | CONSTRUCTED);
-            out.write(0x80);
-            
-            Enumeration e = getObjects();
-            while (e.hasMoreElements())
-            {
-                out.writeObject(e.nextElement());
-            }
-        
-            out.write(0x00);
-            out.write(0x00);
-        }
-        else
-        {
-            super.encode(out);
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/BERSetParser.java b/azureus2/src/org/bouncycastle/asn1/BERSetParser.java
deleted file mode 100644
index 7f9d1d1..0000000
--- a/azureus2/src/org/bouncycastle/asn1/BERSetParser.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-public class BERSetParser
-    implements ASN1SetParser
-{
-    private ASN1ObjectParser _parser;
-
-    BERSetParser(ASN1ObjectParser parser)
-    {
-        this._parser = parser;
-    }
-
-    public DEREncodable readObject()
-        throws IOException
-    {
-        return _parser.readObject();
-    }
-
-    public DERObject getDERObject()
-    {
-        return new BERSet(_parser.readVector());
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/BERTaggedObject.java b/azureus2/src/org/bouncycastle/asn1/BERTaggedObject.java
deleted file mode 100644
index 2e06c40..0000000
--- a/azureus2/src/org/bouncycastle/asn1/BERTaggedObject.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-import java.util.Enumeration;
-
-/**
- * BER 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 class BERTaggedObject
-    extends DERTaggedObject
-{
-    /**
-     * @param tagNo the tag number for this object.
-     * @param obj the tagged object.
-     */
-    public BERTaggedObject(
-        int             tagNo,
-        DEREncodable    obj)
-    {
-        super(tagNo, obj);
-    }
-
-    /**
-     * @param explicit true if an explicitly tagged object.
-     * @param tagNo the tag number for this object.
-     * @param obj the tagged object.
-     */
-    public BERTaggedObject(
-        boolean         explicit,
-        int             tagNo,
-        DEREncodable    obj)
-    {
-        super(explicit, tagNo, obj);
-    }
-
-    /**
-     * create an implicitly tagged object that contains a zero
-     * length sequence.
-     */
-    public BERTaggedObject(
-        int             tagNo)
-    {
-        super(false, tagNo, new BERSequence());
-    }
-
-    void encode(
-        DEROutputStream  out)
-        throws IOException
-    {
-        if (out instanceof ASN1OutputStream || out instanceof BEROutputStream)
-        {
-            out.write(CONSTRUCTED | TAGGED | tagNo);
-            out.write(0x80);
-
-            if (!empty)
-            {
-                if (!explicit)
-                {
-                    if (obj instanceof ASN1OctetString)
-                    {
-                        Enumeration  e;
-
-                        if (obj instanceof BERConstructedOctetString)
-                        {
-                            e = ((BERConstructedOctetString)obj).getObjects();
-                        }
-                        else
-                        {
-                            ASN1OctetString             octs = (ASN1OctetString)obj;
-                            BERConstructedOctetString   berO = new BERConstructedOctetString(octs.getOctets());
-
-                            e = berO.getObjects();
-                        }
-
-                        while (e.hasMoreElements())
-                        {
-                            out.writeObject(e.nextElement());
-                        }
-                    }
-                    else if (obj instanceof ASN1Sequence)
-                    {
-                        Enumeration  e = ((ASN1Sequence)obj).getObjects();
-
-                        while (e.hasMoreElements())
-                        {
-                            out.writeObject(e.nextElement());
-                        }
-                    }
-                    else if (obj instanceof ASN1Set)
-                    {
-                        Enumeration  e = ((ASN1Set)obj).getObjects();
-
-                        while (e.hasMoreElements())
-                        {
-                            out.writeObject(e.nextElement());
-                        }
-                    }
-                    else
-                    {
-                        throw new RuntimeException("not implemented: " + obj.getClass().getName());
-                    }
-                }
-                else
-                {
-                    out.writeObject(obj);
-                }
-            }
-
-            out.write(0x00);
-            out.write(0x00);
-        }
-        else
-        {
-            super.encode(out);
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/BERTaggedObjectParser.java b/azureus2/src/org/bouncycastle/asn1/BERTaggedObjectParser.java
deleted file mode 100644
index 17229f3..0000000
--- a/azureus2/src/org/bouncycastle/asn1/BERTaggedObjectParser.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-public class BERTaggedObjectParser
-    implements ASN1TaggedObjectParser
-{
-    private int _baseTag;
-    private int _tagNumber;
-    private InputStream _contentStream;
-
-    private boolean _indefiniteLength;
-
-    protected BERTaggedObjectParser(
-        int         baseTag,
-        int         tagNumber,
-        InputStream contentStream)
-    {
-        _baseTag = baseTag;
-        _tagNumber = tagNumber;
-        _contentStream = contentStream;
-        _indefiniteLength = contentStream instanceof IndefiniteLengthInputStream;
-    }
-
-    public boolean isConstructed()
-    {
-        return (_baseTag & DERTags.CONSTRUCTED) != 0;
-    }
-
-    public int getTagNo()
-    {
-        return _tagNumber;
-    }
-    
-    public DEREncodable getObjectParser(
-        int     tag,
-        boolean isExplicit)
-        throws IOException
-    {
-        if (isExplicit)
-        {
-            return new ASN1StreamParser(_contentStream).readObject();
-        }
-        else
-        {
-            switch (tag)
-            {
-            case DERTags.SET:
-                if (_indefiniteLength)
-                {
-                    return new BERSetParser(new ASN1ObjectParser(_baseTag, _tagNumber, _contentStream));
-                }
-                else
-                {
-                    return new DERSet(loadVector(_contentStream)).parser();
-                }
-            case DERTags.SEQUENCE:
-                if (_indefiniteLength)
-                {
-                    return new BERSequenceParser(new ASN1ObjectParser(_baseTag, _tagNumber, _contentStream));
-                }
-                else
-                {
-                    return new DERSequence(loadVector(_contentStream)).parser();
-                }
-            case DERTags.OCTET_STRING:
-                if (_indefiniteLength || this.isConstructed())
-                {
-                    return new BEROctetStringParser(new ASN1ObjectParser(_baseTag, _tagNumber, _contentStream));
-                }
-                else
-                {
-                    return new DEROctetString(((DefiniteLengthInputStream)_contentStream).toByteArray()).parser();
-                }
-            }
-        }
-
-        throw new RuntimeException("implicit tagging not implemented");
-    }
-
-    private ASN1EncodableVector loadVector(InputStream in)
-        throws IOException
-    {
-        ASN1StreamParser        aIn = new ASN1StreamParser(in);
-        ASN1EncodableVector     v = new ASN1EncodableVector();
-        DEREncodable            obj = aIn.readObject();
-
-        while (obj != null)
-        {
-            v.add(obj.getDERObject());
-            obj = aIn.readObject();
-        }
-
-        return v;
-    }
-
-    private ASN1EncodableVector rLoadVector(InputStream in)
-    {
-        try
-        {
-            return loadVector(in);
-        }
-        catch (IOException e)
-        {
-            throw new IllegalStateException(e.getMessage());
-        }
-    }
-
-    public DERObject getDERObject()
-    {
-        if (_indefiniteLength)
-        {
-            ASN1EncodableVector v = rLoadVector(_contentStream);
-
-            if (v.size() > 1)
-            {
-                return new BERTaggedObject(false, _tagNumber, new BERSequence(v));
-            }
-            else if (v.size() == 1)
-            {
-                return new BERTaggedObject(true, _tagNumber, v.get(0));
-            }
-            else
-            {
-                return new BERTaggedObject(false, _tagNumber, new BERSequence());
-            }
-        }
-        else
-        {
-            if (this.isConstructed())
-            {
-                ASN1EncodableVector v = rLoadVector(_contentStream);
-
-                if (v.size() == 1)
-                {
-                    return new DERTaggedObject(true, _tagNumber, v.get(0));
-                }
-
-                return new DERTaggedObject(false, _tagNumber, new DERSequence(v));                
-            }
-
-            try
-            {
-                return new DERTaggedObject(false, _tagNumber, new DEROctetString(((DefiniteLengthInputStream)_contentStream).toByteArray()));
-            }
-            catch (IOException e)
-            {
-                throw new IllegalStateException(e.getMessage());
-            }
-        }
-
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/ConstructedOctetStream.java b/azureus2/src/org/bouncycastle/asn1/ConstructedOctetStream.java
deleted file mode 100644
index 0734f40..0000000
--- a/azureus2/src/org/bouncycastle/asn1/ConstructedOctetStream.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.InputStream;
-import java.io.IOException;
-
-class ConstructedOctetStream
-    extends InputStream
-{
-    private final ASN1ObjectParser _parser;
-
-    private boolean                _first = true;
-    private InputStream            _currentStream;
-
-    ConstructedOctetStream(
-        ASN1ObjectParser parser)
-    {
-        _parser = parser;
-    }
-
-    public int read(byte[] b, int off, int len) throws IOException
-    {
-        if (_currentStream == null)
-        {
-            if (!_first)
-            {
-                return -1;
-            }
-
-            ASN1OctetStringParser s = (ASN1OctetStringParser)_parser.readObject();
-
-            if (s == null)
-            {
-                return -1;
-            }
-
-            _first = false;
-            _currentStream = s.getOctetStream();
-        }
-
-        int totalRead = 0;
-
-        for (;;)
-        {
-            int numRead = _currentStream.read(b, off + totalRead, len - totalRead);
-
-            if (numRead >= 0)
-            {
-                totalRead += numRead;
-
-                if (totalRead == len)
-                {
-                    return totalRead;
-                }
-            }
-            else
-            {
-                ASN1OctetStringParser aos = (ASN1OctetStringParser)_parser.readObject();
-
-                if (aos == null)
-                {
-                    _currentStream = null;
-                    return totalRead < 1 ? -1 : totalRead;
-                }
-
-                _currentStream = aos.getOctetStream();
-            }
-        }
-    }
-
-    public int read()
-        throws IOException
-    {
-        if (_currentStream == null)
-        {
-            if (!_first)
-            {
-                return -1;
-            }
-
-            ASN1OctetStringParser s = (ASN1OctetStringParser)_parser.readObject();
-    
-            if (s == null)
-            {
-                return -1;
-            }
-    
-            _first = false;
-            _currentStream = s.getOctetStream();
-        }
-
-        for (;;)
-        {
-            int b = _currentStream.read();
-
-            if (b >= 0)
-            {
-                return b;
-            }
-
-            ASN1OctetStringParser s = (ASN1OctetStringParser)_parser.readObject();
-
-            if (s == null)
-            {
-                _currentStream = null;
-                return -1;
-            }
-
-            _currentStream = s.getOctetStream();
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERApplicationSpecific.java b/azureus2/src/org/bouncycastle/asn1/DERApplicationSpecific.java
deleted file mode 100644
index 7ae9beb..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERApplicationSpecific.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-/**
- * Base class for an application specific object
- */
-public class DERApplicationSpecific 
-    extends ASN1Object
-{
-    private int       tag;
-    private byte[]    octets;
-    
-    public DERApplicationSpecific(
-        int        tag,
-        byte[]    octets)
-    {
-        this.tag = tag;
-        this.octets = octets;
-    }
-    
-    public DERApplicationSpecific(
-        int                  tag, 
-        DEREncodable         object) 
-        throws IOException 
-    {
-        this(true, tag, object);
-    }
-
-    public DERApplicationSpecific(
-        boolean      explicit,
-        int          tag,
-        DEREncodable object)
-        throws IOException
-    {
-        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
-        DEROutputStream dos = new DEROutputStream(bOut);
-
-        dos.writeObject(object);
-
-        byte[] data = bOut.toByteArray();
-
-        if (tag >= 0x1f)
-        {
-            throw new IOException("unsupported tag number");
-        }
-
-        if (explicit)
-        {
-            this.tag = tag | DERTags.CONSTRUCTED;
-            this.octets = data;
-        }
-        else
-        {
-            this.tag = tag;
-            int lenBytes = getLengthOfLength(data);
-            byte[] tmp = new byte[data.length - lenBytes];
-            System.arraycopy(data, lenBytes, tmp, 0, tmp.length);
-            this.octets = tmp;
-        }
-    }
-
-    private int getLengthOfLength(byte[] data)
-    {
-        int count = 2;               // TODO: assumes only a 1 byte tag number
-
-        while((data[count - 1] & 0x80) != 0)
-        {
-            count++;
-        }
-
-        return count;
-    }
-
-    public boolean isConstructed()
-    {
-        return (tag & DERTags.CONSTRUCTED) != 0;
-    }
-    
-    public byte[] getContents()
-    {
-        return octets;
-    }
-    
-    public int getApplicationTag() 
-    {
-        return tag;
-    }
-     
-    public DERObject getObject() 
-        throws IOException 
-    {
-        return new ASN1InputStream(getContents()).readObject();
-    }
-
-    /**
-     * Return the enclosed object assuming implicit tagging.
-     *
-     * @param derTagNo the type tag that should be applied to the object's contents.
-     * @return  the resulting object
-     * @throws IOException if reconstruction fails.
-     */
-    public DERObject getObject(int derTagNo)
-        throws IOException
-    {
-        if (tag >= 0x1f)
-        {
-            throw new IOException("unsupported tag number");
-        }
-                
-        byte[] tmp = this.getEncoded();
-
-        tmp[0] = (byte)derTagNo;
-        
-        return new ASN1InputStream(tmp).readObject();
-    }
-    
-    /* (non-Javadoc)
-     * @see org.bouncycastle.asn1.DERObject#encode(org.bouncycastle.asn1.DEROutputStream)
-     */
-    void encode(DEROutputStream out) throws IOException
-    {
-        out.writeEncoded(DERTags.APPLICATION | tag, octets);
-    }
-    
-    boolean asn1Equals(
-        DERObject o)
-    {
-        if (!(o instanceof DERApplicationSpecific))
-        {
-            return false;
-        }
-        
-        DERApplicationSpecific other = (DERApplicationSpecific)o;
-        
-        if (tag != other.tag)
-        {
-            return false;
-        }
-        
-        if (octets.length != other.octets.length)
-        {
-            return false;
-        }
-        
-        for (int i = 0; i < octets.length; i++) 
-        {
-            if (octets[i] != other.octets[i])
-            {
-                return false;
-            }
-        }
-        
-        return true;
-    }
-    
-    public int hashCode()
-    {
-        byte[]  b = this.getContents();
-        int     value = 0;
-
-        for (int i = 0; i != b.length; i++)
-        {
-            value ^= (b[i] & 0xff) << (i % 4);
-        }
-
-        return value ^ this.getApplicationTag();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERBMPString.java b/azureus2/src/org/bouncycastle/asn1/DERBMPString.java
deleted file mode 100644
index 1472325..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERBMPString.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-/**
- * DER BMPString object.
- */
-public class DERBMPString
-    extends ASN1Object
-    implements DERString
-{
-    String  string;
-
-    /**
-     * return a BMP String from the given object.
-     *
-     * @param obj the object we want converted.
-     * @exception IllegalArgumentException if the object cannot be converted.
-     */
-    public static DERBMPString getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof DERBMPString)
-        {
-            return (DERBMPString)obj;
-        }
-
-        if (obj instanceof ASN1OctetString)
-        {
-            return new DERBMPString(((ASN1OctetString)obj).getOctets());
-        }
-
-        if (obj instanceof ASN1TaggedObject)
-        {
-            return getInstance(((ASN1TaggedObject)obj).getObject());
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    /**
-     * return a BMP 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 DERBMPString getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(obj.getObject());
-    }
-    
-
-    /**
-     * basic constructor - byte encoded string.
-     */
-    public DERBMPString(
-        byte[]   string)
-    {
-        char[]  cs = new char[string.length / 2];
-
-        for (int i = 0; i != cs.length; i++)
-        {
-            cs[i] = (char)((string[2 * i] << 8) | (string[2 * i + 1] & 0xff));
-        }
-
-        this.string = new String(cs);
-    }
-
-    /**
-     * basic constructor
-     */
-    public DERBMPString(
-        String   string)
-    {
-        this.string = string;
-    }
-
-    public String getString()
-    {
-        return string;
-    }
-
-    public String toString()
-    {
-        return string;
-    }
-
-    public int hashCode()
-    {
-        return this.getString().hashCode();
-    }
-
-    protected boolean asn1Equals(
-        DERObject  o)
-    {
-        if (!(o instanceof DERBMPString))
-        {
-            return false;
-        }
-
-        DERBMPString  s = (DERBMPString)o;
-
-        return this.getString().equals(s.getString());
-    }
-
-    void encode(
-        DEROutputStream  out)
-        throws IOException
-    {
-        char[]  c = string.toCharArray();
-        byte[]  b = new byte[c.length * 2];
-
-        for (int i = 0; i != c.length; i++)
-        {
-            b[2 * i] = (byte)(c[i] >> 8);
-            b[2 * i + 1] = (byte)c[i];
-        }
-
-        out.writeEncoded(BMP_STRING, b);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERBitString.java b/azureus2/src/org/bouncycastle/asn1/DERBitString.java
deleted file mode 100644
index 1463db7..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERBitString.java
+++ /dev/null
@@ -1,289 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-public class DERBitString
-    extends ASN1Object
-    implements DERString
-{
-    private static final char[]  table = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
-    
-    protected byte[]      data;
-    protected int         padBits;
-
-    /**
-     * return the correct number of pad bits for a bit string defined in
-     * a 32 bit constant
-     */
-    static protected int getPadBits(
-        int bitString)
-    {
-        int val = 0;
-        for (int i = 3; i >= 0; i--) 
-        {
-            //
-            // this may look a little odd, but if it isn't done like this pre jdk1.2
-            // JVM's break!
-            //
-            if (i != 0)
-            {
-                if ((bitString >> (i * 8)) != 0) 
-                {
-                    val = (bitString >> (i * 8)) & 0xFF;
-                    break;
-                }
-            }
-            else
-            {
-                if (bitString != 0)
-                {
-                    val = bitString & 0xFF;
-                    break;
-                }
-            }
-        }
- 
-        if (val == 0)
-        {
-            return 7;
-        }
-
-
-        int bits = 1;
-
-        while (((val <<= 1) & 0xFF) != 0)
-        {
-            bits++;
-        }
-
-        return 8 - bits;
-    }
-
-    /**
-     * return the correct number of bytes for a bit string defined in
-     * a 32 bit constant
-     */
-    static protected byte[] getBytes(int bitString)
-    {
-        int bytes = 4;
-        for (int i = 3; i >= 1; i--)
-        {
-            if ((bitString & (0xFF << (i * 8))) != 0)
-            {
-                break;
-            }
-            bytes--;
-        }
-        
-        byte[] result = new byte[bytes];
-        for (int i = 0; i < bytes; i++)
-        {
-            result[i] = (byte) ((bitString >> (i * 8)) & 0xFF);
-        }
-
-        return result;
-    }
-
-    /**
-     * return a Bit String from the passed in object
-     *
-     * @exception IllegalArgumentException if the object cannot be converted.
-     */
-    public static DERBitString getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof DERBitString)
-        {
-            return (DERBitString)obj;
-        }
-
-        if (obj instanceof ASN1OctetString)
-        {
-            byte[]  bytes = ((ASN1OctetString)obj).getOctets();
-            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);
-        }
-
-        if (obj instanceof ASN1TaggedObject)
-        {
-            return getInstance(((ASN1TaggedObject)obj).getObject());
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    /**
-     * return a Bit 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 DERBitString getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(obj.getObject());
-    }
-    
-    protected DERBitString(
-        byte    data,
-        int     padBits)
-    {
-        this.data = new byte[1];
-        this.data[0] = data;
-        this.padBits = padBits;
-    }
-
-    /**
-     * @param data the octets making up the bit string.
-     * @param padBits the number of extra bits at the end of the string.
-     */
-    public DERBitString(
-        byte[]  data,
-        int     padBits)
-    {
-        this.data = data;
-        this.padBits = padBits;
-    }
-
-    public DERBitString(
-        byte[]  data)
-    {
-        this(data, 0);
-    }
-
-    public DERBitString(
-        DEREncodable  obj)
-    {
-        try
-        {
-            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-            DEROutputStream         dOut = new DEROutputStream(bOut);
-
-            dOut.writeObject(obj);
-            dOut.close();
-
-            this.data = bOut.toByteArray();
-            this.padBits = 0;
-        }
-        catch (IOException e)
-        {
-            throw new IllegalArgumentException("Error processing object : " + e.toString());
-        }
-    }
-
-    public byte[] getBytes()
-    {
-        return data;
-    }
-
-    public int getPadBits()
-    {
-        return padBits;
-    }
-
-
-    /**
-     * @return the value of the bit string as an int (truncating if necessary)
-     */
-    public int intValue()
-    {
-        int value = 0;
-        
-        for (int i = 0; i != data.length && i != 4; i++)
-        {
-            value |= (data[i] & 0xff) << (8 * i);
-        }
-        
-        return value;
-    }
-    
-    void encode(
-        DEROutputStream  out)
-        throws IOException
-    {
-        byte[]  bytes = new byte[getBytes().length + 1];
-
-        bytes[0] = (byte)getPadBits();
-        System.arraycopy(getBytes(), 0, bytes, 1, bytes.length - 1);
-
-        out.writeEncoded(BIT_STRING, bytes);
-    }
-
-    public int hashCode()
-    {
-        int     value = 0;
-
-        for (int i = 0; i != data.length; i++)
-        {
-            value ^= (data[i] & 0xff) << (i % 4);
-        }
-
-        return value;
-    }
-    
-    protected boolean asn1Equals(
-        DERObject  o)
-    {
-        if (!(o instanceof DERBitString))
-        {
-            return false;
-        }
-
-        DERBitString  other = (DERBitString)o;
-
-        if (data.length != other.data.length)
-        {
-            return false;
-        }
-
-        for (int i = 0; i != data.length; i++)
-        {
-            if (data[i] != other.data[i])
-            {
-                return false;
-            }
-        }
-
-        return (padBits == other.padBits);
-    }
-
-    public String getString()
-    {
-        StringBuffer          buf = new StringBuffer("#");
-        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
-        ASN1OutputStream      aOut = new ASN1OutputStream(bOut);
-        
-        try
-        {
-            aOut.writeObject(this);
-        }
-        catch (IOException e)
-        {
-           throw new RuntimeException("internal error encoding BitString");
-        }
-        
-        byte[]    string = bOut.toByteArray();
-        
-        for (int i = 0; i != string.length; i++)
-        {
-            buf.append(table[(string[i] >>> 4) & 0xf]);
-            buf.append(table[string[i] & 0xf]);
-        }
-        
-        return buf.toString();
-    }
-
-    public String toString()
-    {
-        return getString();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERBoolean.java b/azureus2/src/org/bouncycastle/asn1/DERBoolean.java
deleted file mode 100644
index a2f0c4d..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERBoolean.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-public class DERBoolean
-    extends ASN1Object
-{
-    byte         value;
-
-    public static final DERBoolean FALSE = new DERBoolean(false);
-    public static final DERBoolean TRUE  = new DERBoolean(true);
-
-    /**
-     * return a boolean from the passed in object.
-     *
-     * @exception IllegalArgumentException if the object cannot be converted.
-     */
-    public static DERBoolean getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof DERBoolean)
-        {
-            return (DERBoolean)obj;
-        }
-
-        if (obj instanceof ASN1OctetString)
-        {
-            return new DERBoolean(((ASN1OctetString)obj).getOctets());
-        }
-
-        if (obj instanceof ASN1TaggedObject)
-        {
-            return getInstance(((ASN1TaggedObject)obj).getObject());
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    /**
-     * return a DERBoolean from the passed in boolean.
-     */
-    public static DERBoolean getInstance(
-        boolean  value)
-    {
-        return (value ? TRUE : FALSE);
-    }
-
-    /**
-     * return a Boolean 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 DERBoolean getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(obj.getObject());
-    }
-    
-    public DERBoolean(
-        byte[]       value)
-    {
-        this.value = value[0];
-    }
-
-    public DERBoolean(
-        boolean     value)
-    {
-        this.value = (value) ? (byte)0xff : (byte)0;
-    }
-
-    public boolean isTrue()
-    {
-        return (value != 0);
-    }
-
-    void encode(
-        DEROutputStream out)
-        throws IOException
-    {
-        byte[]  bytes = new byte[1];
-
-        bytes[0] = value;
-
-        out.writeEncoded(BOOLEAN, bytes);
-    }
-    
-    protected boolean asn1Equals(
-        DERObject  o)
-    {
-        if ((o == null) || !(o instanceof DERBoolean))
-        {
-            return false;
-        }
-
-        return (value == ((DERBoolean)o).value);
-    }
-    
-    public int hashCode()
-    {
-        return value;
-    }
-
-
-    public String toString()
-    {
-      return (value != 0) ? "TRUE" : "FALSE";
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERConstructedSequence.java b/azureus2/src/org/bouncycastle/asn1/DERConstructedSequence.java
deleted file mode 100644
index 99a493e..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERConstructedSequence.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Enumeration;
-
-/**
- * @deprecated use DERSequence.
- */
-public class DERConstructedSequence
-    extends ASN1Sequence
-{
-    public void addObject(
-        DEREncodable obj)
-    {
-        super.addObject(obj);
-    }
-
-    public int getSize()
-    {
-        return size();
-    }
-
-    /*
-     * A note on the implementation:
-     * <p>
-     * As DER requires the constructed, definite-length model to
-     * be used for structured types, this varies slightly from the
-     * ASN.1 descriptions given. Rather than just outputing SEQUENCE,
-     * we also have to specify CONSTRUCTED, and the objects length.
-     */
-    void encode(
-        DEROutputStream out)
-        throws IOException
-    {
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-        DEROutputStream         dOut = new DEROutputStream(bOut);
-        Enumeration             e = this.getObjects();
-
-        while (e.hasMoreElements())
-        {
-            Object    obj = e.nextElement();
-
-            dOut.writeObject(obj);
-        }
-
-        dOut.close();
-
-        byte[]  bytes = bOut.toByteArray();
-
-        out.writeEncoded(SEQUENCE | CONSTRUCTED, bytes);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERConstructedSet.java b/azureus2/src/org/bouncycastle/asn1/DERConstructedSet.java
deleted file mode 100644
index 695cef3..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERConstructedSet.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Enumeration;
-
-/**
- * 
- * @deprecated use DERSet
- */
-public class DERConstructedSet
-    extends ASN1Set
-{
-    public DERConstructedSet()
-    {
-    }
-
-    /**
-     * @param obj - a single object that makes up the set.
-     */
-    public DERConstructedSet(
-        DEREncodable   obj)
-    {
-        this.addObject(obj);
-    }
-
-    /**
-     * @param v - a vector of objects making up the set.
-     */
-    public DERConstructedSet(
-        DEREncodableVector   v)
-    {
-        for (int i = 0; i != v.size(); i++)
-        {
-            this.addObject(v.get(i));
-        }
-    }
-
-    public void addObject(
-        DEREncodable    obj)
-    {
-        super.addObject(obj);
-    }
-
-    public int getSize()
-    {
-        return size();
-    }
-
-    /*
-     * A note on the implementation:
-     * <p>
-     * As DER requires the constructed, definite-length model to
-     * be used for structured types, this varies slightly from the
-     * ASN.1 descriptions given. Rather than just outputing SET,
-     * we also have to specify CONSTRUCTED, and the objects length.
-     */
-    void encode(
-        DEROutputStream out)
-        throws IOException
-    {
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-        DEROutputStream         dOut = new DEROutputStream(bOut);
-        Enumeration             e = this.getObjects();
-
-        while (e.hasMoreElements())
-        {
-            Object    obj = e.nextElement();
-
-            dOut.writeObject(obj);
-        }
-
-        dOut.close();
-
-        byte[]  bytes = bOut.toByteArray();
-
-        out.writeEncoded(SET | CONSTRUCTED, bytes);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DEREncodable.java b/azureus2/src/org/bouncycastle/asn1/DEREncodable.java
deleted file mode 100644
index d89305a..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DEREncodable.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.bouncycastle.asn1;
-
-public interface DEREncodable
-{
-    public DERObject getDERObject();
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DEREncodableVector.java b/azureus2/src/org/bouncycastle/asn1/DEREncodableVector.java
deleted file mode 100644
index 60d0bd2..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DEREncodableVector.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.util.Vector;
-
-/**
- * a general class for building up a vector of DER encodable objects -
- * this will eventually be superceded by ASN1EncodableVector so you should
- * use that class in preference.
- */
-public class DEREncodableVector
-{
-    private Vector  v = new Vector();
-
-    /**
-     * @deprecated use ASN1EncodableVector instead.
-     */
-    public DEREncodableVector()
-    {
-
-    }
-    
-    public void add(
-        DEREncodable   obj)
-    {
-        v.addElement(obj);
-    }
-
-    public DEREncodable get(
-        int i)
-    {
-        return (DEREncodable)v.elementAt(i);
-    }
-
-    public int size()
-    {
-        return v.size();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DEREnumerated.java b/azureus2/src/org/bouncycastle/asn1/DEREnumerated.java
deleted file mode 100644
index 9881352..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DEREnumerated.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-import java.math.BigInteger;
-
-public class DEREnumerated
-    extends ASN1Object
-{
-    byte[]      bytes;
-
-    /**
-     * return an integer from the passed in object
-     *
-     * @exception IllegalArgumentException if the object cannot be converted.
-     */
-    public static DEREnumerated getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof DEREnumerated)
-        {
-            return (DEREnumerated)obj;
-        }
-
-        if (obj instanceof ASN1OctetString)
-        {
-            return new DEREnumerated(((ASN1OctetString)obj).getOctets());
-        }
-
-        if (obj instanceof ASN1TaggedObject)
-        {
-            return getInstance(((ASN1TaggedObject)obj).getObject());
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    /**
-     * return an Enumerated 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 DEREnumerated getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(obj.getObject());
-    }
-
-    public DEREnumerated(
-        int         value)
-    {
-        bytes = BigInteger.valueOf(value).toByteArray();
-    }
-
-    public DEREnumerated(
-        BigInteger   value)
-    {
-        bytes = value.toByteArray();
-    }
-
-    public DEREnumerated(
-        byte[]   bytes)
-    {
-        this.bytes = bytes;
-    }
-
-    public BigInteger getValue()
-    {
-        return new BigInteger(bytes);
-    }
-
-    void encode(
-        DEROutputStream out)
-        throws IOException
-    {
-        out.writeEncoded(ENUMERATED, bytes);
-    }
-    
-    boolean asn1Equals(
-        DERObject  o)
-    {
-        if (!(o instanceof DEREnumerated))
-        {
-            return false;
-        }
-
-        DEREnumerated other = (DEREnumerated)o;
-
-        if (bytes.length != other.bytes.length)
-        {
-            return false;
-        }
-
-        for (int i = 0; i != bytes.length; i++)
-        {
-            if (bytes[i] != other.bytes[i])
-            {
-                return false;
-            }
-        }
-
-        return true;
-    }
-    
-    public int hashCode()
-    {
-        return this.getValue().hashCode();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERGeneralString.java b/azureus2/src/org/bouncycastle/asn1/DERGeneralString.java
deleted file mode 100644
index 1992cf3..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERGeneralString.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-public class DERGeneralString 
-    extends ASN1Object implements DERString
-{
-    private String string;
-
-    public static DERGeneralString getInstance(
-        Object obj) 
-    {
-        if (obj == null || obj instanceof DERGeneralString) 
-        {
-            return (DERGeneralString) obj;
-        }
-        if (obj instanceof ASN1OctetString) 
-        {
-            return new DERGeneralString(((ASN1OctetString) obj).getOctets());
-        }
-        if (obj instanceof ASN1TaggedObject) 
-        {
-            return getInstance(((ASN1TaggedObject) obj).getObject());
-        }
-        throw new IllegalArgumentException("illegal object in getInstance: "
-                + obj.getClass().getName());
-    }
-
-    public static DERGeneralString getInstance(
-        ASN1TaggedObject obj, 
-        boolean explicit) 
-    {
-        return getInstance(obj.getObject());
-    }
-
-    public DERGeneralString(byte[] string) 
-    {
-        char[] cs = new char[string.length];
-        for (int i = 0; i != cs.length; i++)
-        {
-            cs[i] = (char)(string[i] & 0xff);
-        }
-        this.string = new String(cs);
-    }
-
-    public DERGeneralString(String string) 
-    {
-        this.string = string;
-    }
-    
-    public String getString() 
-    {
-        return string;
-    }
-
-    public String toString()
-    {
-        return string;
-    }
-
-    public byte[] getOctets() 
-    {
-        char[] cs = string.toCharArray();
-        byte[] bs = new byte[cs.length];
-        for (int i = 0; i != cs.length; i++) 
-        {
-            bs[i] = (byte) cs[i];
-        }
-        return bs;
-    }
-    
-    void encode(DEROutputStream out) 
-        throws IOException 
-    {
-        out.writeEncoded(GENERAL_STRING, this.getOctets());
-    }
-    
-    public int hashCode() 
-    {
-        return this.getString().hashCode();
-    }
-    
-    boolean asn1Equals(DERObject o)
-    {
-        if (!(o instanceof DERGeneralString)) 
-        {
-            return false;
-        }
-        DERGeneralString s = (DERGeneralString) o;
-        return this.getString().equals(s.getString());
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERGeneralizedTime.java b/azureus2/src/org/bouncycastle/asn1/DERGeneralizedTime.java
deleted file mode 100644
index c1cf6c5..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERGeneralizedTime.java
+++ /dev/null
@@ -1,294 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.SimpleTimeZone;
-import java.util.TimeZone;
-
-/**
- * Generalized time object.
- */
-public class DERGeneralizedTime
-    extends ASN1Object
-{
-    String      time;
-
-    /**
-     * return a generalized time from the passed in object
-     *
-     * @exception IllegalArgumentException if the object cannot be converted.
-     */
-    public static DERGeneralizedTime getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof DERGeneralizedTime)
-        {
-            return (DERGeneralizedTime)obj;
-        }
-
-        if (obj instanceof ASN1OctetString)
-        {
-            return new DERGeneralizedTime(((ASN1OctetString)obj).getOctets());
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    /**
-     * return a Generalized Time object 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 DERGeneralizedTime getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(obj.getObject());
-    }
-    
-    /**
-     * The correct format for this is YYYYMMDDHHMMSS[.f]Z, or without the Z
-     * for local time, or Z+-HHMM on the end, for difference between local
-     * time and UTC time. The fractional second amount f must consist of at
-     * least one number with trailing zeroes removed.
-     *
-     * @param time the time string.
-     * @exception IllegalArgumentException if String is an illegal format.
-     */
-    public DERGeneralizedTime(
-        String  time)
-    {
-        this.time = time;
-        try
-        {
-            this.getDate();
-        }
-        catch (ParseException e)
-        {
-            throw new IllegalArgumentException("invalid date string: " + e.getMessage());
-        }
-    }
-
-    /**
-     * base constructer from a java.util.date object
-     */
-    public DERGeneralizedTime(
-        Date time)
-    {
-        SimpleDateFormat dateF = new SimpleDateFormat("yyyyMMddHHmmss'Z'");
-
-        dateF.setTimeZone(new SimpleTimeZone(0,"Z"));
-
-        this.time = dateF.format(time);
-    }
-
-    DERGeneralizedTime(
-        byte[]  bytes)
-    {
-        //
-        // explicitly convert to characters
-        //
-        char[]  dateC = new char[bytes.length];
-
-        for (int i = 0; i != dateC.length; i++)
-        {
-            dateC[i] = (char)(bytes[i] & 0xff);
-        }
-
-        this.time = new String(dateC);
-    }
-
-    /**
-     * Return the time.
-     * @return The time string as it appeared in the encoded object.
-     */
-    public String getTimeString()
-    {
-        return time;
-    }
-    
-    /**
-     * return the time - always in the form of 
-     *  YYYYMMDDhhmmssGMT(+hh:mm|-hh:mm).
-     * <p>
-     * Normally in a certificate we would expect "Z" rather than "GMT",
-     * however adding the "GMT" means we can just use:
-     * <pre>
-     *     dateF = new SimpleDateFormat("yyyyMMddHHmmssz");
-     * </pre>
-     * To read in the time and get a date which is compatible with our local
-     * time zone.
-     */
-    public String getTime()
-    {
-        //
-        // standardise the format.
-        //             
-        if (time.charAt(time.length() - 1) == 'Z')
-        {
-            return time.substring(0, time.length() - 1) + "GMT+00:00";
-        }
-        else
-        {
-            int signPos = time.length() - 5;
-            char sign = time.charAt(signPos);
-            if (sign == '-' || sign == '+')
-            {
-                return time.substring(0, signPos)
-                    + "GMT"
-                    + time.substring(signPos, signPos + 3)
-                    + ":"
-                    + time.substring(signPos + 3);
-            }
-            else
-            {
-                signPos = time.length() - 3;
-                sign = time.charAt(signPos);
-                if (sign == '-' || sign == '+')
-                {
-                    return time.substring(0, signPos)
-                        + "GMT"
-                        + time.substring(signPos)
-                        + ":00";
-                }
-            }
-        }            
-        return time + calculateGMTOffset();
-    }
-
-    private String calculateGMTOffset()
-    {
-        String sign = "+";
-        TimeZone timeZone = TimeZone.getDefault();
-        int offset = timeZone.getRawOffset();
-        if (offset < 0)
-        {
-            sign = "-";
-            offset = -offset;
-        }
-        int hours = offset / (60 * 60 * 1000);
-        int minutes = (offset - (hours * 60 * 60 * 1000)) / (60 * 1000);
-
-        try
-        {
-            if (timeZone.useDaylightTime() && timeZone.inDaylightTime(this.getDate()))
-            {
-                hours += sign.equals("+") ? 1 : -1;
-            }
-        }
-        catch (ParseException e)
-        {
-            // we'll do our best and ignore daylight savings
-        }
-
-        return "GMT" + sign + convert(hours) + ":" + convert(minutes);
-    }
-
-    private String convert(int time)
-    {
-        if (time < 10)
-        {
-            return "0" + time;
-        }
-
-        return Integer.toString(time);
-    }
-
-    public Date getDate()
-        throws ParseException
-    {
-        SimpleDateFormat dateF;
-        String d = time;
-
-        if (time.endsWith("Z"))
-        {
-            if (hasFractionalSeconds())
-            {
-                dateF = new SimpleDateFormat("yyyyMMddHHmmss.SSSS'Z'");
-            }
-            else
-            {
-                dateF = new SimpleDateFormat("yyyyMMddHHmmss'Z'");
-            }
-
-            dateF.setTimeZone(new SimpleTimeZone(0, "Z"));
-        }
-        else if (time.indexOf('-') > 0 || time.indexOf('+') > 0)
-        {
-            d = this.getTime();
-            if (hasFractionalSeconds())
-            {
-                dateF = new SimpleDateFormat("yyyyMMddHHmmss.SSSSz");
-            }
-            else
-            {
-                dateF = new SimpleDateFormat("yyyyMMddHHmmssz");
-            }
-
-            dateF.setTimeZone(new SimpleTimeZone(0, "Z"));
-        }
-        else
-        {
-            if (hasFractionalSeconds())
-            {
-                dateF = new SimpleDateFormat("yyyyMMddHHmmss.SSSS");
-            }
-            else
-            {
-                dateF = new SimpleDateFormat("yyyyMMddHHmmss");
-            }
-
-            dateF.setTimeZone(new SimpleTimeZone(0, TimeZone.getDefault().getID()));
-        }
-
-        return dateF.parse(d);
-    }
-
-    private boolean hasFractionalSeconds()
-    {
-        return time.indexOf('.') == 14;
-    }
-
-    private byte[] getOctets()
-    {
-        char[]  cs = time.toCharArray();
-        byte[]  bs = new byte[cs.length];
-
-        for (int i = 0; i != cs.length; i++)
-        {
-            bs[i] = (byte)cs[i];
-        }
-
-        return bs;
-    }
-
-
-    void encode(
-        DEROutputStream  out)
-        throws IOException
-    {
-        out.writeEncoded(GENERALIZED_TIME, this.getOctets());
-    }
-    
-    boolean asn1Equals(
-        DERObject  o)
-    {
-        if (!(o instanceof DERGeneralizedTime))
-        {
-            return false;
-        }
-
-        return time.equals(((DERGeneralizedTime)o).time);
-    }
-    
-    public int hashCode()
-    {
-        return time.hashCode();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERGenerator.java b/azureus2/src/org/bouncycastle/asn1/DERGenerator.java
deleted file mode 100644
index 3006d0b..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERGenerator.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-public abstract class DERGenerator
-    extends ASN1Generator
-{       
-    private boolean      _tagged = false;
-    private boolean      _isExplicit;
-    private int          _tagNo;
-    
-    protected DERGenerator(
-        OutputStream out)
-    {
-        super(out);
-    }
-
-    public DERGenerator(
-        OutputStream out,
-        int          tagNo,
-        boolean      isExplicit)
-    { 
-        super(out);
-        
-        _tagged = true;
-        _isExplicit = isExplicit;
-        _tagNo = tagNo;
-    }
-
-    private void writeLength(
-        OutputStream out,
-        int          length)
-        throws IOException
-    {
-        if (length > 127)
-        {
-            int size = 1;
-            int val = length;
-
-            while ((val >>>= 8) != 0)
-            {
-                size++;
-            }
-
-            out.write((byte)(size | 0x80));
-
-            for (int i = (size - 1) * 8; i >= 0; i -= 8)
-            {
-                out.write((byte)(length >> i));
-            }
-        }
-        else
-        {
-            out.write((byte)length);
-        }
-    }
-
-    void writeDEREncoded(
-        OutputStream out,
-        int          tag,
-        byte[]       bytes)
-        throws IOException
-    {
-        out.write(tag);
-        writeLength(out, bytes.length);
-        out.write(bytes);
-    }
-
-    void writeDEREncoded(
-        int       tag,
-        byte[]    bytes)
-        throws IOException
-    {
-        if (_tagged)
-        {
-            int tagNum = _tagNo | DERTags.TAGGED;
-            
-            if (_isExplicit)
-            {
-                int newTag = _tagNo | DERTags.CONSTRUCTED | DERTags.TAGGED;
-
-                ByteArrayOutputStream bOut = new ByteArrayOutputStream();
-                
-                writeDEREncoded(bOut, tag, bytes);
-                
-                writeDEREncoded(_out, newTag, bOut.toByteArray());
-            }
-            else
-            {   
-                if ((tag & DERTags.CONSTRUCTED) != 0)
-                {
-                    writeDEREncoded(_out, tagNum | DERTags.CONSTRUCTED, bytes);
-                }
-                else
-                {
-                    writeDEREncoded(_out, tagNum, bytes);
-                }
-            }
-        }
-        else
-        {
-            writeDEREncoded(_out, tag, bytes);
-        }
-    }
-    
-    void writeDEREncoded(
-        OutputStream out,
-        int          tag,
-        InputStream  in)
-        throws IOException
-    {
-        out.write(tag);
-        
-        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
-        
-        int b = 0;
-        while ((b = in.read()) >= 0)
-        {
-            bOut.write(b);
-        }
-        
-        byte[] bytes = bOut.toByteArray();
-        
-        writeLength(out, bytes.length);
-        out.write(bytes);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERIA5String.java b/azureus2/src/org/bouncycastle/asn1/DERIA5String.java
deleted file mode 100644
index c8dd70e..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERIA5String.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-/**
- * DER IA5String object - this is an ascii string.
- */
-public class DERIA5String
-    extends ASN1Object
-    implements DERString
-{
-    String  string;
-
-    /**
-     * return a IA5 string from the passed in object
-     *
-     * @exception IllegalArgumentException if the object cannot be converted.
-     */
-    public static DERIA5String getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof DERIA5String)
-        {
-            return (DERIA5String)obj;
-        }
-
-        if (obj instanceof ASN1OctetString)
-        {
-            return new DERIA5String(((ASN1OctetString)obj).getOctets());
-        }
-
-        if (obj instanceof ASN1TaggedObject)
-        {
-            return getInstance(((ASN1TaggedObject)obj).getObject());
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    /**
-     * return an IA5 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 DERIA5String getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(obj.getObject());
-    }
-
-    /**
-     * basic constructor - with bytes.
-     */
-    public DERIA5String(
-        byte[]   string)
-    {
-        char[]  cs = new char[string.length];
-
-        for (int i = 0; i != cs.length; i++)
-        {
-            cs[i] = (char)(string[i] & 0xff);
-        }
-
-        this.string = new String(cs);
-    }
-
-    /**
-     * basic constructor - without validation.
-     */
-    public DERIA5String(
-        String   string)
-    {
-        this(string, false);
-    }
-
-    /**
-     * Constructor with optional validation.
-     *
-     * @param string the base string to wrap.
-     * @param validate whether or not to check the string.
-     * @throws IllegalArgumentException if validate is true and the string
-     * contains characters that should not be in an IA5String.
-     */
-    public DERIA5String(
-        String   string,
-        boolean  validate)
-    {
-        if (validate && !isIA5String(string))
-        {
-            throw new IllegalArgumentException("string contains illegal characters");
-        }
-
-        this.string = string;
-    }
-
-    public String getString()
-    {
-        return string;
-    }
-
-    public String toString()
-    {
-        return string;
-    }
-
-    public byte[] getOctets()
-    {
-        char[]  cs = string.toCharArray();
-        byte[]  bs = new byte[cs.length];
-
-        for (int i = 0; i != cs.length; i++)
-        {
-            bs[i] = (byte)cs[i];
-        }
-
-        return bs; 
-    }
-
-    void encode(
-        DEROutputStream  out)
-        throws IOException
-    {
-        out.writeEncoded(IA5_STRING, this.getOctets());
-    }
-
-    public int hashCode()
-    {
-        return this.getString().hashCode();
-    }
-
-    boolean asn1Equals(
-        DERObject  o)
-    {
-        if (!(o instanceof DERIA5String))
-        {
-            return false;
-        }
-
-        DERIA5String  s = (DERIA5String)o;
-
-        return this.getString().equals(s.getString());
-    }
-
-    /**
-     * return true if the passed in String can be represented without
-     * loss as an IA5String, false otherwise.
-     *
-     * @return true if in printable set, false otherwise.
-     */
-    public static boolean isIA5String(
-        String  str)
-    {
-        for (int i = str.length() - 1; i >= 0; i--)
-        {
-            char    ch = str.charAt(i);
-
-            if (ch > 0x007f)
-            {
-                return false;
-            }
-        }
-
-        return true;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERInputStream.java b/azureus2/src/org/bouncycastle/asn1/DERInputStream.java
deleted file mode 100644
index 51f5505..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERInputStream.java
+++ /dev/null
@@ -1,272 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.ByteArrayInputStream;
-import java.io.EOFException;
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Don't use this class. It will eventually disappear, use ASN1InputStream.
- * <br>
- * This class is scheduled for removal.
- * @deprecated use ASN1InputStream
- */
-public class DERInputStream
-    extends FilterInputStream implements DERTags
-{
-    /**
-     * @deprecated use ASN1InputStream
-     */
-    public DERInputStream(
-        InputStream is)
-    {
-        super(is);
-    }
-
-    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 stream - negative length found");
-            }
-        }
-
-        return length;
-    }
-
-    protected void readFully(
-        byte[]  bytes)
-        throws IOException
-    {
-        int     left = bytes.length;
-
-        if (left == 0)
-        {
-            return;
-        }
-
-        while (left > 0)
-        {
-            int    l = read(bytes, bytes.length - left, left);
-            
-            if (l < 0)
-            {
-                throw new EOFException("unexpected end of stream");
-            }
-            
-            left -= l;
-        }
-    }
-
-    /**
-     * build an object given its tag and a byte stream to construct it
-     * from.
-     */
-    protected DERObject buildObject(
-        int       tag,
-        byte[]    bytes)
-        throws IOException
-    {
-        switch (tag)
-        {
-        case NULL:
-            return null;   
-        case SEQUENCE | CONSTRUCTED:
-            ByteArrayInputStream    bIn = new ByteArrayInputStream(bytes);
-            BERInputStream          dIn = new BERInputStream(bIn);
-            DERConstructedSequence  seq = new DERConstructedSequence();
-
-            try
-            {
-                for (;;)
-                {
-                    DERObject   obj = dIn.readObject();
-
-                    seq.addObject(obj);
-                }
-            }
-            catch (EOFException ex)
-            {
-                return seq;
-            }
-        case SET | CONSTRUCTED:
-            bIn = new ByteArrayInputStream(bytes);
-            dIn = new BERInputStream(bIn);
-
-            ASN1EncodableVector    v = new ASN1EncodableVector();
-
-            try
-            {
-                for (;;)
-                {
-                    DERObject   obj = dIn.readObject();
-
-                    v.add(obj);
-                }
-            }
-            catch (EOFException ex)
-            {
-                return new DERConstructedSet(v);
-            }
-        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 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 UNIVERSAL_STRING:
-            return new DERUniversalString(bytes);
-        case GENERAL_STRING:
-            return new DERGeneralString(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)  
-            {
-                if ((tag & 0x1f) == 0x1f)
-                {
-                    throw new IOException("unsupported high tag encountered");
-                }
-
-                if (bytes.length == 0)        // empty tag!
-                {
-                    if ((tag & CONSTRUCTED) == 0)
-                    {
-                        return new DERTaggedObject(false, tag & 0x1f, new DERNull());
-                    }
-                    else
-                    {
-                        return new DERTaggedObject(false, tag & 0x1f, new DERConstructedSequence());
-                    }
-                }
-
-                //
-                // simple type - implicit... return an octet string
-                //
-                if ((tag & CONSTRUCTED) == 0)
-                {
-                    return new DERTaggedObject(false, tag & 0x1f, new DEROctetString(bytes));
-                }
-
-                bIn = new ByteArrayInputStream(bytes);
-                dIn = new BERInputStream(bIn);
-
-                DEREncodable dObj = dIn.readObject();
-
-                //
-                // explicitly tagged (probably!) - if it isn't we'd have to
-                // tell from the context
-                //
-                if (dIn.available() == 0)
-                {
-                    return new DERTaggedObject(tag & 0x1f, dObj);
-                }
-
-                //
-                // another implicit object, we'll create a sequence...
-                //
-                seq = new DERConstructedSequence();
-
-                seq.addObject(dObj);
-
-                try
-                {
-                    for (;;)
-                    {
-                        dObj = dIn.readObject();
-
-                        seq.addObject(dObj);
-                    }
-                }
-                catch (EOFException ex)
-                {
-                    // ignore --
-                }
-
-                return new DERTaggedObject(false, tag & 0x1f, seq);
-            }
-
-            return new DERUnknownTag(tag, bytes);
-        }
-    }
-
-    public DERObject readObject()
-        throws IOException
-    {
-        int tag = read();
-        if (tag == -1)
-        {
-            throw new EOFException();
-        }
-
-        int     length = readLength();
-        byte[]  bytes = new byte[length];
-
-        readFully(bytes);
-
-        return buildObject(tag, bytes);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERInteger.java b/azureus2/src/org/bouncycastle/asn1/DERInteger.java
deleted file mode 100644
index 059617c..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERInteger.java
+++ /dev/null
@@ -1,134 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-import java.math.BigInteger;
-
-public class DERInteger
-    extends ASN1Object
-{
-    byte[]      bytes;
-
-    /**
-     * return an integer from the passed in object
-     *
-     * @exception IllegalArgumentException if the object cannot be converted.
-     */
-    public static DERInteger getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof DERInteger)
-        {
-            return (DERInteger)obj;
-        }
-
-        if (obj instanceof ASN1OctetString)
-        {
-            return new DERInteger(((ASN1OctetString)obj).getOctets());
-        }
-
-        if (obj instanceof ASN1TaggedObject)
-        {
-            return getInstance(((ASN1TaggedObject)obj).getObject());
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    /**
-     * return an Integer 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 DERInteger getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(obj.getObject());
-    }
-
-    public DERInteger(
-        int         value)
-    {
-        bytes = BigInteger.valueOf(value).toByteArray();
-    }
-
-    public DERInteger(
-        BigInteger   value)
-    {
-        bytes = value.toByteArray();
-    }
-
-    public DERInteger(
-        byte[]   bytes)
-    {
-        this.bytes = bytes;
-    }
-
-    public BigInteger getValue()
-    {
-        return new BigInteger(bytes);
-    }
-
-    /**
-     * in some cases positive values get crammed into a space,
-     * that's not quite big enough...
-     */
-    public BigInteger getPositiveValue()
-    {
-        return new BigInteger(1, bytes);
-    }
-
-    void encode(
-        DEROutputStream out)
-        throws IOException
-    {
-        out.writeEncoded(INTEGER, bytes);
-    }
-    
-    public int hashCode()
-    {
-         int     value = 0;
- 
-         for (int i = 0; i != bytes.length; i++)
-         {
-             value ^= (bytes[i] & 0xff) << (i % 4);
-         }
- 
-         return value;
-    }
-
-    boolean asn1Equals(
-        DERObject  o)
-    {
-        if (!(o instanceof DERInteger))
-        {
-            return false;
-        }
-
-        DERInteger other = (DERInteger)o;
-
-        if (bytes.length != other.bytes.length)
-        {
-            return false;
-        }
-
-        for (int i = 0; i != bytes.length; i++)
-        {
-            if (bytes[i] != other.bytes[i])
-            {
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    public String toString()
-    {
-      return getValue().toString();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERNull.java b/azureus2/src/org/bouncycastle/asn1/DERNull.java
deleted file mode 100644
index 5d020c7..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERNull.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-/**
- * A NULL object.
- */
-public class DERNull
-    extends ASN1Null
-{
-    public static final DERNull INSTANCE = new DERNull();
-
-    byte[]  zeroBytes = new byte[0];
-
-    public DERNull()
-    {
-    }
-
-    void encode(
-        DEROutputStream  out)
-        throws IOException
-    {
-        out.writeEncoded(NULL, zeroBytes);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERNumericString.java b/azureus2/src/org/bouncycastle/asn1/DERNumericString.java
deleted file mode 100644
index 3c72193..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERNumericString.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-/**
- * DER NumericString object - this is an ascii string of characters {0,1,2,3,4,5,6,7,8,9, }.
- */
-public class DERNumericString
-    extends ASN1Object
-    implements DERString
-{
-    String  string;
-
-    /**
-     * return a Numeric string from the passed in object
-     *
-     * @exception IllegalArgumentException if the object cannot be converted.
-     */
-    public static DERNumericString getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof DERNumericString)
-        {
-            return (DERNumericString)obj;
-        }
-
-        if (obj instanceof ASN1OctetString)
-        {
-            return new DERNumericString(((ASN1OctetString)obj).getOctets());
-        }
-
-        if (obj instanceof ASN1TaggedObject)
-        {
-            return getInstance(((ASN1TaggedObject)obj).getObject());
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    /**
-     * return an Numeric 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 DERNumericString getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(obj.getObject());
-    }
-
-    /**
-     * basic constructor - with bytes.
-     */
-    public DERNumericString(
-        byte[]   string)
-    {
-        char[]  cs = new char[string.length];
-
-        for (int i = 0; i != cs.length; i++)
-        {
-            cs[i] = (char)(string[i] & 0xff);
-        }
-
-        this.string = new String(cs);
-    }
-
-    /**
-     * basic constructor -  without validation..
-     */
-    public DERNumericString(
-        String   string)
-    {
-        this(string, false);
-    }
-
-    /**
-     * Constructor with optional validation.
-     *
-     * @param string the base string to wrap.
-     * @param validate whether or not to check the string.
-     * @throws IllegalArgumentException if validate is true and the string
-     * contains characters that should not be in a NumericString.
-     */
-    public DERNumericString(
-        String   string,
-        boolean  validate)
-    {
-        if (validate && !isNumericString(string))
-        {
-            throw new IllegalArgumentException("string contains illegal characters");
-        }
-
-        this.string = string;
-    }
-
-    public String getString()
-    {
-        return string;
-    }
-
-    public String toString()
-    {
-        return string;
-    }
-
-    public byte[] getOctets()
-    {
-        char[]  cs = string.toCharArray();
-        byte[]  bs = new byte[cs.length];
-
-        for (int i = 0; i != cs.length; i++)
-        {
-            bs[i] = (byte)cs[i];
-        }
-
-        return bs; 
-    }
-
-    void encode(
-        DEROutputStream  out)
-        throws IOException
-    {
-        out.writeEncoded(NUMERIC_STRING, this.getOctets());
-    }
-
-    public int hashCode()
-    {
-        return this.getString().hashCode();
-    }
-
-    boolean asn1Equals(
-        DERObject  o)
-    {
-        if (!(o instanceof DERNumericString))
-        {
-            return false;
-        }
-
-        DERNumericString  s = (DERNumericString)o;
-
-        return this.getString().equals(s.getString());
-    }
-
-    /**
-     * Return true if the string can be represented as a NumericString ('0'..'9', ' ')
-     *
-     * @param str string to validate.
-     * @return true if numeric, fale otherwise.
-     */
-    public static boolean isNumericString(
-        String  str)
-    {
-        for (int i = str.length() - 1; i >= 0; i--)
-        {
-            char    ch = str.charAt(i);
-
-            if (ch > 0x007f)
-            {
-                return false;
-            }
-
-            if (('0' <= ch && ch <= '9') || ch == ' ')
-            {
-                continue;
-            }
-
-            return false;
-        }
-
-        return true;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERObject.java b/azureus2/src/org/bouncycastle/asn1/DERObject.java
deleted file mode 100644
index 42e2487..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERObject.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-public abstract class DERObject
-    extends ASN1Encodable
-    implements DERTags
-{
-    public DERObject toASN1Object()
-    {
-        return this;
-    }
-    
-    public abstract int hashCode();
-    
-    public abstract boolean equals(Object o);
-    
-    abstract void encode(DEROutputStream out)
-        throws IOException;
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERObjectIdentifier.java b/azureus2/src/org/bouncycastle/asn1/DERObjectIdentifier.java
deleted file mode 100644
index 1ba6b2d..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERObjectIdentifier.java
+++ /dev/null
@@ -1,293 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.math.BigInteger;
-
-public class DERObjectIdentifier
-    extends ASN1Object
-{
-    String      identifier;
-
-    /**
-     * return an OID from the passed in object
-     *
-     * @exception IllegalArgumentException if the object cannot be converted.
-     */
-    public static DERObjectIdentifier getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof DERObjectIdentifier)
-        {
-            return (DERObjectIdentifier)obj;
-        }
-
-        if (obj instanceof ASN1OctetString)
-        {
-            return new DERObjectIdentifier(((ASN1OctetString)obj).getOctets());
-        }
-
-        if (obj instanceof ASN1TaggedObject)
-        {
-            return getInstance(((ASN1TaggedObject)obj).getObject());
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    /**
-     * return an Object Identifier 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 DERObjectIdentifier getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(obj.getObject());
-    }
-    
-
-    DERObjectIdentifier(
-        byte[]  bytes)
-    {
-        StringBuffer    objId = new StringBuffer();
-        long            value = 0;
-        BigInteger      bigValue = null;
-        boolean         first = true;
-
-        for (int i = 0; i != bytes.length; i++)
-        {
-            int b = bytes[i] & 0xff;
-
-            if (value < 0x80000000000000L) 
-            {
-                value = value * 128 + (b & 0x7f);
-                if ((b & 0x80) == 0)             // end of number reached
-                {
-                    if (first)
-                    {
-                        switch ((int)value / 40)
-                        {
-                        case 0:
-                            objId.append('0');
-                            break;
-                        case 1:
-                            objId.append('1');
-                            value -= 40;
-                            break;
-                        default:
-                            objId.append('2');
-                            value -= 80;
-                        }
-                        first = false;
-                    }
-
-                    objId.append('.');
-                    objId.append(value);
-                    value = 0;
-                }
-            } 
-            else 
-            {
-                if (bigValue == null)
-                {
-                    bigValue = BigInteger.valueOf(value);
-                }
-                bigValue = bigValue.shiftLeft(7);
-                bigValue = bigValue.or(BigInteger.valueOf(b & 0x7f));
-                if ((b & 0x80) == 0) 
-                {
-                    objId.append('.');
-                    objId.append(bigValue);
-                    bigValue = null;
-                    value = 0;
-                }
-            }
-        }
-
-        this.identifier = objId.toString();
-    }
-
-    public DERObjectIdentifier(
-        String  identifier)
-    {
-        if (!isValidIdentifier(identifier))
-        {
-            throw new IllegalArgumentException("string " + identifier + " not an OID");
-        }
-
-        this.identifier = identifier;
-    }
-
-    public String getId()
-    {
-        return identifier;
-    }
-
-    private void writeField(
-        OutputStream    out,
-        long            fieldValue)
-        throws IOException
-    {
-        if (fieldValue >= (1L << 7))
-        {
-            if (fieldValue >= (1L << 14))
-            {
-                if (fieldValue >= (1L << 21))
-                {
-                    if (fieldValue >= (1L << 28))
-                    {
-                        if (fieldValue >= (1L << 35))
-                        {
-                            if (fieldValue >= (1L << 42))
-                            {
-                                if (fieldValue >= (1L << 49))
-                                {
-                                    if (fieldValue >= (1L << 56))
-                                    {
-                                        out.write((int)(fieldValue >> 56) | 0x80);
-                                    }
-                                    out.write((int)(fieldValue >> 49) | 0x80);
-                                }
-                                out.write((int)(fieldValue >> 42) | 0x80);
-                            }
-                            out.write((int)(fieldValue >> 35) | 0x80);
-                        }
-                        out.write((int)(fieldValue >> 28) | 0x80);
-                    }
-                    out.write((int)(fieldValue >> 21) | 0x80);
-                }
-                out.write((int)(fieldValue >> 14) | 0x80);
-            }
-            out.write((int)(fieldValue >> 7) | 0x80);
-        }
-        out.write((int)fieldValue & 0x7f);
-    }
-
-    private void writeField(
-        OutputStream    out,
-        BigInteger      fieldValue)
-        throws IOException
-    {
-        int byteCount = (fieldValue.bitLength()+6)/7;
-        if (byteCount == 0) 
-        {
-            out.write(0);
-        }  
-        else 
-        {
-            BigInteger tmpValue = fieldValue;
-            byte[] tmp = new byte[byteCount];
-            for (int i = byteCount-1; i >= 0; i--) 
-            {
-                tmp[i] = (byte) ((tmpValue.intValue() & 0x7f) | 0x80);
-                tmpValue = tmpValue.shiftRight(7); 
-            }
-            tmp[byteCount-1] &= 0x7f;
-            out.write(tmp);
-        }
-
-    }
-
-    void encode(
-        DEROutputStream out)
-        throws IOException
-    {
-        OIDTokenizer            tok = new OIDTokenizer(identifier);
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-        DEROutputStream         dOut = new DEROutputStream(bOut);
-
-        writeField(bOut, 
-                    Integer.parseInt(tok.nextToken()) * 40
-                    + Integer.parseInt(tok.nextToken()));
-
-        while (tok.hasMoreTokens())
-        {
-            String token = tok.nextToken();
-            if (token.length() < 18) 
-            {
-                writeField(bOut, Long.parseLong(token));
-            }
-            else
-            {
-                writeField(bOut, new BigInteger(token));
-            }
-        }
-
-        dOut.close();
-
-        byte[]  bytes = bOut.toByteArray();
-
-        out.writeEncoded(OBJECT_IDENTIFIER, bytes);
-    }
-
-    public int hashCode()
-    {
-        return identifier.hashCode();
-    }
-
-    boolean asn1Equals(
-        DERObject  o)
-    {
-        if (!(o instanceof DERObjectIdentifier))
-        {
-            return false;
-        }
-
-        return identifier.equals(((DERObjectIdentifier)o).identifier);
-    }
-
-    public String toString()
-    {
-        return getId();
-    }
-
-    private static boolean isValidIdentifier(
-        String identifier)
-    {
-        if (identifier.length() < 3
-            || identifier.charAt(1) != '.')
-        {
-            return false;
-        }
-
-        char first = identifier.charAt(0);
-        if (first < '0' || first > '2')
-        {
-            return false;
-        }
-
-        boolean periodAllowed = false;
-        for (int i = identifier.length() - 1; i >= 2; i--)
-        {
-            char ch = identifier.charAt(i);
-
-            if ('0' <= ch && ch <= '9')
-            {
-                periodAllowed = true;
-                continue;
-            }
-
-            if (ch == '.')
-            {
-                if (!periodAllowed)
-                {
-                    return false;
-                }
-
-                periodAllowed = false;
-                continue;
-            }
-
-            return false;
-        }
-
-        return periodAllowed;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DEROctetString.java b/azureus2/src/org/bouncycastle/asn1/DEROctetString.java
deleted file mode 100644
index bf7a86b..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DEROctetString.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-public class DEROctetString
-    extends ASN1OctetString
-{
-    /**
-     * @param string the octets making up the octet string.
-     */
-    public DEROctetString(
-        byte[]  string)
-    {
-        super(string);
-    }
-
-    public DEROctetString(
-        DEREncodable  obj)
-    {
-        super(obj);
-    }
-
-    void encode(
-        DEROutputStream out)
-        throws IOException
-    {
-        out.writeEncoded(OCTET_STRING, string);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DEROutputStream.java b/azureus2/src/org/bouncycastle/asn1/DEROutputStream.java
deleted file mode 100644
index 69150e0..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DEROutputStream.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-public class DEROutputStream
-    extends FilterOutputStream implements DERTags
-{
-    public DEROutputStream(
-        OutputStream    os)
-    {
-        super(os);
-    }
-
-    private void writeLength(
-        int length)
-        throws IOException
-    {
-        if (length > 127)
-        {
-            int size = 1;
-            int val = length;
-
-            while ((val >>>= 8) != 0)
-            {
-                size++;
-            }
-
-            write((byte)(size | 0x80));
-
-            for (int i = (size - 1) * 8; i >= 0; i -= 8)
-            {
-                write((byte)(length >> i));
-            }
-        }
-        else
-        {
-            write((byte)length);
-        }
-    }
-
-    void writeEncoded(
-        int     tag,
-        byte[]  bytes)
-        throws IOException
-    {
-        write(tag);
-        writeLength(bytes.length);
-        write(bytes);
-    }
-
-    protected void writeNull()
-        throws IOException
-    {
-        write(NULL);
-        write(0x00);
-    }
-
-    public void write(byte[] buf)
-        throws IOException
-    {
-        out.write(buf, 0, buf.length);
-    }
-
-    public void write(byte[] buf, int offSet, int len)
-        throws IOException
-    {
-        out.write(buf, offSet, len);
-    }
-
-    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 DEREncodable");
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERPrintableString.java b/azureus2/src/org/bouncycastle/asn1/DERPrintableString.java
deleted file mode 100644
index 032823d..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERPrintableString.java
+++ /dev/null
@@ -1,204 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-/**
- * DER PrintableString object.
- */
-public class DERPrintableString
-    extends ASN1Object
-    implements DERString
-{
-    String  string;
-
-    /**
-     * return a printable string from the passed in object.
-     * 
-     * @exception IllegalArgumentException if the object cannot be converted.
-     */
-    public static DERPrintableString getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof DERPrintableString)
-        {
-            return (DERPrintableString)obj;
-        }
-
-        if (obj instanceof ASN1OctetString)
-        {
-            return new DERPrintableString(((ASN1OctetString)obj).getOctets());
-        }
-
-        if (obj instanceof ASN1TaggedObject)
-        {
-            return getInstance(((ASN1TaggedObject)obj).getObject());
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    /**
-     * return a Printable 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 DERPrintableString getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(obj.getObject());
-    }
-
-    /**
-     * basic constructor - byte encoded string.
-     */
-    public DERPrintableString(
-        byte[]   string)
-    {
-        char[]  cs = new char[string.length];
-
-        for (int i = 0; i != cs.length; i++)
-        {
-            cs[i] = (char)(string[i] & 0xff);
-        }
-
-        this.string = new String(cs);
-    }
-
-    /**
-     * basic constructor - this does not validate the string
-     */
-    public DERPrintableString(
-        String   string)
-    {
-        this(string, false);
-    }
-
-    /**
-     * Constructor with optional validation.
-     *
-     * @param string the base string to wrap.
-     * @param validate whether or not to check the string.
-     * @throws IllegalArgumentException if validate is true and the string
-     * contains characters that should not be in a PrintableString.
-     */
-    public DERPrintableString(
-        String   string,
-        boolean  validate)
-    {
-        if (validate && !isPrintableString(string))
-        {
-            throw new IllegalArgumentException("string contains illegal characters");
-        }
-
-        this.string = string;
-    }
-
-    public String getString()
-    {
-        return string;
-    }
-
-    public byte[] getOctets()
-    {
-        char[]  cs = string.toCharArray();
-        byte[]  bs = new byte[cs.length];
-
-        for (int i = 0; i != cs.length; i++)
-        {
-            bs[i] = (byte)cs[i];
-        }
-
-        return bs; 
-    }
-
-    void encode(
-        DEROutputStream  out)
-        throws IOException
-    {
-        out.writeEncoded(PRINTABLE_STRING, this.getOctets());
-    }
-
-    public int hashCode()
-    {
-        return this.getString().hashCode();
-    }
-
-    boolean asn1Equals(
-        DERObject  o)
-    {
-        if (!(o instanceof DERPrintableString))
-        {
-            return false;
-        }
-
-        DERPrintableString  s = (DERPrintableString)o;
-
-        return this.getString().equals(s.getString());
-    }
-
-    public String toString()
-    {
-        return string;
-    }
-
-    /**
-     * return true if the passed in String can be represented without
-     * loss as a PrintableString, false otherwise.
-     *
-     * @return true if in printable set, false otherwise.
-     */
-    public static boolean isPrintableString(
-        String  str)
-    {
-        for (int i = str.length() - 1; i >= 0; i--)
-        {
-            char    ch = str.charAt(i);
-
-            if (ch > 0x007f)
-            {
-                return false;
-            }
-
-            if ('a' <= ch && ch <= 'z')
-            {
-                continue;
-            }
-
-            if ('A' <= ch && ch <= 'Z')
-            {
-                continue;
-            }
-
-            if ('0' <= ch && ch <= '9')
-            {
-                continue;
-            }
-
-            switch (ch)
-            {
-            case ' ':
-            case '\'':
-            case '(':
-            case ')':
-            case '+':
-            case '-':
-            case '.':
-            case ':':
-            case '=':
-            case '?':
-            case '/':
-            case ',':
-                continue;
-            }
-
-            return false;
-        }
-
-        return true;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERSequence.java b/azureus2/src/org/bouncycastle/asn1/DERSequence.java
deleted file mode 100644
index 1cfd38d..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERSequence.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Enumeration;
-
-public class DERSequence
-    extends ASN1Sequence
-{
-    /**
-     * create an empty sequence
-     */
-    public DERSequence()
-    {
-    }
-
-    /**
-     * create a sequence containing one object
-     */
-    public DERSequence(
-        DEREncodable    obj)
-    {
-        this.addObject(obj);
-    }
-
-    /**
-     * create a sequence containing a vector of objects.
-     */
-    public DERSequence(
-        DEREncodableVector   v)
-    {
-        for (int i = 0; i != v.size(); i++)
-        {
-            this.addObject(v.get(i));
-        }
-    }
-
-    /**
-     * create a sequence containing an array of objects.
-     */
-    public DERSequence(
-        ASN1Encodable[]   a)
-    {
-        for (int i = 0; i != a.length; i++)
-        {
-            this.addObject(a[i]);
-        }
-    }
-    
-    /*
-     * A note on the implementation:
-     * <p>
-     * As DER requires the constructed, definite-length model to
-     * be used for structured types, this varies slightly from the
-     * ASN.1 descriptions given. Rather than just outputing SEQUENCE,
-     * we also have to specify CONSTRUCTED, and the objects length.
-     */
-    void encode(
-        DEROutputStream out)
-        throws IOException
-    {
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-        DEROutputStream         dOut = new DEROutputStream(bOut);
-        Enumeration             e = this.getObjects();
-
-        while (e.hasMoreElements())
-        {
-            Object    obj = e.nextElement();
-
-            dOut.writeObject(obj);
-        }
-
-        dOut.close();
-
-        byte[]  bytes = bOut.toByteArray();
-
-        out.writeEncoded(SEQUENCE | CONSTRUCTED, bytes);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERSequenceGenerator.java b/azureus2/src/org/bouncycastle/asn1/DERSequenceGenerator.java
deleted file mode 100644
index 458dcdc..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERSequenceGenerator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-public class DERSequenceGenerator
-    extends DERGenerator
-{
-    private final ByteArrayOutputStream _bOut = new ByteArrayOutputStream();
-
-    public DERSequenceGenerator(
-        OutputStream out)
-        throws IOException
-    {
-        super(out);
-    }
-
-    public DERSequenceGenerator(
-        OutputStream out,
-        int          tagNo,
-        boolean      isExplicit)
-        throws IOException
-    {
-        super(out, tagNo, isExplicit);
-    }
-
-    public void addObject(
-        DEREncodable object) 
-        throws IOException
-    {
-        object.getDERObject().encode(new DEROutputStream(_bOut));
-    }
-    
-    public OutputStream getRawOutputStream()
-    {
-        return _bOut;
-    }
-    
-    public void close() 
-        throws IOException
-    {
-        writeDEREncoded(DERTags.CONSTRUCTED | DERTags.SEQUENCE, _bOut.toByteArray());
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERSet.java b/azureus2/src/org/bouncycastle/asn1/DERSet.java
deleted file mode 100644
index e1aa1d5..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERSet.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Enumeration;
-
-/**
- * A DER encoded set object
- */
-public class DERSet
-    extends ASN1Set
-{
-    /**
-     * create an empty set
-     */
-    public DERSet()
-    {
-    }
-
-    /**
-     * @param obj - a single object that makes up the set.
-     */
-    public DERSet(
-        DEREncodable   obj)
-    {
-        this.addObject(obj);
-    }
-
-    /**
-     * @param v - a vector of objects making up the set.
-     */
-    public DERSet(
-        DEREncodableVector   v)
-    {
-        this(v, true);
-    }
-    
-    /**
-     * create a set from an array of objects.
-     */
-    public DERSet(
-        ASN1Encodable[]   a)
-    {
-        for (int i = 0; i != a.length; i++)
-        {
-            this.addObject(a[i]);
-        }
-        
-        this.sort();
-    }
-    
-    /**
-     * @param v - a vector of objects making up the set.
-     */
-    DERSet(
-        DEREncodableVector   v,
-        boolean              needsSorting)
-    {
-        for (int i = 0; i != v.size(); i++)
-        {
-            this.addObject(v.get(i));
-        }
-
-        if (needsSorting)
-        {
-            this.sort();
-        }
-    }
-
-    /*
-     * A note on the implementation:
-     * <p>
-     * As DER requires the constructed, definite-length model to
-     * be used for structured types, this varies slightly from the
-     * ASN.1 descriptions given. Rather than just outputing SET,
-     * we also have to specify CONSTRUCTED, and the objects length.
-     */
-    void encode(
-        DEROutputStream out)
-        throws IOException
-    {
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-        DEROutputStream         dOut = new DEROutputStream(bOut);
-        Enumeration             e = this.getObjects();
-
-        while (e.hasMoreElements())
-        {
-            Object    obj = e.nextElement();
-
-            dOut.writeObject(obj);
-        }
-
-        dOut.close();
-
-        byte[]  bytes = bOut.toByteArray();
-
-        out.writeEncoded(SET | CONSTRUCTED, bytes);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERString.java b/azureus2/src/org/bouncycastle/asn1/DERString.java
deleted file mode 100644
index 3143be9..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERString.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.bouncycastle.asn1;
-
-/**
- * basic interface for DER string objects.
- */
-public interface DERString
-{
-    public String getString();
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERT61String.java b/azureus2/src/org/bouncycastle/asn1/DERT61String.java
deleted file mode 100644
index 09039fc..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERT61String.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-/**
- * DER T61String (also the teletex string)
- */
-public class DERT61String
-    extends ASN1Object
-    implements DERString
-{
-    String  string;
-
-    /**
-     * return a T61 string from the passed in object.
-     *
-     * @exception IllegalArgumentException if the object cannot be converted.
-     */
-    public static DERT61String getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof DERT61String)
-        {
-            return (DERT61String)obj;
-        }
-
-        if (obj instanceof ASN1OctetString)
-        {
-            return new DERT61String(((ASN1OctetString)obj).getOctets());
-        }
-
-        if (obj instanceof ASN1TaggedObject)
-        {
-            return getInstance(((ASN1TaggedObject)obj).getObject());
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    /**
-     * return an T61 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 DERT61String getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(obj.getObject());
-    }
-
-    /**
-     * basic constructor - with bytes.
-     */
-    public DERT61String(
-        byte[]   string)
-    {
-        char[]  cs = new char[string.length];
-
-        for (int i = 0; i != cs.length; i++)
-        {
-            cs[i] = (char)(string[i] & 0xff);
-        }
-
-        this.string = new String(cs);
-    }
-
-    /**
-     * basic constructor - with string.
-     */
-    public DERT61String(
-        String   string)
-    {
-        this.string = string;
-    }
-
-    public String getString()
-    {
-        return string;
-    }
-
-    public String toString()
-    {
-        return string;
-    }
-
-    void encode(
-        DEROutputStream  out)
-        throws IOException
-    {
-        out.writeEncoded(T61_STRING, this.getOctets());
-    }
-    
-    public byte[] getOctets()
-    {
-        char[]  cs = string.toCharArray();
-        byte[]  bs = new byte[cs.length];
-
-        for (int i = 0; i != cs.length; i++)
-        {
-            bs[i] = (byte)cs[i];
-        }
-
-        return bs; 
-    }
-
-    boolean asn1Equals(
-        DERObject  o)
-    {
-        if (!(o instanceof DERT61String))
-        {
-            return false;
-        }
-
-        return this.getString().equals(((DERT61String)o).getString());
-    }
-    
-    public int hashCode()
-    {
-        return this.getString().hashCode();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERTaggedObject.java b/azureus2/src/org/bouncycastle/asn1/DERTaggedObject.java
deleted file mode 100644
index d42f0d6..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERTaggedObject.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-/**
- * DER 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 class DERTaggedObject
-    extends ASN1TaggedObject
-{
-    /**
-     * @param tagNo the tag number for this object.
-     * @param obj the tagged object.
-     */
-    public DERTaggedObject(
-        int             tagNo,
-        DEREncodable    obj)
-    {
-        super(tagNo, obj);
-    }
-
-    /**
-     * @param explicit true if an explicitly tagged object.
-     * @param tagNo the tag number for this object.
-     * @param obj the tagged object.
-     */
-    public DERTaggedObject(
-        boolean         explicit,
-        int             tagNo,
-        DEREncodable    obj)
-    {
-        super(explicit, tagNo, obj);
-    }
-
-    /**
-     * create an implicitly tagged object that contains a zero
-     * length sequence.
-     */
-    public DERTaggedObject(
-        int             tagNo)
-    {
-        super(false, tagNo, new DERSequence());
-    }
-
-    void encode(
-        DEROutputStream  out)
-        throws IOException
-    {
-        if (!empty)
-        {
-            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-            DEROutputStream         dOut = new DEROutputStream(bOut);
-
-            dOut.writeObject(obj);
-            dOut.close();
-
-            byte[]  bytes = bOut.toByteArray();
-
-            if (explicit)
-            {
-                out.writeEncoded(CONSTRUCTED | TAGGED | tagNo, bytes);
-            }
-            else
-            {
-                //
-                // need to mark constructed types...
-                //
-                if ((bytes[0] & CONSTRUCTED) != 0)
-                {
-                    bytes[0] = (byte)(CONSTRUCTED | TAGGED | tagNo);
-                }
-                else
-                {
-                    bytes[0] = (byte)(TAGGED | tagNo);
-                }
-
-                out.write(bytes);
-            }
-        }
-        else
-        {
-            out.writeEncoded(CONSTRUCTED | TAGGED | tagNo, new byte[0]);
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERTags.java b/azureus2/src/org/bouncycastle/asn1/DERTags.java
deleted file mode 100644
index ef441ef..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERTags.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.bouncycastle.asn1;
-
-public interface DERTags
-{
-    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 EXTERNAL            = 0x08;
-    public static final int ENUMERATED          = 0x0a;
-    public static final int SEQUENCE            = 0x10;
-    public static final int SEQUENCE_OF         = 0x10; // for completeness
-    public static final int SET                 = 0x11;
-    public static final int SET_OF              = 0x11; // for completeness
-
-
-    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 UTC_TIME            = 0x17;
-    public static final int GENERALIZED_TIME    = 0x18;
-    public static final int GRAPHIC_STRING      = 0x19;
-    public static final int VISIBLE_STRING      = 0x1a;
-    public static final int GENERAL_STRING      = 0x1b;
-    public static final int UNIVERSAL_STRING    = 0x1c;
-    public static final int BMP_STRING          = 0x1e;
-    public static final int UTF8_STRING         = 0x0c;
-    
-    public static final int CONSTRUCTED         = 0x20;
-    public static final int APPLICATION         = 0x40;
-    public static final int TAGGED              = 0x80;
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERUTCTime.java b/azureus2/src/org/bouncycastle/asn1/DERUTCTime.java
deleted file mode 100644
index 7a05664..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERUTCTime.java
+++ /dev/null
@@ -1,254 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.SimpleTimeZone;
-
-/**
- * UTC time object.
- */
-public class DERUTCTime
-    extends ASN1Object
-{
-    String      time;
-
-    /**
-     * return an UTC Time from the passed in object.
-     *
-     * @exception IllegalArgumentException if the object cannot be converted.
-     */
-    public static DERUTCTime getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof DERUTCTime)
-        {
-            return (DERUTCTime)obj;
-        }
-
-        if (obj instanceof ASN1OctetString)
-        {
-            return new DERUTCTime(((ASN1OctetString)obj).getOctets());
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    /**
-     * return an UTC Time 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 DERUTCTime getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(obj.getObject());
-    }
-    
-    /**
-     * The correct format for this is YYMMDDHHMMSSZ (it used to be that seconds were
-     * never encoded. When you're creating one of these objects from scratch, that's
-     * what you want to use, otherwise we'll try to deal with whatever gets read from
-     * the input stream... (this is why the input format is different from the getTime()
-     * method output).
-     * <p>
-     *
-     * @param time the time string.
-     */
-    public DERUTCTime(
-        String  time)
-    {
-        this.time = time;
-        try
-        {
-            this.getDate();
-        }
-        catch (ParseException e)
-        {
-            throw new IllegalArgumentException("invalid date string: " + e.getMessage());
-        }
-    }
-
-    /**
-     * base constructer from a java.util.date object
-     */
-    public DERUTCTime(
-        Date time)
-    {
-        SimpleDateFormat dateF = new SimpleDateFormat("yyMMddHHmmss'Z'");
-
-        dateF.setTimeZone(new SimpleTimeZone(0,"Z"));
-
-        this.time = dateF.format(time);
-    }
-
-    DERUTCTime(
-        byte[]  bytes)
-    {
-        //
-        // explicitly convert to characters
-        //
-        char[]  dateC = new char[bytes.length];
-
-        for (int i = 0; i != dateC.length; i++)
-        {
-            dateC[i] = (char)(bytes[i] & 0xff);
-        }
-
-        this.time = new String(dateC);
-    }
-
-    /**
-     * return the time as a date based on whatever a 2 digit year will return. For
-     * standardised processing use getAdjustedDate().
-     *
-     * @return the resulting date
-     * @exception ParseException if the date string cannot be parsed.
-     */
-    public Date getDate()
-        throws ParseException
-    {
-        SimpleDateFormat dateF = new SimpleDateFormat("yyMMddHHmmssz");
-
-        return dateF.parse(getTime());
-    }
-
-    /**
-     * return the time as an adjusted date
-     * in the range of 1950 - 2049.
-     *
-     * @return a date in the range of 1950 to 2049.
-     * @exception ParseException if the date string cannot be parsed.
-     */
-    public Date getAdjustedDate()
-        throws ParseException
-    {
-        SimpleDateFormat dateF = new SimpleDateFormat("yyyyMMddHHmmssz");
-
-        dateF.setTimeZone(new SimpleTimeZone(0, "Z"));
-
-        return dateF.parse(getAdjustedTime());
-    }
-
-    /**
-     * return the time - always in the form of 
-     *  YYMMDDhhmmssGMT(+hh:mm|-hh:mm).
-     * <p>
-     * Normally in a certificate we would expect "Z" rather than "GMT",
-     * however adding the "GMT" means we can just use:
-     * <pre>
-     *     dateF = new SimpleDateFormat("yyMMddHHmmssz");
-     * </pre>
-     * To read in the time and get a date which is compatible with our local
-     * time zone.
-     * <p>
-     * <b>Note:</b> In some cases, due to the local date processing, this
-     * may lead to unexpected results. If you want to stick the normal
-     * convention of 1950 to 2049 use the getAdjustedTime() method.
-     */
-    public String getTime()
-    {
-        //
-        // standardise the format.
-        //
-        if (time.indexOf('-') < 0 && time.indexOf('+') < 0)
-        {
-            if (time.length() == 11)
-            {
-                return time.substring(0, 10) + "00GMT+00:00";
-            }
-            else
-            {
-                return time.substring(0, 12) + "GMT+00:00";
-            }
-        }
-        else
-        {
-            int index = time.indexOf('-');
-            if (index < 0)
-            {
-                index = time.indexOf('+');
-            }
-            String d = time;
-
-            if (index == time.length() - 3)
-            {
-                d += "00";
-            }
-
-            if (index == 10)
-            {
-                return d.substring(0, 10) + "00GMT" + d.substring(10, 13) + ":" + d.substring(13, 15);
-            }
-            else
-            {
-                return d.substring(0, 12) + "GMT" + d.substring(12, 15) + ":" +  d.substring(15, 17);
-            }
-        }
-    }
-
-    /**
-     * return a time string as an adjusted date with a 4 digit year. This goes
-     * in the range of 1950 - 2049.
-     */
-    public String getAdjustedTime()
-    {
-        String   d = this.getTime();
-
-        if (d.charAt(0) < '5')
-        {
-            return "20" + d;
-        }
-        else
-        {
-            return "19" + d;
-        }
-    }
-
-    private byte[] getOctets()
-    {
-        char[]  cs = time.toCharArray();
-        byte[]  bs = new byte[cs.length];
-
-        for (int i = 0; i != cs.length; i++)
-        {
-            bs[i] = (byte)cs[i];
-        }
-
-        return bs;
-    }
-
-    void encode(
-        DEROutputStream  out)
-        throws IOException
-    {
-        out.writeEncoded(UTC_TIME, this.getOctets());
-    }
-    
-    boolean asn1Equals(
-        DERObject  o)
-    {
-        if (!(o instanceof DERUTCTime))
-        {
-            return false;
-        }
-
-        return time.equals(((DERUTCTime)o).time);
-    }
-    
-    public int hashCode()
-    {
-        return time.hashCode();
-    }
-
-    public String toString() 
-    {
-      return time;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERUTF8String.java b/azureus2/src/org/bouncycastle/asn1/DERUTF8String.java
deleted file mode 100644
index 082aa63..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERUTF8String.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.bouncycastle.asn1;
-
-import org.bouncycastle.util.Strings;
-
-import java.io.IOException;
-
-/**
- * DER UTF8String object.
- */
-public class DERUTF8String
-    extends ASN1Object
-    implements DERString
-{
-    String string;
-
-    /**
-     * return an UTF8 string from the passed in object.
-     * 
-     * @exception IllegalArgumentException
-     *                if the object cannot be converted.
-     */
-    public static DERUTF8String getInstance(Object obj)
-    {
-        if (obj == null || obj instanceof DERUTF8String)
-        {
-            return (DERUTF8String)obj;
-        }
-
-        if (obj instanceof ASN1OctetString)
-        {
-            return new DERUTF8String(((ASN1OctetString)obj).getOctets());
-        }
-
-        if (obj instanceof ASN1TaggedObject)
-        {
-            return getInstance(((ASN1TaggedObject)obj).getObject());
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: "
-                + obj.getClass().getName());
-    }
-
-    /**
-     * return an UTF8 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 DERUTF8String getInstance(
-        ASN1TaggedObject obj,
-        boolean explicit)
-    {
-        return getInstance(obj.getObject());
-    }
-
-    /**
-     * basic constructor - byte encoded string.
-     */
-    DERUTF8String(byte[] string)
-    {
-        this.string = Strings.fromUTF8ByteArray(string);
-    }
-
-    /**
-     * basic constructor
-     */
-    public DERUTF8String(String string)
-    {
-        this.string = string;
-    }
-
-    public String getString()
-    {
-        return string;
-    }
-
-    public String toString()
-    {
-        return string;
-    }
-
-    public int hashCode()
-    {
-        return this.getString().hashCode();
-    }
-
-    boolean asn1Equals(DERObject o)
-    {
-        if (!(o instanceof DERUTF8String))
-        {
-            return false;
-        }
-
-        DERUTF8String s = (DERUTF8String)o;
-
-        return this.getString().equals(s.getString());
-    }
-
-    void encode(DEROutputStream out)
-        throws IOException
-    {
-        out.writeEncoded(UTF8_STRING, Strings.toUTF8ByteArray(string));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERUniversalString.java b/azureus2/src/org/bouncycastle/asn1/DERUniversalString.java
deleted file mode 100644
index 68be9a0..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERUniversalString.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-/**
- * DER UniversalString object.
- */
-public class DERUniversalString
-    extends ASN1Object
-    implements DERString
-{
-    private static final char[]  table = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
-    private byte[] string;
-    
-    /**
-     * return a Universal String from the passed in object.
-     *
-     * @exception IllegalArgumentException if the object cannot be converted.
-     */
-    public static DERUniversalString getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof DERUniversalString)
-        {
-            return (DERUniversalString)obj;
-        }
-
-        if (obj instanceof ASN1OctetString)
-        {
-            return new DERUniversalString(((ASN1OctetString)obj).getOctets());
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    /**
-     * return a Universal 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 DERUniversalString getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(obj.getObject());
-    }
-
-    /**
-     * basic constructor - byte encoded string.
-     */
-    public DERUniversalString(
-        byte[]   string)
-    {
-        this.string = string;
-    }
-
-    public String getString()
-    {
-        StringBuffer    buf = new StringBuffer("#");
-        ByteArrayOutputStream    bOut = new ByteArrayOutputStream();
-        ASN1OutputStream            aOut = new ASN1OutputStream(bOut);
-        
-        try
-        {
-            aOut.writeObject(this);
-        }
-        catch (IOException e)
-        {
-           throw new RuntimeException("internal error encoding BitString");
-        }
-        
-        byte[]    string = bOut.toByteArray();
-        
-        for (int i = 0; i != string.length; i++)
-        {
-            buf.append(table[(string[i] >>> 4) & 0xf]);
-            buf.append(table[string[i] & 0xf]);
-        }
-        
-        return buf.toString();
-    }
-
-    public String toString()
-    {
-        return getString();
-    }
-
-    public byte[] getOctets()
-    {
-        return string;
-    }
-
-    void encode(
-        DEROutputStream  out)
-        throws IOException
-    {
-        out.writeEncoded(UNIVERSAL_STRING, this.getOctets());
-    }
-    
-    boolean asn1Equals(
-        DERObject  o)
-    {
-        if (!(o instanceof DERUniversalString))
-        {
-            return false;
-        }
-
-        return this.getString().equals(((DERUniversalString)o).getString());
-    }
-    
-    public int hashCode()
-    {
-        return this.getString().hashCode();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERUnknownTag.java b/azureus2/src/org/bouncycastle/asn1/DERUnknownTag.java
deleted file mode 100644
index 6570d34..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERUnknownTag.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-/**
- * We insert one of these when we find a tag we don't recognise.
- */
-public class DERUnknownTag
-    extends DERObject
-{
-    int         tag;
-    byte[]      data;
-
-    /**
-     * @param tag the tag value.
-     * @param data the octets making up the time.
-     */
-    public DERUnknownTag(
-        int     tag,
-        byte[]  data)
-    {
-        this.tag = tag;
-        this.data = data;
-    }
-
-    public int getTag()
-    {
-        return tag;
-    }
-
-    public byte[] getData()
-    {
-        return data;
-    }
-
-    void encode(
-        DEROutputStream  out)
-        throws IOException
-    {
-        out.writeEncoded(tag, data);
-    }
-    
-    public boolean equals(
-        Object o)
-    {
-        if (!(o instanceof DERUnknownTag))
-        {
-            return false;
-        }
-        
-        DERUnknownTag other = (DERUnknownTag)o;
-        
-        if (tag != other.tag)
-        {
-            return false;
-        }
-        
-        if (data.length != other.data.length)
-        {
-            return false;
-        }
-        
-        for (int i = 0; i < data.length; i++) 
-        {
-            if(data[i] != other.data[i])
-            {
-                return false;
-            }
-        }
-        
-        return true;
-    }
-    
-    public int hashCode()
-    {
-        byte[]  b = this.getData();
-        int     value = 0;
-
-        for (int i = 0; i != b.length; i++)
-        {
-            value ^= (b[i] & 0xff) << (i % 4);
-        }
-
-        return value ^ this.getTag();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DERVisibleString.java b/azureus2/src/org/bouncycastle/asn1/DERVisibleString.java
deleted file mode 100644
index 9d0c991..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DERVisibleString.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-
-/**
- * DER VisibleString object.
- */
-public class DERVisibleString
-    extends ASN1Object
-    implements DERString
-{
-    String  string;
-
-    /**
-     * return a Visible String from the passed in object.
-     *
-     * @exception IllegalArgumentException if the object cannot be converted.
-     */
-    public static DERVisibleString getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof DERVisibleString)
-        {
-            return (DERVisibleString)obj;
-        }
-
-        if (obj instanceof ASN1OctetString)
-        {
-            return new DERVisibleString(((ASN1OctetString)obj).getOctets());
-        }
-
-        if (obj instanceof ASN1TaggedObject)
-        {
-            return getInstance(((ASN1TaggedObject)obj).getObject());
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    /**
-     * return a Visible 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 DERVisibleString getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(obj.getObject());
-    }
-
-    /**
-     * basic constructor - byte encoded string.
-     */
-    public DERVisibleString(
-        byte[]   string)
-    {
-        char[]  cs = new char[string.length];
-
-        for (int i = 0; i != cs.length; i++)
-        {
-            cs[i] = (char)(string[i] & 0xff);
-        }
-
-        this.string = new String(cs);
-    }
-
-    /**
-     * basic constructor
-     */
-    public DERVisibleString(
-        String   string)
-    {
-        this.string = string;
-    }
-
-    public String getString()
-    {
-        return string;
-    }
-
-    public String toString()
-    {
-        return string;
-    }
-
-    public byte[] getOctets()
-    {
-        char[]  cs = string.toCharArray();
-        byte[]  bs = new byte[cs.length];
-
-        for (int i = 0; i != cs.length; i++)
-        {
-            bs[i] = (byte)cs[i];
-        }
-
-        return bs;
-    }
-
-    void encode(
-        DEROutputStream  out)
-        throws IOException
-    {
-        out.writeEncoded(VISIBLE_STRING, this.getOctets());
-    }
-    
-    boolean asn1Equals(
-        DERObject  o)
-    {
-        if (!(o instanceof DERVisibleString))
-        {
-            return false;
-        }
-
-        return this.getString().equals(((DERVisibleString)o).getString());
-    }
-    
-    public int hashCode()
-    {
-        return this.getString().hashCode();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/DefiniteLengthInputStream.java b/azureus2/src/org/bouncycastle/asn1/DefiniteLengthInputStream.java
deleted file mode 100644
index 9a805d2..0000000
--- a/azureus2/src/org/bouncycastle/asn1/DefiniteLengthInputStream.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.EOFException;
-import java.io.InputStream;
-import java.io.IOException;
-
-class DefiniteLengthInputStream
-        extends LimitedInputStream
-{
-    private int               _length;
-
-    DefiniteLengthInputStream(
-        InputStream in,
-        int         length)
-    {
-        super(in);
-
-        if (length < 0)
-        {
-            throw new IllegalArgumentException("negative lengths not allowed");
-        }
-
-        this._length = length;
-    }
-
-    public int read()
-        throws IOException
-    {
-        if (_length > 0)
-        {
-            int b = _in.read();
-
-            if (b < 0)
-            {
-                throw new EOFException();
-            }
-
-            --_length;
-            return b;
-        }
-
-        setParentEofDetect(true);
-
-        return -1;
-    }
-
-    public int read(byte[] buf, int off, int len)
-        throws IOException
-    {
-        if (_length > 0)
-        {
-            int toRead = Math.min(len, _length);
-            int numRead = _in.read(buf, off, toRead);
-
-            if (numRead < 0)
-                throw new EOFException();
-
-            _length -= numRead;
-            return numRead;
-        }
-
-        setParentEofDetect(true);
-
-        return -1;
-    }
-
-    byte[] toByteArray()
-        throws IOException
-    {
-        byte[] bytes = new byte[_length];
-
-        if (_length > 0)
-        {
-            int pos = 0;
-            do
-            {
-                int read = _in.read(bytes, pos, _length - pos);
-
-                if (read < 0)
-                {
-                    throw new EOFException();
-                }
-
-                pos += read;
-            }
-            while (pos < _length);
-
-            _length = 0;
-        }
-
-        setParentEofDetect(true);
-
-        return bytes;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/IndefiniteLengthInputStream.java b/azureus2/src/org/bouncycastle/asn1/IndefiniteLengthInputStream.java
deleted file mode 100644
index 87208b5..0000000
--- a/azureus2/src/org/bouncycastle/asn1/IndefiniteLengthInputStream.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-class IndefiniteLengthInputStream
-    extends LimitedInputStream
-{
-    private int _b1;
-    private int _b2;
-    private boolean _eofReached = false;
-    private boolean _eofOn00 = true;
-
-    IndefiniteLengthInputStream(
-        InputStream in)
-        throws IOException
-    {
-        super(in);
-
-        _b1 = in.read();
-        _b2 = in.read();
-        _eofReached = (_b2 < 0);
-    }
-
-    void setEofOn00(
-        boolean eofOn00)
-    {
-        _eofOn00 = eofOn00;
-    }
-
-    boolean checkForEof()
-    {
-        if (_eofOn00 && (_b1 == 0x00 && _b2 == 0x00))
-        {
-            _eofReached = true;
-            setParentEofDetect(true);
-        }
-        return _eofReached;
-    }
-
-    public int read(byte[] b, int off, int len)
-        throws IOException
-    {
-        // Only use this optimisation if we aren't checking for 00
-        if (_eofOn00 || len < 3)
-        {
-            return super.read(b, off, len);
-        }
-
-        if (_eofReached)
-        {
-            return -1;
-        }
-
-        int numRead = _in.read(b, off + 2, len - 2);
-
-        if (numRead < 0)
-        {
-//          throw new EOFException();
-            _eofReached = true;
-            return -1;
-        }
-
-        b[off] = (byte)_b1;
-        b[off + 1] = (byte)_b2;
-
-        _b1 = _in.read();
-        _b2 = _in.read();
-
-        if (_b2 < 0)
-        {
-            // Corrupted stream
-//            throw new EOFException();
-            _eofReached = true;
-            // Just fall thru...
-        }
-
-        return numRead + 2;
-    }
-
-    public int read()
-        throws IOException
-    {
-        if (checkForEof())
-        {
-            return -1;
-        }
-
-        int b = _in.read();
-
-        //
-        // strictly speaking we should return b1 and b2, but if this happens the stream
-        // is corrupted so we are already in trouble.
-        //
-        if (b < 0)
-        {
-            // Corrupted stream
-//            throw new EOFException();
-            _eofReached = true;
-
-            return -1;
-        }
-
-        int v = _b1;
-
-        _b1 = _b2;
-        _b2 = b;
-
-        return v;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/LimitedInputStream.java b/azureus2/src/org/bouncycastle/asn1/LimitedInputStream.java
deleted file mode 100644
index 027a87f..0000000
--- a/azureus2/src/org/bouncycastle/asn1/LimitedInputStream.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.bouncycastle.asn1;
-
-import java.io.InputStream;
-
-abstract class LimitedInputStream
-        extends InputStream
-{
-    protected final InputStream _in;
-
-    LimitedInputStream(
-        InputStream in)
-    {
-        this._in = in;
-    }
-
-    InputStream getUnderlyingStream()
-    {
-        return _in;
-    }
-
-    protected void setParentEofDetect(boolean on)
-    {
-        if (_in instanceof IndefiniteLengthInputStream)
-        {
-            ((IndefiniteLengthInputStream)_in).setEofOn00(on);
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/OIDTokenizer.java b/azureus2/src/org/bouncycastle/asn1/OIDTokenizer.java
deleted file mode 100644
index 5467944..0000000
--- a/azureus2/src/org/bouncycastle/asn1/OIDTokenizer.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.bouncycastle.asn1;
-
-/**
- * class for breaking up an OID into it's component tokens, ala
- * java.util.StringTokenizer. We need this class as some of the
- * lightweight Java environment don't support classes like
- * StringTokenizer.
- */
-public class OIDTokenizer
-{
-    private String  oid;
-    private int     index;
-
-    public OIDTokenizer(
-        String oid)
-    {
-        this.oid = oid;
-        this.index = 0;
-    }
-
-    public boolean hasMoreTokens()
-    {
-        return (index != -1);
-    }
-
-    public String nextToken()
-    {
-        if (index == -1)
-        {
-            return null;
-        }
-
-        String  token;
-        int     end = oid.indexOf('.', index);
-
-        if (end == -1)
-        {
-            token = oid.substring(index);
-            index = -1;
-            return token;
-        }
-
-        token = oid.substring(index, end);
-
-        index = end + 1;
-        return token;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/cms/CMSObjectIdentifiers.java b/azureus2/src/org/bouncycastle/asn1/cms/CMSObjectIdentifiers.java
deleted file mode 100644
index 2e6b312..0000000
--- a/azureus2/src/org/bouncycastle/asn1/cms/CMSObjectIdentifiers.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.bouncycastle.asn1.cms;
-
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-
-public interface CMSObjectIdentifiers
-{
-    static final DERObjectIdentifier    data = PKCSObjectIdentifiers.data;
-    static final DERObjectIdentifier    signedData = PKCSObjectIdentifiers.signedData;
-    static final DERObjectIdentifier    envelopedData = PKCSObjectIdentifiers.envelopedData;
-    static final DERObjectIdentifier    signedAndEnvelopedData = PKCSObjectIdentifiers.signedAndEnvelopedData;
-    static final DERObjectIdentifier    digestedData = PKCSObjectIdentifiers.digestedData;
-    static final DERObjectIdentifier    encryptedData = PKCSObjectIdentifiers.encryptedData;
-    static final DERObjectIdentifier    compressedData = PKCSObjectIdentifiers.id_ct_compressedData;
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/cms/ContentInfo.java b/azureus2/src/org/bouncycastle/asn1/cms/ContentInfo.java
deleted file mode 100644
index 76801a3..0000000
--- a/azureus2/src/org/bouncycastle/asn1/cms/ContentInfo.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.bouncycastle.asn1.cms;
-
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.BERSequence;
-import org.bouncycastle.asn1.BERTaggedObject;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-
-public class ContentInfo
-    extends ASN1Encodable
-    implements CMSObjectIdentifiers
-{
-    private DERObjectIdentifier contentType;
-    private DEREncodable        content;
-
-    public static ContentInfo getInstance(
-        Object  obj)
-    {
-        if (obj instanceof ContentInfo)
-        {
-            return (ContentInfo)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new ContentInfo((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory: " + obj.getClass().getName());
-    }
-
-    public ContentInfo(
-        ASN1Sequence  seq)
-    {
-        Enumeration   e = seq.getObjects();
-
-        contentType = (DERObjectIdentifier)e.nextElement();
-
-        if (e.hasMoreElements())
-        {
-            content = ((ASN1TaggedObject)e.nextElement()).getObject();
-        }
-    }
-
-    public ContentInfo(
-        DERObjectIdentifier contentType,
-        DEREncodable        content)
-    {
-        this.contentType = contentType;
-        this.content = content;
-    }
-
-    public DERObjectIdentifier getContentType()
-    {
-        return contentType;
-    }
-
-    public DEREncodable getContent()
-    {
-        return content;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     * ContentInfo ::= SEQUENCE {
-     *          contentType ContentType,
-     *          content
-     *          [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(contentType);
-
-        if (content != null)
-        {
-            v.add(new BERTaggedObject(0, content));
-        }
-
-        return new BERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/misc/CAST5CBCParameters.java b/azureus2/src/org/bouncycastle/asn1/misc/CAST5CBCParameters.java
deleted file mode 100644
index b2390dc..0000000
--- a/azureus2/src/org/bouncycastle/asn1/misc/CAST5CBCParameters.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.bouncycastle.asn1.misc;
-
-import org.bouncycastle.asn1.*;
-
-public class CAST5CBCParameters
-    implements DEREncodable
-{
-    DERInteger      keyLength;
-    ASN1OctetString iv;
-
-    public static CAST5CBCParameters getInstance(
-        Object  o)
-    {
-        if (o instanceof CAST5CBCParameters)
-        {
-            return (CAST5CBCParameters)o;
-        }
-        else if (o instanceof ASN1Sequence)
-        {
-            return new CAST5CBCParameters((ASN1Sequence)o);
-        }
-
-        throw new IllegalArgumentException("unknown object in CAST5CBCParameter factory");
-    }
-
-    public CAST5CBCParameters(
-        byte[]  iv,
-        int     keyLength)
-    {
-        this.iv = new DEROctetString(iv);
-        this.keyLength = new DERInteger(keyLength);
-    }
-
-    public CAST5CBCParameters(
-        ASN1Sequence  seq)
-    {
-        iv = (ASN1OctetString)seq.getObjectAt(0);
-        keyLength = (DERInteger)seq.getObjectAt(1);
-    }
-
-    public byte[] getIV()
-    {
-        return iv.getOctets();
-    }
-
-    public int getKeyLength()
-    {
-        return keyLength.getValue().intValue();
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     * cast5CBCParameters ::= SEQUENCE {
-     *                           iv         OCTET STRING DEFAULT 0,
-     *                                  -- Initialization vector
-     *                           keyLength  INTEGER
-     *                                  -- Key length, in bits
-     *                      }
-     * </pre>
-     */
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(iv);
-        v.add(keyLength);
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/misc/IDEACBCPar.java b/azureus2/src/org/bouncycastle/asn1/misc/IDEACBCPar.java
deleted file mode 100644
index 49b752e..0000000
--- a/azureus2/src/org/bouncycastle/asn1/misc/IDEACBCPar.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.bouncycastle.asn1.misc;
-
-import org.bouncycastle.asn1.*;
-
-public class IDEACBCPar
-    implements DEREncodable
-{
-    ASN1OctetString  iv;
-
-    public static IDEACBCPar getInstance(
-        Object  o)
-    {
-        if (o instanceof IDEACBCPar)
-        {
-            return (IDEACBCPar)o;
-        }
-        else if (o instanceof ASN1Sequence)
-        {
-            return new IDEACBCPar((ASN1Sequence)o);
-        }
-
-        throw new IllegalArgumentException("unknown object in IDEACBCPar factory");
-    }
-
-    public IDEACBCPar(
-        byte[]  iv)
-    {
-        this.iv = new DEROctetString(iv);
-    }
-
-    public IDEACBCPar(
-        ASN1Sequence  seq)
-    {
-        if (seq.size() == 1)
-        {
-            iv = (ASN1OctetString)seq.getObjectAt(0);
-        }
-        else
-        {
-            iv = null;
-        }
-    }
-
-    public byte[] getIV()
-    {
-        if (iv != null)
-        {
-            return iv.getOctets();
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     * IDEA-CBCPar ::= SEQUENCE {
-     *                      iv    OCTET STRING OPTIONAL -- exactly 8 octets
-     *                  }
-     * </pre>
-     */
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        if (iv != null)
-        {
-            v.add(iv);
-        }
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/misc/MiscObjectIdentifiers.java b/azureus2/src/org/bouncycastle/asn1/misc/MiscObjectIdentifiers.java
deleted file mode 100644
index b2d46e2..0000000
--- a/azureus2/src/org/bouncycastle/asn1/misc/MiscObjectIdentifiers.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.bouncycastle.asn1.misc;
-
-import org.bouncycastle.asn1.DERObjectIdentifier;
-
-public interface MiscObjectIdentifiers
-{
-    //
-    // Netscape
-    //       iso/itu(2) joint-assign(16) us(840) uscompany(1) netscape(113730) cert-extensions(1) }
-    //
-    static final String                 netscape                = "2.16.840.1.113730.1";
-    static final DERObjectIdentifier    netscapeCertType        = new DERObjectIdentifier(netscape + ".1");
-    static final DERObjectIdentifier    netscapeBaseURL         = new DERObjectIdentifier(netscape + ".2");
-    static final DERObjectIdentifier    netscapeRevocationURL   = new DERObjectIdentifier(netscape + ".3");
-    static final DERObjectIdentifier    netscapeCARevocationURL = new DERObjectIdentifier(netscape + ".4");
-    static final DERObjectIdentifier    netscapeRenewalURL      = new DERObjectIdentifier(netscape + ".7");
-    static final DERObjectIdentifier    netscapeCApolicyURL     = new DERObjectIdentifier(netscape + ".8");
-    static final DERObjectIdentifier    netscapeSSLServerName   = new DERObjectIdentifier(netscape + ".12");
-    static final DERObjectIdentifier    netscapeCertComment     = new DERObjectIdentifier(netscape + ".13");
-    //
-    // Verisign
-    //       iso/itu(2) joint-assign(16) us(840) uscompany(1) verisign(113733) cert-extensions(1) }
-    //
-    static final String                 verisign                = "2.16.840.1.113733.1";
-
-    //
-    // CZAG - country, zip, age, and gender
-    //
-    static final DERObjectIdentifier    verisignCzagExtension   = new DERObjectIdentifier(verisign + ".6.3");
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/misc/NetscapeCertType.java b/azureus2/src/org/bouncycastle/asn1/misc/NetscapeCertType.java
deleted file mode 100644
index 61a851a..0000000
--- a/azureus2/src/org/bouncycastle/asn1/misc/NetscapeCertType.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.bouncycastle.asn1.misc;
-
-import org.bouncycastle.asn1.*;
-
-/**
- * The NetscapeCertType object.
- * <pre>
- *    NetscapeCertType ::= BIT STRING {
- *         SSLClient               (0),
- *         SSLServer               (1),
- *         S/MIME                  (2),
- *         Object Signing          (3),
- *         Reserved                (4),
- *         SSL CA                  (5),
- *         S/MIME CA               (6),
- *         Object Signing CA       (7) }
- * </pre>
- */
-public class NetscapeCertType
-    extends DERBitString
-{
-    public static final int        sslClient        = (1 << 7); 
-    public static final int        sslServer        = (1 << 6);
-    public static final int        smime            = (1 << 5);
-    public static final int        objectSigning    = (1 << 4);
-    public static final int        reserved         = (1 << 3);
-    public static final int        sslCA            = (1 << 2);
-    public static final int        smimeCA          = (1 << 1);
-    public static final int        objectSigningCA  = (1 << 0);
-
-    /**
-     * Basic constructor.
-     * 
-     * @param usage - the bitwise OR of the Key Usage flags giving the
-     * allowed uses for the key.
-     * e.g. (X509NetscapeCertType.sslCA | X509NetscapeCertType.smimeCA)
-     */
-    public NetscapeCertType(
-        int usage)
-    {
-        super(getBytes(usage), getPadBits(usage));
-    }
-
-    public NetscapeCertType(
-        DERBitString usage)
-    {
-        super(usage.getBytes(), usage.getPadBits());
-    }
-
-    public String toString()
-    {
-        return "NetscapeCertType: 0x" + Integer.toHexString(data[0] & 0xff);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/misc/NetscapeRevocationURL.java b/azureus2/src/org/bouncycastle/asn1/misc/NetscapeRevocationURL.java
deleted file mode 100644
index ba35d08..0000000
--- a/azureus2/src/org/bouncycastle/asn1/misc/NetscapeRevocationURL.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.bouncycastle.asn1.misc;
-
-import org.bouncycastle.asn1.*;
-
-public class NetscapeRevocationURL
-    extends DERIA5String
-{
-    public NetscapeRevocationURL(
-        DERIA5String str)
-    {
-        super(str.getString());
-    }
-
-    public String toString()
-    {
-        return "NetscapeRevocationURL: " + this.getString();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/misc/VerisignCzagExtension.java b/azureus2/src/org/bouncycastle/asn1/misc/VerisignCzagExtension.java
deleted file mode 100644
index 5066ec5..0000000
--- a/azureus2/src/org/bouncycastle/asn1/misc/VerisignCzagExtension.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.bouncycastle.asn1.misc;
-
-import org.bouncycastle.asn1.*;
-
-public class VerisignCzagExtension
-    extends DERIA5String
-{
-    public VerisignCzagExtension(
-        DERIA5String str)
-    {
-        super(str.getString());
-    }
-
-    public String toString()
-    {
-        return "VerisignCzagExtension: " + this.getString();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/misc/package.html b/azureus2/src/org/bouncycastle/asn1/misc/package.html
deleted file mode 100644
index e3bda64..0000000
--- a/azureus2/src/org/bouncycastle/asn1/misc/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body bgcolor="#ffffff">
-Miscellaneous object identifiers and objects.
-</body>
-</html>
diff --git a/azureus2/src/org/bouncycastle/asn1/package.html b/azureus2/src/org/bouncycastle/asn1/package.html
deleted file mode 100644
index 1ac16a5..0000000
--- a/azureus2/src/org/bouncycastle/asn1/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body bgcolor="#ffffff">
-A library for parsing and writing ASN.1 objects. Support is provided for DER and BER encoding.
-</body>
-</html>
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/Attribute.java b/azureus2/src/org/bouncycastle/asn1/pkcs/Attribute.java
deleted file mode 100644
index 69ede00..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/Attribute.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1Set;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-
-public class Attribute
-    implements DEREncodable
-{
-	private DERObjectIdentifier attrType;
-	private ASN1Set             attrValues;
-
-    /**
-     * return an Attribute object from the given object.
-     *
-     * @param o the object we want converted.
-     * @exception IllegalArgumentException if the object cannot be converted.
-     */
-	public static Attribute getInstance(
-        Object o)
-    {
-		if (o == null || o instanceof Attribute)
-        {
-			return (Attribute)o;
-		}
-		
-		if (o instanceof ASN1Sequence)
-        {
-			return new Attribute((ASN1Sequence)o);
-		}
-
-        throw new IllegalArgumentException("unknown object in factory");
-	}
-	
-	public Attribute(
-        ASN1Sequence seq)
-    {
-		attrType = (DERObjectIdentifier)seq.getObjectAt(0);
-		attrValues = (ASN1Set)seq.getObjectAt(1);
-	}
-
-	public Attribute(
-	    DERObjectIdentifier attrType,
-	    ASN1Set             attrValues)
-    {
-		this.attrType = attrType;
-		this.attrValues = attrValues;
-	}
-
-	public DERObjectIdentifier getAttrType()
-    {
-		return attrType;
-	}
-	
-	public ASN1Set getAttrValues()
-    {
-		return attrValues;
-	}
-
-    /** 
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     * Attribute ::= SEQUENCE {
-     * 	attrType OBJECT IDENTIFIER,
-     * 	attrValues SET OF AttributeValue
-     * }
-     * </pre>
-     */
-	public DERObject getDERObject()
-    {
-		ASN1EncodableVector v = new ASN1EncodableVector();
-
-		v.add(attrType);
-		v.add(attrValues);
-
-		return new DERSequence(v);
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/AuthenticatedSafe.java b/azureus2/src/org/bouncycastle/asn1/pkcs/AuthenticatedSafe.java
deleted file mode 100644
index 48f6ddc..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/AuthenticatedSafe.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.BERSequence;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-
-public class AuthenticatedSafe
-    implements DEREncodable
-{
-    ContentInfo[]    info;
-
-    public AuthenticatedSafe(
-        ASN1Sequence  seq)
-    {
-        info = new ContentInfo[seq.size()];
-
-        for (int i = 0; i != info.length; i++)
-        {
-            info[i] = ContentInfo.getInstance(seq.getObjectAt(i));
-        }
-    }
-
-    public AuthenticatedSafe(
-        ContentInfo[]       info)
-    {
-        this.info = info;
-    }
-
-    public ContentInfo[] getContentInfo()
-    {
-        return info;
-    }
-
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        for (int i = 0; i != info.length; i++)
-        {
-            v.add(info[i]);
-        }
-
-        return new BERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/CertBag.java b/azureus2/src/org/bouncycastle/asn1/pkcs/CertBag.java
deleted file mode 100644
index 4cb659c..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/CertBag.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-
-public class CertBag
-    implements DEREncodable
-{
-	ASN1Sequence		seq;
-    DERObjectIdentifier         certId;
-    DERObject                   certValue;
-
-	public CertBag(
-		ASN1Sequence	seq)
-	{
-        this.seq = seq;
-        this.certId = (DERObjectIdentifier)seq.getObjectAt(0);
-        this.certValue = ((DERTaggedObject)seq.getObjectAt(1)).getObject();
-	}
-
-    public CertBag(
-        DERObjectIdentifier certId,
-        DERObject           certValue)
-    {
-        this.certId = certId;
-        this.certValue = certValue;
-    }
-
-	public DERObjectIdentifier getCertId()
-	{
-		return certId;
-	}
-
-    public DERObject getCertValue()
-    {
-		return certValue;
-    }
-
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(certId);
-        v.add(new DERTaggedObject(0, certValue));
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/CertificationRequest.java b/azureus2/src/org/bouncycastle/asn1/pkcs/CertificationRequest.java
deleted file mode 100644
index 9197e84..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/CertificationRequest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-
-/**
- * PKCS10 Certfication request object.
- * <pre>
- * CertificationRequest ::= SEQUENCE {
- *   certificationRequestInfo  CertificationRequestInfo,
- *   signatureAlgorithm        AlgorithmIdentifier{{ SignatureAlgorithms }},
- *   signature                 BIT STRING
- * }
- * </pre>
- */
-public class CertificationRequest
-    implements DEREncodable
-{
-    protected CertificationRequestInfo reqInfo = null;
-    protected AlgorithmIdentifier sigAlgId = null;
-    protected DERBitString sigBits = null;
-
-    protected CertificationRequest()
-    {
-    }
-
-    public CertificationRequest(
-        CertificationRequestInfo requestInfo,
-        AlgorithmIdentifier     algorithm,
-        DERBitString            signature)
-    {
-        this.reqInfo = requestInfo;
-        this.sigAlgId = algorithm;
-        this.sigBits = signature;
-    }
-
-    public CertificationRequest(
-        ASN1Sequence seq)
-    {
-        reqInfo = CertificationRequestInfo.getInstance(seq.getObjectAt(0));
-        sigAlgId = AlgorithmIdentifier.getInstance(seq.getObjectAt(1));
-        sigBits = (DERBitString)seq.getObjectAt(2);
-    }
-
-    public CertificationRequestInfo getCertificationRequestInfo()
-    {
-        return reqInfo;
-    }
-
-    public AlgorithmIdentifier getSignatureAlgorithm()
-    {
-        return sigAlgId;
-    }
-
-    public DERBitString getSignature()
-    {
-        return sigBits;
-    }
-
-    public DERObject getDERObject()
-    {
-        // Construct the CertificateRequest
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(reqInfo);
-        v.add(sigAlgId);
-        v.add(sigBits);
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/CertificationRequestInfo.java b/azureus2/src/org/bouncycastle/asn1/pkcs/CertificationRequestInfo.java
deleted file mode 100644
index 4f7d833..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/CertificationRequestInfo.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1Set;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
-import org.bouncycastle.asn1.x509.X509Name;
-
-/**
- * PKCS10 CertificationRequestInfo object.
- * <pre>
- *  CertificationRequestInfo ::= SEQUENCE {
- *   version             INTEGER { v1(0) } (v1,...),
- *   subject             Name,
- *   subjectPKInfo   SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
- *   attributes          [0] Attributes{{ CRIAttributes }}
- *  }
- *
- *  Attributes { ATTRIBUTE:IOSet } ::= SET OF Attribute{{ IOSet }}
- *
- *  Attribute { ATTRIBUTE:IOSet } ::= SEQUENCE {
- *    type    ATTRIBUTE.&id({IOSet}),
- *    values  SET SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{\@type})
- *  }
- * </pre>
- */
-public class CertificationRequestInfo
-    implements DEREncodable
-{
-    DERInteger              version = new DERInteger(0);
-    X509Name                subject;
-    SubjectPublicKeyInfo    subjectPKInfo;
-    ASN1Set                 attributes = null;
-
-    public static CertificationRequestInfo getInstance(
-        Object  obj)
-    {
-        if (obj instanceof CertificationRequestInfo)
-        {
-            return (CertificationRequestInfo)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new CertificationRequestInfo((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    public CertificationRequestInfo(
-        X509Name                subject,
-        SubjectPublicKeyInfo    pkInfo,
-        ASN1Set                 attributes)
-    {
-        this.subject = subject;
-        this.subjectPKInfo = pkInfo;
-        this.attributes = attributes;
-
-        if ((subject == null) || (version == null) || (subjectPKInfo == null))
-        {
-            throw new IllegalArgumentException("Not all mandatory fields set in CertificationRequestInfo generator.");
-        }
-    }
-
-    public CertificationRequestInfo(
-        ASN1Sequence  seq)
-    {
-        version = (DERInteger)seq.getObjectAt(0);
-
-        subject = X509Name.getInstance(seq.getObjectAt(1));
-        subjectPKInfo = SubjectPublicKeyInfo.getInstance(seq.getObjectAt(2));
-
-        //
-        // some CertificationRequestInfo objects seem to treat this field
-        // as optional.
-        //
-        if (seq.size() > 3)
-        {
-            DERTaggedObject tagobj = (DERTaggedObject)seq.getObjectAt(3);
-            attributes = ASN1Set.getInstance(tagobj, false);
-        }
-
-        if ((subject == null) || (version == null) || (subjectPKInfo == null))
-        {
-            throw new IllegalArgumentException("Not all mandatory fields set in CertificationRequestInfo generator.");
-        }
-    }
-
-    public DERInteger getVersion()
-    {
-        return version;
-    }
-
-    public X509Name getSubject()
-    {
-        return subject;
-    }
-
-    public SubjectPublicKeyInfo getSubjectPublicKeyInfo()
-    {
-        return subjectPKInfo;
-    }
-
-    public ASN1Set getAttributes()
-    {
-        return attributes;
-    }
-
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(version);
-        v.add(subject);
-        v.add(subjectPKInfo);
-
-        if (attributes != null)
-        {
-            v.add(new DERTaggedObject(false, 0, attributes));
-        }
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/ContentInfo.java b/azureus2/src/org/bouncycastle/asn1/pkcs/ContentInfo.java
deleted file mode 100644
index 4f9e675..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/ContentInfo.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.BERSequence;
-import org.bouncycastle.asn1.BERTaggedObject;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERTaggedObject;
-
-public class ContentInfo
-    implements DEREncodable, PKCSObjectIdentifiers
-{
-    private DERObjectIdentifier contentType;
-    private DEREncodable        content;
-
-    public static ContentInfo getInstance(
-        Object  obj)
-    {
-        if (obj instanceof ContentInfo)
-        {
-            return (ContentInfo)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new ContentInfo((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    public ContentInfo(
-        ASN1Sequence  seq)
-    {
-        Enumeration   e = seq.getObjects();
-
-        contentType = (DERObjectIdentifier)e.nextElement();
-
-        if (e.hasMoreElements())
-        {
-            content = ((DERTaggedObject)e.nextElement()).getObject();
-        }
-    }
-
-    public ContentInfo(
-        DERObjectIdentifier contentType,
-        DEREncodable        content)
-    {
-        this.contentType = contentType;
-        this.content = content;
-    }
-
-    public DERObjectIdentifier getContentType()
-    {
-        return contentType;
-    }
-
-    public DEREncodable getContent()
-    {
-        return content;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     * ContentInfo ::= SEQUENCE {
-     *          contentType ContentType,
-     *          content
-     *          [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
-     * </pre>
-     */
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(contentType);
-
-        if (content != null)
-        {
-            v.add(new BERTaggedObject(0, content));
-        }
-
-        return new BERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/DHParameter.java b/azureus2/src/org/bouncycastle/asn1/pkcs/DHParameter.java
deleted file mode 100644
index 8998c51..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/DHParameter.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import java.math.BigInteger;
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-public class DHParameter
-    implements DEREncodable
-{
-    DERInteger      p, g, l;
-
-    public DHParameter(
-        BigInteger  p,
-        BigInteger  g,
-        int         l)
-    {
-        this.p = new DERInteger(p);
-        this.g = new DERInteger(g);
-
-        if (l != 0)
-        {
-            this.l = new DERInteger(l);
-        }
-        else
-        {
-            this.l = null;
-        }
-    }
-
-    public DHParameter(
-        ASN1Sequence  seq)
-    {
-        Enumeration     e = seq.getObjects();
-
-        p = (DERInteger)e.nextElement();
-        g = (DERInteger)e.nextElement();
-
-        if (e.hasMoreElements())
-        {
-            l = (DERInteger)e.nextElement();
-        }
-        else
-        {
-            l = null;
-        }
-    }
-
-    public BigInteger getP()
-    {
-        return p.getPositiveValue();
-    }
-
-    public BigInteger getG()
-    {
-        return g.getPositiveValue();
-    }
-
-    public BigInteger getL()
-    {
-        if (l == null)
-        {
-            return null;
-        }
-
-        return l.getPositiveValue();
-    }
-
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(p);
-        v.add(g);
-
-        if (this.getL() != null)
-        {
-            v.add(l);
-        }
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/EncryptedData.java b/azureus2/src/org/bouncycastle/asn1/pkcs/EncryptedData.java
deleted file mode 100644
index cdabf1e..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/EncryptedData.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import org.bouncycastle.asn1.*;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-
-/**
- * The EncryptedData object.
- * <pre>
- *      EncryptedData ::= SEQUENCE {
- *           version Version,
- *           encryptedContentInfo EncryptedContentInfo
- *      }
- *
- *
- *      EncryptedContentInfo ::= SEQUENCE {
- *          contentType ContentType,
- *          contentEncryptionAlgorithm  ContentEncryptionAlgorithmIdentifier,
- *          encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
- *    }
- *
- *    EncryptedContent ::= OCTET STRING
- * </pre>
- */
-public class EncryptedData
-    implements DEREncodable
-{
-    ASN1Sequence                data;
-    DERObjectIdentifier         bagId;
-    DERObject                   bagValue;
-
-	public static EncryptedData getInstance(
-		 Object  obj)
-	{
-		 if (obj instanceof EncryptedData)
-		 {
-			 return (EncryptedData)obj;
-		 }
-		 else if (obj instanceof ASN1Sequence)
-		 {
-			 return new EncryptedData((ASN1Sequence)obj);
-		 }
-
-		 throw new IllegalArgumentException("unknown object in factory");
-	}
-	 
-    public EncryptedData(
-        ASN1Sequence seq)
-    {
-        int version = ((DERInteger)seq.getObjectAt(0)).getValue().intValue();
-
-        if (version != 0)
-        {
-            throw new IllegalArgumentException("sequence not version 0");
-        }
-
-        this.data = (ASN1Sequence)seq.getObjectAt(1);
-    }
-
-    public EncryptedData(
-        DERObjectIdentifier     contentType,
-        AlgorithmIdentifier     encryptionAlgorithm,
-        DEREncodable            content)
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        v.add(contentType);
-        v.add(encryptionAlgorithm.getDERObject());
-        v.add(new BERTaggedObject(false, 0, content));
-
-        data = new BERSequence(v);
-    }
-        
-    public DERObjectIdentifier getContentType()
-    {
-        return (DERObjectIdentifier)data.getObjectAt(0);
-    }
-
-    public AlgorithmIdentifier getEncryptionAlgorithm()
-    {
-        return AlgorithmIdentifier.getInstance(data.getObjectAt(1));
-    }
-
-    public ASN1OctetString getContent()
-    {
-        if (data.size() == 3)
-        {
-            DERTaggedObject o = (DERTaggedObject)data.getObjectAt(2);
-
-            return ASN1OctetString.getInstance(o.getObject());
-        }
-
-        return null;
-    }
-
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(new DERInteger(0));
-        v.add(data);
-
-        return new BERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/EncryptedPrivateKeyInfo.java b/azureus2/src/org/bouncycastle/asn1/pkcs/EncryptedPrivateKeyInfo.java
deleted file mode 100644
index 7221871..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/EncryptedPrivateKeyInfo.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-
-public class EncryptedPrivateKeyInfo
-    implements PKCSObjectIdentifiers, DEREncodable
-{
-    private AlgorithmIdentifier algId;
-    private ASN1OctetString     data;
-
-    public EncryptedPrivateKeyInfo(
-        ASN1Sequence  seq)
-    {
-        Enumeration e = seq.getObjects();
-
-        algId = new AlgorithmIdentifier((ASN1Sequence)e.nextElement());
-        data = (ASN1OctetString)e.nextElement();
-    }
-
-    public EncryptedPrivateKeyInfo(
-        AlgorithmIdentifier algId,
-        byte[]              encoding)
-    {
-        this.algId = algId;
-        this.data = new DEROctetString(encoding);
-    }
-
-    public AlgorithmIdentifier getEncryptionAlgorithm()
-    {
-        return algId;
-    }
-
-    public byte[] getEncryptedData()
-    {
-        return data.getOctets();
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     * EncryptedPrivateKeyInfo ::= SEQUENCE {
-     *      encryptionAlgorithm AlgorithmIdentifier {{KeyEncryptionAlgorithms}},
-     *      encryptedData EncryptedData
-     * }
-     *
-     * EncryptedData ::= OCTET STRING
-     *
-     * KeyEncryptionAlgorithms ALGORITHM-IDENTIFIER ::= {
-     *          ... -- For local profiles
-     * }
-     * </pre>
-     */
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        v.add(algId);
-        v.add(data);
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/EncryptionScheme.java b/azureus2/src/org/bouncycastle/asn1/pkcs/EncryptionScheme.java
deleted file mode 100644
index eb9b326..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/EncryptionScheme.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-
-public class EncryptionScheme
-    extends AlgorithmIdentifier
-{   
-    DERObject   objectId;
-    DERObject   obj;
-
-    EncryptionScheme(
-        ASN1Sequence  seq)
-    {   
-        super(seq);
-        
-        objectId = (DERObject)seq.getObjectAt(0);
-        obj = (DERObject)seq.getObjectAt(1);
-    }
-
-    public DERObject getObject()
-    {
-        return obj;
-    }
-
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(objectId);
-        v.add(obj);
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/IssuerAndSerialNumber.java b/azureus2/src/org/bouncycastle/asn1/pkcs/IssuerAndSerialNumber.java
deleted file mode 100644
index 47892e8..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/IssuerAndSerialNumber.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.x509.X509Name;
-
-public class IssuerAndSerialNumber
-    implements DEREncodable
-{
-    X509Name    name;
-    DERInteger  certSerialNumber;
-
-    public static IssuerAndSerialNumber getInstance(
-        Object  obj)
-    {
-        if (obj instanceof IssuerAndSerialNumber)
-        {
-            return (IssuerAndSerialNumber)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new IssuerAndSerialNumber((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    public IssuerAndSerialNumber(
-        ASN1Sequence    seq)
-    {
-        this.name = X509Name.getInstance(seq.getObjectAt(0));
-        this.certSerialNumber = (DERInteger)seq.getObjectAt(1);
-    }
-
-    public IssuerAndSerialNumber(
-        X509Name    name,
-        BigInteger  certSerialNumber)
-    {
-        this.name = name;
-        this.certSerialNumber = new DERInteger(certSerialNumber);
-    }
-
-    public IssuerAndSerialNumber(
-        X509Name    name,
-        DERInteger  certSerialNumber)
-    {
-        this.name = name;
-        this.certSerialNumber = certSerialNumber;
-    }
-
-    public X509Name getName()
-    {
-        return name;
-    }
-
-    public DERInteger getCertificateSerialNumber()
-    {
-        return certSerialNumber;
-    }
-
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector    v = new ASN1EncodableVector();
-
-        v.add(name);
-        v.add(certSerialNumber);
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/KeyDerivationFunc.java b/azureus2/src/org/bouncycastle/asn1/pkcs/KeyDerivationFunc.java
deleted file mode 100644
index 0da52d3..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/KeyDerivationFunc.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-
-public class KeyDerivationFunc
-    extends AlgorithmIdentifier
-{
-    KeyDerivationFunc(
-        ASN1Sequence  seq)
-    {
-        super(seq);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/MacData.java b/azureus2/src/org/bouncycastle/asn1/pkcs/MacData.java
deleted file mode 100644
index 57b6bf6..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/MacData.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.x509.DigestInfo;
-
-public class MacData
-    implements DEREncodable
-{
-    DigestInfo                  digInfo;
-    byte[]                      salt;
-    BigInteger                  iterationCount;
-
-    public static MacData getInstance(
-        Object  obj)
-    {
-        if (obj instanceof MacData)
-        {
-            return (MacData)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new MacData((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    public MacData(
-        ASN1Sequence seq)
-    {
-        this.digInfo = DigestInfo.getInstance(seq.getObjectAt(0));
-
-        this.salt = ((ASN1OctetString)seq.getObjectAt(1)).getOctets();
-
-        if (seq.size() == 3)
-        {
-            this.iterationCount = ((DERInteger)seq.getObjectAt(2)).getValue();
-        }
-        else
-        {
-            this.iterationCount = BigInteger.valueOf(1);
-        }
-    }
-
-    public MacData(
-        DigestInfo  digInfo,
-        byte[]      salt,
-        int         iterationCount)
-    {
-        this.digInfo = digInfo;
-        this.salt = salt;
-        this.iterationCount = BigInteger.valueOf(iterationCount);
-    }
-
-    public DigestInfo getMac()
-    {
-        return digInfo;
-    }
-
-    public byte[] getSalt()
-    {
-        return salt;
-    }
-
-    public BigInteger getIterationCount()
-    {
-        return iterationCount;
-    }
-
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(digInfo);
-        v.add(new DEROctetString(salt));
-        v.add(new DERInteger(iterationCount));
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/PBES2Algorithms.java b/azureus2/src/org/bouncycastle/asn1/pkcs/PBES2Algorithms.java
deleted file mode 100644
index b79f878..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/PBES2Algorithms.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-
-/**
- * @deprecated - use AlgorithmIdentifier and PBES2Params
- */
-public class PBES2Algorithms
-    extends AlgorithmIdentifier implements PKCSObjectIdentifiers
-{
-    private DERObjectIdentifier objectId;
-    private KeyDerivationFunc   func;
-    private EncryptionScheme    scheme;
-
-    public PBES2Algorithms(
-        ASN1Sequence  obj)
-    {
-        super(obj);
-
-        Enumeration     e = obj.getObjects();
-
-        objectId = (DERObjectIdentifier)e.nextElement();
-
-        ASN1Sequence seq = (ASN1Sequence)e.nextElement();
-
-        e = seq.getObjects();
-
-        ASN1Sequence  funcSeq = (ASN1Sequence)e.nextElement();
-
-        if (funcSeq.getObjectAt(0).equals(id_PBKDF2))
-        {
-            func = new PBKDF2Params(funcSeq);
-        }
-        else
-        {
-            func = new KeyDerivationFunc(funcSeq);
-        }
-
-        scheme = new EncryptionScheme((ASN1Sequence)e.nextElement());
-    }
-
-    public DERObjectIdentifier getObjectId()
-    {
-        return objectId;
-    }
-
-    public KeyDerivationFunc getKeyDerivationFunc()
-    {
-        return func;
-    }
-
-    public EncryptionScheme getEncryptionScheme()
-    {
-        return scheme;
-    }
-
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-        ASN1EncodableVector  subV = new ASN1EncodableVector();
-
-        v.add(objectId);
-
-        subV.add(func);
-        subV.add(scheme);
-        v.add(new DERSequence(subV));
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/PBES2Parameters.java b/azureus2/src/org/bouncycastle/asn1/pkcs/PBES2Parameters.java
deleted file mode 100644
index 2b43ea1..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/PBES2Parameters.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-public class PBES2Parameters
-    implements PKCSObjectIdentifiers, DEREncodable
-{
-    private KeyDerivationFunc   func;
-    private EncryptionScheme    scheme;
-
-    public PBES2Parameters(
-        ASN1Sequence  obj)
-    {
-        Enumeration e = obj.getObjects();
-        ASN1Sequence  funcSeq = (ASN1Sequence)e.nextElement();
-
-        if (funcSeq.getObjectAt(0).equals(id_PBKDF2))
-        {
-            func = new PBKDF2Params(funcSeq);
-        }
-        else
-        {
-            func = new KeyDerivationFunc(funcSeq);
-        }
-
-        scheme = new EncryptionScheme((ASN1Sequence)e.nextElement());
-    }
-
-    public KeyDerivationFunc getKeyDerivationFunc()
-    {
-        return func;
-    }
-
-    public EncryptionScheme getEncryptionScheme()
-    {
-        return scheme;
-    }
-
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(func);
-        v.add(scheme);
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/PBKDF2Params.java b/azureus2/src/org/bouncycastle/asn1/pkcs/PBKDF2Params.java
deleted file mode 100644
index f074a78..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/PBKDF2Params.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import java.math.BigInteger;
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-
-public class PBKDF2Params
-    extends KeyDerivationFunc
-{
-    DERObjectIdentifier id;
-    ASN1OctetString     octStr;
-    DERInteger          iterationCount;
-    DERInteger          keyLength;
-
-    PBKDF2Params(
-        ASN1Sequence  seq)
-    {
-        super(seq);
-
-        Enumeration e = seq.getObjects();
-
-        id = (DERObjectIdentifier)e.nextElement();
-
-        ASN1Sequence  params = (ASN1Sequence)e.nextElement();
-
-        e = params.getObjects();
-
-        octStr = (ASN1OctetString)e.nextElement();
-        iterationCount = (DERInteger)e.nextElement();
-
-        if (e.hasMoreElements())
-        {
-            keyLength = (DERInteger)e.nextElement();
-        }
-        else
-        {
-            keyLength = null;
-        }
-    }
-
-    public byte[] getSalt()
-    {
-        return octStr.getOctets();
-    }
-
-    public BigInteger getIterationCount()
-    {
-        return iterationCount.getValue();
-    }
-
-    public BigInteger getKeyLength()
-    {
-        if (keyLength != null)
-        {
-            return keyLength.getValue();
-        }
-
-        return null;
-    }
-
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-        ASN1EncodableVector  subV = new ASN1EncodableVector();
-
-        v.add(id);
-        subV.add(octStr);
-        subV.add(iterationCount);
-
-        if (keyLength != null)
-        {
-            subV.add(keyLength);
-        }
-
-        v.add(new DERSequence(subV));
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/PKCS12PBEParams.java b/azureus2/src/org/bouncycastle/asn1/pkcs/PKCS12PBEParams.java
deleted file mode 100644
index 7c46205..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/PKCS12PBEParams.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.DERSequence;
-
-public class PKCS12PBEParams
-    implements DEREncodable
-{
-    DERInteger      iterations;
-    ASN1OctetString iv;
-
-    public PKCS12PBEParams(
-        byte[]      salt,
-        int         iterations)
-    {
-        this.iv = new DEROctetString(salt);
-        this.iterations = new DERInteger(iterations);
-    }
-
-    public PKCS12PBEParams(
-        ASN1Sequence  seq)
-    {
-        iv = (ASN1OctetString)seq.getObjectAt(0);
-        iterations = (DERInteger)seq.getObjectAt(1);
-    }
-
-    public static PKCS12PBEParams getInstance(
-        Object  obj)
-    {
-        if (obj instanceof PKCS12PBEParams)
-        {
-            return (PKCS12PBEParams)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new PKCS12PBEParams((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    public BigInteger getIterations()
-    {
-        return iterations.getValue();
-    }
-
-    public byte[] getIV()
-    {
-        return iv.getOctets();
-    }
-
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(iv);
-        v.add(iterations);
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java b/azureus2/src/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java
deleted file mode 100644
index 707fd46..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import org.bouncycastle.asn1.DERObjectIdentifier;
-
-public interface PKCSObjectIdentifiers
-{
-    //
-    // pkcs-1 OBJECT IDENTIFIER ::= {
-    //       iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 1 }
-    //
-    static final String                 pkcs_1                  = "1.2.840.113549.1.1";
-    static final DERObjectIdentifier    rsaEncryption           = new DERObjectIdentifier(pkcs_1 + ".1");
-    static final DERObjectIdentifier    md2WithRSAEncryption    = new DERObjectIdentifier(pkcs_1 + ".2");
-    static final DERObjectIdentifier    md4WithRSAEncryption    = new DERObjectIdentifier(pkcs_1 + ".3");
-    static final DERObjectIdentifier    md5WithRSAEncryption    = new DERObjectIdentifier(pkcs_1 + ".4");
-    static final DERObjectIdentifier    sha1WithRSAEncryption   = new DERObjectIdentifier(pkcs_1 + ".5");
-    static final DERObjectIdentifier    srsaOAEPEncryptionSET   = new DERObjectIdentifier(pkcs_1 + ".6");
-    static final DERObjectIdentifier    sha256WithRSAEncryption   = new DERObjectIdentifier(pkcs_1 + ".11");
-    static final DERObjectIdentifier    sha384WithRSAEncryption   = new DERObjectIdentifier(pkcs_1 + ".12");
-    static final DERObjectIdentifier    sha512WithRSAEncryption   = new DERObjectIdentifier(pkcs_1 + ".13");
-
-    //
-    // pkcs-3 OBJECT IDENTIFIER ::= {
-    //       iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 3 }
-    //
-    static final String                 pkcs_3                  = "1.2.840.113549.1.3";
-    static final DERObjectIdentifier    dhKeyAgreement          = new DERObjectIdentifier(pkcs_3 + ".1");
-
-    //
-    // pkcs-5 OBJECT IDENTIFIER ::= {
-    //       iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 5 }
-    //
-    static final String                 pkcs_5                  = "1.2.840.113549.1.5";
-
-    static final DERObjectIdentifier    id_PBES2                = new DERObjectIdentifier(pkcs_5 + ".13");
-
-    static final DERObjectIdentifier    id_PBKDF2               = new DERObjectIdentifier(pkcs_5 + ".12");
-
-    //
-    // encryptionAlgorithm OBJECT IDENTIFIER ::= {
-    //       iso(1) member-body(2) us(840) rsadsi(113549) 3 }
-    //
-    static final String                 encryptionAlgorithm     = "1.2.840.113549.3";
-
-    static final DERObjectIdentifier    des_EDE3_CBC            = new DERObjectIdentifier(encryptionAlgorithm + ".7");
-    static final DERObjectIdentifier    RC2_CBC                 = new DERObjectIdentifier(encryptionAlgorithm + ".2");
-
-    //
-    // object identifiers for digests
-    //
-
-    //
-    // md2 OBJECT IDENTIFIER ::=
-    //      {iso(1) member-body(2) US(840) rsadsi(113549) digestAlgorithm(2) 2}
-    //
-    static final DERObjectIdentifier    md2                     = new DERObjectIdentifier("1.2.840.113549.2.2");
-
-    //
-    // md5 OBJECT IDENTIFIER ::=
-    //      {iso(1) member-body(2) US(840) rsadsi(113549) digestAlgorithm(2) 5}
-    //
-    static final DERObjectIdentifier    md5                     = new DERObjectIdentifier("1.2.840.113549.2.5");
-
-    //
-    // pkcs-7 OBJECT IDENTIFIER ::= {
-    //       iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 7 }
-    //
-    static final String                 pkcs_7                  = "1.2.840.113549.1.7";
-    static final DERObjectIdentifier    data                    = new DERObjectIdentifier(pkcs_7 + ".1");
-    static final DERObjectIdentifier    signedData              = new DERObjectIdentifier(pkcs_7 + ".2");
-    static final DERObjectIdentifier    envelopedData           = new DERObjectIdentifier(pkcs_7 + ".3");
-    static final DERObjectIdentifier    signedAndEnvelopedData  = new DERObjectIdentifier(pkcs_7 + ".4");
-    static final DERObjectIdentifier    digestedData            = new DERObjectIdentifier(pkcs_7 + ".5");
-    static final DERObjectIdentifier    encryptedData           = new DERObjectIdentifier(pkcs_7 + ".6");
-
-    //
-    // pkcs-9 OBJECT IDENTIFIER ::= {
-    //       iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 9 }
-    //
-    static final String                 pkcs_9                  = "1.2.840.113549.1.9";
-
-    static final DERObjectIdentifier    pkcs_9_at_emailAddress  = new DERObjectIdentifier(pkcs_9 + ".1");
-    static final DERObjectIdentifier    pkcs_9_at_unstructuredName = new DERObjectIdentifier(pkcs_9 + ".2");
-    static final DERObjectIdentifier    pkcs_9_at_contentType = new DERObjectIdentifier(pkcs_9 + ".3");
-    static final DERObjectIdentifier    pkcs_9_at_messageDigest = new DERObjectIdentifier(pkcs_9 + ".4");
-    static final DERObjectIdentifier    pkcs_9_at_signingTime = new DERObjectIdentifier(pkcs_9 + ".5");
-    static final DERObjectIdentifier    pkcs_9_at_counterSignature = new DERObjectIdentifier(pkcs_9 + ".6");
-    static final DERObjectIdentifier    pkcs_9_at_challengePassword = new DERObjectIdentifier(pkcs_9 + ".7");
-    static final DERObjectIdentifier    pkcs_9_at_unstructuredAddress = new DERObjectIdentifier(pkcs_9 + ".8");
-    static final DERObjectIdentifier    pkcs_9_at_extendedCertificateAttributes = new DERObjectIdentifier(pkcs_9 + ".9");
-
-    static final DERObjectIdentifier    pkcs_9_at_signingDescription = new DERObjectIdentifier(pkcs_9 + ".13");
-    static final DERObjectIdentifier    pkcs_9_at_extensionRequest = new DERObjectIdentifier(pkcs_9 + ".14");
-    static final DERObjectIdentifier    pkcs_9_at_smimeCapabilities = new DERObjectIdentifier(pkcs_9 + ".15");
-
-    static final DERObjectIdentifier    pkcs_9_at_friendlyName  = new DERObjectIdentifier(pkcs_9 + ".20");
-    static final DERObjectIdentifier    pkcs_9_at_localKeyId    = new DERObjectIdentifier(pkcs_9 + ".21");
-
-    static final DERObjectIdentifier    x509certType            = new DERObjectIdentifier(pkcs_9 + ".22.1");
-
-    static final DERObjectIdentifier    id_ct_compressedData    = new DERObjectIdentifier(pkcs_9 + ".16.1.9");
-    
-	static final DERObjectIdentifier    id_alg_PWRI_KEK    = new DERObjectIdentifier(pkcs_9 + ".16.3.9");
-
-    //
-    // SMIME capability sub oids.
-    //
-    static final DERObjectIdentifier    preferSignedData        = new DERObjectIdentifier(pkcs_9 + ".15.1");
-    static final DERObjectIdentifier    canNotDecryptAny        = new DERObjectIdentifier(pkcs_9 + ".15.2");
-    static final DERObjectIdentifier    sMIMECapabilitiesVersions = new DERObjectIdentifier(pkcs_9 + ".15.3");
-
-    //
-    // other SMIME attributes
-    //
-
-	//
-	// id-aa OBJECT IDENTIFIER ::= {iso(1) member-body(2) usa(840)
-	// rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) attributes(2)}
-	//
-	static String id_aa = "1.2.840.113549.1.9.16.2";
-	
-	/*
-	 * id-aa-encrypKeyPref OBJECT IDENTIFIER ::= {id-aa 11}
-	 * 
-	 */
-	static DERObjectIdentifier id_aa_encrypKeyPref = new DERObjectIdentifier(id_aa + ".11");
-
-    //
-    // pkcs-12 OBJECT IDENTIFIER ::= {
-    //       iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 12 }
-    //
-    static final String                 pkcs_12                  = "1.2.840.113549.1.12";
-    static final String                 bagtypes                 = pkcs_12 + ".10.1";
-
-    static final DERObjectIdentifier    keyBag                  = new DERObjectIdentifier(bagtypes + ".1");
-    static final DERObjectIdentifier    pkcs8ShroudedKeyBag     = new DERObjectIdentifier(bagtypes + ".2");
-    static final DERObjectIdentifier    certBag                 = new DERObjectIdentifier(bagtypes + ".3");
-    static final DERObjectIdentifier    crlBag                  = new DERObjectIdentifier(bagtypes + ".4");
-    static final DERObjectIdentifier    secretBag               = new DERObjectIdentifier(bagtypes + ".5");
-    static final DERObjectIdentifier    safeContentsBag         = new DERObjectIdentifier(bagtypes + ".6");
-}
-
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/Pfx.java b/azureus2/src/org/bouncycastle/asn1/pkcs/Pfx.java
deleted file mode 100644
index 06bff8c..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/Pfx.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.BERSequence;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-
-/**
- * the infamous Pfx from PKCS12
- */
-public class Pfx
-    implements DEREncodable, PKCSObjectIdentifiers
-{
-    private ContentInfo             contentInfo;
-    private MacData                 macData = null;
-
-    public Pfx(
-        ASN1Sequence   seq)
-    {
-        BigInteger  version = ((DERInteger)seq.getObjectAt(0)).getValue();
-        if (version.intValue() != 3)
-        {
-            throw new IllegalArgumentException("wrong version for PFX PDU");
-        }
-
-        contentInfo = ContentInfo.getInstance(seq.getObjectAt(1));
-
-        if (seq.size() == 3)
-        {
-            macData = MacData.getInstance(seq.getObjectAt(2));
-        }
-    }
-
-    public Pfx(
-        ContentInfo     contentInfo,
-        MacData         macData)
-    {
-        this.contentInfo = contentInfo;
-        this.macData = macData;
-    }
-
-    public ContentInfo getAuthSafe()
-    {
-        return contentInfo;
-    }
-
-    public MacData getMacData()
-    {
-        return macData;
-    }
-
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        v.add(new DERInteger(3));
-        v.add(contentInfo);
-
-        if (macData != null)
-        {
-            v.add(macData);
-        }
-
-        return new BERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/PrivateKeyInfo.java b/azureus2/src/org/bouncycastle/asn1/pkcs/PrivateKeyInfo.java
deleted file mode 100644
index a00332f..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/PrivateKeyInfo.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1InputStream;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1Set;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-
-import java.io.IOException;
-import java.math.BigInteger;
-import java.util.Enumeration;
-
-public class PrivateKeyInfo
-    extends ASN1Encodable
-{
-    private DERObject               privKey;
-    private AlgorithmIdentifier     algId;
-    private ASN1Set                 attributes;
-
-    public static PrivateKeyInfo getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static PrivateKeyInfo getInstance(
-        Object  obj)
-    {
-        if (obj instanceof PrivateKeyInfo)
-        {
-            return (PrivateKeyInfo)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new PrivateKeyInfo((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-        
-    public PrivateKeyInfo(
-        AlgorithmIdentifier algId,
-        DERObject           privateKey)
-    {
-        this(algId, privateKey, null);
-    }
-
-    public PrivateKeyInfo(
-        AlgorithmIdentifier algId,
-        DERObject           privateKey,
-        ASN1Set             attributes)
-    {
-        this.privKey = privateKey;
-        this.algId = algId;
-        this.attributes = attributes;
-    }
-
-    public PrivateKeyInfo(
-        ASN1Sequence  seq)
-    {
-        Enumeration e = seq.getObjects();
-
-        BigInteger  version = ((DERInteger)e.nextElement()).getValue();
-        if (version.intValue() != 0)
-        {
-            throw new IllegalArgumentException("wrong version for private key info");
-        }
-
-        algId = new AlgorithmIdentifier((ASN1Sequence)e.nextElement());
-
-        try
-        {
-            ASN1InputStream         aIn = new ASN1InputStream(((ASN1OctetString)e.nextElement()).getOctets());
-
-            privKey = aIn.readObject();
-        }
-        catch (IOException ex)
-        {
-            throw new IllegalArgumentException("Error recoverying private key from sequence");
-        }
-        
-        if (e.hasMoreElements())
-        {
-           attributes = ASN1Set.getInstance((ASN1TaggedObject)e.nextElement(), false);
-        }
-    }
-
-    public AlgorithmIdentifier getAlgorithmId()
-    {
-        return algId;
-    }
-
-    public DERObject getPrivateKey()
-    {
-        return privKey;
-    }
-    
-    public ASN1Set getAttributes()
-    {
-        return attributes;
-    }
-
-    /**
-     * write out an RSA private key with it's asscociated information
-     * as described in PKCS8.
-     * <pre>
-     *      PrivateKeyInfo ::= SEQUENCE {
-     *                              version Version,
-     *                              privateKeyAlgorithm AlgorithmIdentifier {{PrivateKeyAlgorithms}},
-     *                              privateKey PrivateKey,
-     *                              attributes [0] IMPLICIT Attributes OPTIONAL 
-     *                          }
-     *      Version ::= INTEGER {v1(0)} (v1,...)
-     *
-     *      PrivateKey ::= OCTET STRING
-     *
-     *      Attributes ::= SET OF Attribute
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        v.add(new DERInteger(0));
-        v.add(algId);
-        v.add(new DEROctetString(privKey));
-
-        if (attributes != null)
-        {
-            v.add(new DERTaggedObject(false, 0, attributes));
-        }
-        
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/RC2CBCParameter.java b/azureus2/src/org/bouncycastle/asn1/pkcs/RC2CBCParameter.java
deleted file mode 100644
index a76337a..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/RC2CBCParameter.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.DERSequence;
-
-public class RC2CBCParameter
-    implements DEREncodable
-{
-    DERInteger      version;
-    ASN1OctetString iv;
-
-    public static RC2CBCParameter getInstance(
-        Object  o)
-    {
-        if (o instanceof ASN1Sequence)
-        {
-            return new RC2CBCParameter((ASN1Sequence)o);
-        }
-
-        throw new IllegalArgumentException("unknown object in RC2CBCParameter factory");
-    }
-
-    public RC2CBCParameter(
-        byte[]  iv)
-    {
-        this.version = null;
-        this.iv = new DEROctetString(iv);
-    }
-
-    public RC2CBCParameter(
-        int     parameterVersion,
-        byte[]  iv)
-    {
-        this.version = new DERInteger(parameterVersion);
-        this.iv = new DEROctetString(iv);
-    }
-
-    public RC2CBCParameter(
-        ASN1Sequence  seq)
-    {
-        if (seq.size() == 1)
-        {
-            version = null;
-            iv = (ASN1OctetString)seq.getObjectAt(0);
-        }
-        else
-        {
-            version = (DERInteger)seq.getObjectAt(0);
-            iv = (ASN1OctetString)seq.getObjectAt(1);
-        }
-    }
-
-    public BigInteger getRC2ParameterVersion()
-    {
-        if (version == null)
-        {
-            return null;
-        }
-
-        return version.getValue();
-    }
-
-    public byte[] getIV()
-    {
-        return iv.getOctets();
-    }
-
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        if (version != null)
-        {
-            v.add(version);
-        }
-
-        v.add(iv);
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/RSAPrivateKeyStructure.java b/azureus2/src/org/bouncycastle/asn1/pkcs/RSAPrivateKeyStructure.java
deleted file mode 100644
index 998b7c6..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/RSAPrivateKeyStructure.java
+++ /dev/null
@@ -1,186 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import java.math.BigInteger;
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-public class RSAPrivateKeyStructure
-    extends ASN1Encodable
-{
-    private int         version;
-    private BigInteger  modulus;
-    private BigInteger  publicExponent;
-    private BigInteger  privateExponent;
-    private BigInteger  prime1;
-    private BigInteger  prime2;
-    private BigInteger  exponent1;
-    private BigInteger  exponent2;
-    private BigInteger  coefficient;
-    private ASN1Sequence otherPrimeInfos = null;
-
-    public static RSAPrivateKeyStructure getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static RSAPrivateKeyStructure getInstance(
-        Object  obj)
-    {
-        if (obj instanceof RSAPrivateKeyStructure)
-        {
-            return (RSAPrivateKeyStructure)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new RSAPrivateKeyStructure((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-    
-    public RSAPrivateKeyStructure(
-        BigInteger  modulus,
-        BigInteger  publicExponent,
-        BigInteger  privateExponent,
-        BigInteger  prime1,
-        BigInteger  prime2,
-        BigInteger  exponent1,
-        BigInteger  exponent2,
-        BigInteger  coefficient)
-    {
-        this.version = 0;
-        this.modulus = modulus;
-        this.publicExponent = publicExponent;
-        this.privateExponent = privateExponent;
-        this.prime1 = prime1;
-        this.prime2 = prime2;
-        this.exponent1 = exponent1;
-        this.exponent2 = exponent2;
-        this.coefficient = coefficient;
-    }
-
-    public RSAPrivateKeyStructure(
-        ASN1Sequence  seq)
-    {
-        Enumeration e = seq.getObjects();
-
-        BigInteger  v = ((DERInteger)e.nextElement()).getValue();
-        if (v.intValue() != 0 && v.intValue() != 1)
-        {
-            throw new IllegalArgumentException("wrong version for RSA private key");
-        }
-
-        version = v.intValue();
-        modulus = ((DERInteger)e.nextElement()).getValue();
-        publicExponent = ((DERInteger)e.nextElement()).getValue();
-        privateExponent = ((DERInteger)e.nextElement()).getValue();
-        prime1 = ((DERInteger)e.nextElement()).getValue();
-        prime2 = ((DERInteger)e.nextElement()).getValue();
-        exponent1 = ((DERInteger)e.nextElement()).getValue();
-        exponent2 = ((DERInteger)e.nextElement()).getValue();
-        coefficient = ((DERInteger)e.nextElement()).getValue();
-        
-        if (e.hasMoreElements())
-        {
-            otherPrimeInfos = (ASN1Sequence)e.nextElement();
-        }
-    }
-
-    public int getVersion()
-    {
-        return version;
-    }
-    
-    public BigInteger getModulus()
-    {
-        return modulus;
-    }
-
-    public BigInteger getPublicExponent()
-    {
-        return publicExponent;
-    }
-
-    public BigInteger getPrivateExponent()
-    {
-        return privateExponent;
-    }
-
-    public BigInteger getPrime1()
-    {
-        return prime1;
-    }
-
-    public BigInteger getPrime2()
-    {
-        return prime2;
-    }
-
-    public BigInteger getExponent1()
-    {
-        return exponent1;
-    }
-
-    public BigInteger getExponent2()
-    {
-        return exponent2;
-    }
-
-    public BigInteger getCoefficient()
-    {
-        return coefficient;
-    }
-
-    /**
-     * This outputs the key in PKCS1v2 format.
-     * <pre>
-     *      RSAPrivateKey ::= SEQUENCE {
-     *                          version Version,
-     *                          modulus INTEGER, -- n
-     *                          publicExponent INTEGER, -- e
-     *                          privateExponent INTEGER, -- d
-     *                          prime1 INTEGER, -- p
-     *                          prime2 INTEGER, -- q
-     *                          exponent1 INTEGER, -- d mod (p-1)
-     *                          exponent2 INTEGER, -- d mod (q-1)
-     *                          coefficient INTEGER, -- (inverse of q) mod p
-     *                          otherPrimeInfos OtherPrimeInfos OPTIONAL
-     *                      }
-     *
-     *      Version ::= INTEGER { two-prime(0), multi(1) }
-     *        (CONSTRAINED BY {-- version must be multi if otherPrimeInfos present --})
-     * </pre>
-     * <p>
-     * This routine is written to output PKCS1 version 2.1, private keys.
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(new DERInteger(version));                       // version
-        v.add(new DERInteger(getModulus()));
-        v.add(new DERInteger(getPublicExponent()));
-        v.add(new DERInteger(getPrivateExponent()));
-        v.add(new DERInteger(getPrime1()));
-        v.add(new DERInteger(getPrime2()));
-        v.add(new DERInteger(getExponent1()));
-        v.add(new DERInteger(getExponent2()));
-        v.add(new DERInteger(getCoefficient()));
-
-        if (otherPrimeInfos != null)
-        {
-            v.add(otherPrimeInfos);
-        }
-        
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/SafeBag.java b/azureus2/src/org/bouncycastle/asn1/pkcs/SafeBag.java
deleted file mode 100644
index ebf15fb..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/SafeBag.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1Set;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-
-public class SafeBag
-    implements DEREncodable
-{
-    DERObjectIdentifier         bagId;
-    DERObject                   bagValue;
-    ASN1Set                     bagAttributes;
-
-    public SafeBag(
-        DERObjectIdentifier     oid,
-        DERObject               obj)
-    {
-        this.bagId = oid;
-        this.bagValue = obj;
-        this.bagAttributes = null;
-    }
-
-    public SafeBag(
-        DERObjectIdentifier     oid,
-        DERObject               obj,
-        ASN1Set                 bagAttributes)
-    {
-        this.bagId = oid;
-        this.bagValue = obj;
-        this.bagAttributes = bagAttributes;
-    }
-
-	public SafeBag(
-		ASN1Sequence	seq)
-	{
-		this.bagId = (DERObjectIdentifier)seq.getObjectAt(0);
-		this.bagValue = ((DERTaggedObject)seq.getObjectAt(1)).getObject();
-        if (seq.size() == 3)
-        {
-            this.bagAttributes = (ASN1Set)seq.getObjectAt(2);
-        }
-	}
-
-	public DERObjectIdentifier getBagId()
-	{
-		return bagId;
-	}
-
-    public DERObject getBagValue()
-    {
-		return bagValue;
-    }
-
-    public ASN1Set getBagAttributes()
-    {
-		return bagAttributes;
-    }
-
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        v.add(bagId);
-        v.add(new DERTaggedObject(0, bagValue));
-
-        if (bagAttributes != null)
-        {
-            v.add(bagAttributes);
-        }
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/SignedData.java b/azureus2/src/org/bouncycastle/asn1/pkcs/SignedData.java
deleted file mode 100644
index e3b51b0..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/SignedData.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1Set;
-import org.bouncycastle.asn1.BERSequence;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERTaggedObject;
-
-/**
- * a PKCS#7 signed data object.
- */
-public class SignedData
-    implements DEREncodable, PKCSObjectIdentifiers
-{
-    private DERInteger              version;
-    private ASN1Set                 digestAlgorithms;
-    private ContentInfo             contentInfo;
-    private ASN1Set                 certificates;
-    private ASN1Set                 crls;
-    private ASN1Set                 signerInfos;
-
-    public static SignedData getInstance(
-        Object  o)
-    {
-        if (o instanceof SignedData)
-        {
-            return (SignedData)o;
-        }
-        else if (o instanceof ASN1Sequence)
-        {
-            return new SignedData((ASN1Sequence)o);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory: " + o);
-    }
-
-	public SignedData(
-		DERInteger        _version,
-		ASN1Set           _digestAlgorithms,
-		ContentInfo       _contentInfo,
-		ASN1Set           _certificates,
-		ASN1Set           _crls,
-		ASN1Set           _signerInfos)
-	{
-		version          = _version;
-		digestAlgorithms = _digestAlgorithms;
-		contentInfo      = _contentInfo;
-		certificates     = _certificates;
-		crls             = _crls;
-		signerInfos      = _signerInfos;
-	}
-	
-    public SignedData(
-        ASN1Sequence seq)
-    {
-        Enumeration     e = seq.getObjects();
-
-        version = (DERInteger)e.nextElement();
-        digestAlgorithms = ((ASN1Set)e.nextElement());
-        contentInfo = ContentInfo.getInstance(e.nextElement());
-
-        while (e.hasMoreElements())
-        {
-            DERObject o = (DERObject)e.nextElement();
-
-            //
-            // an interesting feature of SignedData is that there appear to be varying implementations...
-            // for the moment we ignore anything which doesn't fit.
-            //
-            if (o instanceof DERTaggedObject)
-            {
-                DERTaggedObject tagged = (DERTaggedObject)o;
-
-                switch (tagged.getTagNo())
-                {
-                case 0:
-                    certificates = ASN1Set.getInstance(tagged, false);
-                    break;
-                case 1:
-                    crls = ASN1Set.getInstance(tagged, false);
-                    break;
-                default:
-                    throw new IllegalArgumentException("unknown tag value " + tagged.getTagNo());
-                }
-            }
-            else
-            {
-                signerInfos = (ASN1Set)o;
-            }
-        }
-    }
-
-    public DERInteger getVersion()
-    {
-        return version;
-    }
-
-    public ASN1Set getDigestAlgorithms()
-    {
-        return digestAlgorithms;
-    }
-
-    public ContentInfo getContentInfo()
-    {
-        return contentInfo;
-    }
-
-    public ASN1Set getCertificates()
-    {
-        return certificates;
-    }
-
-    public ASN1Set getCRLs()
-    {
-        return crls;
-    }
-
-    public ASN1Set getSignerInfos()
-    {
-        return signerInfos;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     *  SignedData ::= SEQUENCE {
-     *      version Version,
-     *      digestAlgorithms DigestAlgorithmIdentifiers,
-     *      contentInfo ContentInfo,
-     *      certificates
-     *          [0] IMPLICIT ExtendedCertificatesAndCertificates
-     *                   OPTIONAL,
-     *      crls
-     *          [1] IMPLICIT CertificateRevocationLists OPTIONAL,
-     *      signerInfos SignerInfos }
-     * </pre>
-     */
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        v.add(version);
-        v.add(digestAlgorithms);
-        v.add(contentInfo);
-
-        if (certificates != null)
-        {
-            v.add(new DERTaggedObject(false, 0, certificates));
-        }
-
-        if (crls != null)
-        {
-            v.add(new DERTaggedObject(false, 1, crls));
-        }
-
-        v.add(signerInfos);
-
-        return new BERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/SignerInfo.java b/azureus2/src/org/bouncycastle/asn1/pkcs/SignerInfo.java
deleted file mode 100644
index ee9b3c4..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/SignerInfo.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package org.bouncycastle.asn1.pkcs;
-
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.*;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-
-/**
- * a PKCS#7 signer info object.
- */
-public class SignerInfo
-    implements DEREncodable
-{
-    private DERInteger              version;
-    private IssuerAndSerialNumber   issuerAndSerialNumber;
-    private AlgorithmIdentifier     digAlgorithm;
-    private ASN1Set                 authenticatedAttributes;
-    private AlgorithmIdentifier     digEncryptionAlgorithm;
-    private ASN1OctetString         encryptedDigest;
-    private ASN1Set                 unauthenticatedAttributes;
-
-    public static SignerInfo getInstance(
-        Object  o)
-    {
-        if (o instanceof SignerInfo)
-        {
-            return (SignerInfo)o;
-        }
-        else if (o instanceof ASN1Sequence)
-        {
-            return new SignerInfo((ASN1Sequence)o);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    public SignerInfo(
-        DERInteger              version,
-        IssuerAndSerialNumber   issuerAndSerialNumber,
-        AlgorithmIdentifier     digAlgorithm,
-        ASN1Set                 authenticatedAttributes,
-        AlgorithmIdentifier     digEncryptionAlgorithm,
-        ASN1OctetString         encryptedDigest,
-        ASN1Set                 unauthenticatedAttributes)
-    {
-        this.version = version;
-        this.issuerAndSerialNumber = issuerAndSerialNumber;
-        this.digAlgorithm = digAlgorithm;
-        this.authenticatedAttributes = authenticatedAttributes;
-        this.digEncryptionAlgorithm = digEncryptionAlgorithm;
-        this.encryptedDigest = encryptedDigest;
-        this.unauthenticatedAttributes = unauthenticatedAttributes;
-    }
-
-    public SignerInfo(
-        ASN1Sequence seq)
-    {
-        Enumeration     e = seq.getObjects();
-
-        version = (DERInteger)e.nextElement();
-        issuerAndSerialNumber = IssuerAndSerialNumber.getInstance(e.nextElement());
-        digAlgorithm = AlgorithmIdentifier.getInstance(e.nextElement());
-
-        Object obj = e.nextElement();
-
-        if (obj instanceof ASN1TaggedObject)
-        {
-            authenticatedAttributes = ASN1Set.getInstance((ASN1TaggedObject)obj, false);
-
-            digEncryptionAlgorithm = AlgorithmIdentifier.getInstance(e.nextElement());
-        }
-        else
-        {
-            authenticatedAttributes = null;
-            digEncryptionAlgorithm = AlgorithmIdentifier.getInstance(obj);
-        }
-
-        encryptedDigest = DEROctetString.getInstance(e.nextElement());
-
-        if (e.hasMoreElements())
-        {
-            unauthenticatedAttributes = ASN1Set.getInstance((ASN1TaggedObject)e.nextElement(), false);
-        }
-        else
-        {
-            unauthenticatedAttributes = null;
-        }
-    }
-
-    public DERInteger getVersion()
-    {
-        return version;
-    }
-
-    public IssuerAndSerialNumber getIssuerAndSerialNumber()
-    {
-        return issuerAndSerialNumber;
-    }
-
-    public ASN1Set getAuthenticatedAttributes()
-    {
-        return authenticatedAttributes;
-    }
-
-    public AlgorithmIdentifier getDigestAlgorithm()
-    {
-        return digAlgorithm;
-    }
-
-    public ASN1OctetString getEncryptedDigest()
-    {
-        return encryptedDigest;
-    }
-
-    public AlgorithmIdentifier getDigestEncryptionAlgorithm()
-    {
-        return digEncryptionAlgorithm;
-    }
-
-    public ASN1Set getUnauthenticatedAttributes()
-    {
-        return unauthenticatedAttributes;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     *  SignerInfo ::= SEQUENCE {
-     *      version Version,
-     *      issuerAndSerialNumber IssuerAndSerialNumber,
-     *      digestAlgorithm DigestAlgorithmIdentifier,
-     *      authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL,
-     *      digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier,
-     *      encryptedDigest EncryptedDigest,
-     *      unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL
-     *  }
-     *
-     *  EncryptedDigest ::= OCTET STRING
-     *
-     *  DigestAlgorithmIdentifier ::= AlgorithmIdentifier
-     *
-     *  DigestEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
-     * </pre>
-     */
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        v.add(version);
-        v.add(issuerAndSerialNumber);
-        v.add(digAlgorithm);
-
-        if (authenticatedAttributes != null)
-        {
-            v.add(new DERTaggedObject(false, 0, authenticatedAttributes));
-        }
-
-        v.add(digEncryptionAlgorithm);
-        v.add(encryptedDigest);
-
-        if (unauthenticatedAttributes != null)
-        {
-            v.add(new DERTaggedObject(false, 1, unauthenticatedAttributes));
-        }
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/pkcs/package.html b/azureus2/src/org/bouncycastle/asn1/pkcs/package.html
deleted file mode 100644
index ab800f4..0000000
--- a/azureus2/src/org/bouncycastle/asn1/pkcs/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body bgcolor="#ffffff">
-Support classes useful for encoding and supporting the various RSA PKCS documents.
-</body>
-</html>
diff --git a/azureus2/src/org/bouncycastle/asn1/sec/ECPrivateKeyStructure.java b/azureus2/src/org/bouncycastle/asn1/sec/ECPrivateKeyStructure.java
deleted file mode 100644
index 67f19f9..0000000
--- a/azureus2/src/org/bouncycastle/asn1/sec/ECPrivateKeyStructure.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.bouncycastle.asn1.sec;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Object;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.DERSequence;
-
-import java.math.BigInteger;
-import java.util.Enumeration;
-
-/**
- * the elliptic curve private key object from SEC 1
- */
-public class ECPrivateKeyStructure
-    extends ASN1Encodable
-{
-    private ASN1Sequence  seq;
-
-    public ECPrivateKeyStructure(
-        ASN1Sequence  seq)
-    {
-        this.seq = seq;
-    }
-
-    public ECPrivateKeyStructure(
-        BigInteger  key)
-    {
-        byte[]  bytes = key.toByteArray();
-
-        if (bytes[0] == 0)
-        {
-            byte[]  tmp = new byte[bytes.length - 1];
-
-            System.arraycopy(bytes, 1, tmp, 0, tmp.length);
-            bytes = tmp;
-        }
-
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        v.add(new DERInteger(1));
-        v.add(new DEROctetString(bytes));
-
-        seq = new DERSequence(v);
-    }
-
-    public BigInteger getKey()
-    {
-        ASN1OctetString  octs = (ASN1OctetString)seq.getObjectAt(1);
-
-        return new BigInteger(1, octs.getOctets());
-    }
-
-    public DERBitString getPublicKey()
-    {
-        return (DERBitString)getObjectInTag(1);
-    }
-
-    public ASN1Object getParameters()
-    {
-        return getObjectInTag(0);
-    }
-
-    private ASN1Object getObjectInTag(int tagNo)
-    {
-        Enumeration e = seq.getObjects();
-
-        while (e.hasMoreElements())
-        {
-            DEREncodable obj = (DEREncodable)e.nextElement();
-
-            if (obj instanceof ASN1TaggedObject)
-            {
-                ASN1TaggedObject tag = (ASN1TaggedObject)obj;
-                if (tag.getTagNo() == tagNo)
-                {
-                    return (ASN1Object)((DEREncodable)tag.getObject()).getDERObject();
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
-     * ECPrivateKey ::= SEQUENCE {
-     *     version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1),
-     *     privateKey OCTET STRING,
-     *     parameters [0] Parameters OPTIONAL,
-     *     publicKey [1] BIT STRING OPTIONAL }
-     */
-    public DERObject toASN1Object()
-    {
-        return seq;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/sec/package.html b/azureus2/src/org/bouncycastle/asn1/sec/package.html
deleted file mode 100644
index 5e34dec..0000000
--- a/azureus2/src/org/bouncycastle/asn1/sec/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body bgcolor="#ffffff">
-Classes for support of the SEC standard for Elliptic Curve.
-</body>
-</html>
diff --git a/azureus2/src/org/bouncycastle/asn1/teletrust/TeleTrusTObjectIdentifiers.java b/azureus2/src/org/bouncycastle/asn1/teletrust/TeleTrusTObjectIdentifiers.java
deleted file mode 100644
index aeb4a31..0000000
--- a/azureus2/src/org/bouncycastle/asn1/teletrust/TeleTrusTObjectIdentifiers.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.bouncycastle.asn1.teletrust;
-
-import org.bouncycastle.asn1.DERObjectIdentifier;
-
-public interface TeleTrusTObjectIdentifiers
-{
-    static final String teleTrusTAlgorithm = "1.3.36.3";
-
-    static final DERObjectIdentifier    ripemd160           = new DERObjectIdentifier(teleTrusTAlgorithm + ".2.1");
-    static final DERObjectIdentifier    ripemd128           = new DERObjectIdentifier(teleTrusTAlgorithm + ".2.2");
-    static final DERObjectIdentifier    ripemd256           = new DERObjectIdentifier(teleTrusTAlgorithm + ".2.3");
-
-	static final String teleTrusTRSAsignatureAlgorithm = teleTrusTAlgorithm + ".3.1";
-	
-    static final DERObjectIdentifier    rsaSignatureWithripemd160           = new DERObjectIdentifier(teleTrusTRSAsignatureAlgorithm + ".2");
-    static final DERObjectIdentifier    rsaSignatureWithripemd128           = new DERObjectIdentifier(teleTrusTRSAsignatureAlgorithm + ".3");
-    static final DERObjectIdentifier    rsaSignatureWithripemd256           = new DERObjectIdentifier(teleTrusTRSAsignatureAlgorithm + ".4");
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/util/ASN1Dump.java b/azureus2/src/org/bouncycastle/asn1/util/ASN1Dump.java
deleted file mode 100644
index 17e5419..0000000
--- a/azureus2/src/org/bouncycastle/asn1/util/ASN1Dump.java
+++ /dev/null
@@ -1,274 +0,0 @@
-package org.bouncycastle.asn1.util;
-
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.*;
-import org.bouncycastle.util.encoders.Hex;
-
-public class ASN1Dump
-{
-    private static String  TAB = "    ";
-
-    /**
-     * dump a DER object as a formatted string with indentation
-     *
-     * @param obj the DERObject to be dumped out.
-     */
-    public static String _dumpAsString(
-        String      indent,
-        DERObject   obj)
-    {
-        if (obj instanceof ASN1Sequence)
-        {
-            StringBuffer    buf = new StringBuffer();
-            Enumeration     e = ((ASN1Sequence)obj).getObjects();
-            String          tab = indent + TAB;
-
-            buf.append(indent);
-			if (obj instanceof BERConstructedSequence)
-			{
-	            buf.append("BER ConstructedSequence");
-			}
-            else if (obj instanceof DERConstructedSequence)
-			{
-	            buf.append("DER ConstructedSequence");
-			}
-            else if (obj instanceof DERSequence)
-            {
-	            buf.append("DER Sequence");
-            }
-            else if (obj instanceof BERSequence)
-            {
-	            buf.append("BER Sequence");
-            }
-			else
-			{
-	            buf.append("Sequence");
-			}
-
-            buf.append(System.getProperty("line.separator"));
-
-            while (e.hasMoreElements())
-            {
-                Object  o = e.nextElement();
-
-                if (o == null || o.equals(new DERNull()))
-                {
-                    buf.append(tab);
-                    buf.append("NULL");
-                    buf.append(System.getProperty("line.separator"));
-                }
-                else if (o instanceof DERObject)
-                {
-                    buf.append(_dumpAsString(tab, (DERObject)o));
-                }
-                else
-                {
-                    buf.append(_dumpAsString(tab, ((DEREncodable)o).getDERObject()));
-                }
-            }
-            return buf.toString();
-        }
-        else if (obj instanceof DERTaggedObject)
-        {
-            StringBuffer    buf = new StringBuffer();
-            String          tab = indent + TAB;
-
-            buf.append(indent);
-			if (obj instanceof BERTaggedObject)
-			{
-            	buf.append("BER Tagged [");
-			}
-			else
-			{
-            	buf.append("Tagged [");
-			}
-
-            DERTaggedObject o = (DERTaggedObject)obj;
-
-            buf.append(Integer.toString(o.getTagNo()));
-            buf.append("]");
-
-            if (!o.isExplicit())
-            {
-                buf.append(" IMPLICIT ");
-            }
-
-            buf.append(System.getProperty("line.separator"));
-
-            if (o.isEmpty())
-            {
-                buf.append(tab);
-                buf.append("EMPTY");
-                buf.append(System.getProperty("line.separator"));
-            }
-            else
-            {
-                buf.append(_dumpAsString(tab, o.getObject()));
-            }
-
-            return buf.toString();
-        }
-        else if (obj instanceof DERConstructedSet)
-        {
-            StringBuffer    buf = new StringBuffer();
-            Enumeration     e = ((ASN1Set)obj).getObjects();
-            String          tab = indent + TAB;
-
-            buf.append(indent);
-            buf.append("ConstructedSet");
-            buf.append(System.getProperty("line.separator"));
-
-            while (e.hasMoreElements())
-            {
-                Object  o = e.nextElement();
-
-                if (o == null)
-                {
-                    buf.append(tab);
-                    buf.append("NULL");
-                    buf.append(System.getProperty("line.separator"));
-                }
-                else if (o instanceof DERObject)
-                {
-                    buf.append(_dumpAsString(tab, (DERObject)o));
-                }
-                else
-                {
-                    buf.append(_dumpAsString(tab, ((DEREncodable)o).getDERObject()));
-                }
-            }
-            return buf.toString();
-        }
-        else if (obj instanceof BERSet)
-        {
-            StringBuffer    buf = new StringBuffer();
-            Enumeration     e = ((ASN1Set)obj).getObjects();
-            String          tab = indent + TAB;
-
-            buf.append(indent);
-            buf.append("BER Set");
-            buf.append(System.getProperty("line.separator"));
-
-            while (e.hasMoreElements())
-            {
-                Object  o = e.nextElement();
-
-                if (o == null)
-                {
-                    buf.append(tab);
-                    buf.append("NULL");
-                    buf.append(System.getProperty("line.separator"));
-                }
-                else if (o instanceof DERObject)
-                {
-                    buf.append(_dumpAsString(tab, (DERObject)o));
-                }
-                else
-                {
-                    buf.append(_dumpAsString(tab, ((DEREncodable)o).getDERObject()));
-                }
-            }
-            return buf.toString();
-        }
-        else if (obj instanceof DERSet)
-        {
-            StringBuffer    buf = new StringBuffer();
-            Enumeration     e = ((ASN1Set)obj).getObjects();
-            String          tab = indent + TAB;
-
-            buf.append(indent);
-            buf.append("DER Set");
-            buf.append(System.getProperty("line.separator"));
-
-            while (e.hasMoreElements())
-            {
-                Object  o = e.nextElement();
-
-                if (o == null)
-                {
-                    buf.append(tab);
-                    buf.append("NULL");
-                    buf.append(System.getProperty("line.separator"));
-                }
-                else if (o instanceof DERObject)
-                {
-                    buf.append(_dumpAsString(tab, (DERObject)o));
-                }
-                else
-                {
-                    buf.append(_dumpAsString(tab, ((DEREncodable)o).getDERObject()));
-                }
-            }
-            return buf.toString();
-        }
-        else if (obj instanceof DERObjectIdentifier)
-        {
-            return indent + "ObjectIdentifier(" + ((DERObjectIdentifier)obj).getId() + ")" + System.getProperty("line.separator");
-        }
-        else if (obj instanceof DERBoolean)
-        {
-            return indent + "Boolean(" + ((DERBoolean)obj).isTrue() + ")" + System.getProperty("line.separator");
-        }
-        else if (obj instanceof DERInteger)
-        {
-            return indent + "Integer(" + ((DERInteger)obj).getValue() + ")" + System.getProperty("line.separator");
-        }
-        else if (obj instanceof DEROctetString)
-        {
-            return indent + obj.toString() + "[" + ((ASN1OctetString)obj).getOctets().length + "] " + System.getProperty("line.separator");
-        }
-        else if (obj instanceof DERIA5String)
-        {
-            return indent + "IA5String(" + ((DERIA5String)obj).getString() + ") " + System.getProperty("line.separator");
-        }
-        else if (obj instanceof DERPrintableString)
-        {
-            return indent + "PrintableString(" + ((DERPrintableString)obj).getString() + ") " + System.getProperty("line.separator");
-        }
-        else if (obj instanceof DERVisibleString)
-        {
-            return indent + "VisibleString(" + ((DERVisibleString)obj).getString() + ") " + System.getProperty("line.separator");
-        }
-        else if (obj instanceof DERBMPString)
-        {
-            return indent + "BMPString(" + ((DERBMPString)obj).getString() + ") " + System.getProperty("line.separator");
-        }
-        else if (obj instanceof DERT61String)
-        {
-            return indent + "T61String(" + ((DERT61String)obj).getString() + ") " + System.getProperty("line.separator");
-        }
-        else if (obj instanceof DERUTCTime)
-        {
-            return indent + "UTCTime(" + ((DERUTCTime)obj).getTime() + ") " + System.getProperty("line.separator");
-        }
-        else if (obj instanceof DERUnknownTag)
-        {
-            return indent + "Unknown " + Integer.toString(((DERUnknownTag)obj).getTag(), 16) + " " + new String(Hex.encode(((DERUnknownTag)obj).getData())) + System.getProperty("line.separator");
-        }
-        else
-        {
-            return indent + obj.toString() + System.getProperty("line.separator");
-        }
-    }
-
-    /**
-     * dump out a DER object as a formatted string
-     *
-     * @param obj the DERObject to be dumped out.
-     */
-    public static String dumpAsString(
-        Object   obj)
-    {
-		if (obj instanceof DERObject)
-		{
-        	return _dumpAsString("", (DERObject)obj);
-		}
-		else if (obj instanceof DEREncodable)
-		{
-        	return _dumpAsString("", ((DEREncodable)obj).getDERObject());
-		}
-
-		return "unknown object type " + obj.toString();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/util/DERDump.java b/azureus2/src/org/bouncycastle/asn1/util/DERDump.java
deleted file mode 100644
index e9d307a..0000000
--- a/azureus2/src/org/bouncycastle/asn1/util/DERDump.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.bouncycastle.asn1.util;
-
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-
-/**
- * @deprecated use ASN1Dump.
- */
-public class DERDump
-    extends ASN1Dump
-{
-    /**
-     * dump out a DER object as a formatted string
-     *
-     * @param obj the DERObject to be dumped out.
-     */
-    public static String dumpAsString(
-        DERObject   obj)
-    {
-        return _dumpAsString("", obj);
-    }
-
-    /**
-     * dump out a DER object as a formatted string
-     *
-     * @param obj the DERObject to be dumped out.
-     */
-    public static String dumpAsString(
-        DEREncodable   obj)
-    {
-        return _dumpAsString("", obj.getDERObject());
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/util/Dump.java b/azureus2/src/org/bouncycastle/asn1/util/Dump.java
deleted file mode 100644
index 27a37f3..0000000
--- a/azureus2/src/org/bouncycastle/asn1/util/Dump.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.bouncycastle.asn1.util;
-
-import java.io.FileInputStream;
-
-import org.bouncycastle.asn1.ASN1InputStream;
-
-public class Dump
-{
-    public static void main(
-        String args[])
-        throws Exception
-    {
-        FileInputStream fIn = new FileInputStream(args[0]);
-        ASN1InputStream bIn = new ASN1InputStream(fIn);
-        Object          obj = null;
-
-        while ((obj = bIn.readObject()) != null)
-        {
-            System.out.println(ASN1Dump.dumpAsString(obj));
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/util/package.html b/azureus2/src/org/bouncycastle/asn1/util/package.html
deleted file mode 100644
index 1db893d..0000000
--- a/azureus2/src/org/bouncycastle/asn1/util/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body bgcolor="#ffffff">
-An ASN.1 dump utility.
-</body>
-</html>
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/AccessDescription.java b/azureus2/src/org/bouncycastle/asn1/x509/AccessDescription.java
deleted file mode 100644
index ae13f55..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/AccessDescription.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-
-/**
- * The AccessDescription object.
- * <pre>
- * AccessDescription  ::=  SEQUENCE {
- *       accessMethod          OBJECT IDENTIFIER,
- *       accessLocation        GeneralName  }
- * </pre>
- */
-public class AccessDescription
-    extends ASN1Encodable
-{
-    public final static DERObjectIdentifier id_ad_caIssuers = new DERObjectIdentifier("1.3.6.1.5.5.7.48.2");
-    
-    public final static DERObjectIdentifier id_ad_ocsp = new DERObjectIdentifier("1.3.6.1.5.5.7.48.1");
-        
-    DERObjectIdentifier accessMethod = null;
-    GeneralName accessLocation = null;
-
-    public static AccessDescription getInstance(
-        Object  obj)
-    {
-        if (obj instanceof AccessDescription)
-        {
-            return (AccessDescription)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new AccessDescription((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
- 
-    public AccessDescription(
-        ASN1Sequence   seq)
-    {
-        if (seq.size() != 2) 
-        {
-            throw new IllegalArgumentException("wrong number of elements in inner sequence");
-        }
-        
-        accessMethod = DERObjectIdentifier.getInstance(seq.getObjectAt(0));
-        accessLocation = GeneralName.getInstance(seq.getObjectAt(1));
-    }
-
-    /**
-     * create an AccessDescription with the oid and location provided.
-     */
-    public AccessDescription(
-        DERObjectIdentifier oid,
-        GeneralName location)
-    {
-        accessMethod = oid;
-        accessLocation = location;
-    }
-
-    /**
-     * 
-     * @return the access method.
-     */
-    public DERObjectIdentifier getAccessMethod()
-    {
-        return accessMethod;
-    }
-    
-    /**
-     * 
-     * @return the access location
-     */
-    public GeneralName getAccessLocation()
-    {
-        return accessLocation;
-    }
-    
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector accessDescription  = new ASN1EncodableVector();
-        
-        accessDescription.add(accessMethod);
-        accessDescription.add(accessLocation);
-
-        return new DERSequence(accessDescription);
-    }
-
-    public String toString()
-    {
-        return ("AccessDescription: Oid(" + this.accessMethod.getId() + ")");
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/AlgorithmIdentifier.java b/azureus2/src/org/bouncycastle/asn1/x509/AlgorithmIdentifier.java
deleted file mode 100644
index 501dc9c..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/AlgorithmIdentifier.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-
-public class AlgorithmIdentifier
-    extends ASN1Encodable
-{
-    private DERObjectIdentifier objectId;
-    private DEREncodable        parameters;
-    private boolean             parametersDefined = false;
-
-    public static AlgorithmIdentifier getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-    
-    public static AlgorithmIdentifier getInstance(
-        Object  obj)
-    {
-        if (obj== null || obj instanceof AlgorithmIdentifier)
-        {
-            return (AlgorithmIdentifier)obj;
-        }
-        
-        if (obj instanceof DERObjectIdentifier)
-        {
-            return new AlgorithmIdentifier((DERObjectIdentifier)obj);
-        }
-
-        if (obj instanceof String)
-        {
-            return new AlgorithmIdentifier((String)obj);
-        }
-
-        if (obj instanceof ASN1Sequence)
-        {
-            return new AlgorithmIdentifier((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    public AlgorithmIdentifier(
-        DERObjectIdentifier     objectId)
-    {
-        this.objectId = objectId;
-    }
-
-    public AlgorithmIdentifier(
-        String     objectId)
-    {
-        this.objectId = new DERObjectIdentifier(objectId);
-    }
-
-    public AlgorithmIdentifier(
-        DERObjectIdentifier     objectId,
-        DEREncodable            parameters)
-    {
-        parametersDefined = true;
-        this.objectId = objectId;
-        this.parameters = parameters;
-    }
-
-    public AlgorithmIdentifier(
-        ASN1Sequence   seq)
-    {
-        if (seq.size() < 1 || seq.size() > 2)
-        {
-            throw new IllegalArgumentException("Bad sequence size: "
-                    + seq.size());
-        }
-        
-        objectId = DERObjectIdentifier.getInstance(seq.getObjectAt(0));
-
-        if (seq.size() == 2)
-        {
-            parametersDefined = true;
-            parameters = seq.getObjectAt(1);
-        }
-        else
-        {
-            parameters = null;
-        }
-    }
-
-    public DERObjectIdentifier getObjectId()
-    {
-        return objectId;
-    }
-
-    public DEREncodable getParameters()
-    {
-        return parameters;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     *      AlgorithmIdentifier ::= SEQUENCE {
-     *                            algorithm OBJECT IDENTIFIER,
-     *                            parameters ANY DEFINED BY algorithm OPTIONAL }
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(objectId);
-
-        if (parametersDefined)
-        {
-            v.add(parameters);
-        }
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/AttCertIssuer.java b/azureus2/src/org/bouncycastle/asn1/x509/AttCertIssuer.java
deleted file mode 100644
index 010a6ff..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/AttCertIssuer.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Choice;
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERTaggedObject;
-
-public class AttCertIssuer
-    extends ASN1Encodable
-    implements ASN1Choice
-{
-    ASN1Encodable   obj;
-    DERObject       choiceObj;
-    
-    public static AttCertIssuer getInstance(
-        Object  obj)
-    {
-        if (obj instanceof AttCertIssuer)
-        {
-            return (AttCertIssuer)obj;
-        }
-        else if (obj instanceof V2Form)
-        {
-            return new AttCertIssuer(V2Form.getInstance(obj));
-        }
-        else if (obj instanceof GeneralNames)
-        {
-            return new AttCertIssuer((GeneralNames)obj);
-        }
-        else if (obj instanceof ASN1TaggedObject)
-        {
-            return new AttCertIssuer(V2Form.getInstance((ASN1TaggedObject)obj, false));
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new AttCertIssuer(GeneralNames.getInstance(obj));
-        }
-
-        throw new IllegalArgumentException("unknown object in factory: " + obj.getClass());
-    }
-    
-    public static AttCertIssuer getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(obj.getObject()); // must be explictly tagged
-    }
-
-    /**
-     * Don't use this one if you are trying to be RFC 3281 compliant.
-     * Use it for v1 attribute certificates only.
-     * 
-     * @param names our GeneralNames structure
-     */
-    public AttCertIssuer(
-        GeneralNames  names)
-    {
-        obj = names;
-        choiceObj = obj.getDERObject();
-    }
-    
-    public AttCertIssuer(
-        V2Form  v2Form)
-    {
-        obj = v2Form;
-        choiceObj = new DERTaggedObject(false, 0, obj);
-    }
-
-    public ASN1Encodable getIssuer()
-    {
-        return obj;
-    }
-    
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     *  AttCertIssuer ::= CHOICE {
-     *       v1Form   GeneralNames,  -- MUST NOT be used in this
-     *                               -- profile
-     *       v2Form   [0] V2Form     -- v2 only
-     *  }
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        return choiceObj;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/AttCertValidityPeriod.java b/azureus2/src/org/bouncycastle/asn1/x509/AttCertValidityPeriod.java
deleted file mode 100644
index de4e684..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/AttCertValidityPeriod.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERGeneralizedTime;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-public class AttCertValidityPeriod
-    extends ASN1Encodable
-{
-    DERGeneralizedTime  notBeforeTime;
-    DERGeneralizedTime  notAfterTime;
-
-    public static AttCertValidityPeriod getInstance(
-            Object  obj)
-    {
-        if (obj instanceof AttCertValidityPeriod)
-        {
-            return (AttCertValidityPeriod)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new AttCertValidityPeriod((ASN1Sequence)obj);
-        }
-        
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-    
-    public AttCertValidityPeriod(
-        ASN1Sequence    seq)
-    {
-        if (seq.size() != 2)
-        {
-            throw new IllegalArgumentException("Bad sequence size: "
-                    + seq.size());
-        }
-
-        notBeforeTime = DERGeneralizedTime.getInstance(seq.getObjectAt(0));
-        notAfterTime = DERGeneralizedTime.getInstance(seq.getObjectAt(1));
-    }
-
-    /**
-     * @param notBeforeTime
-     * @param notAfterTime
-     */
-    public AttCertValidityPeriod(
-        DERGeneralizedTime notBeforeTime,
-        DERGeneralizedTime notAfterTime)
-    {
-        this.notBeforeTime = notBeforeTime;
-        this.notAfterTime = notAfterTime;
-    }
-
-    public DERGeneralizedTime getNotBeforeTime()
-    {
-        return notBeforeTime;
-    }
-
-    public DERGeneralizedTime getNotAfterTime()
-    {
-        return notAfterTime;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     *  AttCertValidityPeriod  ::= SEQUENCE {
-     *       notBeforeTime  GeneralizedTime,
-     *       notAfterTime   GeneralizedTime
-     *  } 
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(notBeforeTime);
-        v.add(notAfterTime);
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/Attribute.java b/azureus2/src/org/bouncycastle/asn1/x509/Attribute.java
deleted file mode 100644
index c8cbcf7..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/Attribute.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1Set;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-
-public class Attribute
-    extends ASN1Encodable
-{
-    private DERObjectIdentifier attrType;
-    private ASN1Set             attrValues;
-
-    /**
-     * return an Attribute object from the given object.
-     *
-     * @param o the object we want converted.
-     * @exception IllegalArgumentException if the object cannot be converted.
-     */
-    public static Attribute getInstance(
-        Object o)
-    {
-        if (o == null || o instanceof Attribute)
-        {
-            return (Attribute)o;
-        }
-        
-        if (o instanceof ASN1Sequence)
-        {
-            return new Attribute((ASN1Sequence)o);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-    
-    public Attribute(
-        ASN1Sequence seq)
-    {
-        if (seq.size() != 2)
-        {
-            throw new IllegalArgumentException("Bad sequence size: " + seq.size());
-        }
-
-        attrType = DERObjectIdentifier.getInstance(seq.getObjectAt(0));
-        attrValues = ASN1Set.getInstance(seq.getObjectAt(1));
-    }
-
-    public Attribute(
-        DERObjectIdentifier attrType,
-        ASN1Set             attrValues)
-    {
-        this.attrType = attrType;
-        this.attrValues = attrValues;
-    }
-
-    public DERObjectIdentifier getAttrType()
-    {
-        return attrType;
-    }
-    
-    public ASN1Set getAttrValues()
-    {
-        return attrValues;
-    }
-
-    /** 
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     * Attribute ::= SEQUENCE {
-     *     attrType OBJECT IDENTIFIER,
-     *     attrValues SET OF AttributeValue
-     * }
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        v.add(attrType);
-        v.add(attrValues);
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/AttributeCertificate.java b/azureus2/src/org/bouncycastle/asn1/x509/AttributeCertificate.java
deleted file mode 100644
index 6dcb7c6..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/AttributeCertificate.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-public class AttributeCertificate
-    extends ASN1Encodable
-{
-    AttributeCertificateInfo    acinfo;
-    AlgorithmIdentifier         signatureAlgorithm;
-    DERBitString                signatureValue;
-
-    /**
-     * @param obj
-     * @return an AttributeCertificate object
-     */
-    public static AttributeCertificate getInstance(Object obj)
-    {
-        if (obj instanceof AttributeCertificate)
-        {
-            return (AttributeCertificate)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new AttributeCertificate((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-    
-    public AttributeCertificate(
-        AttributeCertificateInfo    acinfo,
-        AlgorithmIdentifier         signatureAlgorithm,
-        DERBitString                signatureValue)
-    {
-        this.acinfo = acinfo;
-        this.signatureAlgorithm = signatureAlgorithm;
-        this.signatureValue = signatureValue;
-    }
-    
-    public AttributeCertificate(
-        ASN1Sequence    seq)
-    {
-        if (seq.size() != 3)
-        {
-            throw new IllegalArgumentException("Bad sequence size: "
-                    + seq.size());
-        }
-
-        this.acinfo = AttributeCertificateInfo.getInstance(seq.getObjectAt(0));
-        this.signatureAlgorithm = AlgorithmIdentifier.getInstance(seq.getObjectAt(1));
-        this.signatureValue = DERBitString.getInstance(seq.getObjectAt(2));
-    }
-    
-    public AttributeCertificateInfo getAcinfo()
-    {
-        return acinfo;
-    }
-
-    public AlgorithmIdentifier getSignatureAlgorithm()
-    {
-        return signatureAlgorithm;
-    }
-
-    public DERBitString getSignatureValue()
-    {
-        return signatureValue;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     *  AttributeCertificate ::= SEQUENCE {
-     *       acinfo               AttributeCertificateInfo,
-     *       signatureAlgorithm   AlgorithmIdentifier,
-     *       signatureValue       BIT STRING
-     *  }
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(acinfo);
-        v.add(signatureAlgorithm);
-        v.add(signatureValue);
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/AttributeCertificateInfo.java b/azureus2/src/org/bouncycastle/asn1/x509/AttributeCertificateInfo.java
deleted file mode 100644
index 74770f5..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/AttributeCertificateInfo.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-public class AttributeCertificateInfo
-    extends ASN1Encodable
-{
-    private DERInteger              version;
-    private Holder                  holder;
-    private AttCertIssuer           issuer;
-    private AlgorithmIdentifier     signature;
-    private DERInteger              serialNumber;
-    private AttCertValidityPeriod   attrCertValidityPeriod;
-    private ASN1Sequence            attributes;
-    private DERBitString            issuerUniqueID;
-    private X509Extensions          extensions;
-
-    public static AttributeCertificateInfo getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static AttributeCertificateInfo getInstance(
-        Object  obj)
-    {
-        if (obj instanceof AttributeCertificateInfo)
-        {
-            return (AttributeCertificateInfo)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new AttributeCertificateInfo((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    public AttributeCertificateInfo(
-        ASN1Sequence   seq)
-    {
-        if (seq.size() < 7 || seq.size() > 9)
-        {
-            throw new IllegalArgumentException("Bad sequence size: " + seq.size());
-        }
-
-        this.version = DERInteger.getInstance(seq.getObjectAt(0));
-        this.holder = Holder.getInstance(seq.getObjectAt(1));
-        this.issuer = AttCertIssuer.getInstance(seq.getObjectAt(2));
-        this.signature = AlgorithmIdentifier.getInstance(seq.getObjectAt(3));
-        this.serialNumber = DERInteger.getInstance(seq.getObjectAt(4));
-        this.attrCertValidityPeriod = AttCertValidityPeriod.getInstance(seq.getObjectAt(5));
-        this.attributes = ASN1Sequence.getInstance(seq.getObjectAt(6));
-        
-        for (int i = 7; i < seq.size(); i++)
-        {
-            ASN1Encodable    obj = (ASN1Encodable)seq.getObjectAt(i);
-
-            if (obj instanceof DERBitString)
-            {
-                this.issuerUniqueID = DERBitString.getInstance(seq.getObjectAt(i));
-            }
-            else if (obj instanceof ASN1Sequence || obj instanceof X509Extensions)
-            {
-                this.extensions = X509Extensions.getInstance(seq.getObjectAt(i));
-            }
-        }
-    }
-    
-    public DERInteger getVersion()
-    {
-        return version;
-    }
-
-    public Holder getHolder()
-    {
-        return holder;
-    }
-
-    public AttCertIssuer getIssuer()
-    {
-        return issuer;
-    }
-
-    public AlgorithmIdentifier getSignature()
-    {
-        return signature;
-    }
-
-    public DERInteger getSerialNumber()
-    {
-        return serialNumber;
-    }
-
-    public AttCertValidityPeriod getAttrCertValidityPeriod()
-    {
-        return attrCertValidityPeriod;
-    }
-
-    public ASN1Sequence getAttributes()
-    {
-        return attributes;
-    }
-
-    public DERBitString getIssuerUniqueID()
-    {
-        return issuerUniqueID;
-    }
-
-    public X509Extensions getExtensions()
-    {
-        return extensions;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     *  AttributeCertificateInfo ::= SEQUENCE {
-     *       version              AttCertVersion -- version is v2,
-     *       holder               Holder,
-     *       issuer               AttCertIssuer,
-     *       signature            AlgorithmIdentifier,
-     *       serialNumber         CertificateSerialNumber,
-     *       attrCertValidityPeriod   AttCertValidityPeriod,
-     *       attributes           SEQUENCE OF Attribute,
-     *       issuerUniqueID       UniqueIdentifier OPTIONAL,
-     *       extensions           Extensions OPTIONAL
-     *  }
-     *
-     *  AttCertVersion ::= INTEGER { v2(1) }
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(version);
-        v.add(holder);
-        v.add(issuer);
-        v.add(signature);
-        v.add(serialNumber);
-        v.add(attrCertValidityPeriod);
-        v.add(attributes);
-        
-        if (issuerUniqueID != null)
-        {
-            v.add(issuerUniqueID);
-        }
-        
-        if (extensions != null)
-        {
-            v.add(extensions);
-        }
-        
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/AuthorityInformationAccess.java b/azureus2/src/org/bouncycastle/asn1/x509/AuthorityInformationAccess.java
deleted file mode 100644
index c331645..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/AuthorityInformationAccess.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-
-/**
- * The AuthorityInformationAccess object.
- * <pre>
- * id-pe-authorityInfoAccess OBJECT IDENTIFIER ::= { id-pe 1 }
- *
- * AuthorityInfoAccessSyntax  ::=
- *      SEQUENCE SIZE (1..MAX) OF AccessDescription
- * AccessDescription  ::=  SEQUENCE {
- *       accessMethod          OBJECT IDENTIFIER,
- *       accessLocation        GeneralName  }
- *
- * id-ad OBJECT IDENTIFIER ::= { id-pkix 48 }
- * id-ad-caIssuers OBJECT IDENTIFIER ::= { id-ad 2 }
- * id-ad-ocsp OBJECT IDENTIFIER ::= { id-ad 1 }
- * </pre>
- */
-public class AuthorityInformationAccess
-    extends ASN1Encodable
-{
-    private AccessDescription[]    descriptions;
-
-    public static AuthorityInformationAccess getInstance(
-        Object  obj)
-    {
-        if (obj instanceof AuthorityInformationAccess)
-        {
-            return (AuthorityInformationAccess)obj;
-        }
-
-        if (obj instanceof ASN1Sequence)
-        {
-            return new AuthorityInformationAccess((ASN1Sequence)obj);
-        }
-
-        if (obj instanceof X509Extension)
-        {
-            return getInstance(X509Extension.convertValueToObject((X509Extension)obj));
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
- 
-    public AuthorityInformationAccess(
-        ASN1Sequence   seq)
-    {
-        descriptions = new AccessDescription[seq.size()];
-        
-        for (int i = 0; i != seq.size(); i++)
-        {
-            descriptions[i] = AccessDescription.getInstance(seq.getObjectAt(i));
-        }
-    }
-
-    /**
-     * create an AuthorityInformationAccess with the oid and location provided.
-     */
-    public AuthorityInformationAccess(
-        DERObjectIdentifier oid,
-        GeneralName location)
-    {
-        descriptions = new AccessDescription[1];
-        
-        descriptions[0] = new AccessDescription(oid, location);
-    }
-
-
-    /**
-     * 
-     * @return the access descriptions contained in this object.
-     */
-    public AccessDescription[] getAccessDescriptions()
-    {
-        return descriptions;
-    }
-    
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector vec = new ASN1EncodableVector();
-        
-        for (int i = 0; i != descriptions.length; i++)
-        {
-            vec.add(descriptions[i]);
-        }
-        
-        return new DERSequence(vec);
-    }
-
-    public String toString()
-    {
-        return ("AuthorityInformationAccess: Oid(" + this.descriptions[0].getAccessMethod().getId() + ")");
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/AuthorityKeyIdentifier.java b/azureus2/src/org/bouncycastle/asn1/x509/AuthorityKeyIdentifier.java
deleted file mode 100644
index 4ef5490..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/AuthorityKeyIdentifier.java
+++ /dev/null
@@ -1,231 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-import org.bouncycastle.crypto.Digest;
-import org.bouncycastle.crypto.digests.SHA1Digest;
-
-import java.math.BigInteger;
-import java.util.Enumeration;
-
-/**
- * The AuthorityKeyIdentifier object.
- * <pre>
- * id-ce-authorityKeyIdentifier OBJECT IDENTIFIER ::=  { id-ce 35 }
- *
- *   AuthorityKeyIdentifier ::= SEQUENCE {
- *      keyIdentifier             [0] IMPLICIT KeyIdentifier           OPTIONAL,
- *      authorityCertIssuer       [1] IMPLICIT GeneralNames            OPTIONAL,
- *      authorityCertSerialNumber [2] IMPLICIT CertificateSerialNumber OPTIONAL  }
- *
- *   KeyIdentifier ::= OCTET STRING
- * </pre>
- *
- */
-public class AuthorityKeyIdentifier
-    extends ASN1Encodable
-{
-    ASN1OctetString keyidentifier=null;
-    GeneralNames certissuer=null;
-    DERInteger certserno=null;
-
-    public static AuthorityKeyIdentifier getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static AuthorityKeyIdentifier getInstance(
-        Object  obj)
-    {
-        if (obj instanceof AuthorityKeyIdentifier)
-        {
-            return (AuthorityKeyIdentifier)obj;
-        }
-        if (obj instanceof ASN1Sequence)
-        {
-            return new AuthorityKeyIdentifier((ASN1Sequence)obj);
-        }
-        if (obj instanceof X509Extension)
-        {
-            return getInstance(X509Extension.convertValueToObject((X509Extension)obj));
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    public AuthorityKeyIdentifier(
-        ASN1Sequence   seq)
-    {
-        Enumeration     e = seq.getObjects();
-
-        while (e.hasMoreElements())
-        {
-            ASN1TaggedObject o = DERTaggedObject.getInstance(e.nextElement());
-
-            switch (o.getTagNo())
-            {
-            case 0:
-                this.keyidentifier = ASN1OctetString.getInstance(o, false);
-                break;
-            case 1:
-                this.certissuer = GeneralNames.getInstance(o, false);
-                break;
-            case 2:
-                this.certserno = DERInteger.getInstance(o, false);
-                break;
-            default:
-                throw new IllegalArgumentException("illegal tag");
-            }
-        }
-    }
-
-    /**
-     *
-     * Calulates the keyidentifier using a SHA1 hash over the BIT STRING
-     * from SubjectPublicKeyInfo as defined in RFC2459.
-     *
-     * Example of making a AuthorityKeyIdentifier:
-     * <pre>
-     *   SubjectPublicKeyInfo apki = new SubjectPublicKeyInfo((ASN1Sequence)new ASN1InputStream(
-     *       publicKey.getEncoded()).readObject());
-     *   AuthorityKeyIdentifier aki = new AuthorityKeyIdentifier(apki);
-     * </pre>
-     *
-     **/
-    public AuthorityKeyIdentifier(
-        SubjectPublicKeyInfo    spki)
-    {
-        Digest  digest = new SHA1Digest();
-        byte[]  resBuf = new byte[digest.getDigestSize()];
-
-        byte[] bytes = spki.getPublicKeyData().getBytes();
-        digest.update(bytes, 0, bytes.length);
-        digest.doFinal(resBuf, 0);
-        this.keyidentifier = new DEROctetString(resBuf);
-    }
-
-    /**
-     * create an AuthorityKeyIdentifier with the GeneralNames tag and
-     * the serial number provided as well.
-     */
-    public AuthorityKeyIdentifier(
-        SubjectPublicKeyInfo    spki,
-        GeneralNames            name,
-        BigInteger              serialNumber)
-    {
-        Digest  digest = new SHA1Digest();
-        byte[]  resBuf = new byte[digest.getDigestSize()];
-
-        byte[] bytes = spki.getPublicKeyData().getBytes();
-        digest.update(bytes, 0, bytes.length);
-        digest.doFinal(resBuf, 0);
-
-        this.keyidentifier = new DEROctetString(resBuf);
-        this.certissuer = GeneralNames.getInstance(name.toASN1Object());
-        this.certserno = new DERInteger(serialNumber);
-    }
-
-    /**
-     * create an AuthorityKeyIdentifier with the GeneralNames tag and
-     * the serial number provided.
-     */
-    public AuthorityKeyIdentifier(
-        GeneralNames            name,
-        BigInteger              serialNumber)
-    {
-        this.keyidentifier = null;
-        this.certissuer = GeneralNames.getInstance(name.toASN1Object());
-        this.certserno = new DERInteger(serialNumber);
-    }
-
-    /**
-      * create an AuthorityKeyIdentifier with a precomupted key identifier
-      */
-     public AuthorityKeyIdentifier(
-         byte[]                  keyIdentifier)
-     {
-         this.keyidentifier = new DEROctetString(keyIdentifier);
-         this.certissuer = null;
-         this.certserno = null;
-     }
-
-    /**
-     * create an AuthorityKeyIdentifier with a precomupted key identifier
-     * and the GeneralNames tag and the serial number provided as well.
-     */
-    public AuthorityKeyIdentifier(
-        byte[]                  keyIdentifier,
-        GeneralNames            name,
-        BigInteger              serialNumber)
-    {
-        this.keyidentifier = new DEROctetString(keyIdentifier);
-        this.certissuer = GeneralNames.getInstance(name.toASN1Object());
-        this.certserno = new DERInteger(serialNumber);
-    }
-    
-    public byte[] getKeyIdentifier()
-    {
-        if (keyidentifier != null)
-        {
-            return keyidentifier.getOctets();
-        }
-
-        return null;
-    }
-
-    public GeneralNames getAuthorityCertIssuer()
-    {
-        return certissuer;
-    }
-    
-    public BigInteger getAuthorityCertSerialNumber()
-    {
-        if (certserno != null)
-        {
-            return certserno.getValue();
-        }
-        
-        return null;
-    }
-    
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        if (keyidentifier != null)
-        {
-            v.add(new DERTaggedObject(false, 0, keyidentifier));
-        }
-
-        if (certissuer != null)
-        {
-            v.add(new DERTaggedObject(false, 1, certissuer));
-        }
-
-        if (certserno != null)
-        {
-            v.add(new DERTaggedObject(false, 2, certserno));
-        }
-
-
-        return new DERSequence(v);
-    }
-
-    public String toString()
-    {
-        return ("AuthorityKeyIdentifier: KeyID(" + this.keyidentifier.getOctets() + ")");
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/BasicConstraints.java b/azureus2/src/org/bouncycastle/asn1/x509/BasicConstraints.java
deleted file mode 100644
index 839a747..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/BasicConstraints.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERBoolean;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-import java.math.BigInteger;
-
-public class BasicConstraints
-    extends ASN1Encodable
-{
-    DERBoolean  cA = new DERBoolean(false);
-    DERInteger  pathLenConstraint = null;
-
-    public static BasicConstraints getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static BasicConstraints getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof BasicConstraints)
-        {
-            return (BasicConstraints)obj;
-        }
-
-        if (obj instanceof ASN1Sequence)
-        {
-            return new BasicConstraints((ASN1Sequence)obj);
-        }
-
-        if (obj instanceof X509Extension)
-        {
-            return getInstance(X509Extension.convertValueToObject((X509Extension)obj));
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-    
-    public BasicConstraints(
-        ASN1Sequence   seq)
-    {
-        if (seq.size() == 0)
-        {
-            this.cA = null;
-            this.pathLenConstraint = null;
-        }
-        else
-        {
-            if (seq.getObjectAt(0) instanceof DERBoolean)
-            {
-                this.cA = DERBoolean.getInstance(seq.getObjectAt(0));
-            }
-            else
-            {
-                this.cA = null;
-                this.pathLenConstraint = DERInteger.getInstance(seq.getObjectAt(0));
-            }
-            if (seq.size() > 1)
-            {
-                if (this.cA != null)
-                {
-                    this.pathLenConstraint = DERInteger.getInstance(seq.getObjectAt(1));
-                }
-                else
-                {
-                    throw new IllegalArgumentException("wrong sequence in constructor");
-                }
-            }
-        }
-    }
-
-    /**
-     * @deprecated use one of the other two unambigous constructors.
-     * @param cA
-     * @param pathLenConstraint
-     */
-    public BasicConstraints(
-        boolean cA,
-        int     pathLenConstraint)
-    {
-        if (cA)
-        {
-            this.cA = new DERBoolean(cA);
-            this.pathLenConstraint = new DERInteger(pathLenConstraint);
-        }
-        else
-        {
-            this.cA = null;
-            this.pathLenConstraint = null;
-        }
-    }
-
-    public BasicConstraints(
-        boolean cA)
-    {
-        if (cA)
-        {
-            this.cA = new DERBoolean(true);
-        }
-        else
-        {
-            this.cA = null;
-        }
-        this.pathLenConstraint = null;
-    }
-
-    /**
-     * create a cA=true object for the given path length constraint.
-     * 
-     * @param pathLenConstraint
-     */
-    public BasicConstraints(
-        int     pathLenConstraint)
-    {
-        this.cA = new DERBoolean(true);
-        this.pathLenConstraint = new DERInteger(pathLenConstraint);
-    }
-
-    public boolean isCA()
-    {
-        return (cA != null) && cA.isTrue();
-    }
-
-    public BigInteger getPathLenConstraint()
-    {
-        if (pathLenConstraint != null)
-        {
-            return pathLenConstraint.getValue();
-        }
-
-        return null;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     * BasicConstraints := SEQUENCE {
-     *    cA                  BOOLEAN DEFAULT FALSE,
-     *    pathLenConstraint   INTEGER (0..MAX) OPTIONAL
-     * }
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        if (cA != null)
-        {
-            v.add(cA);
-        }
-
-        if (pathLenConstraint != null)  // yes some people actually do this when cA is false...
-        {
-            v.add(pathLenConstraint);
-        }
-
-        return new DERSequence(v);
-    }
-
-    public String toString()
-    {
-        if (pathLenConstraint == null)
-        {
-            if (cA == null)
-            {
-                return "BasicConstraints: isCa(false)";
-            }
-            return "BasicConstraints: isCa(" + this.isCA() + ")";
-        }
-        return "BasicConstraints: isCa(" + this.isCA() + "), pathLenConstraint = " + pathLenConstraint.getValue();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/CRLDistPoint.java b/azureus2/src/org/bouncycastle/asn1/x509/CRLDistPoint.java
deleted file mode 100644
index 0eecc6a..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/CRLDistPoint.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-public class CRLDistPoint
-    extends ASN1Encodable
-{
-    ASN1Sequence  seq = null;
-
-    public static CRLDistPoint getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static CRLDistPoint getInstance(
-        Object  obj)
-    {
-        if (obj instanceof CRLDistPoint || obj == null)
-        {
-            return (CRLDistPoint)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new CRLDistPoint((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    public CRLDistPoint(
-        ASN1Sequence seq)
-    {
-        this.seq = seq;
-    }
-    
-    public CRLDistPoint(
-        DistributionPoint[] points)
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        for (int i = 0; i != points.length; i++)
-        {
-            v.add(points[i]);
-        }
-
-        seq = new DERSequence(v);
-    }
-
-    /**
-     * Return the distribution points making up the sequence.
-     * 
-     * @return DistributionPoint[]
-     */
-    public DistributionPoint[] getDistributionPoints()
-    {
-        DistributionPoint[]    dp = new DistributionPoint[seq.size()];
-        
-        for (int i = 0; i != seq.size(); i++)
-        {
-            dp[i] = DistributionPoint.getInstance(seq.getObjectAt(i));
-        }
-        
-        return dp;
-    }
-    
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     * CRLDistPoint ::= SEQUENCE SIZE {1..MAX} OF DistributionPoint
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        return seq;
-    }
-
-    public String toString()
-    {
-        StringBuffer buf = new StringBuffer();
-        String       sep = System.getProperty("line.separator");
-
-        buf.append("CRLDistPoint:");
-        buf.append(sep);
-        DistributionPoint dp[] = getDistributionPoints();
-        for (int i = 0; i != dp.length; i++)
-        {
-            buf.append("    ");
-            buf.append(dp[i]);
-            buf.append(sep);
-        }
-        return buf.toString();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/CRLNumber.java b/azureus2/src/org/bouncycastle/asn1/x509/CRLNumber.java
deleted file mode 100644
index 5c74abf..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/CRLNumber.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.DERInteger;
-
-import java.math.BigInteger;
-
-/**
- * The CRLNumber object.
- * <pre>
- * CRLNumber::= INTEGER(0..MAX)
- * </pre>
- */
-public class CRLNumber
-    extends DERInteger
-{
-
-    public CRLNumber(
-        BigInteger number)
-    {
-        super(number);
-    }
-
-    public BigInteger getCRLNumber()
-    {
-        return getPositiveValue();
-    }
-
-    public String toString()
-    {
-        return "CRLNumber: " + getCRLNumber();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/CRLReason.java b/azureus2/src/org/bouncycastle/asn1/x509/CRLReason.java
deleted file mode 100644
index dfbccda..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/CRLReason.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.DEREnumerated;
-
-/**
- * The CRLReason enumeration.
- * <pre>
- * CRLReason ::= ENUMERATED {
- *  unspecified             (0),
- *  keyCompromise           (1),
- *  cACompromise            (2),
- *  affiliationChanged      (3),
- *  superseded              (4),
- *  cessationOfOperation    (5),
- *  certificateHold         (6),
- *  removeFromCRL           (8),
- *  privilegeWithdrawn      (9),
- *  aACompromise           (10)
- * }
- * </pre>
- */
-public class CRLReason
-    extends DEREnumerated
-{
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int UNSPECIFIED = 0;
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int KEY_COMPROMISE = 1;
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int CA_COMPROMISE = 2;
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int AFFILIATION_CHANGED = 3;
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int SUPERSEDED = 4;
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int CESSATION_OF_OPERATION  = 5;
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int CERTIFICATE_HOLD = 6;
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int REMOVE_FROM_CRL = 8;
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int PRIVILEGE_WITHDRAWN = 9;
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int AA_COMPROMISE = 10;
-
-    public static final int unspecified = 0;
-    public static final int keyCompromise = 1;
-    public static final int cACompromise = 2;
-    public static final int affiliationChanged = 3;
-    public static final int superseded = 4;
-    public static final int cessationOfOperation  = 5;
-    public static final int certificateHold = 6;
-    // 7 -> unknown
-    public static final int removeFromCRL = 8;
-    public static final int privilegeWithdrawn = 9;
-    public static final int aACompromise = 10;
-
-    private static final String[] reasonString =
-    {
-        "unspecified", "keyCompromise", "cACompromise", "affiliationChanged",
-        "superseded", "cessationOfOperation", "certificateHold", "unknown",
-        "removeFromCRL", "privilegeWithdrawn", "aACompromise"
-    };
-
-    public CRLReason(
-        int reason)
-    {
-        super(reason);
-    }
-
-    public CRLReason(
-        DEREnumerated reason)
-    {
-        super(reason.getValue().intValue());
-    }
-
-    public String toString()
-    {
-        String str;
-        int reason = getValue().intValue();
-        if (reason < 0 || reason > 10)
-        {
-            str = "invalid";
-        }
-        else
-        {
-            str = reasonString[reason];
-        }
-        return "CRLReason: " + str;
-    }    
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/CertPolicyId.java b/azureus2/src/org/bouncycastle/asn1/x509/CertPolicyId.java
deleted file mode 100644
index 3e85dbd..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/CertPolicyId.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.DERObjectIdentifier;
-
-
-/**
- * CertPolicyId, used in the CertificatePolicies and PolicyMappings
- * X509V3 Extensions.
- *
- * <pre>
- *     CertPolicyId ::= OBJECT IDENTIFIER
- * </pre>
- */
-public class CertPolicyId extends DERObjectIdentifier 
-{
-   public CertPolicyId (String id) 
-   {
-     super(id);
-   }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/CertificateList.java b/azureus2/src/org/bouncycastle/asn1/x509/CertificateList.java
deleted file mode 100644
index c7f890b..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/CertificateList.java
+++ /dev/null
@@ -1,119 +0,0 @@
-
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-/**
- * PKIX RFC-2459
- *
- * The X.509 v2 CRL syntax is as follows.  For signature calculation,
- * the data that is to be signed is ASN.1 DER encoded.
- *
- * <pre>
- * CertificateList  ::=  SEQUENCE  {
- *      tbsCertList          TBSCertList,
- *      signatureAlgorithm   AlgorithmIdentifier,
- *      signatureValue       BIT STRING  }
- * </pre>
- */
-public class CertificateList
-    extends ASN1Encodable
-{
-    TBSCertList            tbsCertList;
-    AlgorithmIdentifier    sigAlgId;
-    DERBitString           sig;
-
-    public static CertificateList getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static CertificateList getInstance(
-        Object  obj)
-    {
-        if (obj instanceof CertificateList)
-        {
-            return (CertificateList)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new CertificateList((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    public CertificateList(
-        ASN1Sequence seq)
-    {
-        if (seq.size() == 3)
-        {
-            tbsCertList = TBSCertList.getInstance(seq.getObjectAt(0));
-            sigAlgId = AlgorithmIdentifier.getInstance(seq.getObjectAt(1));
-            sig = DERBitString.getInstance(seq.getObjectAt(2));
-        }
-        else
-        {
-            throw new IllegalArgumentException("sequence wrong size for CertificateList");
-        }
-    }
-
-    public TBSCertList getTBSCertList()
-    {
-        return tbsCertList;
-    }
-
-    public TBSCertList.CRLEntry[] getRevokedCertificates()
-    {
-        return tbsCertList.getRevokedCertificates();
-    }
-
-    public AlgorithmIdentifier getSignatureAlgorithm()
-    {
-        return sigAlgId;
-    }
-
-    public DERBitString getSignature()
-    {
-        return sig;
-    }
-
-    public int getVersion()
-    {
-        return tbsCertList.getVersion();
-    }
-
-    public X509Name getIssuer()
-    {
-        return tbsCertList.getIssuer();
-    }
-
-    public Time getThisUpdate()
-    {
-        return tbsCertList.getThisUpdate();
-    }
-
-    public Time getNextUpdate()
-    {
-        return tbsCertList.getNextUpdate();
-    }
-
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        v.add(tbsCertList);
-        v.add(sigAlgId);
-        v.add(sig);
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/CertificatePair.java b/azureus2/src/org/bouncycastle/asn1/x509/CertificatePair.java
deleted file mode 100644
index bd9d25c..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/CertificatePair.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-
-import java.util.Enumeration;
-
-/**
- * This class helps to support crossCerfificatePairs in a LDAP directory
- * according RFC 2587
- * 
- * <pre>
- *     crossCertificatePairATTRIBUTE::={
- *       WITH SYNTAX   CertificatePair
- *       EQUALITY MATCHING RULE certificatePairExactMatch
- *       ID joint-iso-ccitt(2) ds(5) attributeType(4) crossCertificatePair(40)}
- * </pre>
- * 
- * <blockquote> The forward elements of the crossCertificatePair attribute of a
- * CA's directory entry shall be used to store all, except self-issued
- * certificates issued to this CA. Optionally, the reverse elements of the
- * crossCertificatePair attribute, of a CA's directory entry may contain a
- * subset of certificates issued by this CA to other CAs. When both the forward
- * and the reverse elements are present in a single attribute value, issuer name
- * in one certificate shall match the subject name in the other and vice versa,
- * and the subject public key in one certificate shall be capable of verifying
- * the digital signature on the other certificate and vice versa.
- * 
- * When a reverse element is present, the forward element value and the reverse
- * element value need not be stored in the same attribute value; in other words,
- * they can be stored in either a single attribute value or two attribute
- * values. </blockquote>
- * 
- * <pre>
- *       CertificatePair ::= SEQUENCE {
- *         forward        [0]    Certificate OPTIONAL,
- *         reverse        [1]    Certificate OPTIONAL,
- *         -- at least one of the pair shall be present -- } 
- * </pre>
- */
-public class CertificatePair
-    extends ASN1Encodable
-{
-    private X509CertificateStructure forward;
-
-    private X509CertificateStructure reverse;
-
-    public static CertificatePair getInstance(Object obj)
-    {
-        if (obj == null || obj instanceof CertificatePair)
-        {
-            return (CertificatePair)obj;
-        }
-
-        if (obj instanceof ASN1Sequence)
-        {
-            return new CertificatePair((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: "
-            + obj.getClass().getName());
-    }
-
-    /**
-     * Constructor from ASN1Sequence.
-     * <p/>
-     * The sequence is of type CertificatePair:
-     * <p/>
-     * <pre>
-     *       CertificatePair ::= SEQUENCE {
-     *         forward        [0]    Certificate OPTIONAL,
-     *         reverse        [1]    Certificate OPTIONAL,
-     *         -- at least one of the pair shall be present -- }
-     * </pre>
-     *
-     * @param seq The ASN.1 sequence.
-     */
-    private CertificatePair(ASN1Sequence seq)
-    {
-        if (seq.size() != 1 && seq.size() != 2)
-        {
-            throw new IllegalArgumentException("Bad sequence size: "
-                + seq.size());
-        }
-
-        Enumeration e = seq.getObjects();
-
-        while (e.hasMoreElements())
-        {
-            ASN1TaggedObject o = ASN1TaggedObject.getInstance(e.nextElement());
-            if (o.getTagNo() == 0)
-            {
-                forward = X509CertificateStructure.getInstance(o, true);
-            }
-            else if (o.getTagNo() == 1)
-            {
-                reverse = X509CertificateStructure.getInstance(o, true);
-            }
-            else
-            {
-                throw new IllegalArgumentException("Bad tag number: "
-                    + o.getTagNo());
-            }
-        }
-    }
-
-    /**
-     * Constructor from a given details.
-     *
-     * @param forward Certificates issued to this CA.
-     * @param reverse Certificates issued by this CA to other CAs.
-     */
-    public CertificatePair(X509CertificateStructure forward, X509CertificateStructure reverse)
-    {
-        this.forward = forward;
-        this.reverse = reverse;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <p/>
-     * Returns:
-     * <p/>
-     * <pre>
-     *       CertificatePair ::= SEQUENCE {
-     *         forward        [0]    Certificate OPTIONAL,
-     *         reverse        [1]    Certificate OPTIONAL,
-     *         -- at least one of the pair shall be present -- }
-     * </pre>
-     *
-     * @return a DERObject
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector vec = new ASN1EncodableVector();
-
-        if (forward != null)
-        {
-            vec.add(new DERTaggedObject(0, forward));
-        }
-        if (reverse != null)
-        {
-            vec.add(new DERTaggedObject(1, reverse));
-        }
-
-        return new DERSequence(vec);
-    }
-
-    /**
-     * @return Returns the forward.
-     */
-    public X509CertificateStructure getForward()
-    {
-        return forward;
-    }
-
-    /**
-     * @return Returns the reverse.
-     */
-    public X509CertificateStructure getReverse()
-    {
-        return reverse;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/CertificatePolicies.java b/azureus2/src/org/bouncycastle/asn1/x509/CertificatePolicies.java
deleted file mode 100644
index b59e08e..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/CertificatePolicies.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import java.util.Enumeration;
-import java.util.Vector;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-
-public class CertificatePolicies
-    extends ASN1Encodable
-{
-    static final DERObjectIdentifier anyPolicy = new DERObjectIdentifier("2.5.29.32.0");
-
-    Vector policies = new Vector();
-
-/**
- * @deprecated use an ASN1Sequence of PolicyInformation
- */
-    public static CertificatePolicies getInstance(
-        ASN1TaggedObject obj,
-        boolean explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-/**
- * @deprecated use an ASN1Sequence of PolicyInformation
- */
-    public static CertificatePolicies getInstance(
-        Object  obj)
-    {
-        if (obj instanceof CertificatePolicies)
-        {
-            return (CertificatePolicies)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new CertificatePolicies((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-/**
- * @deprecated use an ASN1Sequence of PolicyInformation
- */
-    public CertificatePolicies(
-        ASN1Sequence   seq)
-    {
-        Enumeration e = seq.getObjects();
-        while (e.hasMoreElements())
-        {
-            ASN1Sequence s = ASN1Sequence.getInstance(e.nextElement());
-            policies.addElement(s.getObjectAt(0));
-        }
-        // For now we just don't handle PolicyQualifiers
-    }
-
-    /**
-     * create a certificate policy with the given OID.
-     * @deprecated use an ASN1Sequence of PolicyInformation
-     */
-    public CertificatePolicies(
-        DERObjectIdentifier p)
-    {
-        policies.addElement(p);
-    }
-
-    /**
-     * create a certificate policy with the policy given by the OID represented
-     * by the string p.
-     * @deprecated use an ASN1Sequence of PolicyInformation
-     */
-    public CertificatePolicies(
-        String p)
-    {
-        this(new DERObjectIdentifier(p));
-    }
-
-    public void addPolicy(
-        String p)
-    {
-        policies.addElement(new DERObjectIdentifier(p));
-    }
-
-    public String getPolicy(int nr)
-    {
-        if (policies.size() > nr)
-        {
-            return ((DERObjectIdentifier)policies.elementAt(nr)).getId();
-        }
-        
-        return null;
-    }
-
-    /**
-     * <pre>
-     * certificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation
-     *
-     * PolicyInformation ::= SEQUENCE {
-     *   policyIdentifier   CertPolicyId,
-     *   policyQualifiers   SEQUENCE SIZE (1..MAX) OF
-     *                           PolicyQualifierInfo OPTIONAL }
-     *
-     * CertPolicyId ::= OBJECT IDENTIFIER
-     *
-     * PolicyQualifierInfo ::= SEQUENCE {
-     *   policyQualifierId  PolicyQualifierId,
-     *   qualifier          ANY DEFINED BY policyQualifierId }
-     *
-     * PolicyQualifierId ::=
-     *   OBJECT IDENTIFIER (id-qt-cps | id-qt-unotice)
-     * </pre>
-     * @deprecated use an ASN1Sequence of PolicyInformation
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        // We only do policyIdentifier yet...
-        for (int i=0;i<policies.size();i++)
-        {
-            v.add(new DERSequence((DERObjectIdentifier)policies.elementAt(i)));
-        }
-
-        return new DERSequence(v);
-    }
-
-    public String toString()
-    {
-        String p = null;
-        for (int i=0;i<policies.size();i++)
-        {
-            if (p != null)
-            {
-                p += ", ";
-            }
-            p += ((DERObjectIdentifier)policies.elementAt(i)).getId();
-        }
-        return "CertificatePolicies: "+p;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/DSAParameter.java b/azureus2/src/org/bouncycastle/asn1/x509/DSAParameter.java
deleted file mode 100644
index 50822d6..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/DSAParameter.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import java.math.BigInteger;
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-public class DSAParameter
-    extends ASN1Encodable
-{
-    DERInteger      p, q, g;
-
-    public static DSAParameter getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static DSAParameter getInstance(
-        Object obj)
-    {
-        if(obj == null || obj instanceof DSAParameter) 
-        {
-            return (DSAParameter)obj;
-        }
-        
-        if(obj instanceof ASN1Sequence) 
-        {
-            return new DSAParameter((ASN1Sequence)obj);
-        }
-        
-        throw new IllegalArgumentException("Invalid DSAParameter: " + obj.getClass().getName());
-    }
-
-    public DSAParameter(
-        BigInteger  p,
-        BigInteger  q,
-        BigInteger  g)
-    {
-        this.p = new DERInteger(p);
-        this.q = new DERInteger(q);
-        this.g = new DERInteger(g);
-    }
-
-    public DSAParameter(
-        ASN1Sequence  seq)
-    {
-        if (seq.size() != 3)
-        {
-            throw new IllegalArgumentException("Bad sequence size: " + seq.size());
-        }
-        
-        Enumeration     e = seq.getObjects();
-
-        p = DERInteger.getInstance(e.nextElement());
-        q = DERInteger.getInstance(e.nextElement());
-        g = DERInteger.getInstance(e.nextElement());
-    }
-
-    public BigInteger getP()
-    {
-        return p.getPositiveValue();
-    }
-
-    public BigInteger getQ()
-    {
-        return q.getPositiveValue();
-    }
-
-    public BigInteger getG()
-    {
-        return g.getPositiveValue();
-    }
-
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(p);
-        v.add(q);
-        v.add(g);
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/DigestInfo.java b/azureus2/src/org/bouncycastle/asn1/x509/DigestInfo.java
deleted file mode 100644
index 882e71e..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/DigestInfo.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.DERSequence;
-
-/**
- * The DigestInfo object.
- * <pre>
- * DigestInfo::=SEQUENCE{
- *          digestAlgorithm  AlgorithmIdentifier,
- *          digest OCTET STRING }
- * </pre>
- */
-public class DigestInfo
-    extends ASN1Encodable
-{
-    private byte[]                  digest;
-    private AlgorithmIdentifier     algId;
-
-    public static DigestInfo getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static DigestInfo getInstance(
-        Object  obj)
-    {
-        if (obj instanceof DigestInfo)
-        {
-            return (DigestInfo)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new DigestInfo((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    public DigestInfo(
-        AlgorithmIdentifier  algId,
-        byte[]               digest)
-    {
-        this.digest = digest;
-        this.algId = algId;
-    }
-
-    public DigestInfo(
-        ASN1Sequence  obj)
-    {
-        Enumeration             e = obj.getObjects();
-
-        algId = AlgorithmIdentifier.getInstance(e.nextElement());
-        digest = ASN1OctetString.getInstance(e.nextElement()).getOctets();
-    }
-
-    public AlgorithmIdentifier getAlgorithmId()
-    {
-        return algId;
-    }
-
-    public byte[] getDigest()
-    {
-        return digest;
-    }
-
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(algId);
-        v.add(new DEROctetString(digest));
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/DisplayText.java b/azureus2/src/org/bouncycastle/asn1/x509/DisplayText.java
deleted file mode 100644
index 90b025e..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/DisplayText.java
+++ /dev/null
@@ -1,165 +0,0 @@
-
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Choice;
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERBMPString;
-import org.bouncycastle.asn1.DERIA5String;
-import org.bouncycastle.asn1.DERUTF8String;
-import org.bouncycastle.asn1.DERVisibleString;
-import org.bouncycastle.asn1.DERString;
-
-/**
- * <code>DisplayText</code> class, used in
- * <code>CertificatePolicies</code> X509 V3 extensions (in policy qualifiers).
- *
- * <p>It stores a string in a chosen encoding. 
- * <pre>
- * DisplayText ::= CHOICE {
- *      ia5String        IA5String      (SIZE (1..200)),
- *      visibleString    VisibleString  (SIZE (1..200)),
- *      bmpString        BMPString      (SIZE (1..200)),
- *      utf8String       UTF8String     (SIZE (1..200)) }
- * </pre>
- * @see PolicyQualifierInfo
- * @see PolicyInformation
- */
-public class DisplayText 
-    extends ASN1Encodable
-    implements ASN1Choice
-{
-   /**
-    * Constant corresponding to ia5String encoding. 
-    *
-    */
-   public static final int CONTENT_TYPE_IA5STRING = 0;
-   /**
-    * Constant corresponding to bmpString encoding. 
-    *
-    */
-   public static final int CONTENT_TYPE_BMPSTRING = 1;
-   /**
-    * Constant corresponding to utf8String encoding. 
-    *
-    */
-   public static final int CONTENT_TYPE_UTF8STRING = 2;
-   /**
-    * Constant corresponding to visibleString encoding. 
-    *
-    */
-   public static final int CONTENT_TYPE_VISIBLESTRING = 3;
-
-   /**
-    * Describe constant <code>DISPLAY_TEXT_MAXIMUM_SIZE</code> here.
-    *
-    */
-   public static final int DISPLAY_TEXT_MAXIMUM_SIZE = 200;
-   
-   int contentType;
-   DERString contents;
-   
-   /**
-    * Creates a new <code>DisplayText</code> instance.
-    *
-    * @param type the desired encoding type for the text. 
-    * @param text the text to store. Strings longer than 200
-    * characters are truncated. 
-    */
-   public DisplayText (int type, String text) 
-   {
-      if (text.length() > DISPLAY_TEXT_MAXIMUM_SIZE)
-      {
-         // RFC3280 limits these strings to 200 chars
-         // truncate the string
-         text = text.substring (0, DISPLAY_TEXT_MAXIMUM_SIZE);
-      }
-     
-      contentType = type;
-      switch (type)
-      {
-         case CONTENT_TYPE_IA5STRING:
-            contents = (DERString)new DERIA5String (text);
-            break;
-         case CONTENT_TYPE_UTF8STRING:
-            contents = (DERString)new DERUTF8String(text);
-            break;
-         case CONTENT_TYPE_VISIBLESTRING:
-            contents = (DERString)new DERVisibleString(text);
-            break;
-         case CONTENT_TYPE_BMPSTRING:
-            contents = (DERString)new DERBMPString(text);
-            break;
-         default:
-            contents = (DERString)new DERUTF8String(text);
-            break;
-      }
-   }
-   
-   /**
-    * Creates a new <code>DisplayText</code> instance.
-    *
-    * @param text the text to encapsulate. Strings longer than 200
-    * characters are truncated. 
-    */
-   public DisplayText (String text) 
-   {
-      // by default use UTF8String
-      if (text.length() > DISPLAY_TEXT_MAXIMUM_SIZE)
-      {
-         text = text.substring(0, DISPLAY_TEXT_MAXIMUM_SIZE);
-      }
-      
-      contentType = CONTENT_TYPE_UTF8STRING;
-      contents = new DERUTF8String(text);
-   }
-
-   /**
-    * Creates a new <code>DisplayText</code> instance.
-    * <p>Useful when reading back a <code>DisplayText</code> class
-    * from it's ASN1Encodable/DEREncodable form. 
-    *
-    * @param de a <code>DEREncodable</code> instance. 
-    */
-   public DisplayText(DERString de)
-   {
-      contents = de;
-   }
-
-   public static DisplayText getInstance(Object de) 
-   {
-      if (de instanceof DERString)
-      {
-          return new DisplayText((DERString)de);
-      }
-      else if (de instanceof DisplayText)
-      {
-          return (DisplayText)de;
-      }
-
-      throw new IllegalArgumentException("illegal object in getInstance");
-   }
-
-   public static DisplayText getInstance(
-       ASN1TaggedObject obj,
-       boolean          explicit)
-   {
-       return getInstance(obj.getObject()); // must be explicitly tagged
-   }
-   
-   public DERObject toASN1Object() 
-   {
-      return (DERObject)contents;
-   }
-
-   /**
-    * Returns the stored <code>String</code> object. 
-    *
-    * @return the stored text as a <code>String</code>. 
-    */
-   public String getString() 
-   {
-      return contents.getString();
-   }   
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/DistributionPoint.java b/azureus2/src/org/bouncycastle/asn1/x509/DistributionPoint.java
deleted file mode 100644
index e57c408..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/DistributionPoint.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-
-/**
- * The DistributionPoint object.
- * <pre>
- * DistributionPoint ::= SEQUENCE {
- *      distributionPoint [0] DistributionPointName OPTIONAL,
- *      reasons           [1] ReasonFlags OPTIONAL,
- *      cRLIssuer         [2] GeneralNames OPTIONAL
- * }
- * </pre>
- */
-public class DistributionPoint
-    extends ASN1Encodable
-{
-    DistributionPointName       distributionPoint;
-    ReasonFlags                 reasons;
-    GeneralNames                cRLIssuer;
-
-    public static DistributionPoint getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static DistributionPoint getInstance(
-        Object obj)
-    {
-        if(obj == null || obj instanceof DistributionPoint) 
-        {
-            return (DistributionPoint)obj;
-        }
-        
-        if(obj instanceof ASN1Sequence) 
-        {
-            return new DistributionPoint((ASN1Sequence)obj);
-        }
-        
-        throw new IllegalArgumentException("Invalid DistributionPoint: " + obj.getClass().getName());
-    }
-
-    public DistributionPoint(
-        ASN1Sequence seq)
-    {
-        for (int i = 0; i != seq.size(); i++)
-        {
-            ASN1TaggedObject    t = ASN1TaggedObject.getInstance(seq.getObjectAt(i));
-            switch (t.getTagNo())
-            {
-            case 0:
-                distributionPoint = DistributionPointName.getInstance(t, true);
-                break;
-            case 1:
-                reasons = new ReasonFlags(DERBitString.getInstance(t, false));
-                break;
-            case 2:
-                cRLIssuer = GeneralNames.getInstance(t, false);
-            }
-        }
-    }
-    
-    public DistributionPoint(
-        DistributionPointName distributionPoint,
-        ReasonFlags                 reasons,
-        GeneralNames            cRLIssuer)
-    {
-        this.distributionPoint = distributionPoint;
-        this.reasons = reasons;
-        this.cRLIssuer = cRLIssuer;
-    }
-    
-    public DistributionPointName getDistributionPoint()
-    {
-        return distributionPoint;
-    }
-
-    public ReasonFlags getReasons()
-    {
-        return reasons;
-    }
-    
-    public GeneralNames getCRLIssuer()
-    {
-        return cRLIssuer;
-    }
-    
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-        
-        if (distributionPoint != null)
-        {
-            //
-            // as this is a CHOICE it must be explicitly tagged
-            //
-            v.add(new DERTaggedObject(0, distributionPoint));
-        }
-
-        if (reasons != null)
-        {
-            v.add(new DERTaggedObject(false, 1, reasons));
-        }
-
-        if (cRLIssuer != null)
-        {
-            v.add(new DERTaggedObject(false, 2, cRLIssuer));
-        }
-
-        return new DERSequence(v);
-    }
-
-    public String toString()
-    {
-        String       sep = System.getProperty("line.separator");
-        StringBuffer buf = new StringBuffer();
-        buf.append("DistributionPoint: [");
-        buf.append(sep);
-        if (distributionPoint != null)
-        {
-            appendObject(buf, sep, "distributionPoint", distributionPoint.toString());
-        }
-        if (reasons != null)
-        {
-            appendObject(buf, sep, "reasons", reasons.toString());
-        }
-        if (cRLIssuer != null)
-        {
-            appendObject(buf, sep, "cRLIssuer", cRLIssuer.toString());
-        }
-        buf.append("]");
-        buf.append(sep);
-        return buf.toString();
-    }
-
-    private void appendObject(StringBuffer buf, String sep, String name, String value)
-    {
-        String       indent = "    ";
-
-        buf.append(indent);
-        buf.append(name);
-        buf.append(":");
-        buf.append(sep);
-        buf.append(indent);
-        buf.append(indent);
-        buf.append(value);
-        buf.append(sep);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/DistributionPointName.java b/azureus2/src/org/bouncycastle/asn1/x509/DistributionPointName.java
deleted file mode 100644
index 47c69a1..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/DistributionPointName.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Choice;
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1Set;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERTaggedObject;
-
-/**
- * The DistributionPointName object.
- * <pre>
- * DistributionPointName ::= CHOICE {
- *     fullName                 [0] GeneralNames,
- *     nameRelativeToCRLIssuer  [1] RelativeDistinguishedName
- * }
- * </pre>
- */
-public class DistributionPointName
-    extends ASN1Encodable
-    implements ASN1Choice
-{
-    DEREncodable        name;
-    int                 type;
-
-    public static final int FULL_NAME = 0;
-    public static final int NAME_RELATIVE_TO_CRL_ISSUER = 1;
-
-    public static DistributionPointName getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1TaggedObject.getInstance(obj, true));
-    }
-
-    public static DistributionPointName getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof DistributionPointName)
-        {
-            return (DistributionPointName)obj;
-        }
-        else if (obj instanceof ASN1TaggedObject)
-        {
-            return new DistributionPointName((ASN1TaggedObject)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    /*
-     * @deprecated use ASN1Encodable
-     */
-    public DistributionPointName(
-        int             type,
-        DEREncodable    name)
-    {
-        this.type = type;
-        this.name = name;
-    }
-
-    public DistributionPointName(
-        int             type,
-        ASN1Encodable   name)
-    {
-        this.type = type;
-        this.name = name;
-    }
-    
-    /**
-     * Return the tag number applying to the underlying choice.
-     * 
-     * @return the tag number for this point name.
-     */
-    public int getType()
-    {
-        return this.type;
-    }
-    
-    /**
-     * Return the tagged object inside the distribution point name.
-     * 
-     * @return the underlying choice item.
-     */
-    public ASN1Encodable getName()
-    {
-        return (ASN1Encodable)name;
-    }
-    
-    public DistributionPointName(
-        ASN1TaggedObject    obj)
-    {
-        this.type = obj.getTagNo();
-        
-        if (type == 0)
-        {
-            this.name = GeneralNames.getInstance(obj, false);
-        }
-        else
-        {
-            this.name = ASN1Set.getInstance(obj, false);
-        }
-    }
-    
-    public DERObject toASN1Object()
-    {
-        return new DERTaggedObject(false, type, name);
-    }
-
-    public String toString()
-    {
-        String       sep = System.getProperty("line.separator");
-        StringBuffer buf = new StringBuffer();
-        buf.append("DistributionPointName: [");
-        buf.append(sep);
-        if (type == FULL_NAME)
-        {
-            appendObject(buf, sep, "fullName", name.toString());
-        }
-        else
-        {
-            appendObject(buf, sep, "nameRelativeToCRLIssuer", name.toString());
-        }
-        buf.append("]");
-        buf.append(sep);
-        return buf.toString();
-    }
-
-    private void appendObject(StringBuffer buf, String sep, String name, String value)
-    {
-        String       indent = "    ";
-
-        buf.append(indent);
-        buf.append(name);
-        buf.append(":");
-        buf.append(sep);
-        buf.append(indent);
-        buf.append(indent);
-        buf.append(value);
-        buf.append(sep);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/ExtendedKeyUsage.java b/azureus2/src/org/bouncycastle/asn1/x509/ExtendedKeyUsage.java
deleted file mode 100644
index 0811df5..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/ExtendedKeyUsage.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- * The extendedKeyUsage object.
- * <pre>
- *      extendedKeyUsage ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId
- * </pre>
- */
-public class ExtendedKeyUsage
-    extends ASN1Encodable
-{
-    Hashtable     usageTable = new Hashtable();
-    ASN1Sequence  seq;
-
-    public static ExtendedKeyUsage getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static ExtendedKeyUsage getInstance(
-        Object obj)
-    {
-        if (obj instanceof ExtendedKeyUsage) 
-        {
-            return (ExtendedKeyUsage)obj;
-        }
-        
-        if(obj instanceof ASN1Sequence) 
-        {
-            return new ExtendedKeyUsage((ASN1Sequence)obj);
-        }
-
-        if (obj instanceof X509Extension)
-        {
-            return getInstance(X509Extension.convertValueToObject((X509Extension)obj));
-        }
-
-        throw new IllegalArgumentException("Invalid ExtendedKeyUsage: " + obj.getClass().getName());
-    }
-
-    public ExtendedKeyUsage(
-        KeyPurposeId  usage)
-    {
-        this.seq = new DERSequence(usage);
-
-        this.usageTable.put(usage, usage);
-    }
-    
-    public ExtendedKeyUsage(
-        ASN1Sequence  seq)
-    {
-        this.seq = seq;
-
-        Enumeration e = seq.getObjects();
-
-        while (e.hasMoreElements())
-        {
-            Object  o = e.nextElement();
-            if (!(o instanceof DERObjectIdentifier))
-            {
-                throw new IllegalArgumentException("Only DERObjectIdentifiers allowed in ExtendedKeyUsage.");
-            }
-            this.usageTable.put(o, o);
-        }
-    }
-
-    public ExtendedKeyUsage(
-        Vector  usages)
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-        Enumeration         e = usages.elements();
-
-        while (e.hasMoreElements())
-        {
-            DERObject  o = (DERObject)e.nextElement();
-
-            v.add(o);
-            this.usageTable.put(o, o);
-        }
-
-        this.seq = new DERSequence(v);
-    }
-
-    public boolean hasKeyPurposeId(
-        KeyPurposeId keyPurposeId)
-    {
-        return (usageTable.get(keyPurposeId) != null);
-    }
-    
-    /**
-     * Returns all extended key usages.
-     * The returned vector contains DERObjectIdentifiers.
-     * @return A vector with all key purposes.
-     */
-    public Vector getUsages()
-    {
-        Vector temp = new Vector();
-        for (Enumeration it = usageTable.elements(); it.hasMoreElements();)
-        {
-            temp.addElement(it.nextElement());
-        }
-        return temp;
-    }
-
-    public int size()
-    {
-        return usageTable.size();
-    }
-    
-    public DERObject toASN1Object()
-    {
-        return seq;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/GeneralName.java b/azureus2/src/org/bouncycastle/asn1/x509/GeneralName.java
deleted file mode 100644
index 577f5cc..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/GeneralName.java
+++ /dev/null
@@ -1,258 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Choice;
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERIA5String;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.DERTaggedObject;
-import org.bouncycastle.util.IPAddress;
-import org.bouncycastle.util.Strings;
-
-/**
- * The GeneralName object.
- * <pre>
- * GeneralName ::= CHOICE {
- *      otherName                       [0]     OtherName,
- *      rfc822Name                      [1]     IA5String,
- *      dNSName                         [2]     IA5String,
- *      x400Address                     [3]     ORAddress,
- *      directoryName                   [4]     Name,
- *      ediPartyName                    [5]     EDIPartyName,
- *      uniformResourceIdentifier       [6]     IA5String,
- *      iPAddress                       [7]     OCTET STRING,
- *      registeredID                    [8]     OBJECT IDENTIFIER}
- *
- * OtherName ::= SEQUENCE {
- *      type-id    OBJECT IDENTIFIER,
- *      value      [0] EXPLICIT ANY DEFINED BY type-id }
- *
- * EDIPartyName ::= SEQUENCE {
- *      nameAssigner            [0]     DirectoryString OPTIONAL,
- *      partyName               [1]     DirectoryString }
- * 
- * Name ::= CHOICE { RDNSequence }
- * </pre>
- */
-public class GeneralName
-    extends ASN1Encodable
-    implements ASN1Choice
-{
-    public static final int otherName                     = 0;
-    public static final int rfc822Name                    = 1;
-    public static final int dNSName                       = 2;
-    public static final int x400Address                   = 3;
-    public static final int directoryName                 = 4;
-    public static final int ediPartyName                  = 5;
-    public static final int uniformResourceIdentifier     = 6;
-    public static final int iPAddress                     = 7;
-    public static final int registeredID                  = 8;
-
-    DEREncodable      obj;
-    int               tag;
-   
-    public GeneralName(
-        X509Name  dirName)
-    {
-        this.obj = dirName;
-        this.tag = 4;
-    }
-
-    /**
-     * @deprecated this constructor seems the wrong way round! Use GeneralName(tag, name).
-     */
-    public GeneralName(
-        DERObject name, int tag)
-    {
-        this.obj = name;
-        this.tag = tag;
-    }
-
-    /**
-     * When the subjectAltName extension contains an Internet mail address,
-     * the address MUST be included as an rfc822Name. The format of an
-     * rfc822Name is an "addr-spec" as defined in RFC 822 [RFC 822].
-     *
-     * When the subjectAltName extension contains a domain name service
-     * label, the domain name MUST be stored in the dNSName (an IA5String).
-     * The name MUST be in the "preferred name syntax," as specified by RFC
-     * 1034 [RFC 1034].
-     *
-     * When the subjectAltName extension contains a URI, the name MUST be
-     * stored in the uniformResourceIdentifier (an IA5String). The name MUST
-     * be a non-relative URL, and MUST follow the URL syntax and encoding
-     * rules specified in [RFC 1738].  The name must include both a scheme
-     * (e.g., "http" or "ftp") and a scheme-specific-part.  The scheme-
-     * specific-part must include a fully qualified domain name or IP
-     * address as the host.
-     *
-     * When the subjectAltName extension contains a iPAddress, the address
-     * MUST be stored in the octet string in "network byte order," as
-     * specified in RFC 791 [RFC 791]. The least significant bit (LSB) of
-     * each octet is the LSB of the corresponding byte in the network
-     * address. For IP Version 4, as specified in RFC 791, the octet string
-     * MUST contain exactly four octets.  For IP Version 6, as specified in
-     * RFC 1883, the octet string MUST contain exactly sixteen octets [RFC
-     * 1883].
-     */
-    public GeneralName(
-        int           tag,
-        ASN1Encodable name)
-    {
-        this.obj = name;
-        this.tag = tag;
-    }
-    
-    /**
-     * Create a GeneralName for the given tag from the passed in String.
-     * <p>
-     * This constructor can handle:
-     * <ul>
-     * <li>rfc822Name
-     * <li>iPAddress
-     * <li>directoryName
-     * <li>dNSName
-     * <li>uniformResourceIdentifier
-     * <li>registeredID
-     * </ul>
-     * For x400Address, otherName and ediPartyName there is no common string
-     * format defined.
-     * <p>
-     * Note: A directory name can be encoded in different ways into a byte
-     * representation. Be aware of this if the byte representation is used for
-     * comparing results.
-     *
-     * @param tag tag number
-     * @param name string representation of name
-     * @throws IllegalArgumentException if the string encoding is not correct or     *             not supported.
-     */
-    public GeneralName(
-        int       tag,
-        String    name)
-    {
-        this.tag = tag;
-
-        if (tag == rfc822Name || tag == dNSName || tag == uniformResourceIdentifier)
-        {
-            this.obj = new DERIA5String(name);
-        }
-        else if (tag == registeredID)
-        {
-            this.obj = new DERObjectIdentifier(name);
-        }
-        else if (tag == directoryName)
-        {
-            this.obj = new X509Name(name);
-        }
-        else if (tag == iPAddress)
-        {
-            if (IPAddress.isValid(name))
-            {
-                this.obj = new DEROctetString(Strings.toUTF8ByteArray(name));
-            }
-            else
-            {
-                throw new IllegalArgumentException("IP Address is invalid");
-            }
-        }
-        else
-        {
-            throw new IllegalArgumentException("can't process String for tag: " + tag);
-        }
-    }
-    
-    public static GeneralName getInstance(
-        Object obj)
-    {
-        if (obj == null || obj instanceof GeneralName)
-        {
-            return (GeneralName)obj;
-        }
-
-        if (obj instanceof ASN1TaggedObject)
-        {
-            ASN1TaggedObject    tagObj = (ASN1TaggedObject)obj;
-            int                 tag = tagObj.getTagNo();
-
-            switch (tag)
-            {
-            case otherName:
-                return new GeneralName(tag, ASN1Sequence.getInstance(tagObj, false));
-            case rfc822Name:
-                return new GeneralName(tag, DERIA5String.getInstance(tagObj, false));
-            case dNSName:
-                return new GeneralName(tag, DERIA5String.getInstance(tagObj, false));
-            case x400Address:
-                throw new IllegalArgumentException("unknown tag: " + tag);
-            case directoryName:
-                return new GeneralName(tag, ASN1Sequence.getInstance(tagObj, true));
-            case ediPartyName:
-                return new GeneralName(tag, ASN1Sequence.getInstance(tagObj, false));
-            case uniformResourceIdentifier:
-                return new GeneralName(tag, DERIA5String.getInstance(tagObj, false));
-            case iPAddress:
-                return new GeneralName(tag, ASN1OctetString.getInstance(tagObj, false));
-            case registeredID:
-                return new GeneralName(tag, DERObjectIdentifier.getInstance(tagObj, false));
-            }
-        }
-
-        throw new IllegalArgumentException("unknown object in getInstance");
-    }
-
-    public static GeneralName getInstance(
-        ASN1TaggedObject tagObj,
-        boolean          explicit)
-    {
-        return GeneralName.getInstance(ASN1TaggedObject.getInstance(tagObj, true));
-    }
-
-    public int getTagNo()
-    {
-        return tag;
-    }
-
-    public DEREncodable getName()
-    {
-        return obj;
-    }
-
-    public String toString()
-    {
-        StringBuffer buf = new StringBuffer();
-
-        buf.append(tag);
-        buf.append(": ");
-        switch (tag)
-        {
-        case rfc822Name:
-        case dNSName:
-        case uniformResourceIdentifier:
-            buf.append(DERIA5String.getInstance(obj).getString());
-            break;
-        case directoryName:
-            buf.append(X509Name.getInstance(obj).toString());
-            break;
-        default:
-            buf.append(obj.toString());
-        }
-        return buf.toString();
-    }
-
-    public DERObject toASN1Object()
-    {
-        if (tag == directoryName)       // directoryName is explicitly tagged as it is a CHOICE
-        {
-            return new DERTaggedObject(true, tag, obj);
-        }
-        else
-        {
-            return new DERTaggedObject(false, tag, obj);
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/GeneralNames.java b/azureus2/src/org/bouncycastle/asn1/x509/GeneralNames.java
deleted file mode 100644
index a2af508..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/GeneralNames.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-public class GeneralNames
-    extends ASN1Encodable
-{
-    ASN1Sequence            seq;
-
-    public static GeneralNames getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof GeneralNames)
-        {
-            return (GeneralNames)obj;
-        }
-
-        if (obj instanceof ASN1Sequence)
-        {
-            return new GeneralNames((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    public static GeneralNames getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    /**
-     * Construct a GeneralNames object containing one GeneralName.
-     * 
-     * @param name the name to be contained.
-     */
-    public GeneralNames(
-        GeneralName  name)
-    {
-        this.seq = new DERSequence(name);
-    }
-    
-    public GeneralNames(
-        ASN1Sequence  seq)
-    {
-        this.seq = seq;
-    }
-
-    public GeneralName[] getNames()
-    {
-        GeneralName[]   names = new GeneralName[seq.size()];
-        
-        for (int i = 0; i != seq.size(); i++)
-        {
-            names[i] = GeneralName.getInstance(seq.getObjectAt(i));
-        }
-        
-        return names;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     * GeneralNames ::= SEQUENCE SIZE {1..MAX} OF GeneralName
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        return seq;
-    }
-
-    public String toString()
-    {
-        StringBuffer  buf = new StringBuffer();
-        String        sep = System.getProperty("line.separator");
-        GeneralName[] names = getNames();
-
-        buf.append("GeneralNames:");
-        buf.append(sep);
-
-        for (int i = 0; i != names.length; i++)
-        {
-            buf.append("    ");
-            buf.append(names[i]);
-            buf.append(sep);
-        }
-        return buf.toString();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/GeneralSubtree.java b/azureus2/src/org/bouncycastle/asn1/x509/GeneralSubtree.java
deleted file mode 100644
index 326ee20..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/GeneralSubtree.java
+++ /dev/null
@@ -1,200 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-
-import java.math.BigInteger;
-
-/**
- * Class for containing a restriction object subtrees in NameConstraints. See
- * RFC 3280.
- * 
- * <pre>
- *       
- *       GeneralSubtree ::= SEQUENCE 
- *       {
- *         base                    GeneralName,
- *         minimum         [0]     BaseDistance DEFAULT 0,
- *         maximum         [1]     BaseDistance OPTIONAL 
- *       }
- * </pre>
- * 
- * @see org.bouncycastle.asn1.x509.NameConstraints
- * 
- */
-public class GeneralSubtree 
-    extends ASN1Encodable 
-{
-    private static final BigInteger ZERO = BigInteger.valueOf(0);
-
-    private GeneralName base;
-
-    private DERInteger minimum;
-
-    private DERInteger maximum;
-
-    public GeneralSubtree(
-        ASN1Sequence seq) 
-    {
-        base = GeneralName.getInstance(seq.getObjectAt(0));
-
-        switch (seq.size()) 
-        {
-        case 1:
-            break;
-        case 2:
-            ASN1TaggedObject o = ASN1TaggedObject.getInstance(seq.getObjectAt(1));
-            switch (o.getTagNo()) 
-            {
-            case 0:
-                minimum = DERInteger.getInstance(o, false);
-                break;
-            case 1:
-                maximum = DERInteger.getInstance(o, false);
-                break;
-            default:
-                throw new IllegalArgumentException("Bad tag number: "
-                        + o.getTagNo());
-            }
-            break;
-        case 3:
-            minimum = DERInteger.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(1)));
-            maximum = DERInteger.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(2)));
-            break;
-        default:
-            throw new IllegalArgumentException("Bad sequence size: "
-                    + seq.size());
-        }
-    }
-
-    /**
-     * Constructor from a given details.
-     * 
-     * According RFC 3280, the minimum and maximum fields are not used with any
-     * name forms, thus minimum MUST be zero, and maximum MUST be absent.
-     * <p>
-     * If minimum is <code>null</code>, zero is assumed, if
-     * maximum is <code>null</code>, maximum is absent.
-     * 
-     * @param base
-     *            A restriction.
-     * @param minimum
-     *            Minimum
-     * 
-     * @param maximum
-     *            Maximum
-     */
-    public GeneralSubtree(
-        GeneralName base,
-        BigInteger minimum,
-        BigInteger maximum)
-    {
-        this.base = base;
-        if (maximum != null)
-        {
-            this.maximum = new DERInteger(maximum);
-        }
-        if (minimum == null)
-        {
-            this.minimum = null;
-        }
-        else
-        {
-            this.minimum = new DERInteger(minimum);
-        }
-    }
-
-    public GeneralSubtree(GeneralName base)
-    {
-        this(base, null, null);
-    }
-
-    public static GeneralSubtree getInstance(
-        ASN1TaggedObject o,
-        boolean explicit)
-    {
-        return new GeneralSubtree(ASN1Sequence.getInstance(o, explicit));
-    }
-
-    public static GeneralSubtree getInstance(
-        Object obj)
-    {
-        if (obj == null)
-        {
-            return null;
-        }
-
-        if (obj instanceof GeneralSubtree)
-        {
-            return (GeneralSubtree) obj;
-        }
-
-        return new GeneralSubtree(ASN1Sequence.getInstance(obj));
-    }
-
-    public GeneralName getBase()
-    {
-        return base;
-    }
-
-    public BigInteger getMinimum()
-    {
-        if (minimum == null)
-        {
-            return ZERO;
-        }
-
-        return minimum.getValue();
-    }
-
-    public BigInteger getMaximum()
-    {
-        if (maximum == null)
-        {
-            return null;
-        }
-
-        return maximum.getValue();
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * 
-     * Returns:
-     * 
-     * <pre>
-     *       GeneralSubtree ::= SEQUENCE 
-     *       {
-     *         base                    GeneralName,
-     *         minimum         [0]     BaseDistance DEFAULT 0,
-     *         maximum         [1]     BaseDistance OPTIONAL 
-     *       }
-     * </pre>
-     * 
-     * @return a DERObject
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        v.add(base);
-
-        if (minimum != null && !minimum.getValue().equals(ZERO))
-        {
-            v.add(new DERTaggedObject(false, 0, minimum));
-        }
-
-        if (maximum != null)
-        {
-            v.add(new DERTaggedObject(false, 1, maximum));
-        }
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/Holder.java b/azureus2/src/org/bouncycastle/asn1/x509/Holder.java
deleted file mode 100644
index f7727de..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/Holder.java
+++ /dev/null
@@ -1,242 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-
-/**
- * The Holder object.
- * <p>
- * For an v2 attribute certificate this is:
- * 
- * <pre>
- *            Holder ::= SEQUENCE {
- *                  baseCertificateID   [0] IssuerSerial OPTIONAL,
- *                           -- the issuer and serial number of
- *                           -- the holder's Public Key Certificate
- *                  entityName          [1] GeneralNames OPTIONAL,
- *                           -- the name of the claimant or role
- *                  objectDigestInfo    [2] ObjectDigestInfo OPTIONAL
- *                           -- used to directly authenticate the holder,
- *                           -- for example, an executable
- *            }
- * </pre>
- * 
- * <p>
- * For an v1 attribute certificate this is:
- * 
- * <pre>
- *         subject CHOICE {
- *          baseCertificateID [0] IssuerSerial,
- *          -- associated with a Public Key Certificate
- *          subjectName [1] GeneralNames },
- *          -- associated with a name
- * </pre>
- */
-public class Holder
-    extends ASN1Encodable
-{
-    IssuerSerial baseCertificateID;
-
-    GeneralNames entityName;
-
-    ObjectDigestInfo objectDigestInfo;
-
-    private int version = 1;
-
-    public static Holder getInstance(Object obj)
-    {
-        if (obj instanceof Holder)
-        {
-            return (Holder)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new Holder((ASN1Sequence)obj);
-        }
-        else if (obj instanceof ASN1TaggedObject)
-        {
-            return new Holder((ASN1TaggedObject)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    /**
-     * Constructor for a holder for an v1 attribute certificate.
-     * 
-     * @param tagObj The ASN.1 tagged holder object.
-     */
-    public Holder(ASN1TaggedObject tagObj)
-    {
-        switch (tagObj.getTagNo())
-        {
-        case 0:
-            baseCertificateID = IssuerSerial.getInstance(tagObj, false);
-            break;
-        case 1:
-            entityName = GeneralNames.getInstance(tagObj, false);
-            break;
-        default:
-            throw new IllegalArgumentException("unknown tag in Holder");
-        }
-        version = 0;
-    }
-
-    /**
-     * Constructor for a holder for an v2 attribute certificate. *
-     * 
-     * @param seq The ASN.1 sequence.
-     */
-    public Holder(ASN1Sequence seq)
-    {
-        if (seq.size() > 3)
-        {
-            throw new IllegalArgumentException("Bad sequence size: "
-                + seq.size());
-        }
-
-        for (int i = 0; i != seq.size(); i++)
-        {
-            ASN1TaggedObject tObj = ASN1TaggedObject.getInstance(seq
-                .getObjectAt(i));
-
-            switch (tObj.getTagNo())
-            {
-            case 0:
-                baseCertificateID = IssuerSerial.getInstance(tObj, false);
-                break;
-            case 1:
-                entityName = GeneralNames.getInstance(tObj, false);
-                break;
-            case 2:
-                objectDigestInfo = ObjectDigestInfo.getInstance(tObj, false);
-                break;
-            default:
-                throw new IllegalArgumentException("unknown tag in Holder");
-            }
-        }
-        version = 1;
-    }
-
-    public Holder(IssuerSerial baseCertificateID)
-    {
-        this.baseCertificateID = baseCertificateID;
-    }
-
-    /**
-     * Constructs a holder from a IssuerSerial.
-     * @param baseCertificateID The IssuerSerial.
-     * @param version The version of the attribute certificate. 
-     */
-    public Holder(IssuerSerial baseCertificateID, int version)
-    {
-        this.baseCertificateID = baseCertificateID;
-        this.version = version;
-    }
-    
-    /**
-     * Returns 1 for v2 attribute certificates or 0 for v1 attribute
-     * certificates. 
-     * @return The version of the attribute certificate.
-     */
-    public int getVersion()
-    {
-        return version;
-    }
-
-    /**
-     * Constructs a holder with an entityName for v2 attribute certificates or
-     * with a subjectName for v1 attribute certificates.
-     * 
-     * @param entityName The entity or subject name.
-     */
-    public Holder(GeneralNames entityName)
-    {
-        this.entityName = entityName;
-    }
-
-    /**
-     * Constructs a holder with an entityName for v2 attribute certificates or
-     * with a subjectName for v1 attribute certificates.
-     * 
-     * @param entityName The entity or subject name.
-     * @param version The version of the attribute certificate. 
-     */
-    public Holder(GeneralNames entityName, int version)
-    {
-        this.entityName = entityName;
-        this.version = version;
-    }
-    
-    /**
-     * Constructs a holder from an object digest info.
-     * 
-     * @param objectDigestInfo The object digest info object.
-     */
-    public Holder(ObjectDigestInfo objectDigestInfo)
-    {
-        this.objectDigestInfo = objectDigestInfo;
-    }
-
-    public IssuerSerial getBaseCertificateID()
-    {
-        return baseCertificateID;
-    }
-
-    /**
-     * Returns the entityName for an v2 attribute certificate or the subjectName
-     * for an v1 attribute certificate.
-     * 
-     * @return The entityname or subjectname.
-     */
-    public GeneralNames getEntityName()
-    {
-        return entityName;
-    }
-
-    public ObjectDigestInfo getObjectDigestInfo()
-    {
-        return objectDigestInfo;
-    }
-
-    public DERObject toASN1Object()
-    {
-        if (version == 1)
-        {
-            ASN1EncodableVector v = new ASN1EncodableVector();
-
-            if (baseCertificateID != null)
-            {
-                v.add(new DERTaggedObject(false, 0, baseCertificateID));
-            }
-
-            if (entityName != null)
-            {
-                v.add(new DERTaggedObject(false, 1, entityName));
-            }
-
-            if (objectDigestInfo != null)
-            {
-                v.add(new DERTaggedObject(false, 2, objectDigestInfo));
-            }
-
-            return new DERSequence(v);
-        }
-        else
-        {
-            if (entityName != null)
-            {
-                return new DERTaggedObject(false, 1, entityName);
-            }
-            else
-            {
-                return new DERTaggedObject(false, 0, baseCertificateID);
-            }
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/IetfAttrSyntax.java b/azureus2/src/org/bouncycastle/asn1/x509/IetfAttrSyntax.java
deleted file mode 100644
index 07e07cf..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/IetfAttrSyntax.java
+++ /dev/null
@@ -1,174 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import java.util.Enumeration;
-import java.util.Vector;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-import org.bouncycastle.asn1.DERUTF8String;
-
-/**
- * Implementation of <code>IetfAttrSyntax</code> as specified by RFC3281.
- */
-public class IetfAttrSyntax
-    extends ASN1Encodable
-{
-    public static final int VALUE_OCTETS    = 1;
-    public static final int VALUE_OID       = 2;
-    public static final int VALUE_UTF8      = 3;
-    GeneralNames            policyAuthority = null;
-    Vector                  values          = new Vector();
-    int                     valueChoice     = -1;
-
-    /**
-     *  
-     */
-    public IetfAttrSyntax(ASN1Sequence seq)
-    {
-        int i = 0;
-
-        if (seq.getObjectAt(0) instanceof ASN1TaggedObject)
-        {
-            policyAuthority = GeneralNames.getInstance(((ASN1TaggedObject)seq.getObjectAt(0)), false);
-            i++;
-        }
-        else if (seq.size() == 2)
-        { // VOMS fix
-            policyAuthority = GeneralNames.getInstance(seq.getObjectAt(0));
-            i++;
-        }
-
-        if (!(seq.getObjectAt(i) instanceof ASN1Sequence))
-        {
-            throw new IllegalArgumentException("Non-IetfAttrSyntax encoding");
-        }
-
-        seq = (ASN1Sequence)seq.getObjectAt(i);
-
-        for (Enumeration e = seq.getObjects(); e.hasMoreElements();)
-        {
-            DERObject obj = (DERObject)e.nextElement();
-            int type;
-
-            if (obj instanceof DERObjectIdentifier)
-            {
-                type = VALUE_OID;
-            }
-            else if (obj instanceof DERUTF8String)
-            {
-                type = VALUE_UTF8;
-            }
-            else if (obj instanceof DEROctetString)
-            {
-                type = VALUE_OCTETS;
-            }
-            else
-            {
-                throw new IllegalArgumentException("Bad value type encoding IetfAttrSyntax");
-            }
-
-            if (valueChoice < 0)
-            {
-                valueChoice = type;
-            }
-
-            if (type != valueChoice)
-            {
-                throw new IllegalArgumentException("Mix of value types in IetfAttrSyntax");
-            }
-
-            values.addElement(obj);
-        }
-    }
-
-    public GeneralNames getPolicyAuthority()
-    {
-        return policyAuthority;
-    }
-
-    public int getValueType()
-    {
-        return valueChoice;
-    }
-
-    public Object[] getValues()
-    {
-        if (this.getValueType() == VALUE_OCTETS)
-        {
-            ASN1OctetString[] tmp = new ASN1OctetString[values.size()];
-            
-            for (int i = 0; i != tmp.length; i++)
-            {
-                tmp[i] = (ASN1OctetString)values.elementAt(i);
-            }
-            
-            return tmp;
-        }
-        else if (this.getValueType() == VALUE_OID)
-        {
-            DERObjectIdentifier[] tmp = new DERObjectIdentifier[values.size()];
-            
-            for (int i = 0; i != tmp.length; i++)
-            {
-                tmp[i] = (DERObjectIdentifier)values.elementAt(i);
-            }
-            
-            return tmp;
-        }
-        else
-        {
-            DERUTF8String[] tmp = new DERUTF8String[values.size()];
-            
-            for (int i = 0; i != tmp.length; i++)
-            {
-                tmp[i] = (DERUTF8String)values.elementAt(i);
-            }
-            
-            return tmp;
-        }
-    }
-
-    /**
-     * 
-     * <pre>
-     * 
-     *  IetfAttrSyntax ::= SEQUENCE {
-     *    policyAuthority [0] GeneralNames OPTIONAL,
-     *    values SEQUENCE OF CHOICE {
-     *      octets OCTET STRING,
-     *      oid OBJECT IDENTIFIER,
-     *      string UTF8String
-     *    }
-     *  }
-     *  
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        if (policyAuthority != null)
-        {
-            v.add(new DERTaggedObject(0, policyAuthority));
-        }
-
-        ASN1EncodableVector v2 = new ASN1EncodableVector();
-
-        for (Enumeration i = values.elements(); i.hasMoreElements();)
-        {
-            v2.add((ASN1Encodable)i.nextElement());
-        }
-
-        v.add(new DERSequence(v2));
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/IssuerSerial.java b/azureus2/src/org/bouncycastle/asn1/x509/IssuerSerial.java
deleted file mode 100644
index ceb639f..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/IssuerSerial.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-public class IssuerSerial
-    extends ASN1Encodable
-{
-    GeneralNames            issuer;
-    DERInteger              serial;
-    DERBitString            issuerUID;
-
-    public static IssuerSerial getInstance(
-            Object  obj)
-    {
-        if (obj == null || obj instanceof IssuerSerial)
-        {
-            return (IssuerSerial)obj;
-        }
-
-        if (obj instanceof ASN1Sequence)
-        {
-            return new IssuerSerial((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    public static IssuerSerial getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-    
-    public IssuerSerial(
-        ASN1Sequence    seq)
-    {
-        if (seq.size() != 2 && seq.size() != 3)
-        {
-            throw new IllegalArgumentException("Bad sequence size: " + seq.size());
-        }
-        
-        issuer = GeneralNames.getInstance(seq.getObjectAt(0));
-        serial = DERInteger.getInstance(seq.getObjectAt(1));
-
-        if (seq.size() == 3)
-        {
-            issuerUID = DERBitString.getInstance(seq.getObjectAt(2));
-        }
-    }
-    
-    public IssuerSerial(
-        GeneralNames    issuer,
-        DERInteger      serial)
-    {
-        this.issuer = issuer;
-        this.serial = serial;
-    }
-
-    public GeneralNames getIssuer()
-    {
-        return issuer;
-    }
-
-    public DERInteger getSerial()
-    {
-        return serial;
-    }
-
-    public DERBitString getIssuerUID()
-    {
-        return issuerUID;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     *  IssuerSerial  ::=  SEQUENCE {
-     *       issuer         GeneralNames,
-     *       serial         CertificateSerialNumber,
-     *       issuerUID      UniqueIdentifier OPTIONAL
-     *  }
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(issuer);
-        v.add(serial);
-
-        if (issuerUID != null)
-        {
-            v.add(issuerUID);
-        }
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/IssuingDistributionPoint.java b/azureus2/src/org/bouncycastle/asn1/x509/IssuingDistributionPoint.java
deleted file mode 100644
index 4962ade..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/IssuingDistributionPoint.java
+++ /dev/null
@@ -1,256 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERBoolean;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-
-/**
- * <pre>
- * IssuingDistributionPoint ::= SEQUENCE { 
- *   distributionPoint          [0] DistributionPointName OPTIONAL, 
- *   onlyContainsUserCerts      [1] BOOLEAN DEFAULT FALSE, 
- *   onlyContainsCACerts        [2] BOOLEAN DEFAULT FALSE, 
- *   onlySomeReasons            [3] ReasonFlags OPTIONAL, 
- *   indirectCRL                [4] BOOLEAN DEFAULT FALSE,
- *   onlyContainsAttributeCerts [5] BOOLEAN DEFAULT FALSE }
- * </pre>
- */
-public class IssuingDistributionPoint
-    extends ASN1Encodable
-{
-    private DistributionPointName distributionPoint;
-
-    private boolean onlyContainsUserCerts;
-
-    private boolean onlyContainsCACerts;
-
-    private ReasonFlags onlySomeReasons;
-
-    private boolean indirectCRL;
-
-    private boolean onlyContainsAttributeCerts;
-
-    private ASN1Sequence seq;
-
-    public static IssuingDistributionPoint getInstance(
-        ASN1TaggedObject obj,
-        boolean explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static IssuingDistributionPoint getInstance(
-        Object obj)
-    {
-        if (obj == null || obj instanceof IssuingDistributionPoint)
-        {
-            return (IssuingDistributionPoint)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new IssuingDistributionPoint((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    /**
-     * Constructor from given details.
-     * 
-     * @param distributionPoint
-     *            May contain an URI as pointer to most current CRL.
-     * @param onlyContainsUserCerts Covers revocation information for end certificates.
-     * @param onlyContainsCACerts Covers revocation information for CA certificates.
-     * 
-     * @param onlySomeReasons
-     *            Which revocation reasons does this point cover.
-     * @param indirectCRL
-     *            If <code>true</code> then the CRL contains revocation
-     *            information about certificates ssued by other CAs.
-     * @param onlyContainsAttributeCerts Covers revocation information for attribute certificates.
-     */
-    public IssuingDistributionPoint(
-        DistributionPointName distributionPoint,
-        boolean onlyContainsUserCerts,
-        boolean onlyContainsCACerts,
-        ReasonFlags onlySomeReasons,
-        boolean indirectCRL,
-        boolean onlyContainsAttributeCerts)
-    {
-        this.distributionPoint = distributionPoint;
-        this.indirectCRL = indirectCRL;
-        this.onlyContainsAttributeCerts = onlyContainsAttributeCerts;
-        this.onlyContainsCACerts = onlyContainsCACerts;
-        this.onlyContainsUserCerts = onlyContainsUserCerts;
-        this.onlySomeReasons = onlySomeReasons;
-
-        ASN1EncodableVector vec = new ASN1EncodableVector();
-        if (distributionPoint != null)
-        {                                    // CHOICE item so explicitly tagged
-            vec.add(new DERTaggedObject(true, 0, distributionPoint));
-        }
-        if (!onlyContainsUserCerts)
-        {
-            vec.add(new DERTaggedObject(false, 1, new DERBoolean(true)));
-        }
-        if (!onlyContainsCACerts)
-        {
-            vec.add(new DERTaggedObject(false, 2, new DERBoolean(true)));
-        }
-        if (onlySomeReasons != null)
-        {
-            vec.add(new DERTaggedObject(false, 3, onlySomeReasons));
-        }
-        if (!indirectCRL)
-        {
-            vec.add(new DERTaggedObject(false, 4, new DERBoolean(true)));
-        }
-        if (!onlyContainsAttributeCerts)
-        {
-            vec.add(new DERTaggedObject(false, 5, new DERBoolean(true)));
-        }
-
-        seq = new DERSequence(vec);
-    }
-
-    /**
-     * Constructor from ASN1Sequence
-     */
-    public IssuingDistributionPoint(
-        ASN1Sequence seq)
-    {
-        this.seq = seq;
-
-        for (int i = 0; i != seq.size(); i++)
-        {
-            ASN1TaggedObject o = ASN1TaggedObject.getInstance(seq.getObjectAt(i));
-
-            switch (o.getTagNo())
-            {
-            case 0:
-                                                    // CHOICE so explicit
-                distributionPoint = DistributionPointName.getInstance(o, true);
-                break;
-            case 1:
-                onlyContainsUserCerts = DERBoolean.getInstance(o, false).isTrue();
-                break;
-            case 2:
-                onlyContainsCACerts = DERBoolean.getInstance(o, false).isTrue();
-                break;
-            case 3:
-                onlySomeReasons = new ReasonFlags(ReasonFlags.getInstance(o, false));
-                break;
-            case 4:
-                indirectCRL = DERBoolean.getInstance(o, false).isTrue();
-                break;
-            case 5:
-                onlyContainsAttributeCerts = DERBoolean.getInstance(o, false).isTrue();
-                break;
-            default:
-                throw new IllegalArgumentException(
-                        "unknown tag in IssuingDistributionPoint");
-            }
-        }
-    }
-
-    public boolean onlyContainsUserCerts()
-    {
-        return onlyContainsUserCerts;
-    }
-
-    public boolean onlyContainsCACerts()
-    {
-        return onlyContainsCACerts;
-    }
-
-    public boolean isIndirectCRL()
-    {
-        return indirectCRL;
-    }
-
-    public boolean onlyContainsAttributeCerts()
-    {
-        return onlyContainsAttributeCerts;
-    }
-
-    /**
-     * @return Returns the distributionPoint.
-     */
-    public DistributionPointName getDistributionPoint()
-    {
-        return distributionPoint;
-    }
-
-    /**
-     * @return Returns the onlySomeReasons.
-     */
-    public ReasonFlags getOnlySomeReasons()
-    {
-        return onlySomeReasons;
-    }
-
-    public DERObject toASN1Object()
-    {
-        return seq;
-    }
-
-    public String toString()
-    {
-        String       sep = System.getProperty("line.separator");
-        StringBuffer buf = new StringBuffer();
-
-        buf.append("IssuingDistributionPoint: [");
-        buf.append(sep);
-        if (distributionPoint != null)
-        {
-            appendObject(buf, sep, "distributionPoint", distributionPoint.toString());
-        }
-        if (onlyContainsUserCerts)
-        {
-            appendObject(buf, sep, "onlyContainsUserCerts", booleanToString(onlyContainsUserCerts));
-        }
-        if (onlyContainsCACerts)
-        {
-            appendObject(buf, sep, "onlyContainsCACerts", booleanToString(onlyContainsCACerts));
-        }
-        if (onlySomeReasons != null)
-        {
-            appendObject(buf, sep, "onlySomeReasons", onlySomeReasons.toString());
-        }
-        if (onlyContainsAttributeCerts)
-        {
-            appendObject(buf, sep, "onlyContainsAttributeCerts", booleanToString(onlyContainsAttributeCerts));
-        }
-        if (indirectCRL)
-        {
-            appendObject(buf, sep, "indirectCRL", booleanToString(indirectCRL));
-        }
-        buf.append("]");
-        buf.append(sep);
-        return buf.toString();
-    }
-
-    private void appendObject(StringBuffer buf, String sep, String name, String value)
-    {
-        String       indent = "    ";
-
-        buf.append(indent);
-        buf.append(name);
-        buf.append(":");
-        buf.append(sep);
-        buf.append(indent);
-        buf.append(indent);
-        buf.append(value);
-        buf.append(sep);
-    }
-
-    private String booleanToString(boolean value)
-    {
-        return value ? "true" : "false";
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/KeyPurposeId.java b/azureus2/src/org/bouncycastle/asn1/x509/KeyPurposeId.java
deleted file mode 100644
index b247e09..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/KeyPurposeId.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.DERObjectIdentifier;
-
-/**
- * The KeyPurposeId object.
- * <pre>
- *     KeyPurposeId ::= OBJECT IDENTIFIER
- * </pre>
- */
-public class KeyPurposeId
-    extends DERObjectIdentifier
-{
-    private static final String id_kp = "1.3.6.1.5.5.7.3";
-
-    private KeyPurposeId(
-        String  id)
-    {
-        super(id);
-    }
-
-    public static final KeyPurposeId anyExtendedKeyUsage = new KeyPurposeId(X509Extensions.ExtendedKeyUsage.getId() + ".0");
-    public static final KeyPurposeId id_kp_serverAuth = new KeyPurposeId(id_kp + ".1");
-    public static final KeyPurposeId id_kp_clientAuth = new KeyPurposeId(id_kp + ".2");
-    public static final KeyPurposeId id_kp_codeSigning = new KeyPurposeId(id_kp + ".3");
-    public static final KeyPurposeId id_kp_emailProtection = new KeyPurposeId(id_kp + ".4");
-    public static final KeyPurposeId id_kp_ipsecEndSystem = new KeyPurposeId(id_kp + ".5");
-    public static final KeyPurposeId id_kp_ipsecTunnel = new KeyPurposeId(id_kp + ".6");
-    public static final KeyPurposeId id_kp_ipsecUser = new KeyPurposeId(id_kp + ".7");
-    public static final KeyPurposeId id_kp_timeStamping = new KeyPurposeId(id_kp + ".8");
-    public static final KeyPurposeId id_kp_OCSPSigning = new KeyPurposeId(id_kp + ".9");
-
-    //
-    // microsoft key purpose ids
-    //
-    public static final KeyPurposeId id_kp_smartcardlogon = new KeyPurposeId("1.3.6.1.4.1.311.20.2.2");
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/KeyUsage.java b/azureus2/src/org/bouncycastle/asn1/x509/KeyUsage.java
deleted file mode 100644
index 3ffd94b..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/KeyUsage.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.DERBitString;
-
-/**
- * The KeyUsage object.
- * <pre>
- *    id-ce-keyUsage OBJECT IDENTIFIER ::=  { id-ce 15 }
- *
- *    KeyUsage ::= BIT STRING {
- *         digitalSignature        (0),
- *         nonRepudiation          (1),
- *         keyEncipherment         (2),
- *         dataEncipherment        (3),
- *         keyAgreement            (4),
- *         keyCertSign             (5),
- *         cRLSign                 (6),
- *         encipherOnly            (7),
- *         decipherOnly            (8) }
- * </pre>
- */
-public class KeyUsage
-    extends DERBitString
-{
-    public static final int        digitalSignature = (1 << 7); 
-    public static final int        nonRepudiation   = (1 << 6);
-    public static final int        keyEncipherment  = (1 << 5);
-    public static final int        dataEncipherment = (1 << 4);
-    public static final int        keyAgreement     = (1 << 3);
-    public static final int        keyCertSign      = (1 << 2);
-    public static final int        cRLSign          = (1 << 1);
-    public static final int        encipherOnly     = (1 << 0);
-    public static final int        decipherOnly     = (1 << 15);
-
-    public static DERBitString getInstance(Object obj)   // needs to be DERBitString for other VMs
-    {
-        if (obj instanceof KeyUsage)
-        {
-            return (KeyUsage)obj;
-        }
-
-        if (obj instanceof X509Extension)
-        {
-            return new KeyUsage(DERBitString.getInstance(X509Extension.convertValueToObject((X509Extension)obj)));
-        }
-
-        return new KeyUsage(DERBitString.getInstance(obj));
-    }
-    
-    /**
-     * Basic constructor.
-     * 
-     * @param usage - the bitwise OR of the Key Usage flags giving the
-     * allowed uses for the key.
-     * e.g. (KeyUsage.keyEncipherment | KeyUsage.dataEncipherment)
-     */
-    public KeyUsage(
-        int usage)
-    {
-        super(getBytes(usage), getPadBits(usage));
-    }
-
-    public KeyUsage(
-        DERBitString usage)
-    {
-        super(usage.getBytes(), usage.getPadBits());
-    }
-
-    public String toString()
-    {
-        if (data.length == 1)
-        {
-            return "KeyUsage: 0x" + Integer.toHexString(data[0] & 0xff);
-        }
-        return "KeyUsage: 0x" + Integer.toHexString((data[1] & 0xff) << 8 | (data[0] & 0xff));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/NameConstraints.java b/azureus2/src/org/bouncycastle/asn1/x509/NameConstraints.java
deleted file mode 100644
index 1383d39..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/NameConstraints.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import java.util.Enumeration;
-import java.util.Vector;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-
-public class NameConstraints
-    extends ASN1Encodable
-{
-    private ASN1Sequence permitted, excluded;
-
-    public NameConstraints(ASN1Sequence seq)
-    {
-        Enumeration e = seq.getObjects();
-        while (e.hasMoreElements())
-        {
-            ASN1TaggedObject o = ASN1TaggedObject.getInstance(e.nextElement());
-            switch (o.getTagNo())
-            {
-            case 0:
-                permitted = ASN1Sequence.getInstance(o, false);
-                break;
-            case 1:
-                excluded = ASN1Sequence.getInstance(o, false);
-                break;
-            }
-        }
-    }
-
-    /**
-     * Constructor from a given details.
-     * 
-     * <p>
-     * permitted and excluded are Vectors of GeneralSubtree objects.
-     * 
-     * @param permitted
-     *            Permitted subtrees
-     * @param excluded
-     *            Excludes subtrees
-     */
-    public NameConstraints(
-        Vector permitted,
-        Vector excluded)
-    {
-        if (permitted != null)
-        {
-            this.permitted = createSequence(permitted);
-        }
-        if (excluded != null)
-        {
-            this.excluded = createSequence(excluded);
-        }
-    }
-
-    private DERSequence createSequence(Vector subtree)
-    {
-        ASN1EncodableVector vec = new ASN1EncodableVector();
-        Enumeration e = subtree.elements(); 
-        while (e.hasMoreElements())
-        {
-            vec.add((GeneralSubtree)e.nextElement());
-        }
-        
-        return new DERSequence(vec);
-    }
-
-    public ASN1Sequence getPermittedSubtrees() 
-    {
-        return permitted;
-    }
-
-    public ASN1Sequence getExcludedSubtrees() 
-    {
-        return excluded;
-    }
-
-    /*
-     * NameConstraints ::= SEQUENCE { permittedSubtrees [0] GeneralSubtrees
-     * OPTIONAL, excludedSubtrees [1] GeneralSubtrees OPTIONAL }
-     */
-    public DERObject toASN1Object() 
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        if (permitted != null) 
-        {
-            v.add(new DERTaggedObject(false, 0, permitted));
-        }
-
-        if (excluded != null) 
-        {
-            v.add(new DERTaggedObject(false, 1, excluded));
-        }
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/NoticeReference.java b/azureus2/src/org/bouncycastle/asn1/x509/NoticeReference.java
deleted file mode 100644
index 0bc639a..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/NoticeReference.java
+++ /dev/null
@@ -1,155 +0,0 @@
-
-package org.bouncycastle.asn1.x509;
-
-import java.util.Enumeration;
-import java.util.Vector;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-/**
- * <code>NoticeReference</code> class, used in
- * <code>CertificatePolicies</code> X509 V3 extensions
- * (in policy qualifiers).
- * 
- * <pre>
- *  NoticeReference ::= SEQUENCE {
- *      organization     DisplayText,
- *      noticeNumbers    SEQUENCE OF INTEGER }
- *
- * </pre> 
- * 
- * @see PolicyQualifierInfo
- * @see PolicyInformation
- */
-public class NoticeReference 
-    extends ASN1Encodable
-{
-   private DisplayText organization;
-   private ASN1Sequence noticeNumbers;
-
-   /**
-    * Creates a new <code>NoticeReference</code> instance.
-    *
-    * @param orgName a <code>String</code> value
-    * @param numbers a <code>Vector</code> value
-    */
-   public NoticeReference(
-       String orgName,
-       Vector numbers) 
-   {
-      organization = new DisplayText(orgName);
-
-      Object o = numbers.elementAt(0);
-
-      ASN1EncodableVector av = new ASN1EncodableVector();
-      if (o instanceof Integer)
-      {
-         Enumeration it = numbers.elements();
-
-         while (it.hasMoreElements())
-         {
-            Integer nm = (Integer) it.nextElement();
-               DERInteger di = new DERInteger(nm.intValue());
-            av.add (di);
-         }
-      }
-
-      noticeNumbers = new DERSequence(av);
-   }
-
-   /**
-    * Creates a new <code>NoticeReference</code> instance.
-    *
-    * @param orgName a <code>String</code> value
-    * @param numbers an <code>ASN1EncodableVector</code> value
-    */
-   public NoticeReference(
-       String orgName, 
-       ASN1Sequence numbers) 
-   {
-       organization = new DisplayText (orgName);
-       noticeNumbers = numbers;
-   }
-
-   /**
-    * Creates a new <code>NoticeReference</code> instance.
-    *
-    * @param displayTextType an <code>int</code> value
-    * @param orgName a <code>String</code> value
-    * @param numbers an <code>ASN1EncodableVector</code> value
-    */
-   public NoticeReference(
-       int displayTextType,
-       String orgName,
-       ASN1Sequence numbers) 
-   {
-       organization = new DisplayText(displayTextType, 
-                                     orgName);
-       noticeNumbers = numbers;
-   }
-
-   /**
-    * Creates a new <code>NoticeReference</code> instance.
-    * <p>Useful for reconstructing a <code>NoticeReference</code>
-    * instance from its encodable/encoded form. 
-    *
-    * @param as an <code>ASN1Sequence</code> value obtained from either
-    * calling @{link toASN1Object()} for a <code>NoticeReference</code>
-    * instance or from parsing it from a DER-encoded stream. 
-    */
-   public NoticeReference(
-       ASN1Sequence as) 
-   {
-       if (as.size() != 2)
-       {
-            throw new IllegalArgumentException("Bad sequence size: "
-                    + as.size());
-       }
-
-       organization = DisplayText.getInstance(as.getObjectAt(0));
-       noticeNumbers = ASN1Sequence.getInstance(as.getObjectAt(1));
-   }
-
-   public static NoticeReference getInstance(
-       Object as) 
-   {
-      if (as instanceof NoticeReference)
-      {
-          return (NoticeReference)as;
-      }
-      else if (as instanceof ASN1Sequence)
-      {
-          return new NoticeReference((ASN1Sequence)as);
-      }
-
-      throw new IllegalArgumentException("unknown object in getInstance.");
-   }
-   
-   public DisplayText getOrganization()
-   {
-       return organization;
-   }
-   
-   public ASN1Sequence getNoticeNumbers()
-   {
-       return noticeNumbers;
-   }
-   
-   /**
-    * Describe <code>toASN1Object</code> method here.
-    *
-    * @return a <code>DERObject</code> value
-    */
-   public DERObject toASN1Object() 
-   {
-      ASN1EncodableVector av = new ASN1EncodableVector();
-      av.add (organization);
-      av.add (noticeNumbers);
-      return new DERSequence (av);
-   }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/ObjectDigestInfo.java b/azureus2/src/org/bouncycastle/asn1/x509/ObjectDigestInfo.java
deleted file mode 100644
index b881509..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/ObjectDigestInfo.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DEREnumerated;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-
-/**
- * ObjectDigestInfo ASN.1 structure used in v2 attribute certificates.
- * 
- * <pre>
- *  
- *    ObjectDigestInfo ::= SEQUENCE {
- *         digestedObjectType  ENUMERATED {
- *                 publicKey            (0),
- *                 publicKeyCert        (1),
- *                 otherObjectTypes     (2) },
- *                         -- otherObjectTypes MUST NOT
- *                         -- be used in this profile
- *         otherObjectTypeID   OBJECT IDENTIFIER OPTIONAL,
- *         digestAlgorithm     AlgorithmIdentifier,
- *         objectDigest        BIT STRING
- *    }
- *   
- * </pre>
- * 
- */
-public class ObjectDigestInfo
-    extends ASN1Encodable
-{
-    /**
-     * The public key is hashed.
-     */
-    public final static int publicKey = 0;
-
-    /**
-     * The public key certificate is hashed.
-     */
-    public final static int publicKeyCert = 1;
-
-    /**
-     * An other object is hashed.
-     */
-    public final static int otherObjectDigest = 2;
-
-    DEREnumerated digestedObjectType;
-
-    DERObjectIdentifier otherObjectTypeID;
-
-    AlgorithmIdentifier digestAlgorithm;
-
-    DERBitString objectDigest;
-
-    public static ObjectDigestInfo getInstance(
-        Object obj)
-    {
-        if (obj == null || obj instanceof ObjectDigestInfo)
-        {
-            return (ObjectDigestInfo)obj;
-        }
-
-        if (obj instanceof ASN1Sequence)
-        {
-            return new ObjectDigestInfo((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: "
-            + obj.getClass().getName());
-    }
-
-    public static ObjectDigestInfo getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    /**
-     * Constructor from given details.
-     * <p>
-     * If <code>digestedObjectType</code> is not {@link #publicKeyCert} or
-     * {@link #publicKey} <code>otherObjectTypeID</code> must be given,
-     * otherwise it is ignored.
-     * 
-     * @param digestedObjectType The digest object type.
-     * @param otherObjectTypeID The object type ID for
-     *            <code>otherObjectDigest</code>.
-     * @param digestAlgorithm The algorithm identifier for the hash.
-     * @param objectDigest The hash value.
-     */
-    public ObjectDigestInfo(
-        int digestedObjectType,
-        String otherObjectTypeID,
-        AlgorithmIdentifier digestAlgorithm,
-        byte[] objectDigest)
-    {
-        this.digestedObjectType = new DEREnumerated(digestedObjectType);
-        if (digestedObjectType == otherObjectDigest)
-        {
-            this.otherObjectTypeID = new DERObjectIdentifier(otherObjectTypeID);
-        }
-
-        this.digestAlgorithm = digestAlgorithm; 
-
-        this.objectDigest = new DERBitString(objectDigest);
-    }
-
-    private ObjectDigestInfo(
-        ASN1Sequence seq)
-    {
-        if (seq.size() > 4 || seq.size() < 3)
-        {
-            throw new IllegalArgumentException("Bad sequence size: "
-                + seq.size());
-        }
-
-        digestedObjectType = DEREnumerated.getInstance(seq.getObjectAt(0));
-
-        int offset = 0;
-
-        if (seq.size() == 4)
-        {
-            otherObjectTypeID = DERObjectIdentifier.getInstance(seq.getObjectAt(1));
-            offset++;
-        }
-
-        digestAlgorithm = AlgorithmIdentifier.getInstance(seq.getObjectAt(1 + offset));
-
-        objectDigest = DERBitString.getInstance(seq.getObjectAt(2 + offset));
-    }
-
-    public DEREnumerated getDigestedObjectType()
-    {
-        return digestedObjectType;
-    }
-
-    public DERObjectIdentifier getOtherObjectTypeID()
-    {
-        return otherObjectTypeID;
-    }
-
-    public AlgorithmIdentifier getDigestAlgorithm()
-    {
-        return digestAlgorithm;
-    }
-
-    public DERBitString getObjectDigest()
-    {
-        return objectDigest;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * 
-     * <pre>
-     *  
-     *    ObjectDigestInfo ::= SEQUENCE {
-     *         digestedObjectType  ENUMERATED {
-     *                 publicKey            (0),
-     *                 publicKeyCert        (1),
-     *                 otherObjectTypes     (2) },
-     *                         -- otherObjectTypes MUST NOT
-     *                         -- be used in this profile
-     *         otherObjectTypeID   OBJECT IDENTIFIER OPTIONAL,
-     *         digestAlgorithm     AlgorithmIdentifier,
-     *         objectDigest        BIT STRING
-     *    }
-     *   
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        v.add(digestedObjectType);
-
-        if (otherObjectTypeID != null)
-        {
-            v.add(otherObjectTypeID);
-        }
-
-        v.add(digestAlgorithm);
-        v.add(objectDigest);
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/PolicyInformation.java b/azureus2/src/org/bouncycastle/asn1/x509/PolicyInformation.java
deleted file mode 100644
index b4373b0..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/PolicyInformation.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-
-public class PolicyInformation
-    extends ASN1Encodable
-{
-    private DERObjectIdentifier   policyIdentifier;
-    private ASN1Sequence          policyQualifiers;
-
-    public PolicyInformation(
-        ASN1Sequence seq)
-    {
-        if (seq.size() < 1 || seq.size() > 2)
-        {
-            throw new IllegalArgumentException("Bad sequence size: "
-                    + seq.size());
-        }
-
-        policyIdentifier = DERObjectIdentifier.getInstance(seq.getObjectAt(0));
-
-        if (seq.size() > 1)
-        {
-            policyQualifiers = ASN1Sequence.getInstance(seq.getObjectAt(1));
-        }
-    }
-
-    public PolicyInformation(
-        DERObjectIdentifier policyIdentifier)
-    {
-        this.policyIdentifier = policyIdentifier;
-    }
-
-    public PolicyInformation(
-        DERObjectIdentifier policyIdentifier,
-        ASN1Sequence        policyQualifiers)
-    {
-        this.policyIdentifier = policyIdentifier;
-        this.policyQualifiers = policyQualifiers;
-    }
-
-    public static PolicyInformation getInstance(
-        Object obj)
-    {
-        if (obj == null || obj instanceof PolicyInformation)
-        {
-            return (PolicyInformation)obj;
-        }
-
-        return new PolicyInformation(ASN1Sequence.getInstance(obj));
-    }
-
-    public DERObjectIdentifier getPolicyIdentifier()
-    {
-        return policyIdentifier;
-    }
-    
-    public ASN1Sequence getPolicyQualifiers()
-    {
-        return policyQualifiers;
-    }
-    
-    /* 
-     * PolicyInformation ::= SEQUENCE {
-     *      policyIdentifier   CertPolicyId,
-     *      policyQualifiers   SEQUENCE SIZE (1..MAX) OF
-     *              PolicyQualifierInfo OPTIONAL }
-     */ 
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-        
-        v.add(policyIdentifier);
-
-        if (policyQualifiers != null)
-        {
-            v.add(policyQualifiers);
-        }
-        
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/PolicyMappings.java b/azureus2/src/org/bouncycastle/asn1/x509/PolicyMappings.java
deleted file mode 100644
index df78ec4..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/PolicyMappings.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import java.util.Hashtable;
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-
-/**
- * PolicyMappings V3 extension, described in RFC3280.
- * <pre>
- *    PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE {
- *      issuerDomainPolicy      CertPolicyId,
- *      subjectDomainPolicy     CertPolicyId }
- * </pre>
- *
- * @see <a href="http://www.faqs.org/rfc/rfc3280.txt">RFC 3280, section 4.2.1.6</a>
- */
-public class PolicyMappings
-    extends ASN1Encodable
-{
-   ASN1Sequence seq = null;
-
-   /**
-    * Creates a new <code>PolicyMappings</code> instance.
-    *
-    * @param seq an <code>ASN1Sequence</code> constructed as specified
-    * in RFC 3280
-    */
-   public PolicyMappings (ASN1Sequence seq) 
-      {
-         this.seq = seq;
-      }
-
-   /**
-    * Creates a new <code>PolicyMappings</code> instance.
-    *
-    * @param mappings a <code>HashMap</code> value that maps
-    * <code>String</code> oids
-    * to other <code>String</code> oids. 
-    */
-   public PolicyMappings (Hashtable mappings) 
-      {
-         ASN1EncodableVector dev = new ASN1EncodableVector();
-         Enumeration it = mappings.keys();
-
-         while (it.hasMoreElements())
-         {
-            String idp = (String) it.nextElement();
-            String sdp = (String) mappings.get(idp);
-            ASN1EncodableVector dv = new ASN1EncodableVector();
-            dv.add(new DERObjectIdentifier(idp));
-            dv.add(new DERObjectIdentifier(sdp));
-            dev.add(new DERSequence(dv));
-         }
-
-         seq = new DERSequence(dev);
-      }
-
-   public DERObject toASN1Object() 
-      {
-         return seq;
-      }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/PolicyQualifierId.java b/azureus2/src/org/bouncycastle/asn1/x509/PolicyQualifierId.java
deleted file mode 100644
index 2678057..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/PolicyQualifierId.java
+++ /dev/null
@@ -1,31 +0,0 @@
-
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.DERObjectIdentifier;
-
-/**
- * PolicyQualifierId, used in the CertificatePolicies
- * X509V3 extension.
- * 
- * <pre>
- *    id-qt          OBJECT IDENTIFIER ::=  { id-pkix 2 }
- *    id-qt-cps      OBJECT IDENTIFIER ::=  { id-qt 1 }
- *    id-qt-unotice  OBJECT IDENTIFIER ::=  { id-qt 2 }
- *  PolicyQualifierId ::=
- *       OBJECT IDENTIFIER (id-qt-cps | id-qt-unotice)
- * </pre>
- */
-public class PolicyQualifierId extends DERObjectIdentifier 
-{
-   private static final String id_qt = "1.3.6.1.5.5.7.2";
-
-   private PolicyQualifierId(String id) 
-      {
-         super(id);
-      }
-   
-   public static final PolicyQualifierId id_qt_cps =
-       new PolicyQualifierId(id_qt + ".1");
-   public static final PolicyQualifierId id_qt_unotice =
-       new PolicyQualifierId(id_qt + ".2");
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/PolicyQualifierInfo.java b/azureus2/src/org/bouncycastle/asn1/x509/PolicyQualifierInfo.java
deleted file mode 100644
index 6e97f70..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/PolicyQualifierInfo.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERIA5String;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-
-/**
- * Policy qualifiers, used in the X509V3 CertificatePolicies
- * extension.
- * 
- * <pre>
- *   PolicyQualifierInfo ::= SEQUENCE {
- *       policyQualifierId  PolicyQualifierId,
- *       qualifier          ANY DEFINED BY policyQualifierId }
- * </pre>
- */
-public class PolicyQualifierInfo
-    extends ASN1Encodable
-{
-   private DERObjectIdentifier policyQualifierId;
-   private DEREncodable        qualifier;
-
-   /**
-    * Creates a new <code>PolicyQualifierInfo</code> instance.
-    *
-    * @param policyQualifierId a <code>PolicyQualifierId</code> value
-    * @param qualifier the qualifier, defined by the above field.
-    */
-   public PolicyQualifierInfo(
-       DERObjectIdentifier policyQualifierId,
-       DEREncodable qualifier) 
-   {
-      this.policyQualifierId = policyQualifierId;
-      this.qualifier = qualifier;
-   }
-
-   /**
-    * Creates a new <code>PolicyQualifierInfo</code> containing a
-    * cPSuri qualifier.
-    *
-    * @param cps the CPS (certification practice statement) uri as a
-    * <code>String</code>.
-    */
-   public PolicyQualifierInfo(
-       String cps) 
-   {
-      policyQualifierId = PolicyQualifierId.id_qt_cps;
-      qualifier = new DERIA5String (cps);
-   }
-
-   /**
-    * Creates a new <code>PolicyQualifierInfo</code> instance.
-    *
-    * @param as <code>PolicyQualifierInfo</code> X509 structure
-    * encoded as an ASN1Sequence. 
-    */
-   public PolicyQualifierInfo(
-       ASN1Sequence as)
-   {
-        if (as.size() != 2)
-        {
-            throw new IllegalArgumentException("Bad sequence size: "
-                    + as.size());
-        }
-
-        policyQualifierId = DERObjectIdentifier.getInstance(as.getObjectAt(0));
-        qualifier = as.getObjectAt(1);
-   }
-
-   public static PolicyQualifierInfo getInstance(
-       Object as) 
-   {
-        if (as instanceof PolicyQualifierInfo)
-        {
-            return (PolicyQualifierInfo)as;
-        }
-        else if (as instanceof ASN1Sequence)
-        {
-            return new PolicyQualifierInfo((ASN1Sequence)as);
-        }
-
-        throw new IllegalArgumentException("unknown object in getInstance.");
-   }
-
-
-   public DERObjectIdentifier getPolicyQualifierId()
-   {
-       return policyQualifierId;
-   }
-
-   public DEREncodable getQualifier()
-   {
-       return qualifier;
-   }
-   
-   /**
-    * Returns a DER-encodable representation of this instance. 
-    *
-    * @return a <code>DERObject</code> value
-    */
-   public DERObject toASN1Object() 
-   {
-      ASN1EncodableVector dev = new ASN1EncodableVector();
-      dev.add(policyQualifierId);
-      dev.add(qualifier);
-
-      return new DERSequence(dev);
-   }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/PrivateKeyUsagePeriod.java b/azureus2/src/org/bouncycastle/asn1/x509/PrivateKeyUsagePeriod.java
deleted file mode 100644
index b9db18f..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/PrivateKeyUsagePeriod.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERGeneralizedTime;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-
-import java.util.Enumeration;
-
-/**
- * <pre>
- *    PrivateKeyUsagePeriod ::= SEQUENCE {
- *      notBefore       [0]     GeneralizedTime OPTIONAL,
- *      notAfter        [1]     GeneralizedTime OPTIONAL }
- * </pre>
- */
-public class PrivateKeyUsagePeriod
-    extends ASN1Encodable
-{
-    public static PrivateKeyUsagePeriod getInstance(Object obj)
-    {
-        if (obj instanceof PrivateKeyUsagePeriod)
-        {
-            return (PrivateKeyUsagePeriod)obj;
-        }
-
-        if (obj instanceof ASN1Sequence)
-        {
-            return new PrivateKeyUsagePeriod((ASN1Sequence)obj);
-        }
-
-        if (obj instanceof X509Extension)
-        {
-            return getInstance(X509Extension.convertValueToObject((X509Extension)obj));
-        }
-
-        throw new IllegalArgumentException("unknown object in getInstance");
-    }
-
-    private DERGeneralizedTime _notBefore, _notAfter;
-
-    private PrivateKeyUsagePeriod(ASN1Sequence seq)
-    {
-        Enumeration en = seq.getObjects();
-        while (en.hasMoreElements())
-        {
-            ASN1TaggedObject tObj = (ASN1TaggedObject)en.nextElement();
-
-            if (tObj.getTagNo() == 0)
-            {
-                _notBefore = DERGeneralizedTime.getInstance(tObj, false);
-            }
-            else if (tObj.getTagNo() == 1)
-            {
-                _notAfter = DERGeneralizedTime.getInstance(tObj, false);
-            }
-        }
-    }
-
-    public DERGeneralizedTime getNotBefore()
-    {
-        return _notBefore;
-    }
-
-    public DERGeneralizedTime getNotAfter()
-    {
-        return _notAfter;
-    }
-
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        if (_notBefore != null)
-        {
-            v.add(new DERTaggedObject(false, 0, _notBefore));
-        }
-        if (_notAfter != null)
-        {
-            v.add(new DERTaggedObject(false, 1, _notAfter));
-        }
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/RSAPublicKeyStructure.java b/azureus2/src/org/bouncycastle/asn1/x509/RSAPublicKeyStructure.java
deleted file mode 100644
index 0047f6a..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/RSAPublicKeyStructure.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import java.math.BigInteger;
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-public class RSAPublicKeyStructure
-    extends ASN1Encodable
-{
-    private BigInteger  modulus;
-    private BigInteger  publicExponent;
-
-    public static RSAPublicKeyStructure getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static RSAPublicKeyStructure getInstance(
-        Object obj)
-    {
-        if(obj == null || obj instanceof RSAPublicKeyStructure) 
-        {
-            return (RSAPublicKeyStructure)obj;
-        }
-        
-        if(obj instanceof ASN1Sequence) 
-        {
-            return new RSAPublicKeyStructure((ASN1Sequence)obj);
-        }
-        
-        throw new IllegalArgumentException("Invalid RSAPublicKeyStructure: " + obj.getClass().getName());
-    }
-    
-    public RSAPublicKeyStructure(
-        BigInteger  modulus,
-        BigInteger  publicExponent)
-    {
-        this.modulus = modulus;
-        this.publicExponent = publicExponent;
-    }
-
-    public RSAPublicKeyStructure(
-        ASN1Sequence  seq)
-    {
-        if (seq.size() != 2)
-        {
-            throw new IllegalArgumentException("Bad sequence size: "
-                    + seq.size());
-        }
-
-        Enumeration e = seq.getObjects();
-
-        modulus = DERInteger.getInstance(e.nextElement()).getPositiveValue();
-        publicExponent = DERInteger.getInstance(e.nextElement()).getPositiveValue();
-    }
-
-    public BigInteger getModulus()
-    {
-        return modulus;
-    }
-
-    public BigInteger getPublicExponent()
-    {
-        return publicExponent;
-    }
-
-    /**
-     * This outputs the key in PKCS1v2 format.
-     * <pre>
-     *      RSAPublicKey ::= SEQUENCE {
-     *                          modulus INTEGER, -- n
-     *                          publicExponent INTEGER, -- e
-     *                      }
-     * </pre>
-     * <p>
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(new DERInteger(getModulus()));
-        v.add(new DERInteger(getPublicExponent()));
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/ReasonFlags.java b/azureus2/src/org/bouncycastle/asn1/x509/ReasonFlags.java
deleted file mode 100644
index 612e2c5..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/ReasonFlags.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.DERBitString;
-
-/**
- * The ReasonFlags object.
- * <pre>
- * ReasonFlags ::= BIT STRING {
- *      unused                  (0),
- *      keyCompromise           (1),
- *      cACompromise            (2),
- *      affiliationChanged      (3),
- *      superseded              (4),
- *      cessationOfOperation    (5),
- *      certificateHold         (6),
- *      privilegeWithdrawn      (7),
- *      aACompromise            (8) }
- * </pre>
- */
-public class ReasonFlags
-    extends DERBitString
-{
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int UNUSED                  = (1 << 7);
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int KEY_COMPROMISE          = (1 << 6);
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int CA_COMPROMISE           = (1 << 5);
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int AFFILIATION_CHANGED     = (1 << 4);
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int SUPERSEDED              = (1 << 3);
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int CESSATION_OF_OPERATION  = (1 << 2);
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int CERTIFICATE_HOLD        = (1 << 1);
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int PRIVILEGE_WITHDRAWN     = (1 << 0);
-    /**
-     * @deprecated use lower case version
-     */
-    public static final int AA_COMPROMISE           = (1 << 15);
-    
-    public static final int unused                  = (1 << 7);
-    public static final int keyCompromise           = (1 << 6);
-    public static final int cACompromise            = (1 << 5);
-    public static final int affiliationChanged      = (1 << 4);
-    public static final int superseded              = (1 << 3);
-    public static final int cessationOfOperation    = (1 << 2);
-    public static final int certificateHold         = (1 << 1);
-    public static final int privilegeWithdrawn      = (1 << 0);
-    public static final int aACompromise            = (1 << 15);
-
-    /**
-     * @param reasons - the bitwise OR of the Key Reason flags giving the
-     * allowed uses for the key.
-     */
-    public ReasonFlags(
-        int reasons)
-    {
-        super(getBytes(reasons), getPadBits(reasons));
-    }
-
-    public ReasonFlags(
-        DERBitString reasons)
-    {
-        super(reasons.getBytes(), reasons.getPadBits());
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/RoleSyntax.java b/azureus2/src/org/bouncycastle/asn1/x509/RoleSyntax.java
deleted file mode 100644
index 2811fe7..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/RoleSyntax.java
+++ /dev/null
@@ -1,236 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERString;
-import org.bouncycastle.asn1.DERTaggedObject;
-
-/**
- * Implementation of the RoleSyntax object as specified by the RFC3281.
- * 
- * <pre>
- * RoleSyntax ::= SEQUENCE {
- *                 roleAuthority  [0] GeneralNames OPTIONAL,
- *                 roleName       [1] GeneralName
- *           } 
- * </pre>
- */
-public class RoleSyntax 
-    extends ASN1Encodable
-{
-    private GeneralNames roleAuthority;
-    private GeneralName roleName;
-
-    /**
-     * RoleSyntax factory method.
-     * @param obj the object used to construct an instance of <code>
-     * RoleSyntax</code>. It must be an instance of <code>RoleSyntax
-     * </code> or <code>ASN1Sequence</code>.
-     * @return the instance of <code>RoleSyntax</code> built from the
-     * supplied object.
-     * @throws java.lang.IllegalArgumentException if the object passed
-     * to the factory is not an instance of <code>RoleSyntax</code> or
-     * <code>ASN1Sequence</code>.
-     */
-    public static RoleSyntax getInstance(
-        Object obj)
-    {
-        
-        if(obj == null || obj instanceof RoleSyntax)
-        {
-            return (RoleSyntax)obj;
-        }
-        else if(obj instanceof ASN1Sequence)
-        {
-            return new RoleSyntax((ASN1Sequence)obj);
-        }
-        throw new IllegalArgumentException("Unknown object in RoleSyntax factory.");
-    }
-    
-    /**
-     * Constructor.
-     * @param roleAuthority the role authority of this RoleSyntax.
-     * @param roleName    the role name of this RoleSyntax.
-     */
-    public RoleSyntax(
-        GeneralNames roleAuthority,
-        GeneralName roleName)
-    {
-        if(roleName == null || 
-                roleName.getTagNo() != GeneralName.uniformResourceIdentifier ||
-                ((DERString)roleName.getName()).getString().equals(""))
-        {
-            throw new IllegalArgumentException("the role name MUST be non empty and MUST " +
-                    "use the URI option of GeneralName");
-        }
-        this.roleAuthority = roleAuthority;
-        this.roleName = roleName;
-    }
-    
-    /**
-     * Constructor. Invoking this constructor is the same as invoking
-     * <code>new RoleSyntax(null, roleName)</code>.
-     * @param roleName    the role name of this RoleSyntax.
-     */
-    public RoleSyntax(
-        GeneralName roleName)
-    {
-        this(null, roleName);
-    }
-
-    /**
-     * Utility constructor. Takes a <code>String</code> argument representing
-     * the role name, builds a <code>GeneralName</code> to hold the role name
-     * and calls the constructor that takes a <code>GeneralName</code>.
-     * @param roleName
-     */
-    public RoleSyntax(
-        String roleName)
-    {
-        this(new GeneralName(GeneralName.uniformResourceIdentifier,
-                (roleName == null)? "": roleName));
-    }
-    
-    /**
-     * Constructor that builds an instance of <code>RoleSyntax</code> by
-     * extracting the encoded elements from the <code>ASN1Sequence</code>
-     * object supplied.
-     * @param seq    an instance of <code>ASN1Sequence</code> that holds
-     * the encoded elements used to build this <code>RoleSyntax</code>.
-     */
-    public RoleSyntax(
-        ASN1Sequence seq)
-    {
-        if (seq.size() < 1 || seq.size() > 2)
-        {
-            throw new IllegalArgumentException("Bad sequence size: "
-                    + seq.size());
-        }
-
-        for (int i = 0; i != seq.size(); i++)
-        {
-            ASN1TaggedObject taggedObject = ASN1TaggedObject.getInstance(seq.getObjectAt(i));
-            switch (taggedObject.getTagNo())
-            {
-            case 0:
-                roleAuthority = GeneralNames.getInstance(taggedObject, false);
-                break;
-            case 1:
-                roleName = GeneralName.getInstance(taggedObject, false);
-                break;
-            default:
-                throw new IllegalArgumentException("Unknown tag in RoleSyntax");
-            }
-        }
-    }
-
-    /**
-     * Gets the role authority of this RoleSyntax.
-     * @return    an instance of <code>GeneralNames</code> holding the
-     * role authority of this RoleSyntax.
-     */
-    public GeneralNames getRoleAuthority()
-    {
-        return this.roleAuthority;
-    }
-    
-    /**
-     * Gets the role name of this RoleSyntax.
-     * @return    an instance of <code>GeneralName</code> holding the
-     * role name of this RoleSyntax.
-     */
-    public GeneralName getRoleName()
-    {
-        return this.roleName;
-    }
-    
-    /**
-     * Gets the role name as a <code>java.lang.String</code> object.
-     * @return    the role name of this RoleSyntax represented as a 
-     * <code>java.lang.String</code> object.
-     */
-    public String getRoleNameAsString()
-    {
-        DERString str = (DERString)this.roleName.getName();
-        
-        return str.getString();
-    }
-    
-    /**
-     * Gets the role authority as a <code>String[]</code> object.
-     * @return the role authority of this RoleSyntax represented as a
-     * <code>String[]</code> array.
-     */
-    public String[] getRoleAuthorityAsString() 
-    {
-        if(roleAuthority == null) 
-        {
-            return new String[0];
-        }
-        
-        GeneralName[] names = roleAuthority.getNames();
-        String[] namesString = new String[names.length];
-        for(int i = 0; i < names.length; i++) 
-        {
-            DEREncodable value = names[i].getName();
-            if(value instanceof DERString)
-            {
-                namesString[i] = ((DERString)value).getString();
-            }
-            else
-            {
-                namesString[i] = value.toString();
-            }
-        }
-        return namesString;
-    }
-    
-    /**
-     * Implementation of the method <code>toASN1Object</code> as
-     * required by the superclass <code>ASN1Encodable</code>.
-     * 
-     * <pre>
-     * RoleSyntax ::= SEQUENCE {
-     *                 roleAuthority  [0] GeneralNames OPTIONAL,
-     *                 roleName       [1] GeneralName
-     *           } 
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-        if(this.roleAuthority != null)
-        {
-            v.add(new DERTaggedObject(false, 0, roleAuthority));
-        }
-        v.add(new DERTaggedObject(false, 1, roleName));
-        
-        return new DERSequence(v);
-    }
-    
-    public String toString() 
-    {
-        StringBuffer buff = new StringBuffer("Name: " + this.getRoleNameAsString() +
-                " - Auth: ");
-        if(this.roleAuthority == null || roleAuthority.getNames().length == 0)
-        {
-            buff.append("N/A");
-        }
-        else 
-        {
-            String[] names = this.getRoleAuthorityAsString();
-            buff.append('[').append(names[0]);
-            for(int i = 1; i < names.length; i++) 
-            {
-                    buff.append(", ").append(names[i]);
-            }
-            buff.append(']');
-        }
-        return buff.toString();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/SubjectDirectoryAttributes.java b/azureus2/src/org/bouncycastle/asn1/x509/SubjectDirectoryAttributes.java
deleted file mode 100644
index 3dede65..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/SubjectDirectoryAttributes.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import java.util.Enumeration;
-import java.util.Vector;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-/**
- * This extension may contain further X.500 attributes of the subject. See also
- * RFC 3039.
- * 
- * <pre>
- *     SubjectDirectoryAttributes ::= Attributes
- *     Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
- *     Attribute ::= SEQUENCE 
- *     {
- *       type AttributeType 
- *       values SET OF AttributeValue 
- *     }
- *     
- *     AttributeType ::= OBJECT IDENTIFIER
- *     AttributeValue ::= ANY DEFINED BY AttributeType
- * </pre>
- * 
- * @see org.bouncycastle.asn1.x509.X509Name for AttributeType ObjectIdentifiers.
- */
-public class SubjectDirectoryAttributes 
-    extends ASN1Encodable
-{
-    private Vector attributes = new Vector();
-
-    public static SubjectDirectoryAttributes getInstance(
-        Object obj)
-    {
-        if (obj == null || obj instanceof SubjectDirectoryAttributes)
-        {
-            return (SubjectDirectoryAttributes)obj;
-        }
-
-        if (obj instanceof ASN1Sequence)
-        {
-            return new SubjectDirectoryAttributes((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    /**
-     * Constructor from ASN1Sequence.
-     * 
-     * The sequence is of type SubjectDirectoryAttributes:
-     * 
-     * <pre>
-     *      SubjectDirectoryAttributes ::= Attributes
-     *      Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
-     *      Attribute ::= SEQUENCE 
-     *      {
-     *        type AttributeType 
-     *        values SET OF AttributeValue 
-     *      }
-     *      
-     *      AttributeType ::= OBJECT IDENTIFIER
-     *      AttributeValue ::= ANY DEFINED BY AttributeType
-     * </pre>
-     * 
-     * @param seq
-     *            The ASN.1 sequence.
-     */
-    public SubjectDirectoryAttributes(ASN1Sequence seq)
-    {
-        Enumeration e = seq.getObjects();
-
-        while (e.hasMoreElements())
-        {
-            ASN1Sequence s = ASN1Sequence.getInstance(e.nextElement());
-            attributes.addElement(new Attribute(s));
-        }
-    }
-
-    /**
-     * Constructor from a vector of attributes.
-     * 
-     * The vector consists of attributes of type {@link Attribute Attribute}
-     * 
-     * @param attributes
-     *            The attributes.
-     * 
-     */
-    public SubjectDirectoryAttributes(Vector attributes)
-    {
-        Enumeration e = attributes.elements();
-
-        while (e.hasMoreElements())
-        {
-            this.attributes.addElement(e.nextElement());
-        }
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * 
-     * Returns:
-     * 
-     * <pre>
-     *      SubjectDirectoryAttributes ::= Attributes
-     *      Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
-     *      Attribute ::= SEQUENCE 
-     *      {
-     *        type AttributeType 
-     *        values SET OF AttributeValue 
-     *      }
-     *      
-     *      AttributeType ::= OBJECT IDENTIFIER
-     *      AttributeValue ::= ANY DEFINED BY AttributeType
-     * </pre>
-     * 
-     * @return a DERObject
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector vec = new ASN1EncodableVector();
-        Enumeration e = attributes.elements();
-
-        while (e.hasMoreElements())
-        {
-
-            vec.add((Attribute)e.nextElement());
-        }
-
-        return new DERSequence(vec);
-    }
-
-    /**
-     * @return Returns the attributes.
-     */
-    public Vector getAttributes()
-    {
-        return attributes;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/SubjectKeyIdentifier.java b/azureus2/src/org/bouncycastle/asn1/x509/SubjectKeyIdentifier.java
deleted file mode 100644
index 357b578..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/SubjectKeyIdentifier.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.crypto.Digest;
-import org.bouncycastle.crypto.digests.SHA1Digest;
-
-/**
- * The SubjectKeyIdentifier object.
- * <pre>
- * SubjectKeyIdentifier::= OCTET STRING
- * </pre>
- */
-public class SubjectKeyIdentifier
-    extends ASN1Encodable
-{
-    private byte[] keyidentifier;
-
-    public static SubjectKeyIdentifier getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1OctetString.getInstance(obj, explicit));
-    }
-
-    public static SubjectKeyIdentifier getInstance(
-        Object obj)
-    {
-        if (obj instanceof SubjectKeyIdentifier)
-        {
-            return (SubjectKeyIdentifier)obj;
-        }
-        
-        if (obj instanceof SubjectPublicKeyInfo) 
-        {
-            return new SubjectKeyIdentifier((SubjectPublicKeyInfo)obj);
-        }
-        
-        if (obj instanceof ASN1OctetString) 
-        {
-            return new SubjectKeyIdentifier((ASN1OctetString)obj);
-        }
-
-        if (obj instanceof X509Extension)
-        {
-            return getInstance(X509Extension.convertValueToObject((X509Extension)obj));
-        }
-
-        throw new IllegalArgumentException("Invalid SubjectKeyIdentifier: " + obj.getClass().getName());
-    }
-    
-    public SubjectKeyIdentifier(
-        byte[] keyid)
-    {
-        this.keyidentifier=keyid;
-    }
-
-    public SubjectKeyIdentifier(
-        ASN1OctetString  keyid)
-    {
-        this.keyidentifier=keyid.getOctets();
-
-    }
-
-    /**
-     *
-     * Calulates the keyidentifier using a SHA1 hash over the BIT STRING
-     * from SubjectPublicKeyInfo as defined in RFC2459.
-     *
-     **/
-    public SubjectKeyIdentifier(
-        SubjectPublicKeyInfo    spki)
-    {
-        Digest  digest = new SHA1Digest();
-        byte[]  resBuf = new byte[digest.getDigestSize()];
-
-        byte[] bytes = spki.getPublicKeyData().getBytes();
-        digest.update(bytes, 0, bytes.length);
-        digest.doFinal(resBuf, 0);
-        this.keyidentifier=resBuf;
-    }
-
-    public byte[] getKeyIdentifier()
-    {
-        return keyidentifier;
-    }
-
-    public DERObject toASN1Object()
-    {
-        return new DEROctetString(keyidentifier);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/SubjectPublicKeyInfo.java b/azureus2/src/org/bouncycastle/asn1/x509/SubjectPublicKeyInfo.java
deleted file mode 100644
index a733727..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/SubjectPublicKeyInfo.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import java.io.IOException;
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1InputStream;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-/**
- * The object that contains the public key stored in a certficate.
- * <p>
- * The getEncoded() method in the public keys in the JCE produces a DER
- * encoded one of these.
- */
-public class SubjectPublicKeyInfo
-    extends ASN1Encodable
-{
-    private AlgorithmIdentifier     algId;
-    private DERBitString            keyData;
-
-    public static SubjectPublicKeyInfo getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static SubjectPublicKeyInfo getInstance(
-        Object  obj)
-    {
-        if (obj instanceof SubjectPublicKeyInfo)
-        {
-            return (SubjectPublicKeyInfo)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new SubjectPublicKeyInfo((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    public SubjectPublicKeyInfo(
-        AlgorithmIdentifier algId,
-        DEREncodable        publicKey)
-    {
-        this.keyData = new DERBitString(publicKey);
-        this.algId = algId;
-    }
-
-    public SubjectPublicKeyInfo(
-        AlgorithmIdentifier algId,
-        byte[]              publicKey)
-    {
-        this.keyData = new DERBitString(publicKey);
-        this.algId = algId;
-    }
-
-    public SubjectPublicKeyInfo(
-        ASN1Sequence  seq)
-    {
-        if (seq.size() != 2)
-        {
-            throw new IllegalArgumentException("Bad sequence size: "
-                    + seq.size());
-        }
-
-        Enumeration         e = seq.getObjects();
-
-        this.algId = AlgorithmIdentifier.getInstance(e.nextElement());
-        this.keyData = DERBitString.getInstance(e.nextElement());
-    }
-
-    public AlgorithmIdentifier getAlgorithmId()
-    {
-        return algId;
-    }
-
-    /**
-     * for when the public key is an encoded object - if the bitstring
-     * can't be decoded this routine throws an IOException.
-     *
-     * @exception IOException - if the bit string doesn't represent a DER
-     * encoded object.
-     */
-    public DERObject getPublicKey()
-        throws IOException
-    {
-        ASN1InputStream         aIn = new ASN1InputStream(keyData.getBytes());
-
-        return aIn.readObject();
-    }
-
-    /**
-     * for when the public key is raw bits...
-     */
-    public DERBitString getPublicKeyData()
-    {
-        return keyData;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     * SubjectPublicKeyInfo ::= SEQUENCE {
-     *                          algorithm AlgorithmIdentifier,
-     *                          publicKey BIT STRING }
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(algId);
-        v.add(keyData);
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/TBSCertList.java b/azureus2/src/org/bouncycastle/asn1/x509/TBSCertList.java
deleted file mode 100644
index 6c5afd8..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/TBSCertList.java
+++ /dev/null
@@ -1,212 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERGeneralizedTime;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERTaggedObject;
-import org.bouncycastle.asn1.DERUTCTime;
-
-/**
- * PKIX RFC-2459 - TBSCertList object.
- * <pre>
- * TBSCertList  ::=  SEQUENCE  {
- *      version                 Version OPTIONAL,
- *                                   -- if present, shall be v2
- *      signature               AlgorithmIdentifier,
- *      issuer                  Name,
- *      thisUpdate              Time,
- *      nextUpdate              Time OPTIONAL,
- *      revokedCertificates     SEQUENCE OF SEQUENCE  {
- *           userCertificate         CertificateSerialNumber,
- *           revocationDate          Time,
- *           crlEntryExtensions      Extensions OPTIONAL
- *                                         -- if present, shall be v2
- *                                }  OPTIONAL,
- *      crlExtensions           [0]  EXPLICIT Extensions OPTIONAL
- *                                         -- if present, shall be v2
- *                                }
- * </pre>
- */
-public class TBSCertList
-    extends ASN1Encodable
-{
-    public class CRLEntry
-        extends ASN1Encodable
-    {
-        ASN1Sequence  seq;
-
-        DERInteger          userCertificate;
-        Time                revocationDate;
-        X509Extensions      crlEntryExtensions;
-
-        public CRLEntry(
-            ASN1Sequence  seq)
-        {
-            if (seq.size() < 2 || seq.size() > 3)
-            {
-                throw new IllegalArgumentException("Bad sequence size: " + seq.size());
-            }
-            
-            this.seq = seq;
-
-            userCertificate = DERInteger.getInstance(seq.getObjectAt(0));
-            revocationDate = Time.getInstance(seq.getObjectAt(1));
-            if (seq.size() == 3)
-            {
-                crlEntryExtensions = X509Extensions.getInstance(seq.getObjectAt(2));
-            }
-        }
-
-        public DERInteger getUserCertificate()
-        {
-            return userCertificate;
-        }
-
-        public Time getRevocationDate()
-        {
-            return revocationDate;
-        }
-
-        public X509Extensions getExtensions()
-        {
-            return crlEntryExtensions;
-        }
-
-        public DERObject toASN1Object()
-        {
-            return seq;
-        }
-    }
-
-    ASN1Sequence     seq;
-
-    DERInteger              version;
-    AlgorithmIdentifier     signature;
-    X509Name                issuer;
-    Time                    thisUpdate;
-    Time                    nextUpdate;
-    CRLEntry[]              revokedCertificates;
-    X509Extensions          crlExtensions;
-
-    public static TBSCertList getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static TBSCertList getInstance(
-        Object  obj)
-    {
-        if (obj instanceof TBSCertList)
-        {
-            return (TBSCertList)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new TBSCertList((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    public TBSCertList(
-        ASN1Sequence  seq)
-    {
-        if (seq.size() < 3 || seq.size() > 7)
-        {
-            throw new IllegalArgumentException("Bad sequence size: " + seq.size());
-        }
-
-        int seqPos = 0;
-
-        this.seq = seq;
-
-        if (seq.getObjectAt(seqPos) instanceof DERInteger)
-        {
-            version = DERInteger.getInstance(seq.getObjectAt(seqPos++));
-        }
-        else
-        {
-            version = new DERInteger(0);
-        }
-
-        signature = AlgorithmIdentifier.getInstance(seq.getObjectAt(seqPos++));
-        issuer = X509Name.getInstance(seq.getObjectAt(seqPos++));
-        thisUpdate = Time.getInstance(seq.getObjectAt(seqPos++));
-
-        if (seqPos < seq.size()
-            && (seq.getObjectAt(seqPos) instanceof DERUTCTime
-               || seq.getObjectAt(seqPos) instanceof DERGeneralizedTime
-               || seq.getObjectAt(seqPos) instanceof Time))
-        {
-            nextUpdate = Time.getInstance(seq.getObjectAt(seqPos++));
-        }
-
-        if (seqPos < seq.size()
-            && !(seq.getObjectAt(seqPos) instanceof DERTaggedObject))
-        {
-            ASN1Sequence certs = ASN1Sequence.getInstance(seq.getObjectAt(seqPos++));
-            revokedCertificates = new CRLEntry[certs.size()];
-
-            for (int i = 0; i < revokedCertificates.length; i++)
-            {
-                revokedCertificates[i] = new CRLEntry(ASN1Sequence.getInstance(certs.getObjectAt(i)));
-            }
-        }
-
-        if (seqPos < seq.size()
-            && seq.getObjectAt(seqPos) instanceof DERTaggedObject)
-        {
-            crlExtensions = X509Extensions.getInstance(seq.getObjectAt(seqPos++));
-        }
-    }
-
-    public int getVersion()
-    {
-        return version.getValue().intValue() + 1;
-    }
-
-    public DERInteger getVersionNumber()
-    {
-        return version;
-    }
-
-    public AlgorithmIdentifier getSignature()
-    {
-        return signature;
-    }
-
-    public X509Name getIssuer()
-    {
-        return issuer;
-    }
-
-    public Time getThisUpdate()
-    {
-        return thisUpdate;
-    }
-
-    public Time getNextUpdate()
-    {
-        return nextUpdate;
-    }
-
-    public CRLEntry[] getRevokedCertificates()
-    {
-        return revokedCertificates;
-    }
-
-    public X509Extensions getExtensions()
-    {
-        return crlExtensions;
-    }
-
-    public DERObject toASN1Object()
-    {
-        return seq;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/TBSCertificateStructure.java b/azureus2/src/org/bouncycastle/asn1/x509/TBSCertificateStructure.java
deleted file mode 100644
index cc3c0e4..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/TBSCertificateStructure.java
+++ /dev/null
@@ -1,193 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERTaggedObject;
-import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-
-/**
- * The TBSCertificate object.
- * <pre>
- * TBSCertificate ::= SEQUENCE {
- *      version          [ 0 ]  Version DEFAULT v1(0),
- *      serialNumber            CertificateSerialNumber,
- *      signature               AlgorithmIdentifier,
- *      issuer                  Name,
- *      validity                Validity,
- *      subject                 Name,
- *      subjectPublicKeyInfo    SubjectPublicKeyInfo,
- *      issuerUniqueID    [ 1 ] IMPLICIT UniqueIdentifier OPTIONAL,
- *      subjectUniqueID   [ 2 ] IMPLICIT UniqueIdentifier OPTIONAL,
- *      extensions        [ 3 ] Extensions OPTIONAL
- *      }
- * </pre>
- * <p>
- * Note: issuerUniqueID and subjectUniqueID are both deprecated by the IETF. This class
- * will parse them, but you really shouldn't be creating new ones.
- */
-public class TBSCertificateStructure
-    extends ASN1Encodable
-    implements X509ObjectIdentifiers, PKCSObjectIdentifiers
-{
-    ASN1Sequence            seq;
-
-    DERInteger              version;
-    DERInteger              serialNumber;
-    AlgorithmIdentifier     signature;
-    X509Name                issuer;
-    Time                    startDate, endDate;
-    X509Name                subject;
-    SubjectPublicKeyInfo    subjectPublicKeyInfo;
-    DERBitString            issuerUniqueId;
-    DERBitString            subjectUniqueId;
-    X509Extensions          extensions;
-
-    public static TBSCertificateStructure getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static TBSCertificateStructure getInstance(
-        Object  obj)
-    {
-        if (obj instanceof TBSCertificateStructure)
-        {
-            return (TBSCertificateStructure)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new TBSCertificateStructure((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    public TBSCertificateStructure(
-        ASN1Sequence  seq)
-    {
-        int         seqStart = 0;
-
-        this.seq = seq;
-
-        //
-        // some certficates don't include a version number - we assume v1
-        //
-        if (seq.getObjectAt(0) instanceof DERTaggedObject)
-        {
-            version = DERInteger.getInstance(seq.getObjectAt(0));
-        }
-        else
-        {
-            seqStart = -1;          // field 0 is missing!
-            version = new DERInteger(0);
-        }
-
-        serialNumber = DERInteger.getInstance(seq.getObjectAt(seqStart + 1));
-
-        signature = AlgorithmIdentifier.getInstance(seq.getObjectAt(seqStart + 2));
-        issuer = X509Name.getInstance(seq.getObjectAt(seqStart + 3));
-
-        //
-        // before and after dates
-        //
-        ASN1Sequence  dates = (ASN1Sequence)seq.getObjectAt(seqStart + 4);
-
-        startDate = Time.getInstance(dates.getObjectAt(0));
-        endDate = Time.getInstance(dates.getObjectAt(1));
-
-        subject = X509Name.getInstance(seq.getObjectAt(seqStart + 5));
-
-        //
-        // public key info.
-        //
-        subjectPublicKeyInfo = SubjectPublicKeyInfo.getInstance(seq.getObjectAt(seqStart + 6));
-
-        for (int extras = seq.size() - (seqStart + 6) - 1; extras > 0; extras--)
-        {
-            DERTaggedObject extra = (DERTaggedObject)seq.getObjectAt(seqStart + 6 + extras);
-
-            switch (extra.getTagNo())
-            {
-            case 1:
-                issuerUniqueId = DERBitString.getInstance(extra, false);
-                break;
-            case 2:
-                subjectUniqueId = DERBitString.getInstance(extra, false);
-                break;
-            case 3:
-                extensions = X509Extensions.getInstance(extra);
-            }
-        }
-    }
-
-    public int getVersion()
-    {
-        return version.getValue().intValue() + 1;
-    }
-
-    public DERInteger getVersionNumber()
-    {
-        return version;
-    }
-
-    public DERInteger getSerialNumber()
-    {
-        return serialNumber;
-    }
-
-    public AlgorithmIdentifier getSignature()
-    {
-        return signature;
-    }
-
-    public X509Name getIssuer()
-    {
-        return issuer;
-    }
-
-    public Time getStartDate()
-    {
-        return startDate;
-    }
-
-    public Time getEndDate()
-    {
-        return endDate;
-    }
-
-    public X509Name getSubject()
-    {
-        return subject;
-    }
-
-    public SubjectPublicKeyInfo getSubjectPublicKeyInfo()
-    {
-        return subjectPublicKeyInfo;
-    }
-
-    public DERBitString getIssuerUniqueId()
-    {
-        return issuerUniqueId;
-    }
-
-    public DERBitString getSubjectUniqueId()
-    {
-        return subjectUniqueId;
-    }
-
-    public X509Extensions getExtensions()
-    {
-        return extensions;
-    }
-
-    public DERObject toASN1Object()
-    {
-        return seq;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/Target.java b/azureus2/src/org/bouncycastle/asn1/x509/Target.java
deleted file mode 100644
index 4d3b672..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/Target.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Choice;
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERTaggedObject;
-
-/**
- * Target structure used in target information extension for attribute
- * certificates from RFC 3281.
- * 
- * <pre>
- *     Target  ::= CHOICE {
- *       targetName          [0] GeneralName,
- *       targetGroup         [1] GeneralName,
- *       targetCert          [2] TargetCert
- *     }
- * </pre>
- * 
- * <p>
- * The targetCert field is currently not supported and must not be used
- * according to RFC 3281.
- */
-public class Target
-    extends ASN1Encodable
-    implements ASN1Choice
-{
-    public static final int targetName = 0;
-    public static final int targetGroup = 1;
-
-    private GeneralName targName;
-    private GeneralName targGroup;
-
-    /**
-     * Creates an instance of a Target from the given object.
-     * <p>
-     * <code>obj</code> can be a Target or a {@link ASN1TaggedObject}
-     * 
-     * @param obj The object.
-     * @return A Target instance.
-     * @throws IllegalArgumentException if the given object cannot be
-     *             interpreted as Target.
-     */
-    public static Target getInstance(Object obj)
-    {
-        if (obj instanceof Target)
-        {
-            return (Target) obj;
-        }
-        else if (obj instanceof ASN1TaggedObject)
-        {
-            return new Target((ASN1TaggedObject)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory: "
-            + obj.getClass());
-    }
-
-    /**
-     * Constructor from ASN1TaggedObject.
-     * 
-     * @param tagObj The tagged object.
-     * @throws IllegalArgumentException if the encoding is wrong.
-     */
-    private Target(ASN1TaggedObject tagObj)
-    {
-        switch (tagObj.getTagNo())
-        {
-        case targetName:     // GeneralName is already a choice so explicit
-            targName = GeneralName.getInstance(tagObj, true);
-            break;
-        case targetGroup:
-            targGroup = GeneralName.getInstance(tagObj, true);
-            break;
-        default:
-            throw new IllegalArgumentException("unknown tag: " + tagObj.getTagNo());
-        }
-    }
-
-    /**
-     * Constructor from given details.
-     * <p>
-     * Exactly one of the parameters must be not <code>null</code>.
-     *
-     * @param type the choice type to apply to the name.
-     * @param name the general name.
-     * @throws IllegalArgumentException if type is invalid.
-     */
-    public Target(int type, GeneralName name)
-    {
-        this(new DERTaggedObject(type, name));
-    }
-
-    /**
-     * @return Returns the targetGroup.
-     */
-    public GeneralName getTargetGroup()
-    {
-        return targGroup;
-    }
-
-    /**
-     * @return Returns the targetName.
-     */
-    public GeneralName getTargetName()
-    {
-        return targName;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * 
-     * Returns:
-     * 
-     * <pre>
-     *     Target  ::= CHOICE {
-     *       targetName          [0] GeneralName,
-     *       targetGroup         [1] GeneralName,
-     *       targetCert          [2] TargetCert
-     *     }
-     * </pre>
-     * 
-     * @return a DERObject
-     */
-    public DERObject toASN1Object()
-    {
-        // GeneralName is a choice already so most be explicitly tagged
-        if (targName != null)
-        {
-            return new DERTaggedObject(true, 0, targName);
-        }
-        else
-        {
-            return new DERTaggedObject(true, 1, targGroup);
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/TargetInformation.java b/azureus2/src/org/bouncycastle/asn1/x509/TargetInformation.java
deleted file mode 100644
index 7608b22..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/TargetInformation.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-import java.util.Enumeration;
-
-/**
- * Target information extension for attributes certificates according to RFC
- * 3281.
- * 
- * <pre>
- *           SEQUENCE OF Targets
- * </pre>
- * 
- */
-public class TargetInformation
-    extends ASN1Encodable
-{
-    private ASN1Sequence targets;
-
-    /**
-     * Creates an instance of a TargetInformation from the given object.
-     * <p>
-     * <code>obj</code> can be a TargetInformation or a {@link ASN1Sequence}
-     * 
-     * @param obj The object.
-     * @return A TargetInformation instance.
-     * @throws IllegalArgumentException if the given object cannot be
-     *             interpreted as TargetInformation.
-     */
-    public static TargetInformation getInstance(Object obj)
-    {
-        if (obj instanceof TargetInformation)
-        {
-            return (TargetInformation) obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new TargetInformation((ASN1Sequence) obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory: "
-            + obj.getClass());
-    }
-
-    /**
-     * Constructor from a ASN1Sequence.
-     * 
-     * @param seq The ASN1Sequence.
-     * @throws IllegalArgumentException if the sequence does not contain
-     *             correctly encoded Targets elements.
-     */
-    private TargetInformation(ASN1Sequence seq)
-    {
-        targets = seq;
-    }
-
-    /**
-     * Returns the targets in this target information extension.
-     * 
-     * @return Returns the targets.
-     */
-    public Targets[] getTargetsObjects()
-    {
-        Targets[] copy = new Targets[targets.size()];
-        int count = 0;
-        for (Enumeration e = targets.getObjects(); e.hasMoreElements();)
-        {
-            copy[count++] = Targets.getInstance(e.nextElement());
-        }
-        return copy;
-    }
-
-    /**
-     * Constructs a target information from a single targets element. 
-     * According to RFC 3281 only one targets element must be produced.
-     * 
-     * @param targets A Targets instance.
-     */
-    public TargetInformation(Targets targets)
-    {
-        this.targets = new DERSequence(targets);
-    }
-
-    /**
-     * According to RFC 3281 only one targets element must be produced. If
-     * multiple targets are given they must be merged in
-     * into one targets element.
-     *
-     * @param targets An array with {@link Targets}.
-     */
-    public TargetInformation(Target[] targets)
-    {
-        this(new Targets(targets));
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * 
-     * Returns:
-     * 
-     * <pre>
-     *          SEQUENCE OF Targets
-     * </pre>
-     * 
-     * <p>
-     * According to RFC 3281 only one targets element must be produced. If
-     * multiple targets are given in the constructor they are merged into one
-     * targets element. If this was produced from a
-     * {@link org.bouncycastle.asn1.ASN1Sequence} the encoding is kept.
-     * 
-     * @return a DERObject
-     */
-    public DERObject toASN1Object()
-    {
-        return targets;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/Targets.java b/azureus2/src/org/bouncycastle/asn1/x509/Targets.java
deleted file mode 100644
index 2fead07..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/Targets.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-import java.util.Enumeration;
-
-/**
- * Targets structure used in target information extension for attribute
- * certificates from RFC 3281.
- * 
- * <pre>
- *            Targets ::= SEQUENCE OF Target
- *           
- *            Target  ::= CHOICE {
- *              targetName          [0] GeneralName,
- *              targetGroup         [1] GeneralName,
- *              targetCert          [2] TargetCert
- *            }
- *           
- *            TargetCert  ::= SEQUENCE {
- *              targetCertificate    IssuerSerial,
- *              targetName           GeneralName OPTIONAL,
- *              certDigestInfo       ObjectDigestInfo OPTIONAL
- *            }
- * </pre>
- * 
- * @see org.bouncycastle.asn1.x509.Target
- * @see org.bouncycastle.asn1.x509.TargetInformation
- */
-public class Targets
-    extends ASN1Encodable
-{
-    private ASN1Sequence targets;
-
-    /**
-     * Creates an instance of a Targets from the given object.
-     * <p>
-     * <code>obj</code> can be a Targets or a {@link ASN1Sequence}
-     * 
-     * @param obj The object.
-     * @return A Targets instance.
-     * @throws IllegalArgumentException if the given object cannot be
-     *             interpreted as Target.
-     */
-    public static Targets getInstance(Object obj)
-    {
-        if (obj instanceof Targets)
-        {
-            return (Targets)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new Targets((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory: "
-            + obj.getClass());
-    }
-
-    /**
-     * Constructor from ASN1Sequence.
-     * 
-     * @param targets The ASN.1 SEQUENCE.
-     * @throws IllegalArgumentException if the contents of the sequence are
-     *             invalid.
-     */
-    private Targets(ASN1Sequence targets)
-    {
-        this.targets = targets;
-    }
-
-    /**
-     * Constructor from given targets.
-     * <p>
-     * The vector is copied.
-     * 
-     * @param targets A <code>Vector</code> of {@link Target}s.
-     * @see Target
-     * @throws IllegalArgumentException if the vector contains not only Targets.
-     */
-    public Targets(Target[] targets)
-    {
-        this.targets = new DERSequence(targets);
-    }
-
-    /**
-     * Returns the targets in a <code>Vector</code>.
-     * <p>
-     * The vector is cloned before it is returned.
-     * 
-     * @return Returns the targets.
-     */
-    public Target[] getTargets()
-    {
-        Target[] targs = new Target[targets.size()];
-        int count = 0;
-        for (Enumeration e = targets.getObjects(); e.hasMoreElements();)
-        {
-            targs[count++] = Target.getInstance(e.nextElement());
-        }
-        return targs;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * 
-     * Returns:
-     * 
-     * <pre>
-     *            Targets ::= SEQUENCE OF Target
-     * </pre>
-     * 
-     * @return a DERObject
-     */
-    public DERObject toASN1Object()
-    {
-        return targets;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/Time.java b/azureus2/src/org/bouncycastle/asn1/x509/Time.java
deleted file mode 100644
index 258a23f..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/Time.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Choice;
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERGeneralizedTime;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERUTCTime;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.SimpleTimeZone;
-
-public class Time
-    extends ASN1Encodable
-    implements ASN1Choice
-{
-    DERObject   time;
-
-    public static Time getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(obj.getObject()); // must be explicitly tagged
-    }
-
-    public Time(
-        DERObject   time)
-    {
-        if (!(time instanceof DERUTCTime)
-            && !(time instanceof DERGeneralizedTime))
-        {
-            throw new IllegalArgumentException("unknown object passed to Time");
-        }
-
-        this.time = time; 
-    }
-
-    /**
-     * creates a time object from a given date - if the date is between 1950
-     * and 2049 a UTCTime object is generated, otherwise a GeneralizedTime
-     * is used.
-     */
-    public Time(
-        Date    date)
-    {
-        SimpleTimeZone      tz = new SimpleTimeZone(0, "Z");
-        SimpleDateFormat    dateF = new SimpleDateFormat("yyyyMMddHHmmss");
-
-        dateF.setTimeZone(tz);
-
-        String  d = dateF.format(date) + "Z";
-        int     year = Integer.parseInt(d.substring(0, 4));
-
-        if (year < 1950 || year > 2049)
-        {
-            time = new DERGeneralizedTime(d);
-        }
-        else
-        {
-            time = new DERUTCTime(d.substring(2));
-        }
-    }
-
-    public static Time getInstance(
-        Object  obj)
-    {
-        if (obj instanceof Time)
-        {
-            return (Time)obj;
-        }
-        else if (obj instanceof DERUTCTime)
-        {
-            return new Time((DERUTCTime)obj);
-        }
-        else if (obj instanceof DERGeneralizedTime)
-        {
-            return new Time((DERGeneralizedTime)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    public String getTime()
-    {
-        if (time instanceof DERUTCTime)
-        {
-            return ((DERUTCTime)time).getAdjustedTime();
-        }
-        else
-        {
-            return ((DERGeneralizedTime)time).getTime();
-        }
-    }
-
-    public Date getDate()
-    {
-        try
-        {
-            if (time instanceof DERUTCTime)
-            {
-                return ((DERUTCTime)time).getAdjustedDate();
-            }
-            else
-            {
-                return ((DERGeneralizedTime)time).getDate();
-            }
-        }
-        catch (ParseException e)
-        {         // this should never happen
-            throw new IllegalStateException("invalid date string: " + e.getMessage());
-        }
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     * Time ::= CHOICE {
-     *             utcTime        UTCTime,
-     *             generalTime    GeneralizedTime }
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        return time;
-    }
-
-    public String toString()
-    {
-        return getTime();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/UserNotice.java b/azureus2/src/org/bouncycastle/asn1/x509/UserNotice.java
deleted file mode 100644
index b3785ff..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/UserNotice.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-
-/**
- * <code>UserNotice</code> class, used in
- * <code>CertificatePolicies</code> X509 extensions (in policy
- * qualifiers).
- * <pre>
- * UserNotice ::= SEQUENCE {
- *      noticeRef        NoticeReference OPTIONAL,
- *      explicitText     DisplayText OPTIONAL}
- *
- * </pre>
- * 
- * @see PolicyQualifierId
- * @see PolicyInformation
- */
-public class UserNotice 
-    extends ASN1Encodable 
-{
-    private NoticeReference noticeRef;
-    private DisplayText     explicitText;
-   
-    /**
-     * Creates a new <code>UserNotice</code> instance.
-     *
-     * @param noticeRef a <code>NoticeReference</code> value
-     * @param explicitText a <code>DisplayText</code> value
-     */
-    public UserNotice(
-        NoticeReference noticeRef, 
-        DisplayText explicitText) 
-    {
-        this.noticeRef = noticeRef;
-        this.explicitText = explicitText;
-    }
-
-    /**
-     * Creates a new <code>UserNotice</code> instance.
-     *
-     * @param noticeRef a <code>NoticeReference</code> value
-     * @param str the explicitText field as a String. 
-     */
-    public UserNotice(
-        NoticeReference noticeRef, 
-        String str) 
-    {
-        this.noticeRef = noticeRef;
-        this.explicitText = new DisplayText(str);
-    }
-
-    /**
-     * Creates a new <code>UserNotice</code> instance.
-     * <p>Useful from reconstructing a <code>UserNotice</code> instance
-     * from its encodable/encoded form. 
-     *
-     * @param as an <code>ASN1Sequence</code> value obtained from either
-     * calling @{link toASN1Object()} for a <code>UserNotice</code>
-     * instance or from parsing it from a DER-encoded stream. 
-     */
-    public UserNotice(
-       ASN1Sequence as) 
-    {
-       if (as.size() == 2)
-       {
-           noticeRef = NoticeReference.getInstance(as.getObjectAt(0));
-           explicitText = DisplayText.getInstance(as.getObjectAt(1));
-       }
-       else if (as.size() == 1)
-       {
-           if (as.getObjectAt(0).getDERObject() instanceof ASN1Sequence)
-           {
-               noticeRef = NoticeReference.getInstance(as.getObjectAt(0));
-           }
-           else
-           {
-               explicitText = DisplayText.getInstance(as.getObjectAt(0));
-           }
-       }
-       else
-       {
-           throw new IllegalArgumentException("Bad sequence size: " + as.size());
-       }
-    }
-   
-    public NoticeReference getNoticeRef()
-    {
-        return noticeRef;
-    }
-    
-    public DisplayText getExplicitText()
-    {
-        return explicitText;
-    }
-    
-    public DERObject toASN1Object() 
-    {
-        ASN1EncodableVector av = new ASN1EncodableVector();
-      
-        if (noticeRef != null)
-        {
-            av.add(noticeRef);
-        }
-        
-        if (explicitText != null)
-        {
-            av.add(explicitText);
-        }
-         
-        return new DERSequence(av);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/V1TBSCertificateGenerator.java b/azureus2/src/org/bouncycastle/asn1/x509/V1TBSCertificateGenerator.java
deleted file mode 100644
index 53505d1..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/V1TBSCertificateGenerator.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-import org.bouncycastle.asn1.DERUTCTime;
-
-/**
- * Generator for Version 1 TBSCertificateStructures.
- * <pre>
- * TBSCertificate ::= SEQUENCE {
- *      version          [ 0 ]  Version DEFAULT v1(0),
- *      serialNumber            CertificateSerialNumber,
- *      signature               AlgorithmIdentifier,
- *      issuer                  Name,
- *      validity                Validity,
- *      subject                 Name,
- *      subjectPublicKeyInfo    SubjectPublicKeyInfo,
- *      }
- * </pre>
- *
- */
-public class V1TBSCertificateGenerator
-{
-    DERTaggedObject         version = new DERTaggedObject(0, new DERInteger(0));
-
-    DERInteger              serialNumber;
-    AlgorithmIdentifier     signature;
-    X509Name                issuer;
-    Time                    startDate, endDate;
-    X509Name                subject;
-    SubjectPublicKeyInfo    subjectPublicKeyInfo;
-
-    public V1TBSCertificateGenerator()
-    {
-    }
-
-    public void setSerialNumber(
-        DERInteger  serialNumber)
-    {
-        this.serialNumber = serialNumber;
-    }
-
-    public void setSignature(
-        AlgorithmIdentifier    signature)
-    {
-        this.signature = signature;
-    }
-
-    public void setIssuer(
-        X509Name    issuer)
-    {
-        this.issuer = issuer;
-    }
-
-    public void setStartDate(
-        Time startDate)
-    {
-        this.startDate = startDate;
-    }
-
-    public void setStartDate(
-        DERUTCTime startDate)
-    {
-        this.startDate = new Time(startDate);
-    }
-
-    public void setEndDate(
-        Time endDate)
-    {
-        this.endDate = endDate;
-    }
-
-    public void setEndDate(
-        DERUTCTime endDate)
-    {
-        this.endDate = new Time(endDate);
-    }
-
-    public void setSubject(
-        X509Name    subject)
-    {
-        this.subject = subject;
-    }
-
-    public void setSubjectPublicKeyInfo(
-        SubjectPublicKeyInfo    pubKeyInfo)
-    {
-        this.subjectPublicKeyInfo = pubKeyInfo;
-    }
-
-    public TBSCertificateStructure generateTBSCertificate()
-    {
-        if ((serialNumber == null) || (signature == null)
-            || (issuer == null) || (startDate == null) || (endDate == null)
-            || (subject == null) || (subjectPublicKeyInfo == null))
-        {
-            throw new IllegalStateException("not all mandatory fields set in V1 TBScertificate generator");
-        }
-
-        ASN1EncodableVector  seq = new ASN1EncodableVector();
-
-        // seq.add(version); - not required as default value.
-        seq.add(serialNumber);
-        seq.add(signature);
-        seq.add(issuer);
-
-        //
-        // before and after dates
-        //
-        ASN1EncodableVector  validity = new ASN1EncodableVector();
-
-        validity.add(startDate);
-        validity.add(endDate);
-
-        seq.add(new DERSequence(validity));
-
-        seq.add(subject);
-
-        seq.add(subjectPublicKeyInfo);
-
-        return new TBSCertificateStructure(new DERSequence(seq));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/V2AttributeCertificateInfoGenerator.java b/azureus2/src/org/bouncycastle/asn1/x509/V2AttributeCertificateInfoGenerator.java
deleted file mode 100644
index ed8412e..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/V2AttributeCertificateInfoGenerator.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERGeneralizedTime;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DERSet;
-
-/**
- * Generator for Version 2 AttributeCertificateInfo
- * <pre>
- * AttributeCertificateInfo ::= SEQUENCE {
- *       version              AttCertVersion -- version is v2,
- *       holder               Holder,
- *       issuer               AttCertIssuer,
- *       signature            AlgorithmIdentifier,
- *       serialNumber         CertificateSerialNumber,
- *       attrCertValidityPeriod   AttCertValidityPeriod,
- *       attributes           SEQUENCE OF Attribute,
- *       issuerUniqueID       UniqueIdentifier OPTIONAL,
- *       extensions           Extensions OPTIONAL
- * }
- * </pre>
- *
- */
-public class V2AttributeCertificateInfoGenerator
-{
-    private DERInteger version;
-    private Holder holder;
-    private AttCertIssuer issuer;
-    private AlgorithmIdentifier signature;
-    private DERInteger serialNumber;
-    private ASN1EncodableVector attributes;
-    private DERBitString issuerUniqueID;
-    private X509Extensions extensions;
-
-    // Note: validity period start/end dates stored directly
-    //private AttCertValidityPeriod attrCertValidityPeriod;
-    private DERGeneralizedTime startDate, endDate; 
-
-    public V2AttributeCertificateInfoGenerator()
-    {
-        this.version = new DERInteger(1);
-        attributes = new ASN1EncodableVector();
-    }
-    
-    public void setHolder(Holder holder)
-    {
-        this.holder = holder;
-    }
-    
-    public void addAttribute(String oid, ASN1Encodable value) 
-    {
-        attributes.add(new Attribute(new DERObjectIdentifier(oid), new DERSet(value)));
-    }
-
-    /**
-     * @param attribute
-     */
-    public void addAttribute(Attribute attribute)
-    {
-        attributes.add(attribute);
-    }
-    
-    public void setSerialNumber(
-        DERInteger  serialNumber)
-    {
-        this.serialNumber = serialNumber;
-    }
-
-    public void setSignature(
-        AlgorithmIdentifier    signature)
-    {
-        this.signature = signature;
-    }
-
-    public void setIssuer(
-        AttCertIssuer    issuer)
-    {
-        this.issuer = issuer;
-    }
-
-    public void setStartDate(
-        DERGeneralizedTime startDate)
-    {
-        this.startDate = startDate;
-    }
-
-    public void setEndDate(
-        DERGeneralizedTime endDate)
-    {
-        this.endDate = endDate;
-    }
-
-    public void setIssuerUniqueID(
-        DERBitString    issuerUniqueID)
-    {
-        this.issuerUniqueID = issuerUniqueID;
-    }
-
-    public void setExtensions(
-        X509Extensions    extensions)
-    {
-        this.extensions = extensions;
-    }
-
-    public AttributeCertificateInfo generateAttributeCertificateInfo()
-    {
-        if ((serialNumber == null) || (signature == null)
-            || (issuer == null) || (startDate == null) || (endDate == null)
-            || (holder == null) || (attributes == null))
-        {
-            throw new IllegalStateException("not all mandatory fields set in V2 AttributeCertificateInfo generator");
-        }
-
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(version);
-        v.add(holder);
-        v.add(issuer);
-        v.add(signature);
-        v.add(serialNumber);
-    
-        //
-        // before and after dates => AttCertValidityPeriod
-        //
-        AttCertValidityPeriod validity = new AttCertValidityPeriod(startDate, endDate);
-        v.add(validity);
-        
-        // Attributes
-        v.add(new DERSequence(attributes));
-        
-        if (issuerUniqueID != null)
-        {
-            v.add(issuerUniqueID);
-        }
-    
-        if (extensions != null)
-        {
-            v.add(extensions);
-        }
-
-        return new AttributeCertificateInfo(new DERSequence(v));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/V2Form.java b/azureus2/src/org/bouncycastle/asn1/x509/V2Form.java
deleted file mode 100644
index 6a229dd..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/V2Form.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-
-public class V2Form
-    extends ASN1Encodable
-{
-    GeneralNames        issuerName;
-    IssuerSerial        baseCertificateID;
-    ObjectDigestInfo    objectDigestInfo;
-
-    public static V2Form getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static V2Form getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof V2Form)
-        {
-            return (V2Form)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new V2Form((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-    
-    public V2Form(
-        GeneralNames    issuerName)
-    {
-        this.issuerName = issuerName;
-    }
-    
-    public V2Form(
-        ASN1Sequence seq)
-    {
-        if (seq.size() > 3)
-        {
-            throw new IllegalArgumentException("Bad sequence size: " + seq.size());
-        }
-        
-        int    index = 0;
-
-        if (!(seq.getObjectAt(0) instanceof ASN1TaggedObject))
-        {
-            index++;
-            this.issuerName = GeneralNames.getInstance(seq.getObjectAt(0));
-        }
-
-        for (int i = index; i != seq.size(); i++)
-        {
-            ASN1TaggedObject o = ASN1TaggedObject.getInstance(seq.getObjectAt(i));
-            if (o.getTagNo() == 0)
-            {
-                baseCertificateID = IssuerSerial.getInstance(o, false);
-            }
-            else if (o.getTagNo() == 1)
-            {
-                objectDigestInfo = ObjectDigestInfo.getInstance(o, false);
-            }
-            else 
-            {
-                throw new IllegalArgumentException("Bad tag number: "
-                        + o.getTagNo());
-            }
-        }
-    }
-    
-    public GeneralNames getIssuerName()
-    {
-        return issuerName;
-    }
-
-    public IssuerSerial getBaseCertificateID()
-    {
-        return baseCertificateID;
-    }
-
-    public ObjectDigestInfo getObjectDigestInfo()
-    {
-        return objectDigestInfo;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     *  V2Form ::= SEQUENCE {
-     *       issuerName            GeneralNames  OPTIONAL,
-     *       baseCertificateID     [0] IssuerSerial  OPTIONAL,
-     *       objectDigestInfo      [1] ObjectDigestInfo  OPTIONAL
-     *         -- issuerName MUST be present in this profile
-     *         -- baseCertificateID and objectDigestInfo MUST NOT
-     *         -- be present in this profile
-     *  }
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        if (issuerName != null)
-        {
-            v.add(issuerName);
-        }
-
-        if (baseCertificateID != null)
-        {
-            v.add(new DERTaggedObject(false, 0, baseCertificateID));
-        }
-
-        if (objectDigestInfo != null)
-        {
-            v.add(new DERTaggedObject(false, 1, objectDigestInfo));
-        }
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/V2TBSCertListGenerator.java b/azureus2/src/org/bouncycastle/asn1/x509/V2TBSCertListGenerator.java
deleted file mode 100644
index f50a3b8..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/V2TBSCertListGenerator.java
+++ /dev/null
@@ -1,213 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERGeneralizedTime;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-import org.bouncycastle.asn1.DERUTCTime;
-
-/**
- * Generator for Version 2 TBSCertList structures.
- * <pre>
- *  TBSCertList  ::=  SEQUENCE  {
- *       version                 Version OPTIONAL,
- *                                    -- if present, shall be v2
- *       signature               AlgorithmIdentifier,
- *       issuer                  Name,
- *       thisUpdate              Time,
- *       nextUpdate              Time OPTIONAL,
- *       revokedCertificates     SEQUENCE OF SEQUENCE  {
- *            userCertificate         CertificateSerialNumber,
- *            revocationDate          Time,
- *            crlEntryExtensions      Extensions OPTIONAL
- *                                          -- if present, shall be v2
- *                                 }  OPTIONAL,
- *       crlExtensions           [0]  EXPLICIT Extensions OPTIONAL
- *                                          -- if present, shall be v2
- *                                 }
- * </pre>
- *
- * <b>Note: This class may be subject to change</b>
- */
-public class V2TBSCertListGenerator
-{
-    DERInteger version = new DERInteger(1);
-
-    AlgorithmIdentifier     signature;
-    X509Name                issuer;
-    Time                    thisUpdate, nextUpdate=null;
-    X509Extensions          extensions=null;
-    private Vector          crlentries=null;
-
-    public V2TBSCertListGenerator()
-    {
-    }
-
-
-    public void setSignature(
-        AlgorithmIdentifier    signature)
-    {
-        this.signature = signature;
-    }
-
-    public void setIssuer(
-        X509Name    issuer)
-    {
-        this.issuer = issuer;
-    }
-
-    public void setThisUpdate(
-        DERUTCTime thisUpdate)
-    {
-        this.thisUpdate = new Time(thisUpdate);
-    }
-
-    public void setNextUpdate(
-        DERUTCTime nextUpdate)
-    {
-        this.nextUpdate = new Time(nextUpdate);
-    }
-
-    public void setThisUpdate(
-        Time thisUpdate)
-    {
-        this.thisUpdate = thisUpdate;
-    }
-
-    public void setNextUpdate(
-        Time nextUpdate)
-    {
-        this.nextUpdate = nextUpdate;
-    }
-
-    public void addCRLEntry(
-        ASN1Sequence crlEntry)
-    {
-        if (crlentries == null)
-        {
-            crlentries = new Vector();
-        }
-        
-        crlentries.addElement(crlEntry);
-    }
-
-    public void addCRLEntry(DERInteger userCertificate, DERUTCTime revocationDate, int reason)
-    {
-        addCRLEntry(userCertificate, new Time(revocationDate), reason);
-    }
-
-    public void addCRLEntry(DERInteger userCertificate, Time revocationDate, int reason)
-    {
-        addCRLEntry(userCertificate, revocationDate, reason, null);
-    }
-
-    public void addCRLEntry(DERInteger userCertificate, Time revocationDate, int reason, DERGeneralizedTime invalidityDate)
-    {
-        Vector extOids = new Vector();
-        Vector extValues = new Vector();
-        
-        if (reason != 0)
-        {
-            CRLReason crlReason = new CRLReason(reason);
-            
-            try
-            {
-                extOids.addElement(X509Extensions.ReasonCode);
-                extValues.addElement(new X509Extension(false, new DEROctetString(crlReason.getEncoded())));
-            }
-            catch (IOException e)
-            {
-                throw new IllegalArgumentException("error encoding reason: " + e);
-            }
-        }
-
-        if (invalidityDate != null)
-        {
-            try
-            {
-                extOids.addElement(X509Extensions.InvalidityDate);
-                extValues.addElement(new X509Extension(false, new DEROctetString(invalidityDate.getEncoded())));
-            }
-            catch (IOException e)
-            {
-                throw new IllegalArgumentException("error encoding invalidityDate: " + e);
-            }
-        }
-        
-        if (extOids.size() != 0)
-        {
-            addCRLEntry(userCertificate, revocationDate, new X509Extensions(extOids, extValues));
-        }
-        else
-        {
-            addCRLEntry(userCertificate, revocationDate, null);
-        }
-    }
-
-    public void addCRLEntry(DERInteger userCertificate, Time revocationDate, X509Extensions extensions)
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        v.add(userCertificate);
-        v.add(revocationDate);
-        
-        if (extensions != null)
-        {
-            v.add(extensions);
-        }
-        
-        addCRLEntry(new DERSequence(v));
-    }
-    
-    public void setExtensions(
-        X509Extensions    extensions)
-    {
-        this.extensions = extensions;
-    }
-
-    public TBSCertList generateTBSCertList()
-    {
-        if ((signature == null) || (issuer == null) || (thisUpdate == null))
-        {
-            throw new IllegalStateException("Not all mandatory fields set in V2 TBSCertList generator.");
-        }
-
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(version);
-        v.add(signature);
-        v.add(issuer);
-
-        v.add(thisUpdate);
-        if (nextUpdate != null)
-        {
-            v.add(nextUpdate);
-        }
-
-        // Add CRLEntries if they exist
-        if (crlentries != null)
-        {
-            ASN1EncodableVector certs = new ASN1EncodableVector();
-            Enumeration it = crlentries.elements();
-            while(it.hasMoreElements())
-            {
-                certs.add((ASN1Sequence)it.nextElement());
-            }
-            v.add(new DERSequence(certs));
-        }
-
-        if (extensions != null)
-        {
-            v.add(new DERTaggedObject(0, extensions));
-        }
-
-        return new TBSCertList(new DERSequence(v));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/V3TBSCertificateGenerator.java b/azureus2/src/org/bouncycastle/asn1/x509/V3TBSCertificateGenerator.java
deleted file mode 100644
index ec076d4..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/V3TBSCertificateGenerator.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-import org.bouncycastle.asn1.DERUTCTime;
-
-/**
- * Generator for Version 3 TBSCertificateStructures.
- * <pre>
- * TBSCertificate ::= SEQUENCE {
- *      version          [ 0 ]  Version DEFAULT v1(0),
- *      serialNumber            CertificateSerialNumber,
- *      signature               AlgorithmIdentifier,
- *      issuer                  Name,
- *      validity                Validity,
- *      subject                 Name,
- *      subjectPublicKeyInfo    SubjectPublicKeyInfo,
- *      issuerUniqueID    [ 1 ] IMPLICIT UniqueIdentifier OPTIONAL,
- *      subjectUniqueID   [ 2 ] IMPLICIT UniqueIdentifier OPTIONAL,
- *      extensions        [ 3 ] Extensions OPTIONAL
- *      }
- * </pre>
- *
- */
-public class V3TBSCertificateGenerator
-{
-    DERTaggedObject         version = new DERTaggedObject(0, new DERInteger(2));
-
-    DERInteger              serialNumber;
-    AlgorithmIdentifier     signature;
-    X509Name                issuer;
-    Time                    startDate, endDate;
-    X509Name                subject;
-    SubjectPublicKeyInfo    subjectPublicKeyInfo;
-    X509Extensions          extensions;
-
-    private boolean altNamePresentAndCritical;
-
-    public V3TBSCertificateGenerator()
-    {
-    }
-
-    public void setSerialNumber(
-        DERInteger  serialNumber)
-    {
-        this.serialNumber = serialNumber;
-    }
-
-    public void setSignature(
-        AlgorithmIdentifier    signature)
-    {
-        this.signature = signature;
-    }
-
-    public void setIssuer(
-        X509Name    issuer)
-    {
-        this.issuer = issuer;
-    }
-
-    public void setStartDate(
-        DERUTCTime startDate)
-    {
-        this.startDate = new Time(startDate);
-    }
-
-    public void setStartDate(
-        Time startDate)
-    {
-        this.startDate = startDate;
-    }
-
-    public void setEndDate(
-        DERUTCTime endDate)
-    {
-        this.endDate = new Time(endDate);
-    }
-
-    public void setEndDate(
-        Time endDate)
-    {
-        this.endDate = endDate;
-    }
-
-    public void setSubject(
-        X509Name    subject)
-    {
-        this.subject = subject;
-    }
-
-    public void setSubjectPublicKeyInfo(
-        SubjectPublicKeyInfo    pubKeyInfo)
-    {
-        this.subjectPublicKeyInfo = pubKeyInfo;
-    }
-
-    public void setExtensions(
-        X509Extensions    extensions)
-    {
-        this.extensions = extensions;
-        if (extensions != null)
-        {
-            X509Extension altName = extensions.getExtension(X509Extensions.SubjectAlternativeName);
-
-            if (altName != null && altName.isCritical())
-            {
-                altNamePresentAndCritical = true;
-            }
-        }
-    }
-
-    public TBSCertificateStructure generateTBSCertificate()
-    {
-        if ((serialNumber == null) || (signature == null)
-            || (issuer == null) || (startDate == null) || (endDate == null)
-            || (subject == null && !altNamePresentAndCritical) || (subjectPublicKeyInfo == null))
-        {
-            throw new IllegalStateException("not all mandatory fields set in V3 TBScertificate generator");
-        }
-
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(version);
-        v.add(serialNumber);
-        v.add(signature);
-        v.add(issuer);
-
-        //
-        // before and after dates
-        //
-        ASN1EncodableVector  validity = new ASN1EncodableVector();
-
-        validity.add(startDate);
-        validity.add(endDate);
-
-        v.add(new DERSequence(validity));
-
-        if (subject != null)
-        {
-            v.add(subject);
-        }
-        else
-        {
-            v.add(new DERSequence());
-        }
-
-        v.add(subjectPublicKeyInfo);
-
-        if (extensions != null)
-        {
-            v.add(new DERTaggedObject(3, extensions));
-        }
-
-        return new TBSCertificateStructure(new DERSequence(v));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/X509Attributes.java b/azureus2/src/org/bouncycastle/asn1/x509/X509Attributes.java
deleted file mode 100644
index 8ea18fa..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/X509Attributes.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.DERObjectIdentifier;
-
-public class X509Attributes
-{
-    public static final DERObjectIdentifier RoleSyntax = new DERObjectIdentifier("2.5.4.72");
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/X509CertificateStructure.java b/azureus2/src/org/bouncycastle/asn1/x509/X509CertificateStructure.java
deleted file mode 100644
index 599db32..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/X509CertificateStructure.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-
-/**
- * an X509Certificate structure.
- * <pre>
- *  Certificate ::= SEQUENCE {
- *      tbsCertificate          TBSCertificate,
- *      signatureAlgorithm      AlgorithmIdentifier,
- *      signature               BIT STRING
- *  }
- * </pre>
- */
-public class X509CertificateStructure
-    extends ASN1Encodable
-    implements X509ObjectIdentifiers, PKCSObjectIdentifiers
-{
-    ASN1Sequence  seq;
-    TBSCertificateStructure tbsCert;
-    AlgorithmIdentifier     sigAlgId;
-    DERBitString            sig;
-
-    public static X509CertificateStructure getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static X509CertificateStructure getInstance(
-        Object  obj)
-    {
-        if (obj instanceof X509CertificateStructure)
-        {
-            return (X509CertificateStructure)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new X509CertificateStructure((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory");
-    }
-
-    public X509CertificateStructure(
-        ASN1Sequence  seq)
-    {
-        this.seq = seq;
-
-        //
-        // correct x509 certficate
-        //
-        if (seq.size() == 3)
-        {
-            tbsCert = TBSCertificateStructure.getInstance(seq.getObjectAt(0));
-            sigAlgId = AlgorithmIdentifier.getInstance(seq.getObjectAt(1));
-
-            sig = DERBitString.getInstance(seq.getObjectAt(2));
-        }
-        else
-        {
-            throw new IllegalArgumentException("sequence wrong size for a certificate");
-        }
-    }
-
-    public TBSCertificateStructure getTBSCertificate()
-    {
-        return tbsCert;
-    }
-
-    public int getVersion()
-    {
-        return tbsCert.getVersion();
-    }
-
-    public DERInteger getSerialNumber()
-    {
-        return tbsCert.getSerialNumber();
-    }
-
-    public X509Name getIssuer()
-    {
-        return tbsCert.getIssuer();
-    }
-
-    public Time getStartDate()
-    {
-        return tbsCert.getStartDate();
-    }
-
-    public Time getEndDate()
-    {
-        return tbsCert.getEndDate();
-    }
-
-    public X509Name getSubject()
-    {
-        return tbsCert.getSubject();
-    }
-
-    public SubjectPublicKeyInfo getSubjectPublicKeyInfo()
-    {
-        return tbsCert.getSubjectPublicKeyInfo();
-    }
-
-    public AlgorithmIdentifier getSignatureAlgorithm()
-    {
-        return sigAlgId;
-    }
-
-    public DERBitString getSignature()
-    {
-        return sig;
-    }
-
-    public DERObject toASN1Object()
-    {
-        return seq;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/X509DefaultEntryConverter.java b/azureus2/src/org/bouncycastle/asn1/x509/X509DefaultEntryConverter.java
deleted file mode 100644
index f9801c5..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/X509DefaultEntryConverter.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.DERGeneralizedTime;
-import org.bouncycastle.asn1.DERIA5String;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERPrintableString;
-import org.bouncycastle.asn1.DERUTF8String;
-
-import java.io.IOException;
-
-/**
- * The default converter for X509 DN entries when going from their
- * string value to ASN.1 strings.
- */
-public class X509DefaultEntryConverter
-    extends X509NameEntryConverter
-{
-    /**
-     * Apply default coversion for the given value depending on the oid
-     * and the character range of the value.
-     * 
-     * @param oid the object identifier for the DN entry
-     * @param value the value associated with it
-     * @return the ASN.1 equivalent for the string value.
-     */
-    public DERObject getConvertedValue(
-        DERObjectIdentifier  oid,
-        String               value)
-    {
-        if (value.length() != 0 && value.charAt(0) == '#')
-        {
-            try
-            {
-                return convertHexEncoded(value, 1);
-            }
-            catch (IOException e)
-            {
-                throw new RuntimeException("can't recode value for oid " + oid.getId());
-            }
-        }
-        else if (oid.equals(X509Name.EmailAddress) || oid.equals(X509Name.DC))
-        {
-            return new DERIA5String(value);
-        }
-        else if (oid.equals(X509Name.DATE_OF_BIRTH))  // accept time string as well as # (for compatibility)
-        {
-            return new DERGeneralizedTime(value);
-        }
-        else if (oid.equals(X509Name.C) || oid.equals(X509Name.SN) || oid.equals(X509Name.DN_QUALIFIER))
-        {
-             return new DERPrintableString(value);
-        }        
-        
-        return new DERUTF8String(value);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/X509Extension.java b/azureus2/src/org/bouncycastle/asn1/x509/X509Extension.java
deleted file mode 100644
index 02ac76b..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/X509Extension.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Object;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.DERBoolean;
-
-import java.io.IOException;
-
-/**
- * an object for the elements in the X.509 V3 extension block.
- */
-public class X509Extension
-{
-    boolean             critical;
-    ASN1OctetString      value;
-
-    public X509Extension(
-        DERBoolean              critical,
-        ASN1OctetString         value)
-    {
-        this.critical = critical.isTrue();
-        this.value = value;
-    }
-
-    public X509Extension(
-        boolean                 critical,
-        ASN1OctetString         value)
-    {
-        this.critical = critical;
-        this.value = value;
-    }
-
-    public boolean isCritical()
-    {
-        return critical;
-    }
-
-    public ASN1OctetString getValue()
-    {
-        return value;
-    }
-
-    public int hashCode()
-    {
-        if (this.isCritical())
-        {
-            return this.getValue().hashCode();
-        }
-
-        
-        return ~this.getValue().hashCode();
-    }
-
-    public boolean equals(
-        Object  o)
-    {
-        if (!(o instanceof X509Extension))
-        {
-            return false;
-        }
-
-        X509Extension   other = (X509Extension)o;
-
-        return other.getValue().equals(this.getValue())
-            && (other.isCritical() == this.isCritical());
-    }
-
-    /**
-     * Convert the value of the passed in extension to an object
-     * @param ext the extension to parse
-     * @return the object the value string contains
-     * @exception IllegalArgumentException if conversion is not possible
-     */
-    public static ASN1Object convertValueToObject(
-        X509Extension ext)
-        throws IllegalArgumentException
-    {
-        try
-        {
-            return ASN1Object.fromByteArray(ext.getValue().getOctets());
-        }
-        catch (IOException e)
-        {
-            throw new IllegalArgumentException("can't convert extension: " +  e);
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/X509Extensions.java b/azureus2/src/org/bouncycastle/asn1/x509/X509Extensions.java
deleted file mode 100644
index 38af70b..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/X509Extensions.java
+++ /dev/null
@@ -1,393 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DERBoolean;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-public class X509Extensions
-    extends ASN1Encodable
-{
-    /**
-     * Subject Directory Attributes
-     */
-    public static final DERObjectIdentifier SubjectDirectoryAttributes = new DERObjectIdentifier("2.5.29.9");
-    
-    /**
-     * Subject Key Identifier 
-     */
-    public static final DERObjectIdentifier SubjectKeyIdentifier = new DERObjectIdentifier("2.5.29.14");
-
-    /**
-     * Key Usage 
-     */
-    public static final DERObjectIdentifier KeyUsage = new DERObjectIdentifier("2.5.29.15");
-
-    /**
-     * Private Key Usage Period 
-     */
-    public static final DERObjectIdentifier PrivateKeyUsagePeriod = new DERObjectIdentifier("2.5.29.16");
-
-    /**
-     * Subject Alternative Name 
-     */
-    public static final DERObjectIdentifier SubjectAlternativeName = new DERObjectIdentifier("2.5.29.17");
-
-    /**
-     * Issuer Alternative Name 
-     */
-    public static final DERObjectIdentifier IssuerAlternativeName = new DERObjectIdentifier("2.5.29.18");
-
-    /**
-     * Basic Constraints 
-     */
-    public static final DERObjectIdentifier BasicConstraints = new DERObjectIdentifier("2.5.29.19");
-
-    /**
-     * CRL Number 
-     */
-    public static final DERObjectIdentifier CRLNumber = new DERObjectIdentifier("2.5.29.20");
-
-    /**
-     * Reason code 
-     */
-    public static final DERObjectIdentifier ReasonCode = new DERObjectIdentifier("2.5.29.21");
-
-    /**
-     * Hold Instruction Code 
-     */
-    public static final DERObjectIdentifier InstructionCode = new DERObjectIdentifier("2.5.29.23");
-
-    /**
-     * Invalidity Date 
-     */
-    public static final DERObjectIdentifier InvalidityDate = new DERObjectIdentifier("2.5.29.24");
-
-    /**
-     * Delta CRL indicator 
-     */
-    public static final DERObjectIdentifier DeltaCRLIndicator = new DERObjectIdentifier("2.5.29.27");
-
-    /**
-     * Issuing Distribution Point 
-     */
-    public static final DERObjectIdentifier IssuingDistributionPoint = new DERObjectIdentifier("2.5.29.28");
-
-    /**
-     * Certificate Issuer 
-     */
-    public static final DERObjectIdentifier CertificateIssuer = new DERObjectIdentifier("2.5.29.29");
-
-    /**
-     * Name Constraints 
-     */
-    public static final DERObjectIdentifier NameConstraints = new DERObjectIdentifier("2.5.29.30");
-
-    /**
-     * CRL Distribution Points 
-     */
-    public static final DERObjectIdentifier CRLDistributionPoints = new DERObjectIdentifier("2.5.29.31");
-
-    /**
-     * Certificate Policies 
-     */
-    public static final DERObjectIdentifier CertificatePolicies = new DERObjectIdentifier("2.5.29.32");
-
-    /**
-     * Policy Mappings 
-     */
-    public static final DERObjectIdentifier PolicyMappings = new DERObjectIdentifier("2.5.29.33");
-
-    /**
-     * Authority Key Identifier 
-     */
-    public static final DERObjectIdentifier AuthorityKeyIdentifier = new DERObjectIdentifier("2.5.29.35");
-
-    /**
-     * Policy Constraints 
-     */
-    public static final DERObjectIdentifier PolicyConstraints = new DERObjectIdentifier("2.5.29.36");
-
-    /**
-     * Extended Key Usage 
-     */
-    public static final DERObjectIdentifier ExtendedKeyUsage = new DERObjectIdentifier("2.5.29.37");
-
-    /**
-     * Freshest CRL
-     */
-    public static final DERObjectIdentifier FreshestCRL = new DERObjectIdentifier("2.5.29.46");
-     
-    /**
-     * Inhibit Any Policy
-     */
-    public static final DERObjectIdentifier InhibitAnyPolicy = new DERObjectIdentifier("2.5.29.54");
-
-    /**
-     * Authority Info Access
-     */
-    public static final DERObjectIdentifier AuthorityInfoAccess = new DERObjectIdentifier("1.3.6.1.5.5.7.1.1");
-
-    /**
-     * Subject Info Access
-     */
-    public static final DERObjectIdentifier SubjectInfoAccess = new DERObjectIdentifier("1.3.6.1.5.5.7.1.11");
-    
-    /**
-     * Logo Type
-     */
-    public static final DERObjectIdentifier LogoType = new DERObjectIdentifier("1.3.6.1.5.5.7.1.12");
-
-    /**
-     * BiometricInfo
-     */
-    public static final DERObjectIdentifier BiometricInfo = new DERObjectIdentifier("1.3.6.1.5.5.7.1.2");
-    
-    /**
-     * QCStatements
-     */
-    public static final DERObjectIdentifier QCStatements = new DERObjectIdentifier("1.3.6.1.5.5.7.1.3");
-
-    /**
-     * Audit identity extension in attribute certificates.
-     */
-    public static final DERObjectIdentifier AuditIdentity = new DERObjectIdentifier("1.3.6.1.5.5.7.1.4");
-    
-    /**
-     * NoRevAvail extension in attribute certificates.
-     */
-    public static final DERObjectIdentifier NoRevAvail = new DERObjectIdentifier("2.5.29.56");
-
-    /**
-     * TargetInformation extension in attribute certificates.
-     */
-    public static final DERObjectIdentifier TargetInformation = new DERObjectIdentifier("2.5.29.55");
-    
-    private Hashtable               extensions = new Hashtable();
-    private Vector                  ordering = new Vector();
-
-    public static X509Extensions getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static X509Extensions getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof X509Extensions)
-        {
-            return (X509Extensions)obj;
-        }
-
-        if (obj instanceof ASN1Sequence)
-        {
-            return new X509Extensions((ASN1Sequence)obj);
-        }
-
-        if (obj instanceof ASN1TaggedObject)
-        {
-            return getInstance(((ASN1TaggedObject)obj).getObject());
-        }
-
-        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
-    }
-
-    /**
-     * Constructor from ASN1Sequence.
-     *
-     * the extensions are a list of constructed sequences, either with (OID, OctetString) or (OID, Boolean, OctetString)
-     */
-    public X509Extensions(
-        ASN1Sequence  seq)
-    {
-        Enumeration e = seq.getObjects();
-
-        while (e.hasMoreElements())
-        {
-            ASN1Sequence            s = ASN1Sequence.getInstance(e.nextElement());
-
-            if (s.size() == 3)
-            {
-                extensions.put(s.getObjectAt(0), new X509Extension(DERBoolean.getInstance(s.getObjectAt(1)), ASN1OctetString.getInstance(s.getObjectAt(2))));
-            }
-            else if (s.size() == 2)
-            {
-                extensions.put(s.getObjectAt(0), new X509Extension(false, ASN1OctetString.getInstance(s.getObjectAt(1))));
-            }
-            else
-            {
-                throw new IllegalArgumentException("Bad sequence size: " + s.size());
-            }
-
-            ordering.addElement(s.getObjectAt(0));
-        }
-    }
-
-    /**
-     * constructor from a table of extensions.
-     * <p>
-     * it's is assumed the table contains OID/String pairs.
-     */
-    public X509Extensions(
-        Hashtable  extensions)
-    {
-        this(null, extensions);
-    }
-
-    /**
-     * Constructor from a table of extensions with ordering.
-     * <p>
-     * It's is assumed the table contains OID/String pairs.
-     */
-    public X509Extensions(
-        Vector      ordering,
-        Hashtable   extensions)
-    {
-        Enumeration e;
-
-        if (ordering == null)
-        {
-            e = extensions.keys();
-        }
-        else
-        {
-            e = ordering.elements();
-        }
-
-        while (e.hasMoreElements())
-        {
-            this.ordering.addElement(e.nextElement()); 
-        }
-
-        e = this.ordering.elements();
-
-        while (e.hasMoreElements())
-        {
-            DERObjectIdentifier     oid = (DERObjectIdentifier)e.nextElement();
-            X509Extension           ext = (X509Extension)extensions.get(oid);
-
-            this.extensions.put(oid, ext);
-        }
-    }
-
-    /**
-     * Constructor from two vectors
-     * 
-     * @param objectIDs a vector of the object identifiers.
-     * @param values a vector of the extension values.
-     */
-    public X509Extensions(
-        Vector      objectIDs,
-        Vector      values)
-    {
-        Enumeration e = objectIDs.elements();
-
-        while (e.hasMoreElements())
-        {
-            this.ordering.addElement(e.nextElement()); 
-        }
-
-        int count = 0;
-        
-        e = this.ordering.elements();
-
-        while (e.hasMoreElements())
-        {
-            DERObjectIdentifier     oid = (DERObjectIdentifier)e.nextElement();
-            X509Extension           ext = (X509Extension)values.elementAt(count);
-
-            this.extensions.put(oid, ext);
-            count++;
-        }
-    }
-    
-    /**
-     * return an Enumeration of the extension field's object ids.
-     */
-    public Enumeration oids()
-    {
-        return ordering.elements();
-    }
-
-    /**
-     * return the extension represented by the object identifier
-     * passed in.
-     *
-     * @return the extension if it's present, null otherwise.
-     */
-    public X509Extension getExtension(
-        DERObjectIdentifier oid)
-    {
-        return (X509Extension)extensions.get(oid);
-    }
-
-    /**
-     * <pre>
-     *     Extensions        ::=   SEQUENCE SIZE (1..MAX) OF Extension
-     *
-     *     Extension         ::=   SEQUENCE {
-     *        extnId            EXTENSION.&id ({ExtensionSet}),
-     *        critical          BOOLEAN DEFAULT FALSE,
-     *        extnValue         OCTET STRING }
-     * </pre>
-     */
-    public DERObject toASN1Object()
-    {
-        ASN1EncodableVector     vec = new ASN1EncodableVector();
-        Enumeration             e = ordering.elements();
-
-        while (e.hasMoreElements())
-        {
-            DERObjectIdentifier     oid = (DERObjectIdentifier)e.nextElement();
-            X509Extension           ext = (X509Extension)extensions.get(oid);
-            ASN1EncodableVector     v = new ASN1EncodableVector();
-
-            v.add(oid);
-
-            if (ext.isCritical())
-            {
-                v.add(new DERBoolean(true));
-            }
-
-            v.add(ext.getValue());
-
-            vec.add(new DERSequence(v));
-        }
-
-        return new DERSequence(vec);
-    }
-
-    public boolean equivalent(
-        X509Extensions other)
-    {
-        if (extensions.size() != other.extensions.size())
-        {
-            return false;
-        }
-
-        Enumeration     e1 = extensions.keys();
-
-        while (e1.hasMoreElements())
-        {
-            Object  key = e1.nextElement();
-
-            if (!extensions.get(key).equals(other.extensions.get(key)))
-            {
-                return false;
-            }
-        }
-
-        return true;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/X509ExtensionsGenerator.java b/azureus2/src/org/bouncycastle/asn1/x509/X509ExtensionsGenerator.java
deleted file mode 100644
index b319e2b..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/X509ExtensionsGenerator.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.DEROutputStream;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- * Generator for X.509 extensions
- */
-public class X509ExtensionsGenerator
-{
-    private Hashtable extensions = new Hashtable();
-    private Vector extOrdering = new Vector();
-
-    /**
-     * Reset the generator
-     */
-    public void reset()
-    {
-        extensions = new Hashtable();
-        extOrdering = new Vector();
-    }
-
-    /**
-     * Add an extension with the given oid and the passed in value to be included
-     * in the OCTET STRING associated with the extension.
-     *
-     * @param oid  OID for the extension.
-     * @param critical  true if critical, false otherwise.
-     * @param value the ASN.1 object to be included in the extension.
-     */
-    public void addExtension(
-        DERObjectIdentifier oid,
-        boolean             critical,
-        DEREncodable        value)
-    {
-        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
-        DEROutputStream dOut = new DEROutputStream(bOut);
-
-        try
-        {
-            dOut.writeObject(value);
-        }
-        catch (IOException e)
-        {
-            throw new IllegalArgumentException("error encoding value: " + e);
-        }
-
-        this.addExtension(oid, critical, bOut.toByteArray());
-    }
-
-    /**
-     * Add an extension with the given oid and the passed in byte array to be wrapped in the
-     * OCTET STRING associated with the extension.
-     *
-     * @param oid OID for the extension.
-     * @param critical true if critical, false otherwise.
-     * @param value the byte array to be wrapped.
-     */
-    public void addExtension(
-        DERObjectIdentifier oid,
-        boolean             critical,
-        byte[]              value)
-    {
-        if (extensions.containsKey(oid))
-        {
-            throw new IllegalArgumentException("extension " + oid + " already added");
-        }
-
-        extOrdering.addElement(oid);
-        extensions.put(oid, new X509Extension(critical, new DEROctetString(value)));
-    }
-
-    /**
-     * Return true if there are no extension present in this generator.
-     *
-     * @return true if empty, false otherwise
-     */
-    public boolean isEmpty()
-    {
-        return extOrdering.isEmpty();
-    }
-
-    /**
-     * Generate an X509Extensions object based on the current state of the generator.
-     *
-     * @return  an X09Extensions object.
-     */
-    public X509Extensions generate()
-    {
-        return new X509Extensions(extOrdering, extensions);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/X509Name.java b/azureus2/src/org/bouncycastle/asn1/x509/X509Name.java
deleted file mode 100644
index 11913b2..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/X509Name.java
+++ /dev/null
@@ -1,1158 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1Set;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERSet;
-import org.bouncycastle.asn1.DERString;
-import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-import org.bouncycastle.util.Strings;
-import org.bouncycastle.util.encoders.Hex;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- * <pre>
- *     RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
- *
- *     RelativeDistinguishedName ::= SET SIZE (1..MAX) OF AttributeTypeAndValue
- *
- *     AttributeTypeAndValue ::= SEQUENCE {
- *                                   type  OBJECT IDENTIFIER,
- *                                   value ANY }
- * </pre>
- */
-public class X509Name
-    extends ASN1Encodable
-{
-    /**
-     * country code - StringType(SIZE(2))
-     */
-    public static final DERObjectIdentifier C = new DERObjectIdentifier("2.5.4.6");
-
-    /**
-     * organization - StringType(SIZE(1..64))
-     */
-    public static final DERObjectIdentifier O = new DERObjectIdentifier("2.5.4.10");
-
-    /**
-     * organizational unit name - StringType(SIZE(1..64))
-     */
-    public static final DERObjectIdentifier OU = new DERObjectIdentifier("2.5.4.11");
-
-    /**
-     * Title
-     */
-    public static final DERObjectIdentifier T = new DERObjectIdentifier("2.5.4.12");
-
-    /**
-     * common name - StringType(SIZE(1..64))
-     */
-    public static final DERObjectIdentifier CN = new DERObjectIdentifier("2.5.4.3");
-
-    /**
-     * device serial number name - StringType(SIZE(1..64))
-     */
-    public static final DERObjectIdentifier SN = new DERObjectIdentifier("2.5.4.5");
-
-    /**
-     * street - StringType(SIZE(1..64))
-     */
-    public static final DERObjectIdentifier STREET = new DERObjectIdentifier("2.5.4.9");
-    
-    /**
-     * device serial number name - StringType(SIZE(1..64))
-     */
-    public static final DERObjectIdentifier SERIALNUMBER = SN;
-
-    /**
-     * locality name - StringType(SIZE(1..64))
-     */
-    public static final DERObjectIdentifier L = new DERObjectIdentifier("2.5.4.7");
-
-    /**
-     * state, or province name - StringType(SIZE(1..64))
-     */
-    public static final DERObjectIdentifier ST = new DERObjectIdentifier("2.5.4.8");
-
-    /**
-     * Naming attributes of type X520name
-     */
-    public static final DERObjectIdentifier SURNAME = new DERObjectIdentifier("2.5.4.4");
-    public static final DERObjectIdentifier GIVENNAME = new DERObjectIdentifier("2.5.4.42");
-    public static final DERObjectIdentifier INITIALS = new DERObjectIdentifier("2.5.4.43");
-    public static final DERObjectIdentifier GENERATION = new DERObjectIdentifier("2.5.4.44");
-    public static final DERObjectIdentifier UNIQUE_IDENTIFIER = new DERObjectIdentifier("2.5.4.45");
-
-    /**
-     * businessCategory - DirectoryString(SIZE(1..128)
-     */
-    public static final DERObjectIdentifier BUSINESS_CATEGORY = new DERObjectIdentifier(
-                    "2.5.4.15");
-
-    /**
-     * postalCode - DirectoryString(SIZE(1..40)
-     */
-    public static final DERObjectIdentifier POSTAL_CODE = new DERObjectIdentifier(
-                    "2.5.4.17");
-    
-    /**
-     * dnQualifier - DirectoryString(SIZE(1..64)
-     */
-    public static final DERObjectIdentifier DN_QUALIFIER = new DERObjectIdentifier(
-                    "2.5.4.46");
-
-    /**
-     * RFC 3039 Pseudonym - DirectoryString(SIZE(1..64)
-     */
-    public static final DERObjectIdentifier PSEUDONYM = new DERObjectIdentifier(
-                    "2.5.4.65");
-
-
-    /**
-     * RFC 3039 DateOfBirth - GeneralizedTime - YYYYMMDD000000Z
-     */
-    public static final DERObjectIdentifier DATE_OF_BIRTH = new DERObjectIdentifier(
-                    "1.3.6.1.5.5.7.9.1");
-
-    /**
-     * RFC 3039 PlaceOfBirth - DirectoryString(SIZE(1..128)
-     */
-    public static final DERObjectIdentifier PLACE_OF_BIRTH = new DERObjectIdentifier(
-                    "1.3.6.1.5.5.7.9.2");
-
-    /**
-     * RFC 3039 Gender - PrintableString (SIZE(1)) -- "M", "F", "m" or "f"
-     */
-    public static final DERObjectIdentifier GENDER = new DERObjectIdentifier(
-                    "1.3.6.1.5.5.7.9.3");
-
-    /**
-     * RFC 3039 CountryOfCitizenship - PrintableString (SIZE (2)) -- ISO 3166
-     * codes only
-     */
-    public static final DERObjectIdentifier COUNTRY_OF_CITIZENSHIP = new DERObjectIdentifier(
-                    "1.3.6.1.5.5.7.9.4");
-
-    /**
-     * RFC 3039 CountryOfResidence - PrintableString (SIZE (2)) -- ISO 3166
-     * codes only
-     */
-    public static final DERObjectIdentifier COUNTRY_OF_RESIDENCE = new DERObjectIdentifier(
-                    "1.3.6.1.5.5.7.9.5");
-
-
-    /**
-     * ISIS-MTT NameAtBirth - DirectoryString(SIZE(1..64)
-     */
-    public static final DERObjectIdentifier NAME_AT_BIRTH =  new DERObjectIdentifier("1.3.36.8.3.14");
-
-    /**
-     * RFC 3039 PostalAddress - SEQUENCE SIZE (1..6) OF
-     * DirectoryString(SIZE(1..30))
-     */
-    public static final DERObjectIdentifier POSTAL_ADDRESS = new DERObjectIdentifier(
-                    "2.5.4.16");
-
-    /**
-     * Email address (RSA PKCS#9 extension) - IA5String.
-     * <p>Note: if you're trying to be ultra orthodox, don't use this! It shouldn't be in here.
-     */
-    public static final DERObjectIdentifier EmailAddress = PKCSObjectIdentifiers.pkcs_9_at_emailAddress;
-    
-    /**
-     * more from PKCS#9
-     */
-    public static final DERObjectIdentifier UnstructuredName = PKCSObjectIdentifiers.pkcs_9_at_unstructuredName;
-    public static final DERObjectIdentifier UnstructuredAddress = PKCSObjectIdentifiers.pkcs_9_at_unstructuredAddress;
-    
-    /**
-     * email address in Verisign certificates
-     */
-    public static final DERObjectIdentifier E = EmailAddress;
-    
-    /*
-     * others...
-     */
-    public static final DERObjectIdentifier DC = new DERObjectIdentifier("0.9.2342.19200300.100.1.25");
-
-    /**
-     * LDAP User id.
-     */
-    public static final DERObjectIdentifier UID = new DERObjectIdentifier("0.9.2342.19200300.100.1.1");
-
-    /**
-     * look up table translating OID values into their common symbols - this static is scheduled for deletion
-     */
-    public static Hashtable OIDLookUp = new Hashtable();
-
-    /**
-     * determines whether or not strings should be processed and printed
-     * from back to front.
-     */
-    public static boolean DefaultReverse = false;
-
-    /**
-     * default look up table translating OID values into their common symbols following
-     * the convention in RFC 2253 with a few extras
-     */
-    public static Hashtable DefaultSymbols = OIDLookUp;
-
-    /**
-     * look up table translating OID values into their common symbols following the convention in RFC 2253
-     * 
-     */
-    public static Hashtable RFC2253Symbols = new Hashtable();
-
-    /**
-     * look up table translating OID values into their common symbols following the convention in RFC 1779
-     * 
-     */
-    public static Hashtable RFC1779Symbols = new Hashtable();
-
-    /**
-     * look up table translating string values into their OIDS -
-     * this static is scheduled for deletion
-     */
-    public static Hashtable SymbolLookUp = new Hashtable();
-
-    /**
-     * look up table translating common symbols into their OIDS.
-     */
-    public static Hashtable DefaultLookUp = SymbolLookUp;
-
-    private static final Boolean TRUE = new Boolean(true); // for J2ME compatibility
-    private static final Boolean FALSE = new Boolean(false);
-
-    static
-    {
-        DefaultSymbols.put(C, "C");
-        DefaultSymbols.put(O, "O");
-        DefaultSymbols.put(T, "T");
-        DefaultSymbols.put(OU, "OU");
-        DefaultSymbols.put(CN, "CN");
-        DefaultSymbols.put(L, "L");
-        DefaultSymbols.put(ST, "ST");
-        DefaultSymbols.put(SN, "SERIALNUMBER");
-        DefaultSymbols.put(EmailAddress, "E");
-        DefaultSymbols.put(DC, "DC");
-        DefaultSymbols.put(UID, "UID");
-        DefaultSymbols.put(STREET, "STREET");
-        DefaultSymbols.put(SURNAME, "SURNAME");
-        DefaultSymbols.put(GIVENNAME, "GIVENNAME");
-        DefaultSymbols.put(INITIALS, "INITIALS");
-        DefaultSymbols.put(GENERATION, "GENERATION");
-        DefaultSymbols.put(UnstructuredAddress, "unstructuredAddress");
-        DefaultSymbols.put(UnstructuredName, "unstructuredName");
-        DefaultSymbols.put(UNIQUE_IDENTIFIER, "UniqueIdentifier");
-        DefaultSymbols.put(DN_QUALIFIER, "DN");
-        DefaultSymbols.put(PSEUDONYM, "Pseudonym");
-        DefaultSymbols.put(POSTAL_ADDRESS, "PostalAddress");
-        DefaultSymbols.put(NAME_AT_BIRTH, "NameAtBirth");
-        DefaultSymbols.put(COUNTRY_OF_CITIZENSHIP, "CountryOfCitizenship");
-        DefaultSymbols.put(COUNTRY_OF_RESIDENCE, "CountryOfResidence");
-        DefaultSymbols.put(GENDER, "Gender");
-        DefaultSymbols.put(PLACE_OF_BIRTH, "PlaceOfBirth");
-        DefaultSymbols.put(DATE_OF_BIRTH, "DateOfBirth");
-        DefaultSymbols.put(POSTAL_CODE, "PostalCode");
-        DefaultSymbols.put(BUSINESS_CATEGORY, "BusinessCategory");
-
-        RFC2253Symbols.put(C, "C");
-        RFC2253Symbols.put(O, "O");
-        RFC2253Symbols.put(OU, "OU");
-        RFC2253Symbols.put(CN, "CN");
-        RFC2253Symbols.put(L, "L");
-        RFC2253Symbols.put(ST, "ST");
-        RFC2253Symbols.put(STREET, "STREET");
-        RFC2253Symbols.put(DC, "DC");
-        RFC2253Symbols.put(UID, "UID");
-
-        RFC1779Symbols.put(C, "C");
-        RFC1779Symbols.put(O, "O");
-        RFC1779Symbols.put(OU, "OU");
-        RFC1779Symbols.put(CN, "CN");
-        RFC1779Symbols.put(L, "L");
-        RFC1779Symbols.put(ST, "ST");
-        RFC1779Symbols.put(STREET, "STREET");
-
-        DefaultLookUp.put("c", C);
-        DefaultLookUp.put("o", O);
-        DefaultLookUp.put("t", T);
-        DefaultLookUp.put("ou", OU);
-        DefaultLookUp.put("cn", CN);
-        DefaultLookUp.put("l", L);
-        DefaultLookUp.put("st", ST);
-        DefaultLookUp.put("sn", SN);
-        DefaultLookUp.put("serialnumber", SN);
-        DefaultLookUp.put("street", STREET);
-        DefaultLookUp.put("emailaddress", E);
-        DefaultLookUp.put("dc", DC);
-        DefaultLookUp.put("e", E);
-        DefaultLookUp.put("uid", UID);
-        DefaultLookUp.put("surname", SURNAME);
-        DefaultLookUp.put("givenname", GIVENNAME);
-        DefaultLookUp.put("initials", INITIALS);
-        DefaultLookUp.put("generation", GENERATION);
-        DefaultLookUp.put("unstructuredaddress", UnstructuredAddress);
-        DefaultLookUp.put("unstructuredname", UnstructuredName);
-        DefaultLookUp.put("uniqueidentifier", UNIQUE_IDENTIFIER);
-        DefaultLookUp.put("dn", DN_QUALIFIER);
-        DefaultLookUp.put("pseudonym", PSEUDONYM);
-        DefaultLookUp.put("postaladdress", POSTAL_ADDRESS);
-        DefaultLookUp.put("nameofbirth", NAME_AT_BIRTH);
-        DefaultLookUp.put("countryofcitizenship", COUNTRY_OF_CITIZENSHIP);
-        DefaultLookUp.put("countryofresidence", COUNTRY_OF_RESIDENCE);
-        DefaultLookUp.put("gender", GENDER);
-        DefaultLookUp.put("placeofbirth", PLACE_OF_BIRTH);
-        DefaultLookUp.put("dateofbirth", DATE_OF_BIRTH);
-        DefaultLookUp.put("postalcode", POSTAL_CODE);
-        DefaultLookUp.put("businesscategory", BUSINESS_CATEGORY);
-    }
-
-    private X509NameEntryConverter  converter = null;
-    private Vector                  ordering = new Vector();
-    private Vector                  values = new Vector();
-    private Vector                  added = new Vector();
-    
-    private ASN1Sequence            seq;
-
-    /**
-     * Return a X509Name based on the passed in tagged object.
-     * 
-     * @param obj tag object holding name.
-     * @param explicit true if explicitly tagged false otherwise.
-     * @return the X509Name
-     */
-    public static X509Name getInstance(
-        ASN1TaggedObject obj,
-        boolean          explicit)
-    {
-        return getInstance(ASN1Sequence.getInstance(obj, explicit));
-    }
-
-    public static X509Name getInstance(
-        Object  obj)
-    {
-        if (obj == null || obj instanceof X509Name)
-        {
-            return (X509Name)obj;
-        }
-        else if (obj instanceof ASN1Sequence)
-        {
-            return new X509Name((ASN1Sequence)obj);
-        }
-
-        throw new IllegalArgumentException("unknown object in factory \"" + obj.getClass().getName()+"\"");
-    }
-
-    /**
-     * Constructor from ASN1Sequence
-     *
-     * the principal will be a list of constructed sets, each containing an (OID, String) pair.
-     */
-    public X509Name(
-        ASN1Sequence  seq)
-    {
-        this.seq = seq;
-
-        Enumeration e = seq.getObjects();
-
-        while (e.hasMoreElements())
-        {
-            ASN1Set         set = ASN1Set.getInstance(e.nextElement());
-
-            for (int i = 0; i < set.size(); i++) 
-            {
-                   ASN1Sequence s = ASN1Sequence.getInstance(set.getObjectAt(i));
-
-                   if (s.size() != 2)
-                   {
-                       throw new IllegalArgumentException("badly sized pair");
-                   }
-
-                   ordering.addElement(DERObjectIdentifier.getInstance(s.getObjectAt(0)));
-                   
-                   DEREncodable value = s.getObjectAt(1);
-                   if (value instanceof DERString)
-                   {
-                       values.addElement(((DERString)value).getString());
-                   }
-                   else
-                   {
-                       values.addElement("#" + bytesToString(Hex.encode(value.getDERObject().getDEREncoded())));
-                   }
-                   added.addElement((i != 0) ? TRUE : FALSE);  // to allow earlier JDK compatibility
-            }
-        }
-    }
-
-    /**
-     * constructor from a table of attributes.
-     * <p>
-     * it's is assumed the table contains OID/String pairs, and the contents
-     * of the table are copied into an internal table as part of the
-     * construction process.
-     * <p>
-     * <b>Note:</b> if the name you are trying to generate should be
-     * following a specific ordering, you should use the constructor
-     * with the ordering specified below.
-     * @deprecated use an ordered constructor! The hashtable ordering is rarely correct
-     */
-    public X509Name(
-        Hashtable  attributes)
-    {
-        this(null, attributes);
-    }
-
-    /**
-     * Constructor from a table of attributes with ordering.
-     * <p>
-     * it's is assumed the table contains OID/String pairs, and the contents
-     * of the table are copied into an internal table as part of the
-     * construction process. The ordering vector should contain the OIDs
-     * in the order they are meant to be encoded or printed in toString.
-     */
-    public X509Name(
-        Vector      ordering,
-        Hashtable   attributes)
-    {
-        this(ordering, attributes, new X509DefaultEntryConverter());
-    }
-
-    /**
-     * Constructor from a table of attributes with ordering.
-     * <p>
-     * it's is assumed the table contains OID/String pairs, and the contents
-     * of the table are copied into an internal table as part of the
-     * construction process. The ordering vector should contain the OIDs
-     * in the order they are meant to be encoded or printed in toString.
-     * <p>
-     * The passed in converter will be used to convert the strings into their
-     * ASN.1 counterparts.
-     */
-    public X509Name(
-        Vector                   ordering,
-        Hashtable                attributes,
-        X509NameEntryConverter   converter)
-    {
-        this.converter = converter;
-
-        if (ordering != null)
-        {
-            for (int i = 0; i != ordering.size(); i++)
-            {
-                this.ordering.addElement(ordering.elementAt(i));
-                this.added.addElement(FALSE);
-            }
-        }
-        else
-        {
-            Enumeration     e = attributes.keys();
-
-            while (e.hasMoreElements())
-            {
-                this.ordering.addElement(e.nextElement());
-                this.added.addElement(FALSE);
-            }
-        }
-
-        for (int i = 0; i != this.ordering.size(); i++)
-        {
-            DERObjectIdentifier     oid = (DERObjectIdentifier)this.ordering.elementAt(i);
-
-            if (attributes.get(oid) == null)
-            {
-                throw new IllegalArgumentException("No attribute for object id - " + oid.getId() + " - passed to distinguished name");
-            }
-
-            this.values.addElement(attributes.get(oid)); // copy the hash table
-        }
-    }
-
-    /**
-     * Takes two vectors one of the oids and the other of the values.
-     */
-    public X509Name(
-        Vector  oids,
-        Vector  values)
-    {
-        this(oids, values, new X509DefaultEntryConverter());
-    }
-
-    /**
-     * Takes two vectors one of the oids and the other of the values.
-     * <p>
-     * The passed in converter will be used to convert the strings into their
-     * ASN.1 counterparts.
-     */
-    public X509Name(
-        Vector                  oids,
-        Vector                  values,
-        X509NameEntryConverter  converter)
-    {
-        this.converter = converter;
-
-        if (oids.size() != values.size())
-        {
-            throw new IllegalArgumentException("oids vector must be same length as values.");
-        }
-
-        for (int i = 0; i < oids.size(); i++)
-        {
-            this.ordering.addElement(oids.elementAt(i));
-            this.values.addElement(values.elementAt(i));
-            this.added.addElement(FALSE);
-        }
-    }
-
-    /**
-     * Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or
-     * some such, converting it into an ordered set of name attributes.
-     */
-    public X509Name(
-        String  dirName)
-    {
-        this(DefaultReverse, DefaultLookUp, dirName);
-    }
-
-    /**
-     * Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or
-     * some such, converting it into an ordered set of name attributes with each
-     * string value being converted to its associated ASN.1 type using the passed
-     * in converter.
-     */
-    public X509Name(
-        String                  dirName,
-        X509NameEntryConverter  converter)
-    {
-        this(DefaultReverse, DefaultLookUp, dirName, converter);
-    }
-
-    /**
-     * Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or
-     * some such, converting it into an ordered set of name attributes. If reverse
-     * is true, create the encoded version of the sequence starting from the
-     * last element in the string.
-     */
-    public X509Name(
-        boolean reverse,
-        String  dirName)
-    {
-        this(reverse, DefaultLookUp, dirName);
-    }
-
-    /**
-     * Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or
-     * some such, converting it into an ordered set of name attributes with each
-     * string value being converted to its associated ASN.1 type using the passed
-     * in converter. If reverse is true the ASN.1 sequence representing the DN will
-     * be built by starting at the end of the string, rather than the start.
-     */
-    public X509Name(
-        boolean                 reverse,
-        String                  dirName,
-        X509NameEntryConverter  converter)
-    {
-        this(reverse, DefaultLookUp, dirName, converter);
-    }
-
-    /**
-     * Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or
-     * some such, converting it into an ordered set of name attributes. lookUp
-     * should provide a table of lookups, indexed by lowercase only strings and
-     * yielding a DERObjectIdentifier, other than that OID. and numeric oids
-     * will be processed automatically.
-     * <br>
-     * If reverse is true, create the encoded version of the sequence
-     * starting from the last element in the string.
-     * @param reverse true if we should start scanning from the end (RFC 2553).
-     * @param lookUp table of names and their oids.
-     * @param dirName the X.500 string to be parsed.
-     */
-    public X509Name(
-        boolean     reverse,
-        Hashtable   lookUp,
-        String      dirName)
-    {
-        this(reverse, lookUp, dirName, new X509DefaultEntryConverter());
-    }
-
-    private DERObjectIdentifier decodeOID(
-        String      name,
-        Hashtable   lookUp)
-    {
-        if (Strings.toUpperCase(name).startsWith("OID."))
-        {
-            return new DERObjectIdentifier(name.substring(4));
-        }
-        else if (name.charAt(0) >= '0' && name.charAt(0) <= '9')
-        {
-            return new DERObjectIdentifier(name);
-        }
-
-        DERObjectIdentifier oid = (DERObjectIdentifier)lookUp.get(Strings.toLowerCase(name));
-        if (oid == null)
-        {
-            throw new IllegalArgumentException("Unknown object id - " + name + " - passed to distinguished name");
-        }
-
-        return oid;
-    }
-
-    /**
-     * Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or
-     * some such, converting it into an ordered set of name attributes. lookUp
-     * should provide a table of lookups, indexed by lowercase only strings and
-     * yielding a DERObjectIdentifier, other than that OID. and numeric oids
-     * will be processed automatically. The passed in converter is used to convert the
-     * string values to the right of each equals sign to their ASN.1 counterparts.
-     * <br>
-     * @param reverse true if we should start scanning from the end, false otherwise.
-     * @param lookUp table of names and oids.
-     * @param dirName the string dirName
-     * @param converter the converter to convert string values into their ASN.1 equivalents
-     */
-    public X509Name(
-        boolean                 reverse,
-        Hashtable               lookUp,
-        String                  dirName,
-        X509NameEntryConverter  converter)
-    {
-        this.converter = converter;
-        X509NameTokenizer   nTok = new X509NameTokenizer(dirName);
-
-        while (nTok.hasMoreTokens())
-        {
-            String  token = nTok.nextToken();
-            int     index = token.indexOf('=');
-
-            if (index == -1)
-            {
-                throw new IllegalArgumentException("badly formated directory string");
-            }
-
-            String              name = token.substring(0, index);
-            String              value = token.substring(index + 1);
-            DERObjectIdentifier oid = decodeOID(name, lookUp);
-
-            if (value.indexOf('+') > 0)
-            {
-                X509NameTokenizer   vTok = new X509NameTokenizer(value, '+');
-
-                this.ordering.addElement(oid);
-                this.values.addElement(vTok.nextToken());
-                this.added.addElement(FALSE);
-
-                while (vTok.hasMoreTokens())
-                {
-                    String  sv = vTok.nextToken();
-                    int     ndx = sv.indexOf('=');
-
-                    String  nm = sv.substring(0, ndx);
-                    String  vl = sv.substring(ndx + 1);
-                    this.ordering.addElement(decodeOID(nm, lookUp));
-                    this.values.addElement(vl);
-                    this.added.addElement(TRUE);
-                }
-            }
-            else
-            {
-                this.ordering.addElement(oid);
-                this.values.addElement(value);
-                this.added.addElement(FALSE);
-            }
-        }
-
-        if (reverse)
-        {
-            Vector  o = new Vector();
-            Vector  v = new Vector();
-            Vector  a = new Vector();
-            int count = 1;
-
-            for (int i = 0; i < this.ordering.size(); i++)
-            {
-                if (((Boolean)this.added.elementAt(i)).booleanValue())
-                {
-                    o.insertElementAt(this.ordering.elementAt(i), count);
-                    v.insertElementAt(this.values.elementAt(i), count);
-                    a.insertElementAt(this.added.elementAt(i), count);
-                    count++;
-                }
-                else
-                {
-                    o.insertElementAt(this.ordering.elementAt(i), 0);
-                    v.insertElementAt(this.values.elementAt(i), 0);
-                    a.insertElementAt(this.added.elementAt(i), 0);
-                    count = 1;
-                }
-            }
-
-            this.ordering = o;
-            this.values = v;
-            this.added = a;
-        }
-    }
-
-    /**
-     * return a vector of the oids in the name, in the order they were found.
-     */
-    public Vector getOIDs()
-    {
-        Vector  v = new Vector();
-
-        for (int i = 0; i != ordering.size(); i++)
-        {
-            v.addElement(ordering.elementAt(i));
-        }
-
-        return v;
-    }
-
-    /**
-     * return a vector of the values found in the name, in the order they
-     * were found.
-     */
-    public Vector getValues()
-    {
-        Vector  v = new Vector();
-
-        for (int i = 0; i != values.size(); i++)
-        {
-            v.addElement(values.elementAt(i));
-        }
-
-        return v;
-    }
-
-    /**
-     * return a vector of the values found in the name, in the order they
-     * were found, with the DN label corresponding to passed in oid.
-     */
-    public Vector getValues(
-        DERObjectIdentifier oid)
-    {
-        Vector  v = new Vector();
-
-        for (int i = 0; i != values.size(); i++)
-        {
-            if (ordering.elementAt(i).equals(oid))
-            {
-                v.addElement(values.elementAt(i));
-            }
-        }
-
-        return v;
-    }
-
-    public DERObject toASN1Object()
-    {
-        if (seq == null)
-        {
-            ASN1EncodableVector  vec = new ASN1EncodableVector();
-            ASN1EncodableVector  sVec = new ASN1EncodableVector();
-            DERObjectIdentifier  lstOid = null;
-            
-            for (int i = 0; i != ordering.size(); i++)
-            {
-                ASN1EncodableVector     v = new ASN1EncodableVector();
-                DERObjectIdentifier     oid = (DERObjectIdentifier)ordering.elementAt(i);
-
-                v.add(oid);
-
-                String  str = (String)values.elementAt(i);
-
-                v.add(converter.getConvertedValue(oid, str));
- 
-                if (lstOid == null 
-                    || ((Boolean)this.added.elementAt(i)).booleanValue())
-                {
-                    sVec.add(new DERSequence(v));
-                }
-                else
-                {
-                    vec.add(new DERSet(sVec));
-                    sVec = new ASN1EncodableVector();
-                    
-                    sVec.add(new DERSequence(v));
-                }
-                
-                lstOid = oid;
-            }
-            
-            vec.add(new DERSet(sVec));
-            
-            seq = new DERSequence(vec);
-        }
-
-        return seq;
-    }
-
-    /**
-     * @param inOrder if true the order of both X509 names must be the same,
-     * as well as the values associated with each element.
-     */
-    public boolean equals(Object obj, boolean inOrder)
-    {
-        if (!inOrder)
-        {
-            return this.equals(obj);
-        }
-
-        if (obj == this)
-        {
-            return true;
-        }
-
-        if (!(obj instanceof X509Name || obj instanceof ASN1Sequence))
-        {
-            return false;
-        }
-
-        DERObject derO = ((DEREncodable)obj).getDERObject();
-
-        if (this.getDERObject().equals(derO))
-        {
-            return true;
-        }
-
-        X509Name other;
-
-        try
-        {
-            other = X509Name.getInstance(obj);
-        }
-        catch (IllegalArgumentException e)
-        {
-            return false;
-        }
-
-        int      orderingSize = ordering.size();
-
-        if (orderingSize != other.ordering.size())
-        {
-            return false;
-        }
-
-        for (int i = 0; i < orderingSize; i++)
-        {
-            DERObjectIdentifier  oid = (DERObjectIdentifier)ordering.elementAt(i);
-            DERObjectIdentifier  oOid = (DERObjectIdentifier)other.ordering.elementAt(i);
-
-            if (oid.equals(oOid))
-            {
-                String value = (String)values.elementAt(i);
-                String oValue = (String)other.values.elementAt(i);
-
-                if (!equivalentStrings(value, oValue))
-                {
-                    return false;
-                }
-            }
-            else
-            {
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    /**
-     * test for equality - note: case is ignored.
-     */
-    public boolean equals(Object obj)
-    {
-        if (obj == this)
-        {
-            return true;
-        }
-
-        if (!(obj instanceof X509Name || obj instanceof ASN1Sequence))
-        {
-            return false;
-        }
-        
-        DERObject derO = ((DEREncodable)obj).getDERObject();
-        
-        if (this.getDERObject().equals(derO))
-        {
-            return true;
-        }
-
-        X509Name other;
-
-        try
-        {
-            other = X509Name.getInstance(obj);
-        }
-        catch (IllegalArgumentException e)
-        { 
-            return false;
-        }
-
-        int      orderingSize = ordering.size();
-
-        if (orderingSize != other.ordering.size())
-        {
-            return false;
-        }
-        
-        boolean[] indexes = new boolean[orderingSize];
-        int       start, end, delta;
-
-        if (ordering.elementAt(0).equals(other.ordering.elementAt(0)))   // guess forward
-        {
-            start = 0;
-            end = orderingSize;
-            delta = 1;
-        }
-        else  // guess reversed - most common problem
-        {
-            start = orderingSize - 1;
-            end = -1;
-            delta = -1;
-        }
-
-        for (int i = start; i != end; i += delta)
-        {
-            boolean              found = false;
-            DERObjectIdentifier  oid = (DERObjectIdentifier)ordering.elementAt(i);
-            String               value = (String)values.elementAt(i);
-            
-            for (int j = 0; j < orderingSize; j++)
-            {
-                if (indexes[j])
-                {
-                    continue;
-                }
-                
-                DERObjectIdentifier oOid = (DERObjectIdentifier)other.ordering.elementAt(j);
-
-                if (oid.equals(oOid))
-                {
-                    String oValue = (String)other.values.elementAt(j);
-
-                    if (equivalentStrings(value, oValue))
-                    {
-                        indexes[j] = true;
-                        found      = true;
-                        break;
-                    }
-                }
-            }
-
-            if (!found)
-            {
-                return false;
-            }
-        }
-        
-        return true;
-    }
-
-    private boolean equivalentStrings(String s1, String s2)
-    {
-        String value = Strings.toLowerCase(s1.trim());
-        String oValue = Strings.toLowerCase(s2.trim());
-
-        if (!value.equals(oValue))
-        {
-            value = stripInternalSpaces(value);
-            oValue = stripInternalSpaces(oValue);
-
-            if (!value.equals(oValue))
-            {
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    private String stripInternalSpaces(
-        String str)
-    {
-        StringBuffer res = new StringBuffer();
-
-        if (str.length() != 0)
-        {
-            char    c1 = str.charAt(0);
-
-            res.append(c1);
-
-            for (int k = 1; k < str.length(); k++)
-            {
-                char    c2 = str.charAt(k);
-                if (!(c1 == ' ' && c2 == ' '))
-                {
-                    res.append(c2);
-                }
-                c1 = c2;
-            }
-        }
-
-        return res.toString();
-    }
-
-    public int hashCode()
-    {
-        ASN1Sequence  seq = (ASN1Sequence)this.getDERObject();
-        Enumeration   e = seq.getObjects();
-        int           hashCode = 0;
-
-        while (e.hasMoreElements())
-        {
-            hashCode ^= e.nextElement().hashCode();
-        }
-
-        return hashCode;
-    }
-
-    private void appendValue(
-        StringBuffer        buf,
-        Hashtable           oidSymbols,
-        DERObjectIdentifier oid,
-        String              value)
-    {
-        String  sym = (String)oidSymbols.get(oid);
-
-        if (sym != null)
-        {
-            buf.append(sym);
-        }
-        else
-        {
-            buf.append(oid.getId());
-        }
-
-        buf.append('=');
-
-        int     index = buf.length();
-
-        buf.append(value);
-
-        int     end = buf.length();
-
-        while (index != end)
-        {
-            if ((buf.charAt(index) == ',')
-               || (buf.charAt(index) == '"')
-               || (buf.charAt(index) == '\\')
-               || (buf.charAt(index) == '+')
-               || (buf.charAt(index) == '<')
-               || (buf.charAt(index) == '>')
-               || (buf.charAt(index) == ';'))
-            {
-                buf.insert(index, "\\");
-                index++;
-                end++;
-            }
-
-            index++;
-        }
-    }
-
-    /**
-     * convert the structure to a string - if reverse is true the
-     * oids and values are listed out starting with the last element
-     * in the sequence (ala RFC 2253), otherwise the string will begin
-     * with the first element of the structure. If no string definition
-     * for the oid is found in oidSymbols the string value of the oid is
-     * added. Two standard symbol tables are provided DefaultSymbols, and
-     * RFC2253Symbols as part of this class.
-     *
-     * @param reverse if true start at the end of the sequence and work back.
-     * @param oidSymbols look up table strings for oids.
-     */
-    public String toString(
-        boolean     reverse,
-        Hashtable   oidSymbols)
-    {
-        StringBuffer            buf = new StringBuffer();
-        Vector                  components = new Vector();
-        boolean                 first = true;
-
-        StringBuffer ava = null;
-
-        for (int i = 0; i < ordering.size(); i++)
-        {
-            if (((Boolean)added.elementAt(i)).booleanValue())
-            {
-                ava.append('+');
-                appendValue(ava, oidSymbols,
-                    (DERObjectIdentifier)ordering.elementAt(i),
-                    (String)values.elementAt(i));
-            }
-            else
-            {
-                ava = new StringBuffer();
-                appendValue(ava, oidSymbols,
-                    (DERObjectIdentifier)ordering.elementAt(i),
-                    (String)values.elementAt(i));
-                components.addElement(ava);
-            }
-        }
-
-        if (reverse)
-        {
-            for (int i = components.size() - 1; i >= 0; i--)
-            {
-                if (first)
-                {
-                    first = false;
-                }
-                else
-                {
-                    buf.append(',');
-                }
-
-                buf.append(components.elementAt(i).toString());
-            }
-        }
-        else
-        {
-            for (int i = 0; i < components.size(); i++)
-            {
-                if (first)
-                {
-                    first = false;
-                }
-                else
-                {
-                    buf.append(',');
-                }
-
-                buf.append(components.elementAt(i).toString());
-            }
-        }
-
-        return buf.toString();
-    }
-
-    private String bytesToString(
-        byte[] data)
-    {
-        char[]  cs = new char[data.length];
-
-        for (int i = 0; i != cs.length; i++)
-        {
-            cs[i] = (char)(data[i] & 0xff);
-        }
-
-        return new String(cs);
-    }
-    
-    public String toString()
-    {
-        return toString(DefaultReverse, DefaultSymbols);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/X509NameEntryConverter.java b/azureus2/src/org/bouncycastle/asn1/x509/X509NameEntryConverter.java
deleted file mode 100644
index 5011322..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/X509NameEntryConverter.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.ASN1InputStream;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERPrintableString;
-import org.bouncycastle.util.Strings;
-
-import java.io.IOException;
-
-/**
- * It turns out that the number of standard ways the fields in a DN should be 
- * encoded into their ASN.1 counterparts is rapidly approaching the
- * number of machines on the internet. By default the X509Name class 
- * will produce UTF8Strings in line with the current recommendations (RFC 3280).
- * <p>
- * An example of an encoder look like below:
- * <pre>
- * public class X509DirEntryConverter
- *     extends X509NameEntryConverter
- * {
- *     public DERObject getConvertedValue(
- *         DERObjectIdentifier  oid,
- *         String               value)
- *     {
- *         if (str.length() != 0 && str.charAt(0) == '#')
- *         {
- *             return convertHexEncoded(str, 1);
- *         }
- *         if (oid.equals(EmailAddress))
- *         {
- *             return new DERIA5String(str);
- *         }
- *         else if (canBePrintable(str))
- *         {
- *             return new DERPrintableString(str);
- *         }
- *         else if (canBeUTF8(str))
- *         {
- *             return new DERUTF8String(str);
- *         }
- *         else
- *         {
- *             return new DERBMPString(str);
- *         }
- *     }
- * }
- */
-public abstract class X509NameEntryConverter
-{
-    /**
-     * Convert an inline encoded hex string rendition of an ASN.1
-     * object back into its corresponding ASN.1 object.
-     * 
-     * @param str the hex encoded object
-     * @param off the index at which the encoding starts
-     * @return the decoded object
-     */
-    protected DERObject convertHexEncoded(
-        String  str,
-        int     off)
-        throws IOException
-    {
-        str = Strings.toLowerCase(str);
-        byte[] data = new byte[(str.length() - off) / 2];
-        for (int index = 0; index != data.length; index++)
-        {
-            char left = str.charAt((index * 2) + off);
-            char right = str.charAt((index * 2) + off + 1);
-            
-            if (left < 'a')
-            {
-                data[index] = (byte)((left - '0') << 4);
-            }
-            else
-            {
-                data[index] = (byte)((left - 'a' + 10) << 4);
-            }
-            if (right < 'a')
-            {
-                data[index] |= (byte)(right - '0');
-            }
-            else
-            {
-                data[index] |= (byte)(right - 'a' + 10);
-            }
-        }
-
-        ASN1InputStream aIn = new ASN1InputStream(data);
-                                            
-        return aIn.readObject();
-    }
-    
-    /**
-     * return true if the passed in String can be represented without
-     * loss as a PrintableString, false otherwise.
-     */
-    protected boolean canBePrintable(
-        String  str)
-    {
-        return DERPrintableString.isPrintableString(str);
-    }
-    
-    /**
-     * Convert the passed in String value into the appropriate ASN.1
-     * encoded object.
-     * 
-     * @param oid the oid associated with the value in the DN.
-     * @param value the value of the particular DN component.
-     * @return the ASN.1 equivalent for the value.
-     */
-    public abstract DERObject getConvertedValue(DERObjectIdentifier oid, String value);
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/X509NameTokenizer.java b/azureus2/src/org/bouncycastle/asn1/x509/X509NameTokenizer.java
deleted file mode 100644
index 035e924..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/X509NameTokenizer.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-/**
- * class for breaking up an X500 Name into it's component tokens, ala
- * java.util.StringTokenizer. We need this class as some of the
- * lightweight Java environment don't support classes like
- * StringTokenizer.
- */
-public class X509NameTokenizer
-{
-    private String          value;
-    private int             index;
-    private char            seperator;
-    private StringBuffer    buf = new StringBuffer();
-
-    public X509NameTokenizer(
-        String  oid)
-    {
-        this(oid, ',');
-    }
-    
-    public X509NameTokenizer(
-        String  oid,
-        char    seperator)
-    {
-        this.value = oid;
-        this.index = -1;
-        this.seperator = seperator;
-    }
-
-    public boolean hasMoreTokens()
-    {
-        return (index != value.length());
-    }
-
-    public String nextToken()
-    {
-        if (index == value.length())
-        {
-            return null;
-        }
-
-        int     end = index + 1;
-        boolean quoted = false;
-        boolean escaped = false;
-
-        buf.setLength(0);
-
-        while (end != value.length())
-        {
-            char    c = value.charAt(end);
-
-            if (c == '"')
-            {
-                if (!escaped)
-                {
-                    quoted = !quoted;
-                }
-                else
-                {
-                    buf.append(c);
-                }
-                escaped = false;
-            }
-            else
-            {
-                if (escaped || quoted)
-                {
-                    buf.append(c);
-                    escaped = false;
-                }
-                else if (c == '\\')
-                {
-                    escaped = true;
-                }
-                else if (c == seperator)
-                {
-                    break;
-                }
-                else
-                {
-                    buf.append(c);
-                }
-            }
-            end++;
-        }
-
-        index = end;
-        return buf.toString().trim();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/X509ObjectIdentifiers.java b/azureus2/src/org/bouncycastle/asn1/x509/X509ObjectIdentifiers.java
deleted file mode 100644
index ae48c42..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/X509ObjectIdentifiers.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.bouncycastle.asn1.x509;
-
-import org.bouncycastle.asn1.DERObjectIdentifier;
-
-public interface X509ObjectIdentifiers
-{
-    //
-    // base id
-    //
-    static final String                 id                      = "2.5.4";
-
-    static final DERObjectIdentifier    commonName              = new DERObjectIdentifier(id + ".3");
-    static final DERObjectIdentifier    countryName             = new DERObjectIdentifier(id + ".6");
-    static final DERObjectIdentifier    localityName            = new DERObjectIdentifier(id + ".7");
-    static final DERObjectIdentifier    stateOrProvinceName     = new DERObjectIdentifier(id + ".8");
-    static final DERObjectIdentifier    organization            = new DERObjectIdentifier(id + ".10");
-    static final DERObjectIdentifier    organizationalUnitName  = new DERObjectIdentifier(id + ".11");
-
-    // id-SHA1 OBJECT IDENTIFIER ::=    
-    //   {iso(1) identified-organization(3) oiw(14) secsig(3) algorithms(2) 26 }    //
-    static final DERObjectIdentifier    id_SHA1                 = new DERObjectIdentifier("1.3.14.3.2.26");
-
-    //
-    // ripemd160 OBJECT IDENTIFIER ::=
-    //      {iso(1) identified-organization(3) TeleTrust(36) algorithm(3) hashAlgorithm(2) RIPEMD-160(1)}
-    //
-    static final DERObjectIdentifier    ripemd160               = new DERObjectIdentifier("1.3.36.3.2.1");
-
-    //
-    // ripemd160WithRSAEncryption OBJECT IDENTIFIER ::=
-    //      {iso(1) identified-organization(3) TeleTrust(36) algorithm(3) signatureAlgorithm(3) rsaSignature(1) rsaSignatureWithripemd160(2) }
-    //
-    static final DERObjectIdentifier    ripemd160WithRSAEncryption = new DERObjectIdentifier("1.3.36.3.3.1.2");
-
-
-    static final DERObjectIdentifier    id_ea_rsa = new DERObjectIdentifier("2.5.8.1.1");
-    
-    // id-pkix
-    static final DERObjectIdentifier id_pkix = new DERObjectIdentifier("1.3.6.1.5.5.7");
-
-    //
-    // private internet extensions
-    //
-    static final DERObjectIdentifier  id_pe = new DERObjectIdentifier(id_pkix + ".1");
-
-    //
-    // authority information access
-    //
-    static final DERObjectIdentifier  id_ad = new DERObjectIdentifier(id_pkix + ".48");
-    static final DERObjectIdentifier  id_ad_caIssuers = new DERObjectIdentifier(id_ad + ".2");
-    static final DERObjectIdentifier  id_ad_ocsp = new DERObjectIdentifier(id_ad + ".1");
-
-    //
-    //    OID for ocsp and crl uri in AuthorityInformationAccess extension
-    //
-    static final DERObjectIdentifier ocspAccessMethod = id_ad_ocsp;
-    static final DERObjectIdentifier crlAccessMethod = id_ad_caIssuers;
-}
-
diff --git a/azureus2/src/org/bouncycastle/asn1/x509/package.html b/azureus2/src/org/bouncycastle/asn1/x509/package.html
deleted file mode 100644
index 728921a..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x509/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body bgcolor="#ffffff">
-Support classes useful for encoding and processing X.509 certificates.
-</body>
-</html>
diff --git a/azureus2/src/org/bouncycastle/asn1/x9/KeySpecificInfo.java b/azureus2/src/org/bouncycastle/asn1/x9/KeySpecificInfo.java
deleted file mode 100644
index 02eaaaa..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x9/KeySpecificInfo.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.bouncycastle.asn1.x9;
-
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-
-/**
- * ASN.1 def for Diffie-Hellman key exchange KeySpecificInfo structure. See
- * RFC 2631, or X9.42, for further details.
- */
-public class KeySpecificInfo
-    implements DEREncodable
-{
-    private DERObjectIdentifier algorithm;
-    private ASN1OctetString      counter;
-
-    public KeySpecificInfo(
-        DERObjectIdentifier algorithm,
-        ASN1OctetString      counter)
-    {
-        this.algorithm = algorithm;
-        this.counter = counter;
-    }
-
-    public KeySpecificInfo(
-        ASN1Sequence  seq)
-    {
-        Enumeration e = seq.getObjects();
-
-        algorithm = (DERObjectIdentifier)e.nextElement();
-        counter = (ASN1OctetString)e.nextElement();
-    }
-
-    public DERObjectIdentifier getAlgorithm()
-    {
-        return algorithm;
-    }
-
-    public ASN1OctetString getCounter()
-    {
-        return counter;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     *  KeySpecificInfo ::= SEQUENCE {
-     *      algorithm OBJECT IDENTIFIER,
-     *      counter OCTET STRING SIZE (4..4)
-     *  }
-     * </pre>
-     */
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(algorithm);
-        v.add(counter);
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x9/OtherInfo.java b/azureus2/src/org/bouncycastle/asn1/x9/OtherInfo.java
deleted file mode 100644
index f7a5f63..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x9/OtherInfo.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.bouncycastle.asn1.x9;
-
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERTaggedObject;
-
-/**
- * ANS.1 def for Diffie-Hellman key exchange OtherInfo structure. See
- * RFC 2631, or X9.42, for further details.
- */
-public class OtherInfo
-    implements DEREncodable
-{
-    private KeySpecificInfo     keyInfo;
-    private ASN1OctetString     partyAInfo;
-    private ASN1OctetString     suppPubInfo;
-
-    public OtherInfo(
-        KeySpecificInfo     keyInfo,
-        ASN1OctetString     partyAInfo,
-        ASN1OctetString     suppPubInfo)
-    {
-        this.keyInfo = keyInfo;
-        this.partyAInfo = partyAInfo;
-        this.suppPubInfo = suppPubInfo;
-    }
-
-    public OtherInfo(
-        ASN1Sequence  seq)
-    {
-        Enumeration e = seq.getObjects();
-
-        keyInfo = new KeySpecificInfo((ASN1Sequence)e.nextElement());
-
-        while (e.hasMoreElements())
-        {
-            DERTaggedObject o = (DERTaggedObject)e.nextElement();
-
-            if (o.getTagNo() == 0)
-            {
-                partyAInfo = (ASN1OctetString)o.getObject();
-            }
-            else if (o.getTagNo() == 2)
-            {
-                suppPubInfo = (ASN1OctetString)o.getObject();
-            }
-        }
-    }
-
-    public KeySpecificInfo getKeyInfo()
-    {
-        return keyInfo;
-    }
-
-    public ASN1OctetString getPartyAInfo()
-    {
-        return partyAInfo;
-    }
-
-    public ASN1OctetString getSuppPubInfo()
-    {
-        return suppPubInfo;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     *  OtherInfo ::= SEQUENCE {
-     *      keyInfo KeySpecificInfo,
-     *      partyAInfo [0] OCTET STRING OPTIONAL,
-     *      suppPubInfo [2] OCTET STRING
-     *  }
-     * </pre>
-     */
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(keyInfo);
-
-        if (partyAInfo != null)
-        {
-            v.add(new DERTaggedObject(0, partyAInfo));
-        }
-
-        v.add(new DERTaggedObject(2, suppPubInfo));
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x9/X962NamedCurves.java b/azureus2/src/org/bouncycastle/asn1/x9/X962NamedCurves.java
deleted file mode 100644
index 9826a35..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x9/X962NamedCurves.java
+++ /dev/null
@@ -1,211 +0,0 @@
-package org.bouncycastle.asn1.x9;
-
-import java.math.BigInteger;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Set;
-
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.math.ec.ECCurve;
-import org.bouncycastle.util.encoders.Hex;
-
-
-/**
- * table of the current named curves defined in X.962 EC-DSA.
- */
-public class X962NamedCurves
-{
-    static final ECCurve cFp192v1 = new ECCurve.Fp(
-        new BigInteger("6277101735386680763835789423207666416083908700390324961279"),
-        new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16),
-        new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16));
-
-    static final X9ECParameters prime192v1 = new X9ECParameters(
-        cFp192v1,
-        cFp192v1.decodePoint(
-            Hex.decode("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012")),
-        new BigInteger("ffffffffffffffffffffffff99def836146bc9b1b4d22831", 16),
-        BigInteger.valueOf(1),
-        Hex.decode("3045AE6FC8422f64ED579528D38120EAE12196D5"));
-
-    static final ECCurve cFp192v2 = new ECCurve.Fp(
-        new BigInteger("6277101735386680763835789423207666416083908700390324961279"),
-        new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16),
-        new BigInteger("cc22d6dfb95c6b25e49c0d6364a4e5980c393aa21668d953", 16));
-
-    static final X9ECParameters prime192v2 = new X9ECParameters(
-        cFp192v2,
-        cFp192v2.decodePoint(
-            Hex.decode("03eea2bae7e1497842f2de7769cfe9c989c072ad696f48034a")),
-        new BigInteger("FFFFFFFFFFFFFFFFFFFFFFFE5FB1A724DC80418648D8DD31", 16),	// parg fixed F->E...
-        BigInteger.valueOf(1),
-        Hex.decode("31a92ee2029fd10d901b113e990710f0d21ac6b6"));
-
-    static final ECCurve cFp192v3 = new ECCurve.Fp(
-        new BigInteger("6277101735386680763835789423207666416083908700390324961279"),
-        new BigInteger("fffffffffffffffffffffffffffffffefffffffffffffffc", 16),
-        new BigInteger("22123dc2395a05caa7423daeccc94760a7d462256bd56916", 16));
-
-    static final X9ECParameters prime192v3 = new X9ECParameters(
-        cFp192v3,
-        cFp192v3.decodePoint(
-            Hex.decode("027d29778100c65a1da1783716588dce2b8b4aee8e228f1896")),
-        new BigInteger("ffffffffffffffffffffffff7a62d031c83f4294f640ec13", 16),
-        BigInteger.valueOf(1),
-        Hex.decode("c469684435deb378c4b65ca9591e2a5763059a2e"));
-
-    static final ECCurve cFp239v1 = new ECCurve.Fp(
-        new BigInteger("883423532389192164791648750360308885314476597252960362792450860609699839"),
-        new BigInteger("7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc", 16),
-        new BigInteger("6b016c3bdcf18941d0d654921475ca71a9db2fb27d1d37796185c2942c0a", 16));
-
-    static final X9ECParameters prime239v1 = new X9ECParameters(
-        cFp239v1,
-        cFp239v1.decodePoint(
-            Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")),
-        new BigInteger("7fffffffffffffffffffffff7fffff9e5e9a9f5d9071fbd1522688909d0b", 16),
-        BigInteger.valueOf(1),
-        Hex.decode("e43bb460f0b80cc0c0b075798e948060f8321b7d"));
-
-    static final ECCurve cFp239v2 = new ECCurve.Fp(
-        new BigInteger("883423532389192164791648750360308885314476597252960362792450860609699839"),
-        new BigInteger("7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc", 16),
-        new BigInteger("617fab6832576cbbfed50d99f0249c3fee58b94ba0038c7ae84c8c832f2c", 16));
-
-    static final X9ECParameters prime239v2 = new X9ECParameters(
-        cFp239v2,
-        cFp239v2.decodePoint(
-            Hex.decode("0238af09d98727705120c921bb5e9e26296a3cdcf2f35757a0eafd87b830e7")),
-        new BigInteger("7fffffffffffffffffffffff800000cfa7e8594377d414c03821bc582063", 16),
-        BigInteger.valueOf(1),
-        Hex.decode("e8b4011604095303ca3b8099982be09fcb9ae616"));
-
-    static final ECCurve cFp239v3 = new ECCurve.Fp(
-        new BigInteger("883423532389192164791648750360308885314476597252960362792450860609699839"),
-        new BigInteger("7fffffffffffffffffffffff7fffffffffff8000000000007ffffffffffc", 16),
-        new BigInteger("255705fa2a306654b1f4cb03d6a750a30c250102d4988717d9ba15ab6d3e", 16));
-
-    static final X9ECParameters prime239v3 = new X9ECParameters(
-        cFp239v3,
-        cFp239v3.decodePoint(
-            Hex.decode("036768ae8e18bb92cfcf005c949aa2c6d94853d0e660bbf854b1c9505fe95a")),
-        new BigInteger("7fffffffffffffffffffffff7fffff975deb41b3a6057c3c432146526551", 16),
-        BigInteger.valueOf(1),
-        Hex.decode("7d7374168ffe3471b60a857686a19475d3bfa2ff"));
-
-    static final ECCurve cFp256v1 = new ECCurve.Fp(
-        new BigInteger("115792089210356248762697446949407573530086143415290314195533631308867097853951"),
-        new BigInteger("ffffffff00000001000000000000000000000000fffffffffffffffffffffffc", 16),
-        new BigInteger("5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b", 16));
-
-    static final X9ECParameters prime256v1 = new X9ECParameters(
-        cFp256v1,
-        cFp256v1.decodePoint(
-            Hex.decode("036b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296")),
-        new BigInteger("ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551", 16),
-        BigInteger.valueOf(1),
-        Hex.decode("c49d360886e704936a6678e1139d26b7819f7e90"));
-
-    static final Hashtable objIds = new Hashtable();
-    static final Hashtable curves = new Hashtable();
-    static final Hashtable names = new Hashtable();
-
-    static
-    {
-        objIds.put("prime192v1", X9ObjectIdentifiers.prime192v1);       
-        objIds.put("prime192v2", X9ObjectIdentifiers.prime192v2);       
-        objIds.put("prime192v3", X9ObjectIdentifiers.prime192v3);       
-        objIds.put("prime239v1", X9ObjectIdentifiers.prime239v1);       
-        objIds.put("prime239v2", X9ObjectIdentifiers.prime239v2);       
-        objIds.put("prime239v3", X9ObjectIdentifiers.prime239v3);       
-        objIds.put("prime256v1", X9ObjectIdentifiers.prime256v1);       
-
-        names.put(X9ObjectIdentifiers.prime192v1, "prime192v1");       
-        names.put(X9ObjectIdentifiers.prime192v2, "prime192v2");       
-        names.put(X9ObjectIdentifiers.prime192v3, "prime192v3");       
-        names.put(X9ObjectIdentifiers.prime239v1, "prime239v1");       
-        names.put(X9ObjectIdentifiers.prime239v2, "prime239v2");       
-        names.put(X9ObjectIdentifiers.prime239v3, "prime239v3");       
-        names.put(X9ObjectIdentifiers.prime256v1, "prime256v1");       
-
-        curves.put(X9ObjectIdentifiers.prime192v1, prime192v1);       
-        curves.put(X9ObjectIdentifiers.prime192v2, prime192v2);       
-        curves.put(X9ObjectIdentifiers.prime192v3, prime192v3);       
-        curves.put(X9ObjectIdentifiers.prime239v1, prime239v1);       
-        curves.put(X9ObjectIdentifiers.prime239v2, prime239v2);       
-        curves.put(X9ObjectIdentifiers.prime239v3, prime239v3);       
-        curves.put(X9ObjectIdentifiers.prime256v1, prime256v1);       
-    }
-
-    private static Set<String>	missing_oids = new HashSet<String>();
-    
-    public static X9ECParameters getByName(
-        String  name)
-    {
-        DERObjectIdentifier oid = (DERObjectIdentifier)objIds.get(name);
-
-        if (oid != null)
-        {
-            return (X9ECParameters)curves.get(oid);
-        }
-
-        return null;
-    }
-
-    /**
-     * return the X9ECParameters object for the named curve represented by
-     * the passed in object identifier. Null if the curve isn't present.
-     *
-     * @param oid an object identifier representing a named curve, if present.
-     */
-    public static X9ECParameters getByOID(
-        DERObjectIdentifier  oid)
-    {
-    	X9ECParameters result = (X9ECParameters)curves.get(oid);
-    	
-        if ( result == null ){
-        	
-        	String id = oid.getId();
-        	
-        	if ( !missing_oids.contains( id )){
-        		
-        		missing_oids.add( id );
-        		
-        		new Exception( "Missing named curve: " + id ).printStackTrace();
-        	}
-        }
-        
-        return( result );
-    }
-
-    /**
-     * return the object identifier signified by the passed in name. Null
-     * if there is no object identifier associated with name.
-     *
-     * @return the object identifier associated with name, if present.
-     */
-    public static DERObjectIdentifier getOID(
-        String  name)
-    {
-        return (DERObjectIdentifier)objIds.get(name);
-    }
-
-    /**
-     * return the named curve name represented by the given object identifier.
-     */
-    public static String getName(
-        DERObjectIdentifier  oid)
-    {
-        return (String)names.get(oid);
-    }
-
-    /**
-     * returns an enumeration containing the name strings for curves
-     * contained in this structure.
-     */
-    public static Enumeration getNames()
-    {
-        return objIds.keys();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x9/X962Parameters.java b/azureus2/src/org/bouncycastle/asn1/x9/X962Parameters.java
deleted file mode 100644
index bd88954..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x9/X962Parameters.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.bouncycastle.asn1.x9;
-
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-
-public class X962Parameters
-    implements DEREncodable
-{
-    private DERObject           params = null;
-
-    public X962Parameters(
-        X9ECParameters      ecParameters)
-    {
-        this.params = ecParameters.getDERObject();
-    }
-
-    public X962Parameters(
-        DERObjectIdentifier  namedCurve)
-    {
-        this.params = namedCurve;
-    }
-
-    public X962Parameters(
-        DERObject           obj)
-    {
-        this.params = obj;
-    }
-
-    public boolean isNamedCurve()
-    {
-        return (params instanceof DERObjectIdentifier);
-    }
-
-    public DERObject getParameters()
-    {
-        return params;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     * Parameters ::= CHOICE {
-     *    ecParameters ECParameters,
-     *    namedCurve   CURVES.&id({CurveNames}),
-     *    implicitlyCA NULL
-     * }
-     * </pre>
-     */
-    public DERObject getDERObject()
-    {
-        return params;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x9/X9Curve.java b/azureus2/src/org/bouncycastle/asn1/x9/X9Curve.java
deleted file mode 100644
index 70d07ac..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x9/X9Curve.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.bouncycastle.asn1.x9;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.math.ec.ECCurve;
-
-/**
- * ASN.1 def for Elliptic-Curve Curve structure. See
- * X9.62, for further details.
- */
-public class X9Curve
-    implements DEREncodable, X9ObjectIdentifiers
-{
-    private ECCurve     curve;
-    private byte[]      seed;
-
-	public X9Curve(
-		ECCurve     curve)
-	{
-        this.curve = curve;
-        this.seed = null;
-	}
-
-	public X9Curve(
-		ECCurve     curve,
-        byte[]      seed)
-	{
-        this.curve = curve;
-        this.seed = seed;
-	}
-
-    public X9Curve(
-        X9FieldID     fieldID,
-        ASN1Sequence  seq)
-    {
-        if (fieldID.getIdentifier().equals(prime_field))
-        {
-            BigInteger      q = ((DERInteger)fieldID.getParameters()).getValue();
-            X9FieldElement  x9A = new X9FieldElement(true, q, (ASN1OctetString)seq.getObjectAt(0));
-            X9FieldElement  x9B = new X9FieldElement(true, q, (ASN1OctetString)seq.getObjectAt(1));
-            curve = new ECCurve.Fp(q, x9A.getValue().toBigInteger(), x9B.getValue().toBigInteger());
-        }
-        else
-        {
-            throw new RuntimeException("not implemented");
-        }
-
-        if (seq.size() == 3)
-        {
-            seed = ((DERBitString)seq.getObjectAt(2)).getBytes();
-        }
-    }
-
-    public ECCurve  getCurve()
-    {
-        return curve;
-    }
-
-    public byte[]   getSeed()
-    {
-        return seed;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     *  Curve ::= SEQUENCE {
-     *      a               FieldElement,
-     *      b               FieldElement,
-     *      seed            BIT STRING      OPTIONAL
-     *  }
-     * </pre>
-     */
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        v.add(new X9FieldElement(curve.getA()).getDERObject());
-        v.add(new X9FieldElement(curve.getB()).getDERObject());
-
-        if (seed != null)
-        {
-            v.add(new DERBitString(seed));
-        }
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x9/X9ECParameters.java b/azureus2/src/org/bouncycastle/asn1/x9/X9ECParameters.java
deleted file mode 100644
index 220084f..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x9/X9ECParameters.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.bouncycastle.asn1.x9;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.math.ec.ECCurve;
-import org.bouncycastle.math.ec.ECPoint;
-
-/**
- * ASN.1 def for Elliptic-Curve ECParameters structure. See
- * X9.62, for further details.
- */
-public class X9ECParameters
-    implements DEREncodable, X9ObjectIdentifiers
-{
-    private static BigInteger   ONE = BigInteger.valueOf(1);
-
-    private X9FieldID           fieldID;
-	private ECCurve             curve;
-	private ECPoint             g;
-	private BigInteger          n;
-	private BigInteger          h;
-    private byte[]              seed;
-
-	public X9ECParameters(
-        ASN1Sequence  seq)
-    {
-        if (!(seq.getObjectAt(0) instanceof DERInteger)
-           || !((DERInteger)seq.getObjectAt(0)).getValue().equals(ONE))
-        {
-            throw new IllegalArgumentException("bad version in X9ECParameters");
-        }
-
-        X9Curve     x9c = new X9Curve(
-                        new X9FieldID((ASN1Sequence)seq.getObjectAt(1)),
-                        (ASN1Sequence)seq.getObjectAt(2));
-
-        this.curve = x9c.getCurve();
-		this.g = new X9ECPoint(curve, (ASN1OctetString)seq.getObjectAt(3)).getPoint();
-		this.n = ((DERInteger)seq.getObjectAt(4)).getValue();
-        this.seed = x9c.getSeed();
-
-        if (seq.size() == 6)
-        {
-		    this.h = ((DERInteger)seq.getObjectAt(5)).getValue();
-        }
-        else
-        {
-            this.h = ONE;
-        }
-    }
-
-	public X9ECParameters(
-		ECCurve     curve,
-		ECPoint     g,
-		BigInteger  n)
-	{
-        this(curve, g, n, ONE, null);
-	}
-
-	public X9ECParameters(
-		ECCurve     curve,
-		ECPoint     g,
-		BigInteger  n,
-        BigInteger  h)
-	{
-        this(curve, g, n, h, null);
-	}
-
-	public X9ECParameters(
-		ECCurve     curve,
-		ECPoint     g,
-		BigInteger  n,
-        BigInteger  h,
-        byte[]      seed)
-	{
-		this.curve = curve;
-		this.g = g;
-		this.n = n;
-		this.h = h;
-        this.seed = seed;
-
-        if (curve instanceof ECCurve.Fp)
-        {
-            this.fieldID = new X9FieldID(prime_field, ((ECCurve.Fp)curve).getQ());
-        }
-        else
-        {
-            this.fieldID = new X9FieldID(characteristic_two_field, null);
-        }
-	}
-
-	public ECCurve getCurve()
-	{
-		return curve;
-	}
-
-	public ECPoint getG()
-	{
-		return g;
-	}
-
-	public BigInteger getN()
-	{
-		return n;
-	}
-
-	public BigInteger getH()
-	{
-		return h;
-	}
-
-	public byte[] getSeed()
-	{
-		return seed;
-	}
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     *  ECParameters ::= SEQUENCE {
-     *      version         INTEGER { ecpVer1(1) } (ecpVer1),
-     *      fieldID         FieldID {{FieldTypes}},
-     *      curve           X9Curve,
-     *      base            X9ECPoint,
-     *      order           INTEGER,
-     *      cofactor        INTEGER OPTIONAL
-     *  }
-     * </pre>
-     */
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        v.add(new DERInteger(1));
-        v.add(fieldID);
-        v.add(new X9Curve(curve, seed));
-        v.add(new X9ECPoint(g));
-        v.add(new DERInteger(n));
-
-        if (!h.equals(BigInteger.valueOf(1)))
-        {
-            v.add(new DERInteger(h));
-        }
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x9/X9ECPoint.java b/azureus2/src/org/bouncycastle/asn1/x9/X9ECPoint.java
deleted file mode 100644
index b91f022..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x9/X9ECPoint.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.bouncycastle.asn1.x9;
-
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.math.ec.ECCurve;
-import org.bouncycastle.math.ec.ECPoint;
-
-/**
- * class for describing an ECPoint as a DER object.
- */
-public class X9ECPoint
-    implements DEREncodable
-{
-    ECPoint p;
-
-    public X9ECPoint(
-        ECPoint p)
-    {
-        this.p = p;
-    }
-
-    public X9ECPoint(
-        ECCurve          c,
-        ASN1OctetString  s)
-    {
-        this.p = c.decodePoint(s.getOctets());
-    }
-
-    public ECPoint getPoint()
-    {
-        return p;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     *  ECPoint ::= OCTET STRING
-     * </pre>
-     * <p>
-     * Octet string produced using ECPoint.getEncoded().
-     */
-    public DERObject getDERObject()
-    {
-        return new DEROctetString(p.getEncoded());
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x9/X9FieldElement.java b/azureus2/src/org/bouncycastle/asn1/x9/X9FieldElement.java
deleted file mode 100644
index bc8cbde..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x9/X9FieldElement.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.bouncycastle.asn1.x9;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.math.ec.ECFieldElement;
-
-/**
- * class for processing an FieldElement as a DER object.
- */
-public class X9FieldElement
-    implements DEREncodable
-{
-    private ECFieldElement  f;
-
-    public X9FieldElement(
-        ECFieldElement  f)
-    {
-        this.f = f;
-    }
-
-    public X9FieldElement(
-        boolean          fP,
-        BigInteger       q,
-        ASN1OctetString  s)
-    {
-        if (fP)
-        {
-            this.f = new ECFieldElement.Fp(q, new BigInteger(1, s.getOctets()));
-        }
-        else
-        {
-            throw new RuntimeException("not implemented");
-        }
-    }
-
-    public ECFieldElement getValue()
-    {
-        return f;
-    }
-
-    /**
-     * Produce an object suitable for an ASN1OutputStream.
-     * <pre>
-     *  FieldElement ::= OCTET STRING
-     * </pre>
-     * <p>
-     * <ol>
-     * <li> if <i>q</i> is an odd prime then the field element is
-     * processed as an Integer and converted to an octet string
-     * according to x 9.62 4.3.1.</li>
-     * <li> if <i>q</i> is 2<sup>m</sup> then the bit string
-     * contained in the field element is converted into an octet
-     * string with the same ordering padded at the front if necessary.
-     * </li>
-     * </ol>
-     */
-    public DERObject getDERObject()
-    {
-        return new DEROctetString(f.toBigInteger().toByteArray());
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x9/X9FieldID.java b/azureus2/src/org/bouncycastle/asn1/x9/X9FieldID.java
deleted file mode 100644
index baf4b85..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x9/X9FieldID.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.bouncycastle.asn1.x9;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSequence;
-
-/**
- * ASN.1 def for Elliptic-Curve Field ID structure. See
- * X9.62, for further details.
- */
-public class X9FieldID
-    implements DEREncodable, X9ObjectIdentifiers
-{
-    private DERObjectIdentifier     id;
-    private DERObject               parameters;
-
-	public X9FieldID(
-        DERObjectIdentifier id,
-		BigInteger          primeP)
-	{
-        this.id = id;
-        this.parameters = new DERInteger(primeP);
-	}
-
-    public X9FieldID(
-        ASN1Sequence  seq)
-    {
-        this.id = (DERObjectIdentifier)seq.getObjectAt(0);
-        this.parameters = (DERObject)seq.getObjectAt(1);
-    }
-
-    public DERObjectIdentifier getIdentifier()
-    {
-        return id;
-    }
-
-    public DERObject getParameters()
-    {
-        return parameters;
-    }
-
-    /**
-     * Produce a DER encoding of the following structure.
-     * <pre>
-     *  FieldID ::= SEQUENCE {
-     *      fieldType       FIELD-ID.&id({IOSet}),
-     *      parameters      FIELD-ID.&Type({IOSet}{@fieldType})
-     *  }
-     * </pre>
-     */
-    public DERObject getDERObject()
-    {
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-        v.add(this.id);
-        v.add(this.parameters);
-
-        return new DERSequence(v);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x9/X9IntegerConverter.java b/azureus2/src/org/bouncycastle/asn1/x9/X9IntegerConverter.java
deleted file mode 100644
index ae820ab..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x9/X9IntegerConverter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.bouncycastle.asn1.x9;
-
-import org.bouncycastle.math.ec.ECCurve;
-import org.bouncycastle.math.ec.ECFieldElement;
-
-import java.math.BigInteger;
-
-public class X9IntegerConverter
-{
-    public int getByteLength(
-        ECCurve c)
-    {
-        return (c.getFieldSize() + 7) / 8;
-    }
-
-    public int getByteLength(
-        ECFieldElement fe)
-    {
-        return (fe.getFieldSize() + 7) / 8;
-    }
-
-    public byte[] integerToBytes(
-        BigInteger s,
-        int        qLength)
-    {
-        byte[] bytes = s.toByteArray();
-        
-        if (qLength < bytes.length)
-        {
-            byte[] tmp = new byte[qLength];
-        
-            System.arraycopy(bytes, bytes.length - tmp.length, tmp, 0, tmp.length);
-            
-            return tmp;
-        }
-        else if (qLength > bytes.length)
-        {
-            byte[] tmp = new byte[qLength];
-        
-            System.arraycopy(bytes, 0, tmp, tmp.length - bytes.length, bytes.length);
-            
-            return tmp; 
-        }
-    
-        return bytes;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/asn1/x9/X9ObjectIdentifiers.java b/azureus2/src/org/bouncycastle/asn1/x9/X9ObjectIdentifiers.java
deleted file mode 100644
index a10bc81..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x9/X9ObjectIdentifiers.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.bouncycastle.asn1.x9;
-
-import org.bouncycastle.asn1.DERObjectIdentifier;
-
-public interface X9ObjectIdentifiers
-{
-    //
-    // X9.62
-    //
-    // ansi-X9-62 OBJECT IDENTIFIER ::= { iso(1) member-body(2)
-    //            us(840) ansi-x962(10045) }
-    //
-    static final String    ansi_X9_62 = "1.2.840.10045";
-    static final String    id_fieldType = ansi_X9_62 + ".1";
-
-    static final DERObjectIdentifier    prime_field
-                    = new DERObjectIdentifier(id_fieldType + ".1");
-
-    static final DERObjectIdentifier    characteristic_two_field
-                    = new DERObjectIdentifier(id_fieldType + ".2");
-
-    static final DERObjectIdentifier    gnBasis
-                    = new DERObjectIdentifier(id_fieldType + ".2.3.1");
-
-    static final DERObjectIdentifier    tpBasis
-                    = new DERObjectIdentifier(id_fieldType + ".2.3.2");
-
-    static final DERObjectIdentifier    ppBasis
-                    = new DERObjectIdentifier(id_fieldType + ".2.3.3");
-
-    static final String    id_ecSigType = ansi_X9_62 + ".4";
-
-    static final DERObjectIdentifier    ecdsa_with_SHA1
-                    = new DERObjectIdentifier(id_ecSigType + ".1");
-
-    static final String    id_publicKeyType = ansi_X9_62 + ".2";
-
-    static final DERObjectIdentifier    id_ecPublicKey
-                    = new DERObjectIdentifier(id_publicKeyType + ".1");
-
-    //
-    // named curves
-    //
-    static final String    ellipticCurve = ansi_X9_62 + ".3";
-
-    //
-    // Prime
-    //
-    static final String    primeCurve = ellipticCurve + ".1";
-
-    static final DERObjectIdentifier    prime192v1 =
-                    new DERObjectIdentifier(primeCurve + ".1");
-    static final DERObjectIdentifier    prime192v2 =
-                    new DERObjectIdentifier(primeCurve + ".2");
-    static final DERObjectIdentifier    prime192v3 =
-                    new DERObjectIdentifier(primeCurve + ".3");
-    static final DERObjectIdentifier    prime239v1 =
-                    new DERObjectIdentifier(primeCurve + ".4");
-    static final DERObjectIdentifier    prime239v2 =
-                    new DERObjectIdentifier(primeCurve + ".5");
-    static final DERObjectIdentifier    prime239v3 =
-                    new DERObjectIdentifier(primeCurve + ".6");
-    static final DERObjectIdentifier    prime256v1 =
-                    new DERObjectIdentifier(primeCurve + ".7");
-
-    //
-    // Diffie-Hellman
-    //
-    // dhpublicnumber OBJECT IDENTIFIER ::= { iso(1) member-body(2)
-    //            us(840) ansi-x942(10046) number-type(2) 1 }
-    //
-    static final DERObjectIdentifier    dhpublicnumber = new DERObjectIdentifier("1.2.840.10046.2.1");
-
-    //
-    // DSA
-    //
-    // dsapublicnumber OBJECT IDENTIFIER ::= { iso(1) member-body(2)
-    //            us(840) ansi-x957(10040) number-type(4) 1 }
-    static final DERObjectIdentifier    id_dsa = new DERObjectIdentifier("1.2.840.10040.4.1");
-
-    /**
-     *   id-dsa-with-sha1 OBJECT IDENTIFIER ::=  { iso(1) member-body(2)
-     *         us(840) x9-57 (10040) x9cm(4) 3 }
-     */
-    public static final DERObjectIdentifier id_dsa_with_sha1 = new DERObjectIdentifier("1.2.840.10040.4.3");
-}
-
diff --git a/azureus2/src/org/bouncycastle/asn1/x9/package.html b/azureus2/src/org/bouncycastle/asn1/x9/package.html
deleted file mode 100644
index 42fc97c..0000000
--- a/azureus2/src/org/bouncycastle/asn1/x9/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body bgcolor="#ffffff">
-Support classes useful for encoding and supporting X9.62 elliptic curve.
-</body>
-</html>
diff --git a/azureus2/src/org/bouncycastle/crypto/AsymmetricBlockCipher.java b/azureus2/src/org/bouncycastle/crypto/AsymmetricBlockCipher.java
deleted file mode 100644
index 565effc..0000000
--- a/azureus2/src/org/bouncycastle/crypto/AsymmetricBlockCipher.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.bouncycastle.crypto;
-
-
-/**
- * base interface that a public/private key block cipher needs
- * to conform to.
- */
-public interface AsymmetricBlockCipher
-{
-    /**
-     * initialise the cipher.
-     *
-     * @param forEncryption if true the cipher is initialised for 
-     *  encryption, if false for decryption.
-     * @param param the key and other data required by the cipher.
-     */
-    public void init(boolean forEncryption, CipherParameters param);
-
-    /**
-     * returns the largest size an input block can be.
-     *
-     * @return maximum size for an input block.
-     */
-    public int getInputBlockSize();
-
-    /**
-     * returns the maximum size of the block produced by this cipher.
-     *
-     * @return maximum size of the output block produced by the cipher.
-     */
-    public int getOutputBlockSize();
-
-    /**
-     * process the block of len bytes stored in in from offset inOff.
-     *
-     * @param in the input data
-     * @param inOff offset into the in array where the data starts
-     * @param len the length of the block to be processed.
-     * @return the resulting byte array of the encryption/decryption process.
-     * @exception InvalidCipherTextException data decrypts improperly.
-     * @exception DataLengthException the input data is too large for the cipher.
-     */
-    public byte[] processBlock(byte[] in, int inOff, int len)
-        throws InvalidCipherTextException;
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/AsymmetricCipherKeyPair.java b/azureus2/src/org/bouncycastle/crypto/AsymmetricCipherKeyPair.java
deleted file mode 100644
index 85bec73..0000000
--- a/azureus2/src/org/bouncycastle/crypto/AsymmetricCipherKeyPair.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.bouncycastle.crypto;
-
-/**
- * a holding class for public/private parameter pairs.
- */
-public class AsymmetricCipherKeyPair
-{
-    private CipherParameters    publicParam;
-    private CipherParameters    privateParam;
-
-    /**
-     * basic constructor.
-     *
-     * @param publicParam a public key parameters object.
-     * @param privateParam the corresponding private key parameters.
-     */
-    public AsymmetricCipherKeyPair(
-        CipherParameters    publicParam,
-        CipherParameters    privateParam)
-    {
-        this.publicParam = publicParam;
-        this.privateParam = privateParam;
-    }
-
-    /**
-     * return the public key parameters.
-     *
-     * @return the public key parameters.
-     */
-    public CipherParameters getPublic()
-    {
-        return publicParam;
-    }
-
-    /**
-     * return the private key parameters.
-     *
-     * @return the private key parameters.
-     */
-    public CipherParameters getPrivate()
-    {
-        return privateParam;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/AsymmetricCipherKeyPairGenerator.java b/azureus2/src/org/bouncycastle/crypto/AsymmetricCipherKeyPairGenerator.java
deleted file mode 100644
index 236ebbe..0000000
--- a/azureus2/src/org/bouncycastle/crypto/AsymmetricCipherKeyPairGenerator.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.bouncycastle.crypto;
-
-/**
- * interface that a public/private key pair generator should conform to.
- */
-public interface AsymmetricCipherKeyPairGenerator
-{
-    /**
-     * intialise the key pair generator.
-     *
-     * @param the parameters the key pair is to be initialised with.
-     */
-    public void init(KeyGenerationParameters param);
-
-    /**
-     * return an AsymmetricCipherKeyPair containing the generated keys.
-     *
-     * @return an AsymmetricCipherKeyPair containing the generated keys.
-     */
-    public AsymmetricCipherKeyPair generateKeyPair();
-}
-
diff --git a/azureus2/src/org/bouncycastle/crypto/BasicAgreement.java b/azureus2/src/org/bouncycastle/crypto/BasicAgreement.java
deleted file mode 100644
index 4907427..0000000
--- a/azureus2/src/org/bouncycastle/crypto/BasicAgreement.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.bouncycastle.crypto;
-
-import java.math.BigInteger;
-
-/**
- * The basic interface that basic Diffie-Hellman implementations
- * conforms to.
- */
-public interface BasicAgreement
-{
-    /**
-     * initialise the agreement engine.
-     */
-    public void init(CipherParameters param);
-
-    /**
-     * given a public key from a given party calculate the next
-     * message in the agreement sequence. 
-     */
-    public BigInteger calculateAgreement(CipherParameters pubKey);
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/BlockCipher.java b/azureus2/src/org/bouncycastle/crypto/BlockCipher.java
deleted file mode 100644
index 1594e6d..0000000
--- a/azureus2/src/org/bouncycastle/crypto/BlockCipher.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.bouncycastle.crypto;
-
-
-/**
- * Block cipher engines are expected to conform to this interface.
- */
-public interface BlockCipher
-{
-    /**
-     * Initialise the cipher.
-     *
-     * @param forEncryption if true the cipher is initialised for
-     *  encryption, if false for decryption.
-     * @param param the key and other data required by the cipher.
-     * @exception IllegalArgumentException if the params argument is
-     * inappropriate.
-     */
-    public void init(boolean forEncryption, CipherParameters params)
-        throws IllegalArgumentException;
-
-    /**
-     * Return the name of the algorithm the cipher implements.
-     *
-     * @return the name of the algorithm the cipher implements.
-     */
-    public String getAlgorithmName();
-
-    /**
-     * Return the block size for this cipher (in bytes).
-     *
-     * @return the block size for this cipher in bytes.
-     */
-    public int getBlockSize();
-
-    /**
-     * Process one block of input from the array in and write it to
-     * the out array.
-     *
-     * @param in the array containing the input data.
-     * @param inOff offset into the in array the data starts at.
-     * @param out the array the output data will be copied into.
-     * @param outOff the offset into the out array the output will start at.
-     * @exception DataLengthException if there isn't enough data in in, or
-     * space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     * @return the number of bytes processed and produced.
-     */
-    public int processBlock(byte[] in, int inOff, byte[] out, int outOff)
-        throws DataLengthException, IllegalStateException;
-
-    /**
-     * Reset the cipher. After resetting the cipher is in the same state
-     * as it was after the last init (if there was one).
-     */
-    public void reset();
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/BufferedAsymmetricBlockCipher.java b/azureus2/src/org/bouncycastle/crypto/BufferedAsymmetricBlockCipher.java
deleted file mode 100644
index 591d6cf..0000000
--- a/azureus2/src/org/bouncycastle/crypto/BufferedAsymmetricBlockCipher.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package org.bouncycastle.crypto;
-
-/**
- * a buffer wrapper for an asymmetric block cipher, allowing input
- * to be accumulated in a piecemeal fashion until final processing.
- */
-public class BufferedAsymmetricBlockCipher
-{
-	protected byte[]        buf;
-	protected int           bufOff;
-
-    private boolean                 forEncryption;
-    private AsymmetricBlockCipher   cipher;
-
-    /**
-     * base constructor.
-     *
-     * @param cipher the cipher this buffering object wraps.
-     */
-	public BufferedAsymmetricBlockCipher(
-        AsymmetricBlockCipher     cipher)
-	{
-        this.cipher = cipher;
-	}
-
-    /**
-     * return the underlying cipher for the buffer.
-     *
-     * @return the underlying cipher for the buffer.
-     */
-    public AsymmetricBlockCipher getUnderlyingCipher()
-    {
-        return cipher;
-    }
-
-    /**
-     * return the amount of data sitting in the buffer.
-     *
-     * @return the amount of data sitting in the buffer.
-     */
-    public int getBufferPosition()
-    {
-        return bufOff;
-    }
-
-    /**
-     * initialise the buffer and the underlying cipher.
-     *
-     * @param forEncryption if true the cipher is initialised for
-     *  encryption, if false for decryption.
-     * @param param the key and other data required by the cipher.
-     */
-    public void init(
-        boolean             forEncryption,
-        CipherParameters    params)
-    {
-        this.forEncryption = forEncryption;
-
-        reset();
-
-        cipher.init(forEncryption, params);
-
-        buf = new byte[cipher.getInputBlockSize()];
-        bufOff = 0;
-    }
-
-    /**
-     * returns the largest size an input block can be.
-     *
-     * @return maximum size for an input block.
-     */
-	public int getInputBlockSize()
-	{
-		return cipher.getInputBlockSize();
-	}
-
-    /**
-     * returns the maximum size of the block produced by this cipher.
-     *
-     * @return maximum size of the output block produced by the cipher.
-     */
-	public int getOutputBlockSize()
-	{
-		return cipher.getOutputBlockSize();
-	}
-
-    /**
-     * add another byte for processing.
-     * 
-     * @param in the input byte.
-     */
-	public void processByte(
-        byte        in)
-    {
-        if (bufOff > buf.length)
-        {
-            throw new DataLengthException("attempt to process message to long for cipher");
-        }
-
-        buf[bufOff++] = in;
-    }
-
-    /**
-     * add len bytes to the buffer for processing.
-     *
-     * @param in the input data
-     * @param inOff offset into the in array where the data starts
-     * @param len the length of the block to be processed.
-     */
-	public void processBytes(
-		byte[]      in,
-		int         inOff,
-		int         len)
-	{
-        if (len == 0)
-        {
-            return;
-        }
-
-        if (len < 0)
-        {
-            throw new IllegalArgumentException("Can't have a negative input length!");
-        }
-
-        if (bufOff + len > buf.length)
-        {
-            throw new DataLengthException("attempt to process message to long for cipher");
-        }
-
-        System.arraycopy(in, inOff, buf, bufOff, len);
-        bufOff += len;
-	}
-
-    /**
-     * process the contents of the buffer using the underlying
-     * cipher.
-     *
-     * @return the result of the encryption/decryption process on the
-     * buffer.
-     * @exception InvalidCipherTextException if we are given a garbage block.
-     */
-	public byte[] doFinal()
-        throws InvalidCipherTextException
-	{
-        byte[] out = cipher.processBlock(buf, 0, bufOff);
-
-        reset();
-
-        return out;
-	}
-
-	/**
-	 * Reset the buffer and the underlying cipher.
-	 */
-	public void reset()
-	{
-        /*
-         * clean the buffer.
-         */
-        if (buf != null)
-        {
-            for (int i = 0; i < buf.length; i++)
-            {
-                buf[0] = 0;
-            }
-        }
-
-        bufOff = 0;
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/BufferedBlockCipher.java b/azureus2/src/org/bouncycastle/crypto/BufferedBlockCipher.java
deleted file mode 100644
index 9af929f..0000000
--- a/azureus2/src/org/bouncycastle/crypto/BufferedBlockCipher.java
+++ /dev/null
@@ -1,324 +0,0 @@
-package org.bouncycastle.crypto;
-
-
-/**
- * A wrapper class that allows block ciphers to be used to process data in
- * a piecemeal fashion. The BufferedBlockCipher outputs a block only when the
- * buffer is full and more data is being added, or on a doFinal.
- * <p>
- * Note: in the case where the underlying cipher is either a CFB cipher or an
- * OFB one the last block may not be a multiple of the block size.
- */
-public class BufferedBlockCipher
-{
-	protected byte[]        buf;
-	protected int           bufOff;
-
-    protected boolean       forEncryption;
-    protected BlockCipher   cipher;
-
-    protected boolean       partialBlockOkay;
-    protected boolean       pgpCFB;
-
-    /**
-     * constructor for subclasses
-     */
-    protected BufferedBlockCipher()
-    {
-    }
-
-    /**
-     * Create a buffered block cipher without padding.
-     *
-     * @param cipher the underlying block cipher this buffering object wraps.
-     * @param padded true if the buffer should add, or remove, pad bytes,
-     * false otherwise.
-     */
-	public BufferedBlockCipher(
-        BlockCipher     cipher)
-	{
-        this.cipher = cipher;
-
-        buf = new byte[cipher.getBlockSize()];
-        bufOff = 0;
-
-        //
-        // check if we can handle partial blocks on doFinal.
-        //
-        String  name = cipher.getAlgorithmName();
-        int     idx = name.indexOf('/') + 1;
-
-        pgpCFB = (idx > 0 && name.startsWith("PGP", idx));
-
-        if (pgpCFB)
-        {
-            partialBlockOkay = true;
-        }
-        else
-        {
-            partialBlockOkay = (idx > 0 && (name.startsWith("CFB", idx) || name.startsWith("OFB", idx) || name.startsWith("OpenPGP", idx)));
-        }
-	}
-
-    /**
-     * return the cipher this object wraps.
-     *
-     * @return the cipher this object wraps.
-     */
-    public BlockCipher getUnderlyingCipher()
-    {
-        return cipher;
-    }
-
-    /**
-     * initialise the cipher.
-     *
-     * @param forEncryption if true the cipher is initialised for
-     *  encryption, if false for decryption.
-     * @param param the key and other data required by the cipher.
-     * @exception IllegalArgumentException if the params argument is
-     * inappropriate.
-     */
-    public void init(
-        boolean             forEncryption,
-        CipherParameters    params)
-        throws IllegalArgumentException
-    {
-        this.forEncryption = forEncryption;
-
-        reset();
-
-        cipher.init(forEncryption, params);
-    }
-
-    /**
-     * return the blocksize for the underlying cipher.
-     *
-     * @return the blocksize for the underlying cipher.
-     */
-	public int getBlockSize()
-	{
-		return cipher.getBlockSize();
-	}
-
-    /**
-     * return the size of the output buffer required for an update 
-     * an input of len bytes.
-     *
-     * @param len the length of the input.
-     * @return the space required to accommodate a call to update
-     * with len bytes of input.
-     */
-    public int getUpdateOutputSize(
-        int len)
-    {
-        int total       = len + bufOff;
-        int leftOver;
-
-        if (pgpCFB)
-        {
-            leftOver    = total % buf.length - (cipher.getBlockSize() + 2);
-        }
-        else
-        {
-            leftOver    = total % buf.length;
-        }
-
-        return total - leftOver;
-    }
-
-    /**
-     * return the size of the output buffer required for an update plus a
-     * doFinal with an input of len bytes.
-     *
-     * @param len the length of the input.
-     * @return the space required to accommodate a call to update and doFinal
-     * with len bytes of input.
-     */
-    public int getOutputSize(
-        int len)
-    {
-        int total       = len + bufOff;
-        int leftOver;
-
-        if (pgpCFB)
-        {
-            leftOver    = total % buf.length - (cipher.getBlockSize() + 2);
-        }
-        else
-        {
-            leftOver    = total % buf.length;
-            if (leftOver == 0)
-            {
-                return total;
-            }
-        }
-
-        return total - leftOver + buf.length;
-    }
-
-    /**
-     * process a single byte, producing an output block if neccessary.
-     *
-     * @param in the input byte.
-     * @param out the space for any output that might be produced.
-     * @param outOff the offset from which the output will be copied.
-     * @return the number of output bytes copied to out.
-     * @exception DataLengthException if there isn't enough space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     */
-	public int processByte(
-        byte        in,
-		byte[]      out,
-		int         outOff)
-        throws DataLengthException, IllegalStateException
-    {
-        int         resultLen = 0;
-
-        buf[bufOff++] = in;
-
-        if (bufOff == buf.length)
-        {
-            resultLen = cipher.processBlock(buf, 0, out, outOff);
-            bufOff = 0;
-        }
-
-        return resultLen;
-    }
-
-    /**
-     * process an array of bytes, producing output if necessary.
-     *
-     * @param in the input byte array.
-     * @param inOff the offset at which the input data starts.
-     * @param len the number of bytes to be copied out of the input array.
-     * @param out the space for any output that might be produced.
-     * @param outOff the offset from which the output will be copied.
-     * @return the number of output bytes copied to out.
-     * @exception DataLengthException if there isn't enough space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     */
-	public int processBytes(
-		byte[]      in,
-		int         inOff,
-		int         len,
-		byte[]      out,
-		int         outOff)
-        throws DataLengthException, IllegalStateException
-	{
-        if (len < 0)
-        {
-            throw new IllegalArgumentException("Can't have a negative input length!");
-        }
-
-        int blockSize   = getBlockSize();
-        int length      = getUpdateOutputSize(len);
-        
-        if (length > 0)
-        {
-            if ((outOff + length) > out.length)
-            {
-                throw new DataLengthException("output buffer too short");
-            }
-        }
-
-		int resultLen = 0;
-        int gapLen = buf.length - bufOff;
-
-        if (len > gapLen)
-        {
-            System.arraycopy(in, inOff, buf, bufOff, gapLen);
-
-            resultLen += cipher.processBlock(buf, 0, out, outOff);
-
-            bufOff = 0;
-            len -= gapLen;
-            inOff += gapLen;
-
-            while (len > buf.length)
-            {
-                resultLen += cipher.processBlock(in, inOff, out, outOff + resultLen);
-
-                len -= blockSize;
-                inOff += blockSize;
-            }
-        }
-
-        System.arraycopy(in, inOff, buf, bufOff, len);
-
-        bufOff += len;
-
-        if (bufOff == buf.length)
-        {
-            resultLen += cipher.processBlock(buf, 0, out, outOff + resultLen);
-            bufOff = 0;
-        }
-
-        return resultLen;
-	}
-
-    /**
-     * Process the last block in the buffer.
-     *
-     * @param out the array the block currently being held is copied into.
-     * @param outOff the offset at which the copying starts.
-     * @return the number of output bytes copied to out.
-     * @exception DataLengthException if there is insufficient space in out for
-     * the output, or the input is not block size aligned and should be.
-     * @exception IllegalStateException if the underlying cipher is not
-     * initialised.
-     * @exception InvalidCipherTextException if padding is expected and not found.
-     * @exception DataLengthException if the input is not block size
-     * aligned.
-     */
-	public int doFinal(
-        byte[]  out,
-        int     outOff)
-        throws DataLengthException, IllegalStateException, InvalidCipherTextException
-	{
-        int resultLen = 0;
-
-        if (outOff + bufOff > out.length)
-        {
-            throw new DataLengthException("output buffer too short for doFinal()");
-        }
-
-        if (bufOff != 0 && partialBlockOkay)
-        {
-            cipher.processBlock(buf, 0, buf, 0);
-            resultLen = bufOff;
-            bufOff = 0;
-            System.arraycopy(buf, 0, out, outOff, resultLen);
-        }
-        else if (bufOff != 0)
-        {
-            throw new DataLengthException("data not block size aligned");
-        }
-
-        reset();
-
-		return resultLen;
-	}
-
-    /**
-     * Reset the buffer and cipher. After resetting the object is in the same
-     * state as it was after the last init (if there was one).
-     */
-	public void reset()
-	{
-        //
-        // clean the buffer.
-        //
-        for (int i = 0; i < buf.length; i++)
-        {
-            buf[i] = 0;
-        }
-
-        bufOff = 0;
-
-        //
-        // reset the underlying cipher.
-        //
-        cipher.reset();
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/CipherKeyGenerator.java b/azureus2/src/org/bouncycastle/crypto/CipherKeyGenerator.java
deleted file mode 100644
index 451f8e8..0000000
--- a/azureus2/src/org/bouncycastle/crypto/CipherKeyGenerator.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.bouncycastle.crypto;
-
-import java.security.SecureRandom;
-
-/**
- * The base class for symmetric, or secret, cipher key generators.
- */
-public class CipherKeyGenerator
-{
-    protected SecureRandom  random;
-    protected int           strength;
-
-    /**
-     * initialise the key generator.
-     *
-     * @param param the parameters to be used for key generation
-     */
-    public void init(
-        KeyGenerationParameters param)
-    {
-        this.random = param.getRandom();
-        this.strength = (param.getStrength() + 7) / 8;
-    }
-
-    /**
-     * generate a secret key.
-     *
-     * @return a byte array containing the key value.
-     */
-    public byte[] generateKey()
-    {
-        byte[]  key = new byte[strength];
-
-        random.nextBytes(key);
-
-        return key;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/CipherParameters.java b/azureus2/src/org/bouncycastle/crypto/CipherParameters.java
deleted file mode 100644
index 5be8730..0000000
--- a/azureus2/src/org/bouncycastle/crypto/CipherParameters.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.bouncycastle.crypto;
-
-/**
- * all parameter classes implement this.
- */
-public interface CipherParameters
-{
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/CryptoException.java b/azureus2/src/org/bouncycastle/crypto/CryptoException.java
deleted file mode 100644
index 566ba38..0000000
--- a/azureus2/src/org/bouncycastle/crypto/CryptoException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.bouncycastle.crypto;
-
-/**
- * the foundation class for the hard exceptions thrown by the crypto packages.
- */
-public class CryptoException 
-    extends Exception
-{
-	
-    /**
-     * base constructor.
-     */
-    public CryptoException()
-    {
-    }
-
-    /**
-     * create a CryptoException with the given message.
-     *
-     * @param message the message to be carried with the exception.
-     */
-    public CryptoException(
-        String  message)
-    {
-        super(message);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/DSA.java b/azureus2/src/org/bouncycastle/crypto/DSA.java
deleted file mode 100644
index f0e1f99..0000000
--- a/azureus2/src/org/bouncycastle/crypto/DSA.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.bouncycastle.crypto;
-
-import java.math.BigInteger;
-
-/**
- * interface for classes implementing the Digital Signature Algorithm
- */
-public interface DSA
-{
-    /**
-     * initialise the signer for signature generation or signature
-     * verification.
-     *
-     * @param forSigning true if we are generating a signature, false
-     * otherwise.
-     * @param param key parameters for signature generation.
-     */
-	public void init(boolean forSigning, CipherParameters param);
-
-    /**
-     * sign the passed in message (usually the output of a hash function).
-     *
-     * @param message the message to be signed.
-     * @return two big integers representing the r and s values respectively.
-     */
-	public BigInteger[] generateSignature(byte[] message);
-
-    /**
-     * verify the message message against the signature values r and s.
-     *
-     * @param message the message that was supposed to have been signed.
-     * @param r the r signature value.
-     * @param s the s signature value.
-     */
-	public boolean verifySignature(byte[] message, BigInteger  r, BigInteger s);
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/DataLengthException.java b/azureus2/src/org/bouncycastle/crypto/DataLengthException.java
deleted file mode 100644
index f36d1b5..0000000
--- a/azureus2/src/org/bouncycastle/crypto/DataLengthException.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.bouncycastle.crypto;
-
-/**
- * this exception is thrown if a buffer that is meant to have output
- * copied into it turns out to be too short, or if we've been given 
- * insufficient input. In general this exception will get thrown rather
- * than an ArrayOutOfBounds exception.
- */
-public class DataLengthException 
-    extends RuntimeCryptoException
-{
-	
-    /**
-     * base constructor.
-     */
-    public DataLengthException()
-    {
-    }
-
-    /**
-     * create a DataLengthException with the given message.
-     *
-     * @param message the message to be carried with the exception.
-     */
-    public DataLengthException(
-        String  message)
-    {
-        super(message);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/DerivationFunction.java b/azureus2/src/org/bouncycastle/crypto/DerivationFunction.java
deleted file mode 100644
index ef6e29e..0000000
--- a/azureus2/src/org/bouncycastle/crypto/DerivationFunction.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.bouncycastle.crypto;
-
-/**
- * base interface for general purpose byte derivation functions.
- */
-public interface DerivationFunction
-{
-    public void init(DerivationParameters param);
-
-    /**
-     * return the message digest used as the basis for the function
-     */
-    public Digest getDigest();
-
-    public int generateBytes(byte[] out, int outOff, int len)
-        throws DataLengthException, IllegalArgumentException;
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/DerivationParameters.java b/azureus2/src/org/bouncycastle/crypto/DerivationParameters.java
deleted file mode 100644
index e11eb86..0000000
--- a/azureus2/src/org/bouncycastle/crypto/DerivationParameters.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.bouncycastle.crypto;
-
-/**
- * Parameters for key/byte stream derivation classes
- */
-public interface DerivationParameters
-{
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/Digest.java b/azureus2/src/org/bouncycastle/crypto/Digest.java
deleted file mode 100644
index 844c28b..0000000
--- a/azureus2/src/org/bouncycastle/crypto/Digest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.bouncycastle.crypto;
-
-/**
- * interface that a message digest conforms to.
- */
-public interface Digest
-{
-    /**
-     * return the algorithm name
-     *
-     * @return the algorithm name
-     */
-    public String getAlgorithmName();
-
-    /**
-     * return the size, in bytes, of the digest produced by this message digest.
-     *
-     * @return the size, in bytes, of the digest produced by this message digest.
-     */
-	public int getDigestSize();
-
-    /**
-     * update the message digest with a single byte.
-     *
-     * @param in the input byte to be entered.
-     */
-	public void update(byte in);
-
-    /**
-     * update the message digest with a block of bytes.
-     *
-     * @param in the byte array containing the data.
-     * @param inOff the offset into the byte array where the data starts.
-     * @param len the length of the data.
-     */
-	public void update(byte[] in, int inOff, int len);
-
-    /**
-     * close the digest, producing the final digest value. The doFinal
-     * call leaves the digest reset.
-     *
-     * @param out the array the digest is to be copied into.
-     * @param outOff the offset into the out array the digest is to start at.
-     */
-	public int doFinal(byte[] out, int outOff);
-
-    /**
-     * reset the digest back to it's initial state.
-     */
-    public void reset();
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/InvalidCipherTextException.java b/azureus2/src/org/bouncycastle/crypto/InvalidCipherTextException.java
deleted file mode 100644
index 59e4b26..0000000
--- a/azureus2/src/org/bouncycastle/crypto/InvalidCipherTextException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.bouncycastle.crypto;
-
-/**
- * this exception is thrown whenever we find something we don't expect in a
- * message.
- */
-public class InvalidCipherTextException 
-    extends CryptoException
-{
-    /**
-     * base constructor.
-     */
-    public InvalidCipherTextException()
-    {
-    }
-
-    /**
-     * create a InvalidCipherTextException with the given message.
-     *
-     * @param message the message to be carried with the exception.
-     */
-    public InvalidCipherTextException(
-        String  message)
-    {
-        super(message);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/KeyGenerationParameters.java b/azureus2/src/org/bouncycastle/crypto/KeyGenerationParameters.java
deleted file mode 100644
index 9a63522..0000000
--- a/azureus2/src/org/bouncycastle/crypto/KeyGenerationParameters.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.bouncycastle.crypto;
-
-import java.security.SecureRandom;
-
-/**
- * The base class for parameters to key generators.
- */
-public class KeyGenerationParameters
-{
-    private SecureRandom    random;
-    private int             strength;
-
-    /**
-     * initialise the generator with a source of randomness
-     * and a strength (in bits).
-     *
-     * @param random the random byte source.
-     * @param strength the size, in bits, of the keys we want to produce.
-     */
-    public KeyGenerationParameters(
-        SecureRandom    random,
-        int             strength)
-    {
-        this.random = random;
-        this.strength = strength;
-    }
-
-    /**
-     * return the random source associated with this
-     * generator.
-     *
-     * @return the generators random source.
-     */
-    public SecureRandom getRandom()
-    {
-        return random;
-    }
-
-    /**
-     * return the bit strength for keys produced by this generator,
-     *
-     * @return the strength of the keys this generator produces (in bits).
-     */
-    public int getStrength()
-    {
-        return strength;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/Mac.java b/azureus2/src/org/bouncycastle/crypto/Mac.java
deleted file mode 100644
index 281b189..0000000
--- a/azureus2/src/org/bouncycastle/crypto/Mac.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.bouncycastle.crypto;
-
-
-/**
- * The base interface for implementations of message authentication codes (MACs).
- */
-public interface Mac
-{
-    /**
-     * Initialise the MAC.
-     *
-     * @param param the key and other data required by the MAC.
-     * @exception IllegalArgumentException if the params argument is
-     * inappropriate.
-     */
-    public void init(CipherParameters params)
-        throws IllegalArgumentException;
-
-    /**
-     * Return the name of the algorithm the MAC implements.
-     *
-     * @return the name of the algorithm the MAC implements.
-     */
-    public String getAlgorithmName();
-
-    /**
-     * Return the block size for this cipher (in bytes).
-     *
-     * @return the block size for this cipher in bytes.
-     */
-	public int getMacSize();
-
-    /**
-     * add a single byte to the mac for processing.
-     *
-     * @param in the byte to be processed.
-     * @exception IllegalStateException if the MAC is not initialised.
-     */
-	public void update(byte in)
-        throws IllegalStateException;
-
-    /**
-     * @param in the array containing the input.
-     * @param inOff the index in the array the data begins at.
-     * @param len the length of the input starting at inOff.
-     * @exception IllegalStateException if the MAC is not initialised.
-     * @exception DataLengthException if there isn't enough data in in.
-     */
-	public void update(byte[] in, int inOff, int len)
-        throws DataLengthException, IllegalStateException;
-
-    /**
-     * Compute the final statge of the MAC writing the output to the out
-     * parameter.
-     * <p>
-     * doFinal leaves the MAC in the same state it was after the last init.
-     *
-     * @param out the array the MAC is to be output to.
-     * @param outOff the offset into the out buffer the output is to start at.
-     * @exception DataLengthException if there isn't enough space in out.
-     * @exception IllegalStateException if the MAC is not initialised.
-     */
-	public int doFinal(byte[] out, int outOff)
-        throws DataLengthException, IllegalStateException;
-
-    /**
-     * Reset the MAC. At the end of resetting the MAC should be in the
-     * in the same state it was after the last init (if there was one).
-     */
-	public void reset();
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/PBEParametersGenerator.java b/azureus2/src/org/bouncycastle/crypto/PBEParametersGenerator.java
deleted file mode 100644
index 8fb2abd..0000000
--- a/azureus2/src/org/bouncycastle/crypto/PBEParametersGenerator.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package org.bouncycastle.crypto;
-
-/**
- * super class for all Password Based Encyrption (PBE) parameter generator classes.
- */
-public abstract class PBEParametersGenerator
-{
-    protected byte[]  password;
-    protected byte[]  salt;
-    protected int     iterationCount;
-
-    /**
-     * base constructor.
-     */
-    protected PBEParametersGenerator()
-    {
-    }
-
-    /**
-     * initialise the PBE generator.
-     *
-     * @param password the password converted into bytes (see below).
-     * @param salt the salt to be mixed with the password.
-     * @param iterationCount the number of iterations the "mixing" function
-     * is to be applied for.
-     */
-    public void init(
-        byte[]  password,
-        byte[]  salt,
-        int     iterationCount)
-    {
-        this.password = password;
-        this.salt = salt;
-        this.iterationCount = iterationCount;
-    }
-
-    /**
-     * return the password byte array.
-     *
-     * @return the password byte array.
-     */
-    public byte[] getPassword()
-    {
-        return password;
-    }
-
-    /**
-     * return the salt byte array.
-     *
-     * @return the salt byte array.
-     */
-    public byte[] getSalt()
-    {
-        return salt;
-    }
-
-    /**
-     * return the iteration count.
-     *
-     * @return the iteration count.
-     */
-    public int getIterationCount()
-    {
-        return iterationCount;
-    }
-
-    /**
-     * generate derived parameters for a key of length keySize.
-     *
-     * @param keySize the length, in bits, of the key required.
-     * @return a parameters object representing a key.
-     */
-    public abstract CipherParameters generateDerivedParameters(int keySize);
-
-    /**
-     * generate derived parameters for a key of length keySize, and
-     * an initialisation vector (IV) of length ivSize.
-     *
-     * @param keySize the length, in bits, of the key required.
-     * @param ivSize the length, in bits, of the iv required.
-     * @return a parameters object representing a key and an IV.
-     */
-    public abstract CipherParameters generateDerivedParameters(int keySize, int ivSize);
-
-    /**
-     * generate derived parameters for a key of length keySize, specifically
-     * for use with a MAC.
-     *
-     * @param keySize the length, in bits, of the key required.
-     * @return a parameters object representing a key.
-     */
-    public abstract CipherParameters generateDerivedMacParameters(int keySize);
-
-    /**
-     * converts a password to a byte array according to the scheme in
-     * PKCS5 (ascii, no padding)
-     *
-     * @param password a character array reqpresenting the password.
-     * @return a byte array representing the password.
-     */
-    public static byte[] PKCS5PasswordToBytes(
-        char[]  password)
-    {
-        byte[]  bytes = new byte[password.length];
-
-        for (int i = 0; i != bytes.length; i++)
-        {
-            bytes[i] = (byte)password[i];
-        }
-
-        return bytes;
-    }
-
-    /**
-     * converts a password to a byte array according to the scheme in
-     * PKCS12 (unicode, big endian, 2 zero pad bytes at the end).
-     *
-     * @param password a character array reqpresenting the password.
-     * @return a byte array representing the password.
-     */
-    public static byte[] PKCS12PasswordToBytes(
-        char[]  password)
-    {
-        if (password.length > 0)
-        {
-                                       // +1 for extra 2 pad bytes.
-            byte[]  bytes = new byte[(password.length + 1) * 2];
-
-            for (int i = 0; i != password.length; i ++)
-            {
-                bytes[i * 2] = (byte)(password[i] >>> 8);
-                bytes[i * 2 + 1] = (byte)password[i];
-            }
-
-            return bytes;
-        }
-        else
-        {
-            return new byte[0];
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/RuntimeCryptoException.java b/azureus2/src/org/bouncycastle/crypto/RuntimeCryptoException.java
deleted file mode 100644
index 612734b..0000000
--- a/azureus2/src/org/bouncycastle/crypto/RuntimeCryptoException.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.bouncycastle.crypto;
-
-/**
- * the foundation class for the exceptions thrown by the crypto packages.
- */
-public class RuntimeCryptoException 
-    extends RuntimeException
-{	
-    /**
-     * base constructor.
-     */
-    public RuntimeCryptoException()
-    {
-    }
-
-    /**
-     * create a RuntimeCryptoException with the given message.
-     *
-     * @param message the message to be carried with the exception.
-     */
-    public RuntimeCryptoException(
-        String  message)
-    {
-        super(message);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/StreamBlockCipher.java b/azureus2/src/org/bouncycastle/crypto/StreamBlockCipher.java
deleted file mode 100644
index bea3b6a..0000000
--- a/azureus2/src/org/bouncycastle/crypto/StreamBlockCipher.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.bouncycastle.crypto;
-
-/**
- * a wrapper for block ciphers with a single byte block size, so that they
- * can be treated like stream ciphers.
- */
-public class StreamBlockCipher
-    implements StreamCipher
-{
-    private BlockCipher  cipher;
-
-    private byte[]  oneByte = new byte[1];
-
-    /**
-     * basic constructor.
-     *
-     * @param cipher the block cipher to be wrapped.
-     * @exception IllegalArgumentException if the cipher has a block size other than
-     * one.
-     */
-    public StreamBlockCipher(
-        BlockCipher cipher)
-    {
-        if (cipher.getBlockSize() != 1)
-        {
-            throw new IllegalArgumentException("block cipher block size != 1.");
-        }
-
-        this.cipher = cipher;
-    }
-
-    /**
-     * initialise the underlying cipher.
-     *
-     * @param forEncryption true if we are setting up for encryption, false otherwise.
-     * @param param the necessary parameters for the underlying cipher to be initialised.
-     */
-    public void init(
-        boolean forEncryption,
-        CipherParameters params)
-    {
-        cipher.init(forEncryption, params);
-    }
-
-    /**
-     * return the name of the algorithm we are wrapping.
-     *
-     * @return the name of the algorithm we are wrapping.
-     */
-    public String getAlgorithmName()
-    {
-        return cipher.getAlgorithmName();
-    }
-
-    /**
-     * encrypt/decrypt a single byte returning the result.
-     *
-     * @param in the byte to be processed.
-     * @return the result of processing the input byte.
-     */
-    public byte returnByte(
-        byte    in)
-    {
-        oneByte[0] = in;
-
-        cipher.processBlock(oneByte, 0, oneByte, 0);
-
-        return oneByte[0];
-    }
-
-    /**
-     * process a block of bytes from in putting the result into out.
-     * 
-     * @param in the input byte array.
-     * @param inOff the offset into the in array where the data to be processed starts.
-     * @param len the number of bytes to be processed.
-     * @param out the output buffer the processed bytes go into.   
-     * @param outOff the offset into the output byte array the processed data stars at.
-     * @exception DataLengthException if the output buffer is too small.
-     */
-    public void processBytes(
-        byte[]  in,
-        int     inOff,
-        int     len,
-        byte[]  out,
-        int     outOff)
-        throws DataLengthException
-    {
-        if (outOff + len > out.length)
-        {
-            throw new DataLengthException("output buffer too small in processBytes()");
-        }
-
-        for (int i = 0; i != len; i++)
-        {
-                cipher.processBlock(in, inOff + i, out, outOff + i);
-        }
-    }
-
-    /**
-     * reset the underlying cipher. This leaves it in the same state
-     * it was at after the last init (if there was one).
-     */
-    public void reset()
-    {
-        cipher.reset();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/StreamCipher.java b/azureus2/src/org/bouncycastle/crypto/StreamCipher.java
deleted file mode 100644
index 6886e8c..0000000
--- a/azureus2/src/org/bouncycastle/crypto/StreamCipher.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.bouncycastle.crypto;
-
-/**
- * the interface stream ciphers conform to.
- */
-public interface StreamCipher
-{
-    /**
-     * Initialise the cipher.
-     *
-     * @param forEncryption if true the cipher is initialised for
-     *  encryption, if false for decryption.
-     * @param param the key and other data required by the cipher.
-     * @exception IllegalArgumentException if the params argument is
-     * inappropriate.
-     */
-    public void init(boolean forEncryption, CipherParameters params)
-        throws IllegalArgumentException;
-
-    /**
-     * Return the name of the algorithm the cipher implements.
-     *
-     * @return the name of the algorithm the cipher implements.
-     */
-    public String getAlgorithmName();
-
-    /**
-     * encrypt/decrypt a single byte returning the result.
-     *
-     * @param in the byte to be processed.
-     * @return the result of processing the input byte.
-     */
-    public byte returnByte(byte in);
-
-    /**
-     * process a block of bytes from in putting the result into out.
-     *
-     * @param in the input byte array.
-     * @param inOff the offset into the in array where the data to be processed starts.
-     * @param len the number of bytes to be processed.
-     * @param out the output buffer the processed bytes go into.
-     * @param outOff the offset into the output byte array the processed data stars at.
-     * @exception DataLengthException if the output buffer is too small.
-     */
-    public void processBytes(byte[] in, int inOff, int len, byte[] out, int outOff)
-        throws DataLengthException;
-
-    /**
-     * reset the cipher. This leaves it in the same state
-     * it was at after the last init (if there was one).
-     */
-    public void reset();
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/Wrapper.java b/azureus2/src/org/bouncycastle/crypto/Wrapper.java
deleted file mode 100644
index 3956a6f..0000000
--- a/azureus2/src/org/bouncycastle/crypto/Wrapper.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.bouncycastle.crypto;
-
-public interface Wrapper
-{
-    public void init(boolean forWrapping, CipherParameters param);
-
-    /**
-     * Return the name of the algorithm the wrapper implements.
-     *
-     * @return the name of the algorithm the wrapper implements.
-     */
-    public String getAlgorithmName();
-
-    public byte[] wrap(byte[] in, int inOff, int inLen);
-
-    public byte[] unwrap(byte[] in, int inOff, int inLen)
-        throws InvalidCipherTextException;
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/agreement/ECDHBasicAgreement.java b/azureus2/src/org/bouncycastle/crypto/agreement/ECDHBasicAgreement.java
deleted file mode 100644
index abd120f..0000000
--- a/azureus2/src/org/bouncycastle/crypto/agreement/ECDHBasicAgreement.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.bouncycastle.crypto.agreement;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.math.ec.ECPoint;
-
-import org.bouncycastle.crypto.BasicAgreement;
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.params.ECPublicKeyParameters;
-import org.bouncycastle.crypto.params.ECPrivateKeyParameters;
-
-/**
- * P1363 7.2.1 ECSVDP-DH
- *
- * ECSVDP-DH is Elliptic Curve Secret Value Derivation Primitive,
- * Diffie-Hellman version. It is based on the work of [DH76], [Mil86],
- * and [Kob87]. This primitive derives a shared secret value from one
- * party's private key and another party's public key, where both have
- * the same set of EC domain parameters. If two parties correctly
- * execute this primitive, they will produce the same output. This
- * primitive can be invoked by a scheme to derive a shared secret key;
- * specifically, it may be used with the schemes ECKAS-DH1 and
- * DL/ECKAS-DH2. It assumes that the input keys are valid (see also
- * Section 7.2.2).
- */
-public class ECDHBasicAgreement
-    implements BasicAgreement
-{
-	private ECPrivateKeyParameters key;
-
-	public void init(
-        CipherParameters key)
-	{
-		this.key = (ECPrivateKeyParameters)key;
-	}
-
-	public BigInteger calculateAgreement(
-        CipherParameters pubKey)
-	{
-        ECPublicKeyParameters pub = (ECPublicKeyParameters)pubKey;
-		ECPoint P = pub.getQ().multiply(key.getD());
-
-		// if ( p.isInfinity() ) throw new RuntimeException("d*Q == infinity");
-
-		return P.getX().toBigInteger();
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/agreement/srp/SRP6Client.java b/azureus2/src/org/bouncycastle/crypto/agreement/srp/SRP6Client.java
deleted file mode 100644
index 4df9023..0000000
--- a/azureus2/src/org/bouncycastle/crypto/agreement/srp/SRP6Client.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.bouncycastle.crypto.agreement.srp;
-
-import java.math.BigInteger;
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.CryptoException;
-import org.bouncycastle.crypto.Digest;
-
-/**
- * Implements the client side SRP-6a protocol. Note that this class is stateful, and therefore NOT threadsafe.
- * This implementation of SRP is based on the optimized message sequence put forth by Thomas Wu in the paper
- * "SRP-6: Improvements and Refinements to the Secure Remote Password Protocol, 2002"
- */
-public class SRP6Client
-{
-    protected BigInteger N;
-    protected BigInteger g;
-
-    protected BigInteger a;
-    protected BigInteger A;
-
-    protected BigInteger B;
-
-    protected BigInteger x;
-    protected BigInteger u;
-    protected BigInteger S;
-
-    protected Digest digest;
-    protected SecureRandom random;
-
-    public SRP6Client()
-    {
-    }
-
-    /**
-     * Initialises the client to begin new authentication attempt
-     * @param N The safe prime associated with the client's verifier
-     * @param g The group parameter associated with the client's verifier
-     * @param digest The digest algorithm associated with the client's verifier
-     * @param random For key generation
-     */
-    public void init(BigInteger N, BigInteger g, Digest digest, SecureRandom random)
-    {
-        this.N = N;
-        this.g = g;
-        this.digest = digest;
-        this.random = random;
-    }
-
-    /**
-     * Generates client's credentials given the client's salt, identity and password
-     * @param salt The salt used in the client's verifier.
-     * @param identity The user's identity (eg. username)
-     * @param password The user's password
-     * @return Client's public value to send to server
-     */
-    public BigInteger generateClientCredentials(byte[] salt, byte[] identity, byte[] password)
-    {
-        this.x = SRP6Util.calculateX(digest, N, salt, identity, password);
-        this.a = selectPrivateValue();
-        this.A = g.modPow(a, N);
-
-        return A;
-    }
-
-    /**
-     * Generates client's verification message given the server's credentials
-     * @param serverB The server's credentials
-     * @return Client's verification message for the server
-     * @throws CryptoException If server's credentials are invalid
-     */
-    public BigInteger calculateSecret(BigInteger serverB) throws CryptoException
-    {
-        this.B = SRP6Util.validatePublicValue(N, serverB);
-        this.u = SRP6Util.calculateU(digest, N, A, B);
-        this.S = calculateS();
-
-        return S;
-    }
-
-    protected BigInteger selectPrivateValue()
-    {
-        return SRP6Util.generatePrivateValue(digest, N, g, random);        
-    }
-
-    private BigInteger calculateS()
-    {
-        BigInteger k = SRP6Util.calculateK(digest, N, g);
-        BigInteger exp = u.multiply(x).add(a);
-        BigInteger tmp = g.modPow(x, N).multiply(k).mod(N);
-        return B.subtract(tmp).mod(N).modPow(exp, N);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/agreement/srp/SRP6Server.java b/azureus2/src/org/bouncycastle/crypto/agreement/srp/SRP6Server.java
deleted file mode 100644
index fb20838..0000000
--- a/azureus2/src/org/bouncycastle/crypto/agreement/srp/SRP6Server.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.bouncycastle.crypto.agreement.srp;
-
-import java.math.BigInteger;
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.CryptoException;
-import org.bouncycastle.crypto.Digest;
-
-/**
- * Implements the server side SRP-6a protocol. Note that this class is stateful, and therefore NOT threadsafe.
- * This implementation of SRP is based on the optimized message sequence put forth by Thomas Wu in the paper
- * "SRP-6: Improvements and Refinements to the Secure Remote Password Protocol, 2002"
- */
-public class SRP6Server
-{
-    protected BigInteger N;
-    protected BigInteger g;
-    protected BigInteger v;
-
-    protected SecureRandom random;
-    protected Digest digest;
-
-    protected BigInteger A;
-
-    protected BigInteger b;
-    protected BigInteger B;
-
-    protected BigInteger u;
-    protected BigInteger S;
-
-    public SRP6Server()
-    {
-    }
-
-    /**
-     * Initialises the server to accept a new client authentication attempt
-     * @param N The safe prime associated with the client's verifier
-     * @param g The group parameter associated with the client's verifier
-     * @param v The client's verifier
-     * @param digest The digest algorithm associated with the client's verifier
-     * @param random For key generation
-     */
-    public void init(BigInteger N, BigInteger g, BigInteger v, Digest digest, SecureRandom random)
-    {
-        this.N = N;
-        this.g = g;
-        this.v = v;
-
-        this.random = random;
-        this.digest = digest;
-    }
-
-    /**
-     * Generates the server's credentials that are to be sent to the client.
-     * @return The server's public value to the client
-     */
-    public BigInteger generateServerCredentials()
-    {
-        BigInteger k = SRP6Util.calculateK(digest, N, g);
-        this.b = selectPrivateValue();
-        this.B = k.multiply(v).mod(N).add(g.modPow(b, N)).mod(N);
-
-        return B;
-    }
-
-    /**
-     * Processes the client's credentials. If valid the shared secret is generated and returned.
-     * @param clientA The client's credentials
-     * @return A shared secret BigInteger
-     * @throws CryptoException If client's credentials are invalid
-     */
-    public BigInteger calculateSecret(BigInteger clientA) throws CryptoException
-    {
-        this.A = SRP6Util.validatePublicValue(N, clientA);
-        this.u = SRP6Util.calculateU(digest, N, A, B);
-        this.S = calculateS();
-
-        return S;
-    }
-
-    protected BigInteger selectPrivateValue()
-    {
-        return SRP6Util.generatePrivateValue(digest, N, g, random);        
-    }
-
-    private BigInteger calculateS()
-    {
-        return v.modPow(u, N).multiply(A).mod(N).modPow(b, N);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/agreement/srp/SRP6Util.java b/azureus2/src/org/bouncycastle/crypto/agreement/srp/SRP6Util.java
deleted file mode 100644
index ad5ceac..0000000
--- a/azureus2/src/org/bouncycastle/crypto/agreement/srp/SRP6Util.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.bouncycastle.crypto.agreement.srp;
-
-import java.math.BigInteger;
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.CryptoException;
-import org.bouncycastle.crypto.Digest;
-import org.bouncycastle.util.BigIntegers;
-
-public class SRP6Util
-{
-    private static BigInteger ZERO = BigInteger.valueOf(0);
-    private static BigInteger ONE = BigInteger.valueOf(1);
-
-    public static BigInteger calculateK(Digest digest, BigInteger N, BigInteger g)
-    {
-        return hashPaddedPair(digest, N, N, g);
-    }
-
-    public static BigInteger calculateU(Digest digest, BigInteger N, BigInteger A, BigInteger B)
-    {
-        return hashPaddedPair(digest, N, A, B);
-    }
-
-    public static BigInteger calculateX(Digest digest, BigInteger N, byte[] salt, byte[] identity, byte[] password)
-    {
-        byte[] output = new byte[digest.getDigestSize()];
-
-        digest.update(identity, 0, identity.length);
-        digest.update((byte)':');
-        digest.update(password, 0, password.length);
-        digest.doFinal(output, 0);
-
-        digest.update(salt, 0, salt.length);
-        digest.update(output, 0, output.length);
-        digest.doFinal(output, 0);
-
-        return new BigInteger(1, output);
-    }
-
-    public static BigInteger generatePrivateValue(Digest digest, BigInteger N, BigInteger g, SecureRandom random)
-    {
-        int minBits = Math.min(256, N.bitLength() / 2);
-        BigInteger min = ONE.shiftLeft(minBits - 1);
-        BigInteger max = N.subtract(ONE);
-
-        return BigIntegers.createRandomInRange(min, max, random);
-    }
-
-    public static BigInteger validatePublicValue(BigInteger N, BigInteger val)
-        throws CryptoException
-    {
-        val = val.mod(N);
-
-        // Check that val % N != 0
-        if (val.equals(ZERO))
-        {
-            throw new CryptoException("Invalid public value: 0");
-        }
-
-        return val;
-    }
-
-    private static BigInteger hashPaddedPair(Digest digest, BigInteger N, BigInteger n1, BigInteger n2)
-    {
-        int padLength = (N.bitLength() + 7) / 8;
-
-        byte[] n1_bytes = getPadded(n1, padLength);
-        byte[] n2_bytes = getPadded(n2, padLength);
-
-        digest.update(n1_bytes, 0, n1_bytes.length);
-        digest.update(n2_bytes, 0, n2_bytes.length);
-
-        byte[] output = new byte[digest.getDigestSize()];
-        digest.doFinal(output, 0);
-
-        return new BigInteger(1, output);
-    }
-
-    private static byte[] getPadded(BigInteger n, int length)
-    {
-        byte[] bs = BigIntegers.asUnsignedByteArray(n);
-        if (bs.length < length)
-        {
-            byte[] tmp = new byte[length];
-            System.arraycopy(bs, 0, tmp, length - bs.length, bs.length);
-            bs = tmp;
-        }
-        return bs;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/agreement/srp/SRP6VerifierGenerator.java b/azureus2/src/org/bouncycastle/crypto/agreement/srp/SRP6VerifierGenerator.java
deleted file mode 100644
index 631ecc6..0000000
--- a/azureus2/src/org/bouncycastle/crypto/agreement/srp/SRP6VerifierGenerator.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.bouncycastle.crypto.agreement.srp;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.crypto.Digest;
-
-/**
- * Generates new SRP verifier for user
- */
-public class SRP6VerifierGenerator
-{
-    protected BigInteger N;
-    protected BigInteger g;
-    protected Digest digest;
-
-    public SRP6VerifierGenerator()
-    {
-    }
-
-    /**
-     * Initialises generator to create new verifiers
-     * @param N The safe prime to use (see DHParametersGenerator)
-     * @param g The group parameter to use (see DHParametersGenerator)
-     * @param digest The digest to use. The same digest type will need to be used later for the actual authentication
-     * attempt. Also note that the final session key size is dependent on the chosen digest.
-     */
-    public void init(BigInteger N, BigInteger g, Digest digest)
-    {
-        this.N = N;
-        this.g = g;
-        this.digest = digest;
-    }
-
-    /**
-     * Creates a new SRP verifier
-     * @param salt The salt to use, generally should be large and random
-     * @param identity The user's identifying information (eg. username)
-     * @param password The user's password
-     * @return A new verifier for use in future SRP authentication
-     */
-    public BigInteger generateVerifier(byte[] salt, byte[] identity, byte[] password)
-    {
-        BigInteger x = SRP6Util.calculateX(digest, N, salt, identity, password);
-
-        return g.modPow(x, N);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/digests/GeneralDigest.java b/azureus2/src/org/bouncycastle/crypto/digests/GeneralDigest.java
deleted file mode 100644
index 2d319b7..0000000
--- a/azureus2/src/org/bouncycastle/crypto/digests/GeneralDigest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package org.bouncycastle.crypto.digests;
-
-import org.bouncycastle.crypto.Digest;
-
-/**
- * base implementation of MD4 family style digest as outlined in
- * "Handbook of Applied Cryptography", pages 344 - 347.
- */
-public abstract class GeneralDigest
-    implements Digest
-{
-    private byte[]  xBuf;
-    private int     xBufOff;
-
-    private long    byteCount;
-
-	/**
-	 * Standard constructor
-	 */
-	protected GeneralDigest()
-	{
-		xBuf = new byte[4];
-		xBufOff = 0;
-	}
-
-	/**
-	 * Copy constructor.  We are using copy constructors in place
-	 * of the Object.clone() interface as this interface is not
-	 * supported by J2ME.
-	 */
-	protected GeneralDigest(GeneralDigest t)
-	{
-        xBuf = new byte[t.xBuf.length];
-		System.arraycopy(t.xBuf, 0, xBuf, 0, t.xBuf.length);
-
-		xBufOff = t.xBufOff;
-		byteCount = t.byteCount;
-	}
-
-    public void update(
-        byte in)
-    {
-        xBuf[xBufOff++] = in;
-
-        if (xBufOff == xBuf.length)
-        {
-            processWord(xBuf, 0);
-            xBufOff = 0;
-        }
-
-        byteCount++;
-    }
-
-    public void update(
-        byte[]  in,
-        int     inOff,
-        int     len)
-    {
-        //
-        // fill the current word
-        //
-        while ((xBufOff != 0) && (len > 0))
-        {
-            update(in[inOff]);
-
-            inOff++;
-            len--;
-        }
-
-        //
-        // process whole words.
-        //
-        while (len > xBuf.length)
-        {
-            processWord(in, inOff);
-
-            inOff += xBuf.length;
-            len -= xBuf.length;
-            byteCount += xBuf.length;
-        }
-
-        //
-        // load in the remainder.
-        //
-        while (len > 0)
-        {
-            update(in[inOff]);
-
-            inOff++;
-            len--;
-        }
-    }
-
-    public void finish()
-    {
-        long    bitLength = (byteCount << 3);
-
-        //
-        // add the pad bytes.
-        //
-        update((byte)128);
-
-        while (xBufOff != 0)
-        {
-            update((byte)0);
-        }
-
-        processLength(bitLength);
-
-        processBlock();
-    }
-
-    public void reset()
-    {
-        byteCount = 0;
-
-        xBufOff = 0;
-		for ( int i = 0; i < xBuf.length; i++ ) {
-			xBuf[i] = 0;
-		}
-    }
-
-    protected abstract void processWord(byte[] in, int inOff);
-
-    protected abstract void processLength(long bitLength);
-
-    protected abstract void processBlock();
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/digests/LongDigest.java b/azureus2/src/org/bouncycastle/crypto/digests/LongDigest.java
deleted file mode 100644
index f3e0043..0000000
--- a/azureus2/src/org/bouncycastle/crypto/digests/LongDigest.java
+++ /dev/null
@@ -1,346 +0,0 @@
-package org.bouncycastle.crypto.digests;
-
-import org.bouncycastle.crypto.Digest;
-
-/**
- * Base class for SHA-384 and SHA-512.
- */
-public abstract class LongDigest
-    implements Digest
-{
-    private byte[]  xBuf;
-    private int     xBufOff;
-
-    private long    byteCount1;
-    private long    byteCount2;
-
-    protected long    H1, H2, H3, H4, H5, H6, H7, H8;
-
-    private long[]  W = new long[80];
-    private int     wOff;
-
-	/**
-	 * Constructor for variable length word
-	 */
-	protected LongDigest()
-	{
-		xBuf = new byte[8];
-		xBufOff = 0;
-
-        reset();
-	}
-
-	/**
-	 * Copy constructor.  We are using copy constructors in place
-	 * of the Object.clone() interface as this interface is not
-	 * supported by J2ME.
-	 */
-	protected LongDigest(LongDigest t)
-	{
-        xBuf = new byte[t.xBuf.length];
-		System.arraycopy(t.xBuf, 0, xBuf, 0, t.xBuf.length);
-
-		xBufOff = t.xBufOff;
-		byteCount1 = t.byteCount1;
-		byteCount2 = t.byteCount2;
-
-		H1 = t.H1;
-		H2 = t.H2;
-		H3 = t.H3;
-		H4 = t.H4;
-		H5 = t.H5;
-		H6 = t.H6;
-		H7 = t.H7;
-		H8 = t.H8;
-
-		System.arraycopy(t.W, 0, W, 0, t.W.length);
-		wOff = t.wOff;
-	}
-
-    public void update(
-        byte in)
-    {
-        xBuf[xBufOff++] = in;
-
-        if (xBufOff == xBuf.length)
-        {
-            processWord(xBuf, 0);
-            xBufOff = 0;
-        }
-
-        byteCount1++;
-    }
-
-    public void update(
-        byte[]  in,
-        int     inOff,
-        int     len)
-    {
-        //
-        // fill the current word
-        //
-        while ((xBufOff != 0) && (len > 0))
-        {
-            update(in[inOff]);
-
-            inOff++;
-            len--;
-        }
-
-        //
-        // process whole words.
-        //
-        while (len > xBuf.length)
-        {
-            processWord(in, inOff);
-
-            inOff += xBuf.length;
-            len -= xBuf.length;
-            byteCount1 += xBuf.length;
-        }
-
-        //
-        // load in the remainder.
-        //
-        while (len > 0)
-        {
-            update(in[inOff]);
-
-            inOff++;
-            len--;
-        }
-    }
-
-    public void finish()
-    {
-        adjustByteCounts();
-
-        long    lowBitLength = byteCount1 << 3;
-        long    hiBitLength = byteCount2;
-
-        //
-        // add the pad bytes.
-        //
-        update((byte)128);
-
-        while (xBufOff != 0)
-        {
-            update((byte)0);
-        }
-
-        processLength(lowBitLength, hiBitLength);
-
-        processBlock();
-    }
-
-    public void reset()
-    {
-        byteCount1 = 0;
-        byteCount2 = 0;
-
-        xBufOff = 0;
-		for ( int i = 0; i < xBuf.length; i++ ) {
-			xBuf[i] = 0;
-		}
-
-        wOff = 0;
-        for (int i = 0; i != W.length; i++)
-        {
-            W[i] = 0;
-        }
-    }
-
-    protected void processWord(
-        byte[]  in,
-        int     inOff)
-    {
-        W[wOff++] = ((long)(in[inOff] & 0xff) << 56)
-					| ((long)(in[inOff + 1] & 0xff) << 48)
-                    | ((long)(in[inOff + 2] & 0xff) << 40)
-					| ((long)(in[inOff + 3] & 0xff) << 32)
-        			| ((long)(in[inOff + 4] & 0xff) << 24)
-					| ((long)(in[inOff + 5] & 0xff) << 16)
-                    | ((long)(in[inOff + 6] & 0xff) << 8)
-					| ((in[inOff + 7] & 0xff)); 
-
-        if (wOff == 16)
-        {
-            processBlock();
-        }
-    }
-
-    protected void unpackWord(
-        long    word,
-        byte[]  out,
-        int     outOff)
-    {
-        out[outOff]     = (byte)(word >>> 56);
-        out[outOff + 1] = (byte)(word >>> 48);
-        out[outOff + 2] = (byte)(word >>> 40);
-        out[outOff + 3] = (byte)(word >>> 32);
-        out[outOff + 4] = (byte)(word >>> 24);
-        out[outOff + 5] = (byte)(word >>> 16);
-        out[outOff + 6] = (byte)(word >>> 8);
-        out[outOff + 7] = (byte)word;
-    }
-
-    /**
-     * adjust the byte counts so that byteCount2 represents the
-     * upper long (less 3 bits) word of the byte count.
-     */
-    private void adjustByteCounts()
-    {
-        if (byteCount1 > 0x1fffffffffffffffL)
-        {
-            byteCount2 += (byteCount1 >>> 61);
-            byteCount1 &= 0x1fffffffffffffffL;
-        }
-    }
-
-    protected void processLength(
-        long    lowW,
-        long    hiW)
-    {
-        if (wOff > 14)
-        {
-            processBlock();
-        }
-
-        W[14] = hiW;
-        W[15] = lowW;
-    }
-
-    protected void processBlock()
-    {
-        adjustByteCounts();
-
-        //
-        // expand 16 word block into 80 word blocks.
-        //
-        for (int t = 16; t <= 79; t++)
-        {
-            W[t] = Sigma1(W[t - 2]) + W[t - 7] + Sigma0(W[t - 15]) + W[t - 16];
-        }
-
-        //
-        // set up working variables.
-        //
-        long     a = H1;
-        long     b = H2;
-        long     c = H3;
-        long     d = H4;
-        long     e = H5;
-        long     f = H6;
-        long     g = H7;
-        long     h = H8;
-
-		for (int t = 0; t <= 79; t++)
-		{
-			long	T1, T2;
-
-			T1 = h + Sum1(e) + Ch(e, f, g) + K[t] + W[t];
-			T2 = Sum0(a) + Maj(a, b, c);
-			h = g;
-			g = f;
-			f = e;
-			e = d + T1;
-			d = c;
-			c = b;
-			b = a;
-			a = T1 + T2;
-		}
-
-        H1 += a;
-        H2 += b;
-        H3 += c;
-        H4 += d;
-        H5 += e;
-        H6 += f;
-        H7 += g;
-        H8 += h;
-
-        //
-        // reset the offset and clean out the word buffer.
-        //
-        wOff = 0;
-        for (int i = 0; i != W.length; i++)
-        {
-            W[i] = 0;
-        }
-    }
-
-    private long rotateRight(
-        long   x,
-        int    n)
-    {
-        return (x >>> n) | (x << (64 - n));
-    }
-
-	/* SHA-384 and SHA-512 functions (as for SHA-256 but for longs) */
-    private long Ch(
-        long    x,
-        long    y,
-        long    z)
-    {
-        return ((x & y) ^ ((~x) & z));
-    }
-
-    private long Maj(
-        long    x,
-        long    y,
-        long    z)
-    {
-        return ((x & y) ^ (x & z) ^ (y & z));
-    }
-
-    private long Sum0(
-        long    x)
-    {
-        return rotateRight(x, 28) ^ rotateRight(x, 34) ^ rotateRight(x, 39);
-    }
-
-    private long Sum1(
-        long    x)
-    {
-        return rotateRight(x, 14) ^ rotateRight(x, 18) ^ rotateRight(x, 41);
-    }
-
-    private long Sigma0(
-        long    x)
-    {
-        return rotateRight(x, 1) ^ rotateRight(x, 8) ^ (x >>> 7);
-    }
-
-    private long Sigma1(
-        long    x)
-    {
-        return rotateRight(x, 19) ^ rotateRight(x, 61) ^ (x >>> 6);
-    }
-
-	/* SHA-384 and SHA-512 Constants
-	 * (represent the first 64 bits of the fractional parts of the
-     * cube roots of the first sixty-four prime numbers)
-	 */
-	static final long K[] = {
-0x428a2f98d728ae22L, 0x7137449123ef65cdL, 0xb5c0fbcfec4d3b2fL, 0xe9b5dba58189dbbcL,
-0x3956c25bf348b538L, 0x59f111f1b605d019L, 0x923f82a4af194f9bL, 0xab1c5ed5da6d8118L,
-0xd807aa98a3030242L, 0x12835b0145706fbeL, 0x243185be4ee4b28cL, 0x550c7dc3d5ffb4e2L,
-0x72be5d74f27b896fL, 0x80deb1fe3b1696b1L, 0x9bdc06a725c71235L, 0xc19bf174cf692694L,
-0xe49b69c19ef14ad2L, 0xefbe4786384f25e3L, 0x0fc19dc68b8cd5b5L, 0x240ca1cc77ac9c65L,
-0x2de92c6f592b0275L, 0x4a7484aa6ea6e483L, 0x5cb0a9dcbd41fbd4L, 0x76f988da831153b5L,
-0x983e5152ee66dfabL, 0xa831c66d2db43210L, 0xb00327c898fb213fL, 0xbf597fc7beef0ee4L,
-0xc6e00bf33da88fc2L, 0xd5a79147930aa725L, 0x06ca6351e003826fL, 0x142929670a0e6e70L,
-0x27b70a8546d22ffcL, 0x2e1b21385c26c926L, 0x4d2c6dfc5ac42aedL, 0x53380d139d95b3dfL,
-0x650a73548baf63deL, 0x766a0abb3c77b2a8L, 0x81c2c92e47edaee6L, 0x92722c851482353bL,
-0xa2bfe8a14cf10364L, 0xa81a664bbc423001L, 0xc24b8b70d0f89791L, 0xc76c51a30654be30L,
-0xd192e819d6ef5218L, 0xd69906245565a910L, 0xf40e35855771202aL, 0x106aa07032bbd1b8L,
-0x19a4c116b8d2d0c8L, 0x1e376c085141ab53L, 0x2748774cdf8eeb99L, 0x34b0bcb5e19b48a8L,
-0x391c0cb3c5c95a63L, 0x4ed8aa4ae3418acbL, 0x5b9cca4f7763e373L, 0x682e6ff3d6b2b8a3L,
-0x748f82ee5defb2fcL, 0x78a5636f43172f60L, 0x84c87814a1f0ab72L, 0x8cc702081a6439ecL,
-0x90befffa23631e28L, 0xa4506cebde82bde9L, 0xbef9a3f7b2c67915L, 0xc67178f2e372532bL,
-0xca273eceea26619cL, 0xd186b8c721c0c207L, 0xeada7dd6cde0eb1eL, 0xf57d4f7fee6ed178L,
-0x06f067aa72176fbaL, 0x0a637dc5a2c898a6L, 0x113f9804bef90daeL, 0x1b710b35131c471bL,
-0x28db77f523047d84L, 0x32caab7b40c72493L, 0x3c9ebe0a15c9bebcL, 0x431d67c49c100d4cL,
-0x4cc5d4becb3e42b6L, 0x597f299cfc657e2aL, 0x5fcb6fab3ad6faecL, 0x6c44198c4a475817L
-	};
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/digests/MD2Digest.java b/azureus2/src/org/bouncycastle/crypto/digests/MD2Digest.java
deleted file mode 100644
index 51e3e3c..0000000
--- a/azureus2/src/org/bouncycastle/crypto/digests/MD2Digest.java
+++ /dev/null
@@ -1,230 +0,0 @@
-package org.bouncycastle.crypto.digests;
-
-import org.bouncycastle.crypto.Digest;
-/**
- * implementation of MD2
- * as outlined in RFC1319 by B.Kaliski from RSA Laboratories April 1992
- */
-public class MD2Digest
-    implements Digest
-{
-    private static final int DIGEST_LENGTH = 16;
-
-    /* X buffer */
-    private byte[]   X = new byte[48];
-    private int     xOff;
-
    /* M buffer */
-
    private byte[]   M = new byte[16];
-    private int     mOff;
-
    /* check sum */
-
    private byte[]   C = new byte[16];
-    private int COff;
-
-    public MD2Digest()
-    {
-        reset();
-    }
-	public MD2Digest(MD2Digest t)
-	{
-		System.arraycopy(t.X, 0, X, 0, t.X.length);
-		xOff = t.xOff;
-		System.arraycopy(t.M, 0, M, 0, t.M.length);
-		mOff = t.mOff;
-		System.arraycopy(t.C, 0, C, 0, t.C.length);
-		COff = t.COff;
-	}
-    /**
-     * return the algorithm name
-     *
-     * @return the algorithm name
-     */
-    public String getAlgorithmName()
-    {
-        return "MD2";
-    }
-    /**
-     * return the size, in bytes, of the digest produced by this message digest.
-     *
-     * @return the size, in bytes, of the digest produced by this message digest.
-     */
-	public int getDigestSize()
-    {
-        return DIGEST_LENGTH;
-    }
-    /**
-     * close the digest, producing the final digest value. The doFinal
-     * call leaves the digest reset.
-     *
-     * @param out the array the digest is to be copied into.
-     * @param outOff the offset into the out array the digest is to start at.
-     */
-	public int doFinal(byte[] out, int outOff)
-    {
-        // add padding
-        byte paddingByte = (byte)(M.length-mOff);
-        for (int i=mOff;i<M.length;i++)
-        {
-            M[i] = paddingByte;
-        }
-        //do final check sum
-        processCheckSum(M);
-        // do final block process
-        processBlock(M);
-
-        processBlock(C);
-
-        System.arraycopy(X,xOff,out,outOff,16);
-
-        reset();
-
-        return DIGEST_LENGTH;
-    }
-    /**
-     * reset the digest back to it's initial state.
-     */
-    public void reset()
-    {
-        xOff = 0;
-        for (int i = 0; i != X.length; i++)
-        {
-            X[i] = 0;
-        }
-        mOff = 0;
-        for (int i = 0; i != M.length; i++)
-        {
-            M[i] = 0;
-        }
-        COff = 0;
-        for (int i = 0; i != C.length; i++)
-        {
-            C[i] = 0;
-        }
-    }
-    /**
-     * update the message digest with a single byte.
-     *
-     * @param in the input byte to be entered.
-     */
-	public void update(byte in)
-    {
-        M[mOff++] = in;
-
-        if (mOff == 16)
-        {
-            processCheckSum(M);
-            processBlock(M);
-            mOff = 0;
-        }
-    }
-
-    /**
-     * update the message digest with a block of bytes.
-     *
-     * @param in the byte array containing the data.
-     * @param inOff the offset into the byte array where the data starts.
-     * @param len the length of the data.
-     */
-	public void update(byte[] in, int inOff, int len)
-    {
-        //
-        // fill the current word
-        //
-        while ((mOff != 0) && (len > 0))
-        {
-            update(in[inOff]);
-            inOff++;
-            len--;
-        }
-
-        //
-        // process whole words.
-        //
-        while (len > 16)
-        {
-            System.arraycopy(in,inOff,M,0,16);
-            processCheckSum(M);
-            processBlock(M);
-            len -= 16;
-            inOff += 16;
-        }
-
-        //
-        // load in the remainder.
-        //
-        while (len > 0)
-        {
-            update(in[inOff]);
-            inOff++;
-            len--;
-        }
-    }
-    protected void processCheckSum(byte[] m)
-    {
-        int L = C[15];
-        for (int i=0;i<16;i++)
-        {
-            C[i] ^= S[(m[i] ^ L) & 0xff];
-            L = C[i];
-        }
-    }
-    protected void processBlock(byte[] m)
-    {
-        for (int i=0;i<16;i++)
-        {
-            X[i+16] = m[i];
-            X[i+32] = (byte)(m[i] ^ X[i]);
-        }
-        // encrypt block
-        int t = 0;
-
-        for (int j=0;j<18;j++)
-        {
-            for (int k=0;k<48;k++)
-            {
-                t = X[k] ^= S[t];
-                t = t & 0xff;
-            }
-            t = (t + j)%256;
-        }
-     }
-     // 256-byte random permutation constructed from the digits of PI
-    private static final byte[] S = {
-      (byte)41,(byte)46,(byte)67,(byte)201,(byte)162,(byte)216,(byte)124,
-      (byte)1,(byte)61,(byte)54,(byte)84,(byte)161,(byte)236,(byte)240,
-      (byte)6,(byte)19,(byte)98,(byte)167,(byte)5,(byte)243,(byte)192,
-      (byte)199,(byte)115,(byte)140,(byte)152,(byte)147,(byte)43,(byte)217,
-      (byte)188,(byte)76,(byte)130,(byte)202,(byte)30,(byte)155,(byte)87,
-      (byte)60,(byte)253,(byte)212,(byte)224,(byte)22,(byte)103,(byte)66,
-      (byte)111,(byte)24,(byte)138,(byte)23,(byte)229,(byte)18,(byte)190,
-      (byte)78,(byte)196,(byte)214,(byte)218,(byte)158,(byte)222,(byte)73,
-      (byte)160,(byte)251,(byte)245,(byte)142,(byte)187,(byte)47,(byte)238,
-      (byte)122,(byte)169,(byte)104,(byte)121,(byte)145,(byte)21,(byte)178,
-      (byte)7,(byte)63,(byte)148,(byte)194,(byte)16,(byte)137,(byte)11,
-      (byte)34,(byte)95,(byte)33,(byte)128,(byte)127,(byte)93,(byte)154,
-      (byte)90,(byte)144,(byte)50,(byte)39,(byte)53,(byte)62,(byte)204,
-      (byte)231,(byte)191,(byte)247,(byte)151,(byte)3,(byte)255,(byte)25,
-      (byte)48,(byte)179,(byte)72,(byte)165,(byte)181,(byte)209,(byte)215,
-      (byte)94,(byte)146,(byte)42,(byte)172,(byte)86,(byte)170,(byte)198,
-      (byte)79,(byte)184,(byte)56,(byte)210,(byte)150,(byte)164,(byte)125,
-      (byte)182,(byte)118,(byte)252,(byte)107,(byte)226,(byte)156,(byte)116,
-      (byte)4,(byte)241,(byte)69,(byte)157,(byte)112,(byte)89,(byte)100,
-      (byte)113,(byte)135,(byte)32,(byte)134,(byte)91,(byte)207,(byte)101,
-      (byte)230,(byte)45,(byte)168,(byte)2,(byte)27,(byte)96,(byte)37,
-      (byte)173,(byte)174,(byte)176,(byte)185,(byte)246,(byte)28,(byte)70,
-      (byte)97,(byte)105,(byte)52,(byte)64,(byte)126,(byte)15,(byte)85,
-      (byte)71,(byte)163,(byte)35,(byte)221,(byte)81,(byte)175,(byte)58,
-      (byte)195,(byte)92,(byte)249,(byte)206,(byte)186,(byte)197,(byte)234,
-      (byte)38,(byte)44,(byte)83,(byte)13,(byte)110,(byte)133,(byte)40,
-      (byte)132, 9,(byte)211,(byte)223,(byte)205,(byte)244,(byte)65,
-      (byte)129,(byte)77,(byte)82,(byte)106,(byte)220,(byte)55,(byte)200,
-      (byte)108,(byte)193,(byte)171,(byte)250,(byte)36,(byte)225,(byte)123,
-      (byte)8,(byte)12,(byte)189,(byte)177,(byte)74,(byte)120,(byte)136,
-      (byte)149,(byte)139,(byte)227,(byte)99,(byte)232,(byte)109,(byte)233,
-      (byte)203,(byte)213,(byte)254,(byte)59,(byte)0,(byte)29,(byte)57,
-      (byte)242,(byte)239,(byte)183,(byte)14,(byte)102,(byte)88,(byte)208,
-      (byte)228,(byte)166,(byte)119,(byte)114,(byte)248,(byte)235,(byte)117,
-      (byte)75,(byte)10,(byte)49,(byte)68,(byte)80,(byte)180,(byte)143,
-      (byte)237,(byte)31,(byte)26,(byte)219,(byte)153,(byte)141,(byte)51,
-      (byte)159,(byte)17,(byte)131,(byte)20
-    };
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/digests/MD4Digest.java b/azureus2/src/org/bouncycastle/crypto/digests/MD4Digest.java
deleted file mode 100644
index 4a482e2..0000000
--- a/azureus2/src/org/bouncycastle/crypto/digests/MD4Digest.java
+++ /dev/null
@@ -1,270 +0,0 @@
-package org.bouncycastle.crypto.digests;
-
-
-/**
- * implementation of MD4 as RFC 1320 by R. Rivest, MIT Laboratory for
- * Computer Science and RSA Data Security, Inc.
- * <p>
- * <b>NOTE</b>: This algorithm is only included for backwards compatability
- * with legacy applications, it's not secure, don't use it for anything new!
- */
-public class MD4Digest
-    extends GeneralDigest
-{
-    private static final int    DIGEST_LENGTH = 16;
-
-    private int     H1, H2, H3, H4;         // IV's
-
-    private int[]   X = new int[16];
-    private int     xOff;
-
-	/**
-	 * Standard constructor
-	 */
-    public MD4Digest()
-    {
-        reset();
-    }
-
-	/**
-	 * Copy constructor.  This will copy the state of the provided
-	 * message digest.
-	 */
-	public MD4Digest(MD4Digest t)
-	{
-		super(t);
-
-		H1 = t.H1;
-		H2 = t.H2;
-		H3 = t.H3;
-		H4 = t.H4;
-
-		System.arraycopy(t.X, 0, X, 0, t.X.length);
-		xOff = t.xOff;
-	}
-
-    public String getAlgorithmName()
-    {
-        return "MD4";
-    }
-
-    public int getDigestSize()
-    {
-        return DIGEST_LENGTH;
-    }
-
-    protected void processWord(
-        byte[]  in,
-        int     inOff)
-    {
-        X[xOff++] = (in[inOff] & 0xff) | ((in[inOff + 1] & 0xff) << 8)
-            | ((in[inOff + 2] & 0xff) << 16) | ((in[inOff + 3] & 0xff) << 24); 
-
-        if (xOff == 16)
-        {
-            processBlock();
-        }
-    }
-
-    protected void processLength(
-        long    bitLength)
-    {
-        if (xOff > 14)
-        {
-            processBlock();
-        }
-
-        X[14] = (int)(bitLength & 0xffffffff);
-        X[15] = (int)(bitLength >>> 32);
-    }
-
-    private void unpackWord(
-        int     word,
-        byte[]  out,
-        int     outOff)
-    {
-        out[outOff]     = (byte)word;
-        out[outOff + 1] = (byte)(word >>> 8);
-        out[outOff + 2] = (byte)(word >>> 16);
-        out[outOff + 3] = (byte)(word >>> 24);
-    }
-
-    public int doFinal(
-        byte[]  out,
-        int     outOff)
-    {
-        finish();
-
-        unpackWord(H1, out, outOff);
-        unpackWord(H2, out, outOff + 4);
-        unpackWord(H3, out, outOff + 8);
-        unpackWord(H4, out, outOff + 12);
-
-        reset();
-
-        return DIGEST_LENGTH;
-    }
-
-    /**
-     * reset the chaining variables to the IV values.
-     */
-    public void reset()
-    {
-        super.reset();
-
-        H1 = 0x67452301;
-        H2 = 0xefcdab89;
-        H3 = 0x98badcfe;
-        H4 = 0x10325476;
-
-        xOff = 0;
-
-        for (int i = 0; i != X.length; i++)
-        {
-            X[i] = 0;
-        }
-    }
-
-    //
-    // round 1 left rotates
-    //
-    private static final int S11 = 3;
-    private static final int S12 = 7;
-    private static final int S13 = 11;
-    private static final int S14 = 19;
-
-    //
-    // round 2 left rotates
-    //
-    private static final int S21 = 3;
-    private static final int S22 = 5;
-    private static final int S23 = 9;
-    private static final int S24 = 13;
-
-    //
-    // round 3 left rotates
-    //
-    private static final int S31 = 3;
-    private static final int S32 = 9;
-    private static final int S33 = 11;
-    private static final int S34 = 15;
-
-    /*
-     * rotate int x left n bits.
-     */
-    private int rotateLeft(
-        int x,
-        int n)
-    {
-        return (x << n) | (x >>> (32 - n));
-    }
-
-    /*
-     * F, G, H and I are the basic MD4 functions.
-     */
-    private int F(
-        int u,
-        int v,
-        int w)
-    {
-        return (u & v) | (~u & w);
-    }
-
-    private int G(
-        int u,
-        int v,
-        int w)
-    {
-        return (u & v) | (u & w) | (v & w);
-    }
-
-    private int H(
-        int u,
-        int v,
-        int w)
-    {
-        return u ^ v ^ w;
-    }
-
-    protected void processBlock()
-    {
-        int a = H1;
-        int b = H2;
-        int c = H3;
-        int d = H4;
-
-        //
-        // Round 1 - F cycle, 16 times.
-        //
-        a = rotateLeft((a + F(b, c, d) + X[ 0]), S11);
-        d = rotateLeft((d + F(a, b, c) + X[ 1]), S12);
-        c = rotateLeft((c + F(d, a, b) + X[ 2]), S13);
-        b = rotateLeft((b + F(c, d, a) + X[ 3]), S14);
-        a = rotateLeft((a + F(b, c, d) + X[ 4]), S11);
-        d = rotateLeft((d + F(a, b, c) + X[ 5]), S12);
-        c = rotateLeft((c + F(d, a, b) + X[ 6]), S13);
-        b = rotateLeft((b + F(c, d, a) + X[ 7]), S14);
-        a = rotateLeft((a + F(b, c, d) + X[ 8]), S11);
-        d = rotateLeft((d + F(a, b, c) + X[ 9]), S12);
-        c = rotateLeft((c + F(d, a, b) + X[10]), S13);
-        b = rotateLeft((b + F(c, d, a) + X[11]), S14);
-        a = rotateLeft((a + F(b, c, d) + X[12]), S11);
-        d = rotateLeft((d + F(a, b, c) + X[13]), S12);
-        c = rotateLeft((c + F(d, a, b) + X[14]), S13);
-        b = rotateLeft((b + F(c, d, a) + X[15]), S14);
-
-        //
-        // Round 2 - G cycle, 16 times.
-        //
-        a = rotateLeft((a + G(b, c, d) + X[ 0] + 0x5a827999), S21);
-        d = rotateLeft((d + G(a, b, c) + X[ 4] + 0x5a827999), S22);
-        c = rotateLeft((c + G(d, a, b) + X[ 8] + 0x5a827999), S23);
-        b = rotateLeft((b + G(c, d, a) + X[12] + 0x5a827999), S24);
-        a = rotateLeft((a + G(b, c, d) + X[ 1] + 0x5a827999), S21);
-        d = rotateLeft((d + G(a, b, c) + X[ 5] + 0x5a827999), S22);
-        c = rotateLeft((c + G(d, a, b) + X[ 9] + 0x5a827999), S23);
-        b = rotateLeft((b + G(c, d, a) + X[13] + 0x5a827999), S24);
-        a = rotateLeft((a + G(b, c, d) + X[ 2] + 0x5a827999), S21);
-        d = rotateLeft((d + G(a, b, c) + X[ 6] + 0x5a827999), S22);
-        c = rotateLeft((c + G(d, a, b) + X[10] + 0x5a827999), S23);
-        b = rotateLeft((b + G(c, d, a) + X[14] + 0x5a827999), S24);
-        a = rotateLeft((a + G(b, c, d) + X[ 3] + 0x5a827999), S21);
-        d = rotateLeft((d + G(a, b, c) + X[ 7] + 0x5a827999), S22);
-        c = rotateLeft((c + G(d, a, b) + X[11] + 0x5a827999), S23);
-        b = rotateLeft((b + G(c, d, a) + X[15] + 0x5a827999), S24);
-
-        //
-        // Round 3 - H cycle, 16 times.
-        //
-        a = rotateLeft((a + H(b, c, d) + X[ 0] + 0x6ed9eba1), S31);
-        d = rotateLeft((d + H(a, b, c) + X[ 8] + 0x6ed9eba1), S32);
-        c = rotateLeft((c + H(d, a, b) + X[ 4] + 0x6ed9eba1), S33);
-        b = rotateLeft((b + H(c, d, a) + X[12] + 0x6ed9eba1), S34);
-        a = rotateLeft((a + H(b, c, d) + X[ 2] + 0x6ed9eba1), S31);
-        d = rotateLeft((d + H(a, b, c) + X[10] + 0x6ed9eba1), S32);
-        c = rotateLeft((c + H(d, a, b) + X[ 6] + 0x6ed9eba1), S33);
-        b = rotateLeft((b + H(c, d, a) + X[14] + 0x6ed9eba1), S34);
-        a = rotateLeft((a + H(b, c, d) + X[ 1] + 0x6ed9eba1), S31);
-        d = rotateLeft((d + H(a, b, c) + X[ 9] + 0x6ed9eba1), S32);
-        c = rotateLeft((c + H(d, a, b) + X[ 5] + 0x6ed9eba1), S33);
-        b = rotateLeft((b + H(c, d, a) + X[13] + 0x6ed9eba1), S34);
-        a = rotateLeft((a + H(b, c, d) + X[ 3] + 0x6ed9eba1), S31);
-        d = rotateLeft((d + H(a, b, c) + X[11] + 0x6ed9eba1), S32);
-        c = rotateLeft((c + H(d, a, b) + X[ 7] + 0x6ed9eba1), S33);
-        b = rotateLeft((b + H(c, d, a) + X[15] + 0x6ed9eba1), S34);
-
-        H1 += a;
-        H2 += b;
-        H3 += c;
-        H4 += d;
-
-        //
-        // reset the offset and clean out the word buffer.
-        //
-        xOff = 0;
-        for (int i = 0; i != X.length; i++)
-        {
-            X[i] = 0;
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/digests/MD5Digest.java b/azureus2/src/org/bouncycastle/crypto/digests/MD5Digest.java
deleted file mode 100644
index c21461a..0000000
--- a/azureus2/src/org/bouncycastle/crypto/digests/MD5Digest.java
+++ /dev/null
@@ -1,302 +0,0 @@
-package org.bouncycastle.crypto.digests;
-
-
-/**
- * implementation of MD5 as outlined in "Handbook of Applied Cryptography", pages 346 - 347.
- */
-public class MD5Digest
-    extends GeneralDigest
-{
-    private static final int    DIGEST_LENGTH = 16;
-
-    private int     H1, H2, H3, H4;         // IV's
-
-    private int[]   X = new int[16];
-    private int     xOff;
-
-	/**
-	 * Standard constructor
-	 */
-    public MD5Digest()
-    {
-        reset();
-    }
-
-	/**
-	 * Copy constructor.  This will copy the state of the provided
-	 * message digest.
-	 */
-	public MD5Digest(MD5Digest t)
-	{
-		super(t);
-
-		H1 = t.H1;
-		H2 = t.H2;
-		H3 = t.H3;
-		H4 = t.H4;
-
-		System.arraycopy(t.X, 0, X, 0, t.X.length);
-		xOff = t.xOff;
-	}
-
-    public String getAlgorithmName()
-    {
-        return "MD5";
-    }
-
-    public int getDigestSize()
-    {
-        return DIGEST_LENGTH;
-    }
-
-    protected void processWord(
-        byte[]  in,
-        int     inOff)
-    {
-        X[xOff++] = (in[inOff] & 0xff) | ((in[inOff + 1] & 0xff) << 8)
-            | ((in[inOff + 2] & 0xff) << 16) | ((in[inOff + 3] & 0xff) << 24); 
-
-        if (xOff == 16)
-        {
-            processBlock();
-        }
-    }
-
-    protected void processLength(
-        long    bitLength)
-    {
-        if (xOff > 14)
-        {
-            processBlock();
-        }
-
-        X[14] = (int)(bitLength & 0xffffffff);
-        X[15] = (int)(bitLength >>> 32);
-    }
-
-    private void unpackWord(
-        int     word,
-        byte[]  out,
-        int     outOff)
-    {
-        out[outOff]     = (byte)word;
-        out[outOff + 1] = (byte)(word >>> 8);
-        out[outOff + 2] = (byte)(word >>> 16);
-        out[outOff + 3] = (byte)(word >>> 24);
-    }
-
-    public int doFinal(
-        byte[]  out,
-        int     outOff)
-    {
-        finish();
-
-        unpackWord(H1, out, outOff);
-        unpackWord(H2, out, outOff + 4);
-        unpackWord(H3, out, outOff + 8);
-        unpackWord(H4, out, outOff + 12);
-
-        reset();
-
-        return DIGEST_LENGTH;
-    }
-
-    /**
-     * reset the chaining variables to the IV values.
-     */
-    public void reset()
-    {
-        super.reset();
-
-        H1 = 0x67452301;
-        H2 = 0xefcdab89;
-        H3 = 0x98badcfe;
-        H4 = 0x10325476;
-
-        xOff = 0;
-
-        for (int i = 0; i != X.length; i++)
-        {
-            X[i] = 0;
-        }
-    }
-
-    //
-    // round 1 left rotates
-    //
-    private static final int S11 = 7;
-    private static final int S12 = 12;
-    private static final int S13 = 17;
-    private static final int S14 = 22;
-
-    //
-    // round 2 left rotates
-    //
-    private static final int S21 = 5;
-    private static final int S22 = 9;
-    private static final int S23 = 14;
-    private static final int S24 = 20;
-
-    //
-    // round 3 left rotates
-    //
-    private static final int S31 = 4;
-    private static final int S32 = 11;
-    private static final int S33 = 16;
-    private static final int S34 = 23;
-
-    //
-    // round 4 left rotates
-    //
-    private static final int S41 = 6;
-    private static final int S42 = 10;
-    private static final int S43 = 15;
-    private static final int S44 = 21;
-
-    /*
-     * rotate int x left n bits.
-     */
-    private int rotateLeft(
-        int x,
-        int n)
-    {
-        return (x << n) | (x >>> (32 - n));
-    }
-
-    /*
-     * F, G, H and I are the basic MD5 functions.
-     */
-    private int F(
-        int u,
-        int v,
-        int w)
-    {
-        return (u & v) | (~u & w);
-    }
-
-    private int G(
-        int u,
-        int v,
-        int w)
-    {
-        return (u & w) | (v & ~w);
-    }
-
-    private int H(
-        int u,
-        int v,
-        int w)
-    {
-        return u ^ v ^ w;
-    }
-
-    private int K(
-        int u,
-        int v,
-        int w)
-    {
-        return v ^ (u | ~w);
-    }
-
-    protected void processBlock()
-    {
-        int a = H1;
-        int b = H2;
-        int c = H3;
-        int d = H4;
-
-        //
-        // Round 1 - F cycle, 16 times.
-        //
-        a = rotateLeft((a + F(b, c, d) + X[ 0] + 0xd76aa478), S11) + b;
-        d = rotateLeft((d + F(a, b, c) + X[ 1] + 0xe8c7b756), S12) + a;
-        c = rotateLeft((c + F(d, a, b) + X[ 2] + 0x242070db), S13) + d;
-        b = rotateLeft((b + F(c, d, a) + X[ 3] + 0xc1bdceee), S14) + c;
-        a = rotateLeft((a + F(b, c, d) + X[ 4] + 0xf57c0faf), S11) + b;
-        d = rotateLeft((d + F(a, b, c) + X[ 5] + 0x4787c62a), S12) + a;
-        c = rotateLeft((c + F(d, a, b) + X[ 6] + 0xa8304613), S13) + d;
-        b = rotateLeft((b + F(c, d, a) + X[ 7] + 0xfd469501), S14) + c;
-        a = rotateLeft((a + F(b, c, d) + X[ 8] + 0x698098d8), S11) + b;
-        d = rotateLeft((d + F(a, b, c) + X[ 9] + 0x8b44f7af), S12) + a;
-        c = rotateLeft((c + F(d, a, b) + X[10] + 0xffff5bb1), S13) + d;
-        b = rotateLeft((b + F(c, d, a) + X[11] + 0x895cd7be), S14) + c;
-        a = rotateLeft((a + F(b, c, d) + X[12] + 0x6b901122), S11) + b;
-        d = rotateLeft((d + F(a, b, c) + X[13] + 0xfd987193), S12) + a;
-        c = rotateLeft((c + F(d, a, b) + X[14] + 0xa679438e), S13) + d;
-        b = rotateLeft((b + F(c, d, a) + X[15] + 0x49b40821), S14) + c;
-
-        //
-        // Round 2 - G cycle, 16 times.
-        //
-        a = rotateLeft((a + G(b, c, d) + X[ 1] + 0xf61e2562), S21) + b;
-        d = rotateLeft((d + G(a, b, c) + X[ 6] + 0xc040b340), S22) + a;
-        c = rotateLeft((c + G(d, a, b) + X[11] + 0x265e5a51), S23) + d;
-        b = rotateLeft((b + G(c, d, a) + X[ 0] + 0xe9b6c7aa), S24) + c;
-        a = rotateLeft((a + G(b, c, d) + X[ 5] + 0xd62f105d), S21) + b;
-        d = rotateLeft((d + G(a, b, c) + X[10] + 0x02441453), S22) + a;
-        c = rotateLeft((c + G(d, a, b) + X[15] + 0xd8a1e681), S23) + d;
-        b = rotateLeft((b + G(c, d, a) + X[ 4] + 0xe7d3fbc8), S24) + c;
-        a = rotateLeft((a + G(b, c, d) + X[ 9] + 0x21e1cde6), S21) + b;
-        d = rotateLeft((d + G(a, b, c) + X[14] + 0xc33707d6), S22) + a;
-        c = rotateLeft((c + G(d, a, b) + X[ 3] + 0xf4d50d87), S23) + d;
-        b = rotateLeft((b + G(c, d, a) + X[ 8] + 0x455a14ed), S24) + c;
-        a = rotateLeft((a + G(b, c, d) + X[13] + 0xa9e3e905), S21) + b;
-        d = rotateLeft((d + G(a, b, c) + X[ 2] + 0xfcefa3f8), S22) + a;
-        c = rotateLeft((c + G(d, a, b) + X[ 7] + 0x676f02d9), S23) + d;
-        b = rotateLeft((b + G(c, d, a) + X[12] + 0x8d2a4c8a), S24) + c;
-
-        //
-        // Round 3 - H cycle, 16 times.
-        //
-        a = rotateLeft((a + H(b, c, d) + X[ 5] + 0xfffa3942), S31) + b;
-        d = rotateLeft((d + H(a, b, c) + X[ 8] + 0x8771f681), S32) + a;
-        c = rotateLeft((c + H(d, a, b) + X[11] + 0x6d9d6122), S33) + d;
-        b = rotateLeft((b + H(c, d, a) + X[14] + 0xfde5380c), S34) + c;
-        a = rotateLeft((a + H(b, c, d) + X[ 1] + 0xa4beea44), S31) + b;
-        d = rotateLeft((d + H(a, b, c) + X[ 4] + 0x4bdecfa9), S32) + a;
-        c = rotateLeft((c + H(d, a, b) + X[ 7] + 0xf6bb4b60), S33) + d;
-        b = rotateLeft((b + H(c, d, a) + X[10] + 0xbebfbc70), S34) + c;
-        a = rotateLeft((a + H(b, c, d) + X[13] + 0x289b7ec6), S31) + b;
-        d = rotateLeft((d + H(a, b, c) + X[ 0] + 0xeaa127fa), S32) + a;
-        c = rotateLeft((c + H(d, a, b) + X[ 3] + 0xd4ef3085), S33) + d;
-        b = rotateLeft((b + H(c, d, a) + X[ 6] + 0x04881d05), S34) + c;
-        a = rotateLeft((a + H(b, c, d) + X[ 9] + 0xd9d4d039), S31) + b;
-        d = rotateLeft((d + H(a, b, c) + X[12] + 0xe6db99e5), S32) + a;
-        c = rotateLeft((c + H(d, a, b) + X[15] + 0x1fa27cf8), S33) + d;
-        b = rotateLeft((b + H(c, d, a) + X[ 2] + 0xc4ac5665), S34) + c;
-
-        //
-        // Round 4 - K cycle, 16 times.
-        //
-        a = rotateLeft((a + K(b, c, d) + X[ 0] + 0xf4292244), S41) + b;
-        d = rotateLeft((d + K(a, b, c) + X[ 7] + 0x432aff97), S42) + a;
-        c = rotateLeft((c + K(d, a, b) + X[14] + 0xab9423a7), S43) + d;
-        b = rotateLeft((b + K(c, d, a) + X[ 5] + 0xfc93a039), S44) + c;
-        a = rotateLeft((a + K(b, c, d) + X[12] + 0x655b59c3), S41) + b;
-        d = rotateLeft((d + K(a, b, c) + X[ 3] + 0x8f0ccc92), S42) + a;
-        c = rotateLeft((c + K(d, a, b) + X[10] + 0xffeff47d), S43) + d;
-        b = rotateLeft((b + K(c, d, a) + X[ 1] + 0x85845dd1), S44) + c;
-        a = rotateLeft((a + K(b, c, d) + X[ 8] + 0x6fa87e4f), S41) + b;
-        d = rotateLeft((d + K(a, b, c) + X[15] + 0xfe2ce6e0), S42) + a;
-        c = rotateLeft((c + K(d, a, b) + X[ 6] + 0xa3014314), S43) + d;
-        b = rotateLeft((b + K(c, d, a) + X[13] + 0x4e0811a1), S44) + c;
-        a = rotateLeft((a + K(b, c, d) + X[ 4] + 0xf7537e82), S41) + b;
-        d = rotateLeft((d + K(a, b, c) + X[11] + 0xbd3af235), S42) + a;
-        c = rotateLeft((c + K(d, a, b) + X[ 2] + 0x2ad7d2bb), S43) + d;
-        b = rotateLeft((b + K(c, d, a) + X[ 9] + 0xeb86d391), S44) + c;
-
-        H1 += a;
-        H2 += b;
-        H3 += c;
-        H4 += d;
-
-        //
-        // reset the offset and clean out the word buffer.
-        //
-        xOff = 0;
-        for (int i = 0; i != X.length; i++)
-        {
-            X[i] = 0;
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/digests/RIPEMD128Digest.java b/azureus2/src/org/bouncycastle/crypto/digests/RIPEMD128Digest.java
deleted file mode 100644
index 00195a4..0000000
--- a/azureus2/src/org/bouncycastle/crypto/digests/RIPEMD128Digest.java
+++ /dev/null
@@ -1,461 +0,0 @@
-package org.bouncycastle.crypto.digests;
-
-
-/**
- * implementation of RIPEMD128
- */
-public class RIPEMD128Digest
-    extends GeneralDigest
-{
-	private static final int DIGEST_LENGTH = 16;
-
-	private int H0, H1, H2, H3; // IV's
-
-	private int[] X = new int[16];
-	private int xOff;
-
-	/**
-	 * Standard constructor
-	 */
-	public RIPEMD128Digest()
-	{
-		reset();
-	}
-
-	/**
-	 * Copy constructor.  This will copy the state of the provided
-	 * message digest.
-	 */
-	public RIPEMD128Digest(RIPEMD128Digest t)
-	{
-		super(t);
-
-		H0 = t.H0;
-		H1 = t.H1;
-		H2 = t.H2;
-		H3 = t.H3;
-
-		System.arraycopy(t.X, 0, X, 0, t.X.length);
-		xOff = t.xOff;
-	}
-
-	public String getAlgorithmName()
-	{
-		return "RIPEMD128";
-	}
-
-	public int getDigestSize()
-	{
-		return DIGEST_LENGTH;
-	}
-
-	protected void processWord(
-		byte[] in,
-		int inOff)
-	{
-		X[xOff++] = (in[inOff] & 0xff) | ((in[inOff + 1] & 0xff) << 8)
-			| ((in[inOff + 2] & 0xff) << 16) | ((in[inOff + 3] & 0xff) << 24); 
-
-		if (xOff == 16)
-		{
-			processBlock();
-		}
-	}
-
-	protected void processLength(
-		long bitLength)
-	{
-		if (xOff > 14)
-		{
-		processBlock();
-		}
-
-		X[14] = (int)(bitLength & 0xffffffff);
-		X[15] = (int)(bitLength >>> 32);
-	}
-
-	private void unpackWord(
-		int word,
-		byte[] out,
-		int outOff)
-	{
-		out[outOff]     = (byte)word;
-		out[outOff + 1] = (byte)(word >>> 8);
-		out[outOff + 2] = (byte)(word >>> 16);
-		out[outOff + 3] = (byte)(word >>> 24);
-	}
-
-	public int doFinal(
-		byte[] out,
-		int outOff)
-	{
-		finish();
-
-		unpackWord(H0, out, outOff);
-		unpackWord(H1, out, outOff + 4);
-		unpackWord(H2, out, outOff + 8);
-		unpackWord(H3, out, outOff + 12);
-
-		reset();
-
-		return DIGEST_LENGTH;
-	}
-
-	/**
-	* reset the chaining variables to the IV values.
-	*/
-	public void reset()
-	{
-		super.reset();
-
-		H0 = 0x67452301;
-		H1 = 0xefcdab89;
-		H2 = 0x98badcfe;
-		H3 = 0x10325476;
-
-		xOff = 0;
-
-		for (int i = 0; i != X.length; i++)
-		{
-			X[i] = 0;
-		}
-	}
-
-	/*
-	 * rotate int x left n bits.
-	 */
-	private final int RL(
-		int x,
-		int n)
-	{
-		return (x << n) | (x >>> (32 - n));
-	}
-
-	/*
-	 * f1,f2,f3,f4 are the basic RIPEMD128 functions.
-	 */
-
-	/*
-	 * F
-	 */
-	private final int f1(
-		int x,
-		int y,
-		int z)
-	{
-		return x ^ y ^ z;
-	}
-
-	/*
-	 * G
-	 */
-	private final int f2(
-		int x,
-		int y,
-		int z)
-	{
-		return (x & y) | (~x & z);
-	}
-
-	/*
-	 * H
-	 */
-	private final int f3(
-		int x,
-		int y,
-		int z)
-	{
-		return (x | ~y) ^ z;
-	}
-
-	/*
-	 * I
-	 */
-	private final int f4(
-		int x,
-		int y,
-		int z)
-	{
-		return (x & z) | (y & ~z);
-	}
-
-    private final int F1(
-        int a,
-        int b,
-        int c,
-        int d,
-        int x,
-        int s)
-    {
-        return RL(a + f1(b, c, d) + x, s);
-    }
-
-    private final int F2(
-        int a,
-        int b,
-        int c,
-        int d,
-        int x,
-        int s)
-    {
-        return RL(a + f2(b, c, d) + x + 0x5a827999, s);
-    }
-
-    private final int F3(
-        int a,
-        int b,
-        int c,
-        int d,
-        int x,
-        int s)
-    {
-        return RL(a + f3(b, c, d) + x + 0x6ed9eba1, s);
-    }
-
-    private final int F4(
-        int a,
-        int b,
-        int c,
-        int d,
-        int x,
-        int s)
-    {
-        return RL(a + f4(b, c, d) + x + 0x8f1bbcdc, s);
-    }
-
-    private final int FF1(
-        int a,
-        int b,
-        int c,
-        int d,
-        int x,
-        int s)
-    {
-        return RL(a + f1(b, c, d) + x, s);
-    }
-
-    private final int FF2(
-        int a,
-        int b,
-        int c,
-        int d,
-        int x,
-        int s)
-    {
-      return RL(a + f2(b, c, d) + x + 0x6d703ef3, s);
-    }
-
-    private final int FF3(
-        int a,
-        int b,
-        int c,
-        int d,
-        int x,
-        int s)
-    {
-      return RL(a + f3(b, c, d) + x + 0x5c4dd124, s);
-    }
-
-    private final int FF4(
-        int a,
-        int b,
-        int c,
-        int d,
-        int x,
-        int s)
-    {
-      return RL(a + f4(b, c, d) + x + 0x50a28be6, s);
-    }
-
-	protected void processBlock()
-	{
-		int a, aa;
-		int b, bb;
-		int c, cc;
-		int d, dd;
-
-		a = aa = H0;
-		b = bb = H1;
-		c = cc = H2;
-		d = dd = H3;
-
-		//
-		// Round 1
-		//
-        a = F1(a, b, c, d, X[ 0], 11);
-        d = F1(d, a, b, c, X[ 1], 14);
-        c = F1(c, d, a, b, X[ 2], 15);
-        b = F1(b, c, d, a, X[ 3], 12);
-        a = F1(a, b, c, d, X[ 4],  5);
-        d = F1(d, a, b, c, X[ 5],  8);
-        c = F1(c, d, a, b, X[ 6],  7);
-        b = F1(b, c, d, a, X[ 7],  9);
-        a = F1(a, b, c, d, X[ 8], 11);
-        d = F1(d, a, b, c, X[ 9], 13);
-        c = F1(c, d, a, b, X[10], 14);
-        b = F1(b, c, d, a, X[11], 15);
-        a = F1(a, b, c, d, X[12],  6);
-        d = F1(d, a, b, c, X[13],  7);
-        c = F1(c, d, a, b, X[14],  9);
-        b = F1(b, c, d, a, X[15],  8);
-
-		//
-		// Round 2
-		//
-        a = F2(a, b, c, d, X[ 7],  7);
-        d = F2(d, a, b, c, X[ 4],  6);
-        c = F2(c, d, a, b, X[13],  8);
-        b = F2(b, c, d, a, X[ 1], 13);
-        a = F2(a, b, c, d, X[10], 11);
-        d = F2(d, a, b, c, X[ 6],  9);
-        c = F2(c, d, a, b, X[15],  7);
-        b = F2(b, c, d, a, X[ 3], 15);
-        a = F2(a, b, c, d, X[12],  7);
-        d = F2(d, a, b, c, X[ 0], 12);
-        c = F2(c, d, a, b, X[ 9], 15);
-        b = F2(b, c, d, a, X[ 5],  9);
-        a = F2(a, b, c, d, X[ 2], 11);
-        d = F2(d, a, b, c, X[14],  7);
-        c = F2(c, d, a, b, X[11], 13);
-        b = F2(b, c, d, a, X[ 8], 12);
-
-        //
-        // Round 3
-        //
-        a = F3(a, b, c, d, X[ 3], 11);
-        d = F3(d, a, b, c, X[10], 13);
-        c = F3(c, d, a, b, X[14],  6);
-        b = F3(b, c, d, a, X[ 4],  7);
-        a = F3(a, b, c, d, X[ 9], 14);
-        d = F3(d, a, b, c, X[15],  9);
-        c = F3(c, d, a, b, X[ 8], 13);
-        b = F3(b, c, d, a, X[ 1], 15);
-        a = F3(a, b, c, d, X[ 2], 14);
-        d = F3(d, a, b, c, X[ 7],  8);
-        c = F3(c, d, a, b, X[ 0], 13);
-        b = F3(b, c, d, a, X[ 6],  6);
-        a = F3(a, b, c, d, X[13],  5);
-        d = F3(d, a, b, c, X[11], 12);
-        c = F3(c, d, a, b, X[ 5],  7);
-        b = F3(b, c, d, a, X[12],  5);
-
-        //
-        // Round 4
-        //
-        a = F4(a, b, c, d, X[ 1], 11);
-        d = F4(d, a, b, c, X[ 9], 12);
-        c = F4(c, d, a, b, X[11], 14);
-        b = F4(b, c, d, a, X[10], 15);
-        a = F4(a, b, c, d, X[ 0], 14);
-        d = F4(d, a, b, c, X[ 8], 15);
-        c = F4(c, d, a, b, X[12],  9);
-        b = F4(b, c, d, a, X[ 4],  8);
-        a = F4(a, b, c, d, X[13],  9);
-        d = F4(d, a, b, c, X[ 3], 14);
-        c = F4(c, d, a, b, X[ 7],  5);
-        b = F4(b, c, d, a, X[15],  6);
-        a = F4(a, b, c, d, X[14],  8);
-        d = F4(d, a, b, c, X[ 5],  6);
-        c = F4(c, d, a, b, X[ 6],  5);
-        b = F4(b, c, d, a, X[ 2], 12);
-
-        //
-        // Parallel round 1
-        //
-        aa = FF4(aa, bb, cc, dd, X[ 5],  8);
-        dd = FF4(dd, aa, bb, cc, X[14],  9);
-        cc = FF4(cc, dd, aa, bb, X[ 7],  9);
-        bb = FF4(bb, cc, dd, aa, X[ 0], 11);
-        aa = FF4(aa, bb, cc, dd, X[ 9], 13);
-        dd = FF4(dd, aa, bb, cc, X[ 2], 15);
-        cc = FF4(cc, dd, aa, bb, X[11], 15);
-        bb = FF4(bb, cc, dd, aa, X[ 4],  5);
-        aa = FF4(aa, bb, cc, dd, X[13],  7);
-        dd = FF4(dd, aa, bb, cc, X[ 6],  7);
-        cc = FF4(cc, dd, aa, bb, X[15],  8);
-        bb = FF4(bb, cc, dd, aa, X[ 8], 11);
-        aa = FF4(aa, bb, cc, dd, X[ 1], 14);
-        dd = FF4(dd, aa, bb, cc, X[10], 14);
-        cc = FF4(cc, dd, aa, bb, X[ 3], 12);
-        bb = FF4(bb, cc, dd, aa, X[12],  6);
-
-        //
-        // Parallel round 2
-        //
-        aa = FF3(aa, bb, cc, dd, X[ 6],  9);
-        dd = FF3(dd, aa, bb, cc, X[11], 13);
-        cc = FF3(cc, dd, aa, bb, X[ 3], 15);
-        bb = FF3(bb, cc, dd, aa, X[ 7],  7);
-        aa = FF3(aa, bb, cc, dd, X[ 0], 12);
-        dd = FF3(dd, aa, bb, cc, X[13],  8);
-        cc = FF3(cc, dd, aa, bb, X[ 5],  9);
-        bb = FF3(bb, cc, dd, aa, X[10], 11);
-        aa = FF3(aa, bb, cc, dd, X[14],  7);
-        dd = FF3(dd, aa, bb, cc, X[15],  7);
-        cc = FF3(cc, dd, aa, bb, X[ 8], 12);
-        bb = FF3(bb, cc, dd, aa, X[12],  7);
-        aa = FF3(aa, bb, cc, dd, X[ 4],  6);
-        dd = FF3(dd, aa, bb, cc, X[ 9], 15);
-        cc = FF3(cc, dd, aa, bb, X[ 1], 13);
-        bb = FF3(bb, cc, dd, aa, X[ 2], 11);
-
-        //
-        // Parallel round 3
-        //
-        aa = FF2(aa, bb, cc, dd, X[15],  9);
-        dd = FF2(dd, aa, bb, cc, X[ 5],  7);
-        cc = FF2(cc, dd, aa, bb, X[ 1], 15);
-        bb = FF2(bb, cc, dd, aa, X[ 3], 11);
-        aa = FF2(aa, bb, cc, dd, X[ 7],  8);
-        dd = FF2(dd, aa, bb, cc, X[14],  6);
-        cc = FF2(cc, dd, aa, bb, X[ 6],  6);
-        bb = FF2(bb, cc, dd, aa, X[ 9], 14);
-        aa = FF2(aa, bb, cc, dd, X[11], 12);
-        dd = FF2(dd, aa, bb, cc, X[ 8], 13);
-        cc = FF2(cc, dd, aa, bb, X[12],  5);
-        bb = FF2(bb, cc, dd, aa, X[ 2], 14);
-        aa = FF2(aa, bb, cc, dd, X[10], 13);
-        dd = FF2(dd, aa, bb, cc, X[ 0], 13);
-        cc = FF2(cc, dd, aa, bb, X[ 4],  7);
-        bb = FF2(bb, cc, dd, aa, X[13],  5);
-
-        //
-        // Parallel round 4
-        //
-        aa = FF1(aa, bb, cc, dd, X[ 8], 15);
-        dd = FF1(dd, aa, bb, cc, X[ 6],  5);
-        cc = FF1(cc, dd, aa, bb, X[ 4],  8);
-        bb = FF1(bb, cc, dd, aa, X[ 1], 11);
-        aa = FF1(aa, bb, cc, dd, X[ 3], 14);
-        dd = FF1(dd, aa, bb, cc, X[11], 14);
-        cc = FF1(cc, dd, aa, bb, X[15],  6);
-        bb = FF1(bb, cc, dd, aa, X[ 0], 14);
-        aa = FF1(aa, bb, cc, dd, X[ 5],  6);
-        dd = FF1(dd, aa, bb, cc, X[12],  9);
-        cc = FF1(cc, dd, aa, bb, X[ 2], 12);
-        bb = FF1(bb, cc, dd, aa, X[13],  9);
-        aa = FF1(aa, bb, cc, dd, X[ 9], 12);
-        dd = FF1(dd, aa, bb, cc, X[ 7],  5);
-        cc = FF1(cc, dd, aa, bb, X[10], 15);
-        bb = FF1(bb, cc, dd, aa, X[14],  8);
-
-        dd += c + H1;               // final result for H0
-
-        //
-        // combine the results
-        //
-        H1 = H2 + d + aa;
-        H2 = H3 + a + bb;
-        H3 = H0 + b + cc;
-        H0 = dd;
-
-		//
-		// reset the offset and clean out the word buffer.
-		//
-		xOff = 0;
-		for (int i = 0; i != X.length; i++)
-		{
-			X[i] = 0;
-		}
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/digests/RIPEMD160Digest.java b/azureus2/src/org/bouncycastle/crypto/digests/RIPEMD160Digest.java
deleted file mode 100644
index 377b7b7..0000000
--- a/azureus2/src/org/bouncycastle/crypto/digests/RIPEMD160Digest.java
+++ /dev/null
@@ -1,422 +0,0 @@
-package org.bouncycastle.crypto.digests;
-
-
-/**
- * implementation of RIPEMD see,
- * http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html
- */
-public class RIPEMD160Digest
-    extends GeneralDigest
-{
-	private static final int DIGEST_LENGTH = 20;
-
-	private int H0, H1, H2, H3, H4; // IV's
-
-	private int[] X = new int[16];
-	private int xOff;
-
-	/**
-	 * Standard constructor
-	 */
-	public RIPEMD160Digest()
-	{
-		reset();
-	}
-
-	/**
-	 * Copy constructor.  This will copy the state of the provided
-	 * message digest.
-	 */
-	public RIPEMD160Digest(RIPEMD160Digest t)
-	{
-		super(t);
-
-		H0 = t.H0;
-		H1 = t.H1;
-		H2 = t.H2;
-		H3 = t.H3;
-		H4 = t.H4;
-
-		System.arraycopy(t.X, 0, X, 0, t.X.length);
-		xOff = t.xOff;
-	}
-
-	public String getAlgorithmName()
-	{
-		return "RIPEMD160";
-	}
-
-	public int getDigestSize()
-	{
-		return DIGEST_LENGTH;
-	}
-
-	protected void processWord(
-		byte[] in,
-		int inOff)
-	{
-		X[xOff++] = (in[inOff] & 0xff) | ((in[inOff + 1] & 0xff) << 8)
-			| ((in[inOff + 2] & 0xff) << 16) | ((in[inOff + 3] & 0xff) << 24); 
-
-		if (xOff == 16)
-		{
-			processBlock();
-		}
-	}
-
-	protected void processLength(
-		long bitLength)
-	{
-		if (xOff > 14)
-		{
-		processBlock();
-		}
-
-		X[14] = (int)(bitLength & 0xffffffff);
-		X[15] = (int)(bitLength >>> 32);
-	}
-
-	private void unpackWord(
-		int word,
-		byte[] out,
-		int outOff)
-	{
-		out[outOff]     = (byte)word;
-		out[outOff + 1] = (byte)(word >>> 8);
-		out[outOff + 2] = (byte)(word >>> 16);
-		out[outOff + 3] = (byte)(word >>> 24);
-	}
-
-	public int doFinal(
-		byte[] out,
-		int outOff)
-	{
-		finish();
-
-		unpackWord(H0, out, outOff);
-		unpackWord(H1, out, outOff + 4);
-		unpackWord(H2, out, outOff + 8);
-		unpackWord(H3, out, outOff + 12);
-		unpackWord(H4, out, outOff + 16);
-
-		reset();
-
-		return DIGEST_LENGTH;
-	}
-
-	/**
-	* reset the chaining variables to the IV values.
-	*/
-	public void reset()
-	{
-		super.reset();
-
-		H0 = 0x67452301;
-		H1 = 0xefcdab89;
-		H2 = 0x98badcfe;
-		H3 = 0x10325476;
-		H4 = 0xc3d2e1f0;
-
-		xOff = 0;
-
-		for (int i = 0; i != X.length; i++)
-		{
-			X[i] = 0;
-		}
-	}
-
-	/*
-	 * rotate int x left n bits.
-	 */
-	private final int RL(
-		int x,
-		int n)
-	{
-		return (x << n) | (x >>> (32 - n));
-	}
-
-	/*
-	 * f1,f2,f3,f4,f5 are the basic RIPEMD160 functions.
-	 */
-
-	/*
-	 * rounds 0-15
-	 */
-	private final int f1(
-		int x,
-		int y,
-		int z)
-	{
-		return x ^ y ^ z;
-	}
-
-	/*
-	 * rounds 16-31
-	 */
-	private final int f2(
-		int x,
-		int y,
-		int z)
-	{
-		return (x & y) | (~x & z);
-	}
-
-	/*
-	 * rounds 32-47
-	 */
-	private final int f3(
-		int x,
-		int y,
-		int z)
-	{
-		return (x | ~y) ^ z;
-	}
-
-	/*
-	 * rounds 48-63
-	 */
-	private final int f4(
-		int x,
-		int y,
-		int z)
-	{
-		return (x & z) | (y & ~z);
-	}
-
-	/*
-	 * rounds 64-79
-	 */
-	private final int f5(
-		int x,
-		int y,
-		int z)
-	{
-		return x ^ (y | ~z);
-	}
-
-	protected void processBlock()
-	{
-		int a, aa;
-		int b, bb;
-		int c, cc;
-		int d, dd;
-		int e, ee;
-
-		a = aa = H0;
-		b = bb = H1;
-		c = cc = H2;
-		d = dd = H3;
-		e = ee = H4;
-
-		//
-		// Rounds 1 - 16
-		//
-		// left
-		a = RL(a + f1(b,c,d) + X[ 0], 11) + e; c = RL(c, 10);
-		e = RL(e + f1(a,b,c) + X[ 1], 14) + d; b = RL(b, 10);
-		d = RL(d + f1(e,a,b) + X[ 2], 15) + c; a = RL(a, 10);
-		c = RL(c + f1(d,e,a) + X[ 3], 12) + b; e = RL(e, 10);
-		b = RL(b + f1(c,d,e) + X[ 4],  5) + a; d = RL(d, 10);
-		a = RL(a + f1(b,c,d) + X[ 5],  8) + e; c = RL(c, 10);
-		e = RL(e + f1(a,b,c) + X[ 6],  7) + d; b = RL(b, 10);
-		d = RL(d + f1(e,a,b) + X[ 7],  9) + c; a = RL(a, 10);
-		c = RL(c + f1(d,e,a) + X[ 8], 11) + b; e = RL(e, 10);
-		b = RL(b + f1(c,d,e) + X[ 9], 13) + a; d = RL(d, 10);
-		a = RL(a + f1(b,c,d) + X[10], 14) + e; c = RL(c, 10);
-		e = RL(e + f1(a,b,c) + X[11], 15) + d; b = RL(b, 10);
-		d = RL(d + f1(e,a,b) + X[12],  6) + c; a = RL(a, 10);
-		c = RL(c + f1(d,e,a) + X[13],  7) + b; e = RL(e, 10);
-		b = RL(b + f1(c,d,e) + X[14],  9) + a; d = RL(d, 10);
-		a = RL(a + f1(b,c,d) + X[15],  8) + e; c = RL(c, 10);
-
-		// right
-		aa = RL(aa + f5(bb,cc,dd) + X[ 5] + 0x50a28be6,  8) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f5(aa,bb,cc) + X[14] + 0x50a28be6,  9) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f5(ee,aa,bb) + X[ 7] + 0x50a28be6,  9) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f5(dd,ee,aa) + X[ 0] + 0x50a28be6, 11) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f5(cc,dd,ee) + X[ 9] + 0x50a28be6, 13) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f5(bb,cc,dd) + X[ 2] + 0x50a28be6, 15) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f5(aa,bb,cc) + X[11] + 0x50a28be6, 15) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f5(ee,aa,bb) + X[ 4] + 0x50a28be6,  5) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f5(dd,ee,aa) + X[13] + 0x50a28be6,  7) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f5(cc,dd,ee) + X[ 6] + 0x50a28be6,  7) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f5(bb,cc,dd) + X[15] + 0x50a28be6,  8) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f5(aa,bb,cc) + X[ 8] + 0x50a28be6, 11) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f5(ee,aa,bb) + X[ 1] + 0x50a28be6, 14) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f5(dd,ee,aa) + X[10] + 0x50a28be6, 14) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f5(cc,dd,ee) + X[ 3] + 0x50a28be6, 12) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f5(bb,cc,dd) + X[12] + 0x50a28be6,  6) + ee; cc = RL(cc, 10);
-
-		//
-		// Rounds 16-31
-		//
-		// left
-		e = RL(e + f2(a,b,c) + X[ 7] + 0x5a827999,  7) + d; b = RL(b, 10);
-		d = RL(d + f2(e,a,b) + X[ 4] + 0x5a827999,  6) + c; a = RL(a, 10);
-		c = RL(c + f2(d,e,a) + X[13] + 0x5a827999,  8) + b; e = RL(e, 10);
-		b = RL(b + f2(c,d,e) + X[ 1] + 0x5a827999, 13) + a; d = RL(d, 10);
-		a = RL(a + f2(b,c,d) + X[10] + 0x5a827999, 11) + e; c = RL(c, 10);
-		e = RL(e + f2(a,b,c) + X[ 6] + 0x5a827999,  9) + d; b = RL(b, 10);
-		d = RL(d + f2(e,a,b) + X[15] + 0x5a827999,  7) + c; a = RL(a, 10);
-		c = RL(c + f2(d,e,a) + X[ 3] + 0x5a827999, 15) + b; e = RL(e, 10);
-		b = RL(b + f2(c,d,e) + X[12] + 0x5a827999,  7) + a; d = RL(d, 10);
-		a = RL(a + f2(b,c,d) + X[ 0] + 0x5a827999, 12) + e; c = RL(c, 10);
-		e = RL(e + f2(a,b,c) + X[ 9] + 0x5a827999, 15) + d; b = RL(b, 10);
-		d = RL(d + f2(e,a,b) + X[ 5] + 0x5a827999,  9) + c; a = RL(a, 10);
-		c = RL(c + f2(d,e,a) + X[ 2] + 0x5a827999, 11) + b; e = RL(e, 10);
-		b = RL(b + f2(c,d,e) + X[14] + 0x5a827999,  7) + a; d = RL(d, 10);
-		a = RL(a + f2(b,c,d) + X[11] + 0x5a827999, 13) + e; c = RL(c, 10);
-		e = RL(e + f2(a,b,c) + X[ 8] + 0x5a827999, 12) + d; b = RL(b, 10);
-
-		// right
-		ee = RL(ee + f4(aa,bb,cc) + X[ 6] + 0x5c4dd124,  9) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f4(ee,aa,bb) + X[11] + 0x5c4dd124, 13) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f4(dd,ee,aa) + X[ 3] + 0x5c4dd124, 15) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f4(cc,dd,ee) + X[ 7] + 0x5c4dd124,  7) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f4(bb,cc,dd) + X[ 0] + 0x5c4dd124, 12) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f4(aa,bb,cc) + X[13] + 0x5c4dd124,  8) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f4(ee,aa,bb) + X[ 5] + 0x5c4dd124,  9) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f4(dd,ee,aa) + X[10] + 0x5c4dd124, 11) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f4(cc,dd,ee) + X[14] + 0x5c4dd124,  7) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f4(bb,cc,dd) + X[15] + 0x5c4dd124,  7) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f4(aa,bb,cc) + X[ 8] + 0x5c4dd124, 12) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f4(ee,aa,bb) + X[12] + 0x5c4dd124,  7) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f4(dd,ee,aa) + X[ 4] + 0x5c4dd124,  6) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f4(cc,dd,ee) + X[ 9] + 0x5c4dd124, 15) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f4(bb,cc,dd) + X[ 1] + 0x5c4dd124, 13) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f4(aa,bb,cc) + X[ 2] + 0x5c4dd124, 11) + dd; bb = RL(bb, 10);
-
-		//
-		// Rounds 32-47
-		//
-		// left
-		d = RL(d + f3(e,a,b) + X[ 3] + 0x6ed9eba1, 11) + c; a = RL(a, 10);
-		c = RL(c + f3(d,e,a) + X[10] + 0x6ed9eba1, 13) + b; e = RL(e, 10);
-		b = RL(b + f3(c,d,e) + X[14] + 0x6ed9eba1,  6) + a; d = RL(d, 10);
-		a = RL(a + f3(b,c,d) + X[ 4] + 0x6ed9eba1,  7) + e; c = RL(c, 10);
-		e = RL(e + f3(a,b,c) + X[ 9] + 0x6ed9eba1, 14) + d; b = RL(b, 10);
-		d = RL(d + f3(e,a,b) + X[15] + 0x6ed9eba1,  9) + c; a = RL(a, 10);
-		c = RL(c + f3(d,e,a) + X[ 8] + 0x6ed9eba1, 13) + b; e = RL(e, 10);
-		b = RL(b + f3(c,d,e) + X[ 1] + 0x6ed9eba1, 15) + a; d = RL(d, 10);
-		a = RL(a + f3(b,c,d) + X[ 2] + 0x6ed9eba1, 14) + e; c = RL(c, 10);
-		e = RL(e + f3(a,b,c) + X[ 7] + 0x6ed9eba1,  8) + d; b = RL(b, 10);
-		d = RL(d + f3(e,a,b) + X[ 0] + 0x6ed9eba1, 13) + c; a = RL(a, 10);
-		c = RL(c + f3(d,e,a) + X[ 6] + 0x6ed9eba1,  6) + b; e = RL(e, 10);
-		b = RL(b + f3(c,d,e) + X[13] + 0x6ed9eba1,  5) + a; d = RL(d, 10);
-		a = RL(a + f3(b,c,d) + X[11] + 0x6ed9eba1, 12) + e; c = RL(c, 10);
-		e = RL(e + f3(a,b,c) + X[ 5] + 0x6ed9eba1,  7) + d; b = RL(b, 10);
-		d = RL(d + f3(e,a,b) + X[12] + 0x6ed9eba1,  5) + c; a = RL(a, 10);
-
-		// right
-		dd = RL(dd + f3(ee,aa,bb) + X[15] + 0x6d703ef3,  9) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f3(dd,ee,aa) + X[ 5] + 0x6d703ef3,  7) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f3(cc,dd,ee) + X[ 1] + 0x6d703ef3, 15) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f3(bb,cc,dd) + X[ 3] + 0x6d703ef3, 11) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f3(aa,bb,cc) + X[ 7] + 0x6d703ef3,  8) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f3(ee,aa,bb) + X[14] + 0x6d703ef3,  6) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f3(dd,ee,aa) + X[ 6] + 0x6d703ef3,  6) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f3(cc,dd,ee) + X[ 9] + 0x6d703ef3, 14) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f3(bb,cc,dd) + X[11] + 0x6d703ef3, 12) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f3(aa,bb,cc) + X[ 8] + 0x6d703ef3, 13) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f3(ee,aa,bb) + X[12] + 0x6d703ef3,  5) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f3(dd,ee,aa) + X[ 2] + 0x6d703ef3, 14) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f3(cc,dd,ee) + X[10] + 0x6d703ef3, 13) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f3(bb,cc,dd) + X[ 0] + 0x6d703ef3, 13) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f3(aa,bb,cc) + X[ 4] + 0x6d703ef3,  7) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f3(ee,aa,bb) + X[13] + 0x6d703ef3,  5) + cc; aa = RL(aa, 10);
-
-		//
-		// Rounds 48-63
-		//
-		// left
-		c = RL(c + f4(d,e,a) + X[ 1] + 0x8f1bbcdc, 11) + b; e = RL(e, 10);
-		b = RL(b + f4(c,d,e) + X[ 9] + 0x8f1bbcdc, 12) + a; d = RL(d, 10);
-		a = RL(a + f4(b,c,d) + X[11] + 0x8f1bbcdc, 14) + e; c = RL(c, 10);
-		e = RL(e + f4(a,b,c) + X[10] + 0x8f1bbcdc, 15) + d; b = RL(b, 10);
-		d = RL(d + f4(e,a,b) + X[ 0] + 0x8f1bbcdc, 14) + c; a = RL(a, 10);
-		c = RL(c + f4(d,e,a) + X[ 8] + 0x8f1bbcdc, 15) + b; e = RL(e, 10);
-		b = RL(b + f4(c,d,e) + X[12] + 0x8f1bbcdc,  9) + a; d = RL(d, 10);
-		a = RL(a + f4(b,c,d) + X[ 4] + 0x8f1bbcdc,  8) + e; c = RL(c, 10);
-		e = RL(e + f4(a,b,c) + X[13] + 0x8f1bbcdc,  9) + d; b = RL(b, 10);
-		d = RL(d + f4(e,a,b) + X[ 3] + 0x8f1bbcdc, 14) + c; a = RL(a, 10);
-		c = RL(c + f4(d,e,a) + X[ 7] + 0x8f1bbcdc,  5) + b; e = RL(e, 10);
-		b = RL(b + f4(c,d,e) + X[15] + 0x8f1bbcdc,  6) + a; d = RL(d, 10);
-		a = RL(a + f4(b,c,d) + X[14] + 0x8f1bbcdc,  8) + e; c = RL(c, 10);
-		e = RL(e + f4(a,b,c) + X[ 5] + 0x8f1bbcdc,  6) + d; b = RL(b, 10);
-		d = RL(d + f4(e,a,b) + X[ 6] + 0x8f1bbcdc,  5) + c; a = RL(a, 10);
-		c = RL(c + f4(d,e,a) + X[ 2] + 0x8f1bbcdc, 12) + b; e = RL(e, 10);
-
-		// right
-		cc = RL(cc + f2(dd,ee,aa) + X[ 8] + 0x7a6d76e9, 15) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f2(cc,dd,ee) + X[ 6] + 0x7a6d76e9,  5) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f2(bb,cc,dd) + X[ 4] + 0x7a6d76e9,  8) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f2(aa,bb,cc) + X[ 1] + 0x7a6d76e9, 11) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f2(ee,aa,bb) + X[ 3] + 0x7a6d76e9, 14) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f2(dd,ee,aa) + X[11] + 0x7a6d76e9, 14) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f2(cc,dd,ee) + X[15] + 0x7a6d76e9,  6) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f2(bb,cc,dd) + X[ 0] + 0x7a6d76e9, 14) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f2(aa,bb,cc) + X[ 5] + 0x7a6d76e9,  6) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f2(ee,aa,bb) + X[12] + 0x7a6d76e9,  9) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f2(dd,ee,aa) + X[ 2] + 0x7a6d76e9, 12) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f2(cc,dd,ee) + X[13] + 0x7a6d76e9,  9) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f2(bb,cc,dd) + X[ 9] + 0x7a6d76e9, 12) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f2(aa,bb,cc) + X[ 7] + 0x7a6d76e9,  5) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f2(ee,aa,bb) + X[10] + 0x7a6d76e9, 15) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f2(dd,ee,aa) + X[14] + 0x7a6d76e9,  8) + bb; ee = RL(ee, 10);
-
-		//
-		// Rounds 64-79
-		//
-		// left
-		b = RL(b + f5(c,d,e) + X[ 4] + 0xa953fd4e,  9) + a; d = RL(d, 10);
-		a = RL(a + f5(b,c,d) + X[ 0] + 0xa953fd4e, 15) + e; c = RL(c, 10);
-		e = RL(e + f5(a,b,c) + X[ 5] + 0xa953fd4e,  5) + d; b = RL(b, 10);
-		d = RL(d + f5(e,a,b) + X[ 9] + 0xa953fd4e, 11) + c; a = RL(a, 10);
-		c = RL(c + f5(d,e,a) + X[ 7] + 0xa953fd4e,  6) + b; e = RL(e, 10);
-		b = RL(b + f5(c,d,e) + X[12] + 0xa953fd4e,  8) + a; d = RL(d, 10);
-		a = RL(a + f5(b,c,d) + X[ 2] + 0xa953fd4e, 13) + e; c = RL(c, 10);
-		e = RL(e + f5(a,b,c) + X[10] + 0xa953fd4e, 12) + d; b = RL(b, 10);
-		d = RL(d + f5(e,a,b) + X[14] + 0xa953fd4e,  5) + c; a = RL(a, 10);
-		c = RL(c + f5(d,e,a) + X[ 1] + 0xa953fd4e, 12) + b; e = RL(e, 10);
-		b = RL(b + f5(c,d,e) + X[ 3] + 0xa953fd4e, 13) + a; d = RL(d, 10);
-		a = RL(a + f5(b,c,d) + X[ 8] + 0xa953fd4e, 14) + e; c = RL(c, 10);
-		e = RL(e + f5(a,b,c) + X[11] + 0xa953fd4e, 11) + d; b = RL(b, 10);
-		d = RL(d + f5(e,a,b) + X[ 6] + 0xa953fd4e,  8) + c; a = RL(a, 10);
-		c = RL(c + f5(d,e,a) + X[15] + 0xa953fd4e,  5) + b; e = RL(e, 10);
-		b = RL(b + f5(c,d,e) + X[13] + 0xa953fd4e,  6) + a; d = RL(d, 10);
-
-		// right
-		bb = RL(bb + f1(cc,dd,ee) + X[12],  8) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f1(bb,cc,dd) + X[15],  5) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f1(aa,bb,cc) + X[10], 12) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f1(ee,aa,bb) + X[ 4],  9) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f1(dd,ee,aa) + X[ 1], 12) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f1(cc,dd,ee) + X[ 5],  5) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f1(bb,cc,dd) + X[ 8], 14) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f1(aa,bb,cc) + X[ 7],  6) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f1(ee,aa,bb) + X[ 6],  8) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f1(dd,ee,aa) + X[ 2], 13) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f1(cc,dd,ee) + X[13],  6) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f1(bb,cc,dd) + X[14],  5) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f1(aa,bb,cc) + X[ 0], 15) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f1(ee,aa,bb) + X[ 3], 13) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f1(dd,ee,aa) + X[ 9], 11) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f1(cc,dd,ee) + X[11], 11) + aa; dd = RL(dd, 10);
-
-		dd += c + H1;
-		H1 = H2 + d + ee;
-		H2 = H3 + e + aa;
-		H3 = H4 + a + bb;
-		H4 = H0 + b + cc;
-		H0 = dd;
-
-		//
-		// reset the offset and clean out the word buffer.
-		//
-		xOff = 0;
-		for (int i = 0; i != X.length; i++)
-		{
-			X[i] = 0;
-		}
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/digests/RIPEMD256Digest.java b/azureus2/src/org/bouncycastle/crypto/digests/RIPEMD256Digest.java
deleted file mode 100644
index 7030e4a..0000000
--- a/azureus2/src/org/bouncycastle/crypto/digests/RIPEMD256Digest.java
+++ /dev/null
@@ -1,476 +0,0 @@
-package org.bouncycastle.crypto.digests;
-
-
-/**
- * implementation of RIPEMD256.
- * <p>
- * <b>note:</b> this algorithm offers the same level of security as RIPEMD128.
- */
-public class RIPEMD256Digest
-    extends GeneralDigest
-{
-	private static final int DIGEST_LENGTH = 32;
-
-	private int H0, H1, H2, H3, H4, H5, H6, H7; // IV's
-
-	private int[] X = new int[16];
-	private int xOff;
-
-	/**
-	 * Standard constructor
-	 */
-	public RIPEMD256Digest()
-	{
-		reset();
-	}
-
-	/**
-	 * Copy constructor.  This will copy the state of the provided
-	 * message digest.
-	 */
-	public RIPEMD256Digest(RIPEMD256Digest t)
-	{
-		super(t);
-
-		H0 = t.H0;
-		H1 = t.H1;
-		H2 = t.H2;
-		H3 = t.H3;
-		H4 = t.H4;
-		H5 = t.H5;
-		H6 = t.H6;
-		H7 = t.H7;
-
-		System.arraycopy(t.X, 0, X, 0, t.X.length);
-		xOff = t.xOff;
-	}
-
-	public String getAlgorithmName()
-	{
-		return "RIPEMD256";
-	}
-
-	public int getDigestSize()
-	{
-		return DIGEST_LENGTH;
-	}
-
-	protected void processWord(
-		byte[] in,
-		int inOff)
-	{
-		X[xOff++] = (in[inOff] & 0xff) | ((in[inOff + 1] & 0xff) << 8)
-			| ((in[inOff + 2] & 0xff) << 16) | ((in[inOff + 3] & 0xff) << 24); 
-
-		if (xOff == 16)
-		{
-			processBlock();
-		}
-	}
-
-	protected void processLength(
-		long bitLength)
-	{
-		if (xOff > 14)
-		{
-			processBlock();
-		}
-
-		X[14] = (int)(bitLength & 0xffffffff);
-		X[15] = (int)(bitLength >>> 32);
-	}
-
-	private void unpackWord(
-		int word,
-		byte[] out,
-		int outOff)
-	{
-		out[outOff]     = (byte)word;
-		out[outOff + 1] = (byte)(word >>> 8);
-		out[outOff + 2] = (byte)(word >>> 16);
-		out[outOff + 3] = (byte)(word >>> 24);
-	}
-
-	public int doFinal(
-		byte[] out,
-		int outOff)
-	{
-		finish();
-
-		unpackWord(H0, out, outOff);
-		unpackWord(H1, out, outOff + 4);
-		unpackWord(H2, out, outOff + 8);
-		unpackWord(H3, out, outOff + 12);
-		unpackWord(H4, out, outOff + 16);
-		unpackWord(H5, out, outOff + 20);
-		unpackWord(H6, out, outOff + 24);
-		unpackWord(H7, out, outOff + 28);
-
-		reset();
-
-		return DIGEST_LENGTH;
-	}
-
-	/**
-	* reset the chaining variables to the IV values.
-	*/
-	public void reset()
-	{
-		super.reset();
-
-		H0 = 0x67452301;
-		H1 = 0xefcdab89;
-		H2 = 0x98badcfe;
-		H3 = 0x10325476; 
-		H4 = 0x76543210; 
-		H5 = 0xFEDCBA98; 
-		H6 = 0x89ABCDEF; 
-		H7 = 0x01234567;
-		
-		xOff = 0;
-
-		for (int i = 0; i != X.length; i++)
-		{
-			X[i] = 0;
-		}
-	}
-
-	/*
-	 * rotate int x left n bits.
-	 */
-	private final int RL(
-		int x,
-		int n)
-	{
-		return (x << n) | (x >>> (32 - n));
-	}
-
-	/*
-	 * f1,f2,f3,f4 are the basic RIPEMD128 functions.
-	 */
-
-	/*
-	 * F
-	 */
-	private final int f1(
-		int x,
-		int y,
-		int z)
-	{
-		return x ^ y ^ z;
-	}
-
-	/*
-	 * G
-	 */
-	private final int f2(
-		int x,
-		int y,
-		int z)
-	{
-		return (x & y) | (~x & z);
-	}
-
-	/*
-	 * H
-	 */
-	private final int f3(
-		int x,
-		int y,
-		int z)
-	{
-		return (x | ~y) ^ z;
-	}
-
-	/*
-	 * I
-	 */
-	private final int f4(
-		int x,
-		int y,
-		int z)
-	{
-		return (x & z) | (y & ~z);
-	}
-
-    private final int F1(
-        int a,
-        int b,
-        int c,
-        int d,
-        int x,
-        int s)
-    {
-        return RL(a + f1(b, c, d) + x, s);
-    }
-
-    private final int F2(
-        int a,
-        int b,
-        int c,
-        int d,
-        int x,
-        int s)
-    {
-        return RL(a + f2(b, c, d) + x + 0x5a827999, s);
-    }
-
-    private final int F3(
-        int a,
-        int b,
-        int c,
-        int d,
-        int x,
-        int s)
-    {
-        return RL(a + f3(b, c, d) + x + 0x6ed9eba1, s);
-    }
-
-    private final int F4(
-        int a,
-        int b,
-        int c,
-        int d,
-        int x,
-        int s)
-    {
-        return RL(a + f4(b, c, d) + x + 0x8f1bbcdc, s);
-    }
-
-    private final int FF1(
-        int a,
-        int b,
-        int c,
-        int d,
-        int x,
-        int s)
-    {
-        return RL(a + f1(b, c, d) + x, s);
-    }
-
-    private final int FF2(
-        int a,
-        int b,
-        int c,
-        int d,
-        int x,
-        int s)
-    {
-      return RL(a + f2(b, c, d) + x + 0x6d703ef3, s);
-    }
-
-    private final int FF3(
-        int a,
-        int b,
-        int c,
-        int d,
-        int x,
-        int s)
-    {
-      return RL(a + f3(b, c, d) + x + 0x5c4dd124, s);
-    }
-
-    private final int FF4(
-        int a,
-        int b,
-        int c,
-        int d,
-        int x,
-        int s)
-    {
-      return RL(a + f4(b, c, d) + x + 0x50a28be6, s);
-    }
-
-	protected void processBlock()
-	{
-		int a, aa;
-		int b, bb;
-		int c, cc;
-		int d, dd;
-		int t;
-		
-		a = H0;
-		b = H1;
-		c = H2;
-		d = H3;
-		aa = H4;
-		bb = H5;
-		cc = H6;
-		dd = H7;
-
-		//
-		// Round 1
-		//
-		
-		a = F1(a, b, c, d, X[ 0], 11);
-        d = F1(d, a, b, c, X[ 1], 14);
-        c = F1(c, d, a, b, X[ 2], 15);
-        b = F1(b, c, d, a, X[ 3], 12);
-        a = F1(a, b, c, d, X[ 4],  5);
-        d = F1(d, a, b, c, X[ 5],  8);
-        c = F1(c, d, a, b, X[ 6],  7);
-        b = F1(b, c, d, a, X[ 7],  9);
-        a = F1(a, b, c, d, X[ 8], 11);
-        d = F1(d, a, b, c, X[ 9], 13);
-        c = F1(c, d, a, b, X[10], 14);
-        b = F1(b, c, d, a, X[11], 15);
-        a = F1(a, b, c, d, X[12],  6);
-        d = F1(d, a, b, c, X[13],  7);
-        c = F1(c, d, a, b, X[14],  9);
-        b = F1(b, c, d, a, X[15],  8);
-
-		aa = FF4(aa, bb, cc, dd, X[ 5],  8);
-        dd = FF4(dd, aa, bb, cc, X[14],  9);
-        cc = FF4(cc, dd, aa, bb, X[ 7],  9);
-        bb = FF4(bb, cc, dd, aa, X[ 0], 11);
-        aa = FF4(aa, bb, cc, dd, X[ 9], 13);
-        dd = FF4(dd, aa, bb, cc, X[ 2], 15);
-        cc = FF4(cc, dd, aa, bb, X[11], 15);
-        bb = FF4(bb, cc, dd, aa, X[ 4],  5);
-        aa = FF4(aa, bb, cc, dd, X[13],  7);
-        dd = FF4(dd, aa, bb, cc, X[ 6],  7);
-        cc = FF4(cc, dd, aa, bb, X[15],  8);
-        bb = FF4(bb, cc, dd, aa, X[ 8], 11);
-        aa = FF4(aa, bb, cc, dd, X[ 1], 14);
-        dd = FF4(dd, aa, bb, cc, X[10], 14);
-        cc = FF4(cc, dd, aa, bb, X[ 3], 12);
-        bb = FF4(bb, cc, dd, aa, X[12],  6);
-
-		t = a; a = aa; aa = t;
-		
-		//
-		// Round 2
-		//
-        a = F2(a, b, c, d, X[ 7],  7);
-        d = F2(d, a, b, c, X[ 4],  6);
-        c = F2(c, d, a, b, X[13],  8);
-        b = F2(b, c, d, a, X[ 1], 13);
-        a = F2(a, b, c, d, X[10], 11);
-        d = F2(d, a, b, c, X[ 6],  9);
-        c = F2(c, d, a, b, X[15],  7);
-        b = F2(b, c, d, a, X[ 3], 15);
-        a = F2(a, b, c, d, X[12],  7);
-        d = F2(d, a, b, c, X[ 0], 12);
-        c = F2(c, d, a, b, X[ 9], 15);
-        b = F2(b, c, d, a, X[ 5],  9);
-        a = F2(a, b, c, d, X[ 2], 11);
-        d = F2(d, a, b, c, X[14],  7);
-        c = F2(c, d, a, b, X[11], 13);
-        b = F2(b, c, d, a, X[ 8], 12);
-
-        aa = FF3(aa, bb, cc, dd, X[ 6],  9);
-        dd = FF3(dd, aa, bb, cc, X[ 11], 13);
-        cc = FF3(cc, dd, aa, bb, X[3], 15);
-        bb = FF3(bb, cc, dd, aa, X[ 7],  7);
-        aa = FF3(aa, bb, cc, dd, X[0], 12);
-        dd = FF3(dd, aa, bb, cc, X[13],  8);
-        cc = FF3(cc, dd, aa, bb, X[5],  9);
-        bb = FF3(bb, cc, dd, aa, X[10], 11);
-        aa = FF3(aa, bb, cc, dd, X[14],  7);
-        dd = FF3(dd, aa, bb, cc, X[15],  7);
-        cc = FF3(cc, dd, aa, bb, X[ 8], 12);
-        bb = FF3(bb, cc, dd, aa, X[12],  7);
-        aa = FF3(aa, bb, cc, dd, X[ 4],  6);
-        dd = FF3(dd, aa, bb, cc, X[ 9], 15);
-        cc = FF3(cc, dd, aa, bb, X[ 1], 13);
-        bb = FF3(bb, cc, dd, aa, X[ 2], 11);
-
-		t = b; b = bb; bb = t;
-		
-        //
-        // Round 3
-        //
-        a = F3(a, b, c, d, X[ 3], 11);
-        d = F3(d, a, b, c, X[10], 13);
-        c = F3(c, d, a, b, X[14],  6);
-        b = F3(b, c, d, a, X[ 4],  7);
-        a = F3(a, b, c, d, X[ 9], 14);
-        d = F3(d, a, b, c, X[15],  9);
-        c = F3(c, d, a, b, X[ 8], 13);
-        b = F3(b, c, d, a, X[ 1], 15);
-        a = F3(a, b, c, d, X[ 2], 14);
-        d = F3(d, a, b, c, X[ 7],  8);
-        c = F3(c, d, a, b, X[ 0], 13);
-        b = F3(b, c, d, a, X[ 6],  6);
-        a = F3(a, b, c, d, X[13],  5);
-        d = F3(d, a, b, c, X[11], 12);
-        c = F3(c, d, a, b, X[ 5],  7);
-        b = F3(b, c, d, a, X[12],  5);
-
-        aa = FF2(aa, bb, cc, dd, X[ 15], 9);
-        dd = FF2(dd, aa, bb, cc, X[5], 7);
-        cc = FF2(cc, dd, aa, bb, X[1], 15);
-        bb = FF2(bb, cc, dd, aa, X[ 3],  11);
-        aa = FF2(aa, bb, cc, dd, X[ 7], 8);
-        dd = FF2(dd, aa, bb, cc, X[14],  6);
-        cc = FF2(cc, dd, aa, bb, X[ 6], 6);
-        bb = FF2(bb, cc, dd, aa, X[ 9], 14);
-        aa = FF2(aa, bb, cc, dd, X[11], 12);
-        dd = FF2(dd, aa, bb, cc, X[ 8], 13);
-        cc = FF2(cc, dd, aa, bb, X[12],  5);
-        bb = FF2(bb, cc, dd, aa, X[ 2], 14);
-        aa = FF2(aa, bb, cc, dd, X[10], 13);
-        dd = FF2(dd, aa, bb, cc, X[ 0], 13);
-        cc = FF2(cc, dd, aa, bb, X[ 4],  7);
-        bb = FF2(bb, cc, dd, aa, X[13],  5);
-
-		t = c; c = cc; cc = t;
-
-        //
-        // Round 4
-        //
-        a = F4(a, b, c, d, X[ 1], 11);
-        d = F4(d, a, b, c, X[ 9], 12);
-        c = F4(c, d, a, b, X[11], 14);
-        b = F4(b, c, d, a, X[10], 15);
-        a = F4(a, b, c, d, X[ 0], 14);
-        d = F4(d, a, b, c, X[ 8], 15);
-        c = F4(c, d, a, b, X[12],  9);
-        b = F4(b, c, d, a, X[ 4],  8);
-        a = F4(a, b, c, d, X[13],  9);
-        d = F4(d, a, b, c, X[ 3], 14);
-        c = F4(c, d, a, b, X[ 7],  5);
-        b = F4(b, c, d, a, X[15],  6);
-        a = F4(a, b, c, d, X[14],  8);
-        d = F4(d, a, b, c, X[ 5],  6);
-        c = F4(c, d, a, b, X[ 6],  5);
-        b = F4(b, c, d, a, X[ 2], 12);
-
-        aa = FF1(aa, bb, cc, dd, X[ 8], 15);
-        dd = FF1(dd, aa, bb, cc, X[ 6],  5);
-        cc = FF1(cc, dd, aa, bb, X[ 4],  8);
-        bb = FF1(bb, cc, dd, aa, X[ 1], 11);
-        aa = FF1(aa, bb, cc, dd, X[ 3], 14);
-        dd = FF1(dd, aa, bb, cc, X[11], 14);
-        cc = FF1(cc, dd, aa, bb, X[15],  6);
-        bb = FF1(bb, cc, dd, aa, X[ 0], 14);
-        aa = FF1(aa, bb, cc, dd, X[ 5],  6);
-        dd = FF1(dd, aa, bb, cc, X[12],  9);
-        cc = FF1(cc, dd, aa, bb, X[ 2],  12);
-        bb = FF1(bb, cc, dd, aa, X[13],  9);
-        aa = FF1(aa, bb, cc, dd, X[ 9],  12);
-        dd = FF1(dd, aa, bb, cc, X[ 7],  5);
-        cc = FF1(cc, dd, aa, bb, X[10],  15);
-        bb = FF1(bb, cc, dd, aa, X[14], 8);
-
-		t = d; d = dd; dd = t;
-
-		H0 += a; 
-		H1 += b; 
-		H2 += c; 
-		H3 += d;
-		H4 += aa; 
-		H5 += bb; 
-		H6 += cc; 
-		H7 += dd;
-		
-		//
-		// reset the offset and clean out the word buffer.
-		//
-		xOff = 0;
-		for (int i = 0; i != X.length; i++)
-		{
-			X[i] = 0;
-		}
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/digests/RIPEMD320Digest.java b/azureus2/src/org/bouncycastle/crypto/digests/RIPEMD320Digest.java
deleted file mode 100644
index 819df25..0000000
--- a/azureus2/src/org/bouncycastle/crypto/digests/RIPEMD320Digest.java
+++ /dev/null
@@ -1,461 +0,0 @@
-package org.bouncycastle.crypto.digests;
-
-
-/**
- * implementation of RIPEMD 320.
- * <p>
- * <b>Note:</b> this implementation offers the same level of security
- * as RIPEMD 160.
- */
-public class RIPEMD320Digest
-    extends GeneralDigest
-{
-	private static final int DIGEST_LENGTH = 40;
-
-	private int H0, H1, H2, H3, H4, H5, H6, H7, H8, H9; // IV's
-
-	private int[] X = new int[16];
-	private int xOff;
-
-	/**
-	 * Standard constructor
-	 */
-	public RIPEMD320Digest()
-	{
-		reset();
-	}
-
-	/**
-	 * Copy constructor.  This will copy the state of the provided
-	 * message digest.
-	 */
-	public RIPEMD320Digest(RIPEMD320Digest t)
-	{
-		super(t);
-
-		H0 = t.H0;
-		H1 = t.H1;
-		H2 = t.H2;
-		H3 = t.H3;
-		H4 = t.H4;
-		H5 = t.H5;
-		H6 = t.H6;
-		H7 = t.H7;
-		H8 = t.H8;
-		H9 = t.H9;
-		
-		System.arraycopy(t.X, 0, X, 0, t.X.length);
-		xOff = t.xOff;
-	}
-
-	public String getAlgorithmName()
-	{
-		return "RIPEMD320";
-	}
-
-	public int getDigestSize()
-	{
-		return DIGEST_LENGTH;
-	}
-
-	protected void processWord(
-		byte[] in,
-		int inOff)
-	{
-		X[xOff++] = (in[inOff] & 0xff) | ((in[inOff + 1] & 0xff) << 8)
-			| ((in[inOff + 2] & 0xff) << 16) | ((in[inOff + 3] & 0xff) << 24); 
-
-		if (xOff == 16)
-		{
-			processBlock();
-		}
-	}
-
-	protected void processLength(
-		long bitLength)
-	{
-		if (xOff > 14)
-		{
-		processBlock();
-		}
-
-		X[14] = (int)(bitLength & 0xffffffff);
-		X[15] = (int)(bitLength >>> 32);
-	}
-
-	private void unpackWord(
-		int word,
-		byte[] out,
-		int outOff)
-	{
-		out[outOff]     = (byte)word;
-		out[outOff + 1] = (byte)(word >>> 8);
-		out[outOff + 2] = (byte)(word >>> 16);
-		out[outOff + 3] = (byte)(word >>> 24);
-	}
-
-	public int doFinal(
-		byte[] out,
-		int outOff)
-	{
-		finish();
-
-		unpackWord(H0, out, outOff);
-		unpackWord(H1, out, outOff + 4);
-		unpackWord(H2, out, outOff + 8);
-		unpackWord(H3, out, outOff + 12);
-		unpackWord(H4, out, outOff + 16);
-		unpackWord(H5, out, outOff + 20);
-		unpackWord(H6, out, outOff + 24);
-		unpackWord(H7, out, outOff + 28);
-		unpackWord(H8, out, outOff + 32);
-		unpackWord(H9, out, outOff + 36);
-
-		reset();
-
-		return DIGEST_LENGTH;
-	}
-
-	/**
-	* reset the chaining variables to the IV values.
-	*/
-	public void reset()
-	{
-		super.reset();
-
-		H0 = 0x67452301;
-		H1 = 0xefcdab89;
-		H2 = 0x98badcfe;
-		H3 = 0x10325476;
-		H4 = 0xc3d2e1f0;
-		H5 = 0x76543210; 
-		H6 = 0xFEDCBA98;
-		H7 = 0x89ABCDEF; 
-		H8 = 0x01234567; 
-		H9 = 0x3C2D1E0F;
-
-		xOff = 0;
-
-		for (int i = 0; i != X.length; i++)
-		{
-			X[i] = 0;
-		}
-	}
-
-	/*
-	 * rotate int x left n bits.
-	 */
-	private final int RL(
-		int x,
-		int n)
-	{
-		return (x << n) | (x >>> (32 - n));
-	}
-
-	/*
-	 * f1,f2,f3,f4,f5 are the basic RIPEMD160 functions.
-	 */
-
-	/*
-	 * rounds 0-15
-	 */
-	private final int f1(
-		int x,
-		int y,
-		int z)
-	{
-		return x ^ y ^ z;
-	}
-
-	/*
-	 * rounds 16-31
-	 */
-	private final int f2(
-		int x,
-		int y,
-		int z)
-	{
-		return (x & y) | (~x & z);
-	}
-
-	/*
-	 * rounds 32-47
-	 */
-	private final int f3(
-		int x,
-		int y,
-		int z)
-	{
-		return (x | ~y) ^ z;
-	}
-
-	/*
-	 * rounds 48-63
-	 */
-	private final int f4(
-		int x,
-		int y,
-		int z)
-	{
-		return (x & z) | (y & ~z);
-	}
-
-	/*
-	 * rounds 64-79
-	 */
-	private final int f5(
-		int x,
-		int y,
-		int z)
-	{
-		return x ^ (y | ~z);
-	}
-
-	protected void processBlock()
-	{
-		int a, aa;
-		int b, bb;
-		int c, cc;
-		int d, dd;
-		int e, ee;
-        int t;
-
-		a = H0;
-		b = H1;
-		c = H2;
-		d = H3;
-		e = H4;
-		aa = H5;
-		bb = H6;
-		cc = H7;
-		dd = H8;
-		ee = H9;
-		
-		//
-		// Rounds 1 - 16
-		//
-		// left
-		a = RL(a + f1(b,c,d) + X[ 0], 11) + e; c = RL(c, 10);
-		e = RL(e + f1(a,b,c) + X[ 1], 14) + d; b = RL(b, 10);
-		d = RL(d + f1(e,a,b) + X[ 2], 15) + c; a = RL(a, 10);
-		c = RL(c + f1(d,e,a) + X[ 3], 12) + b; e = RL(e, 10);
-		b = RL(b + f1(c,d,e) + X[ 4],  5) + a; d = RL(d, 10);
-		a = RL(a + f1(b,c,d) + X[ 5],  8) + e; c = RL(c, 10);
-		e = RL(e + f1(a,b,c) + X[ 6],  7) + d; b = RL(b, 10);
-		d = RL(d + f1(e,a,b) + X[ 7],  9) + c; a = RL(a, 10);
-		c = RL(c + f1(d,e,a) + X[ 8], 11) + b; e = RL(e, 10);
-		b = RL(b + f1(c,d,e) + X[ 9], 13) + a; d = RL(d, 10);
-		a = RL(a + f1(b,c,d) + X[10], 14) + e; c = RL(c, 10);
-		e = RL(e + f1(a,b,c) + X[11], 15) + d; b = RL(b, 10);
-		d = RL(d + f1(e,a,b) + X[12],  6) + c; a = RL(a, 10);
-		c = RL(c + f1(d,e,a) + X[13],  7) + b; e = RL(e, 10);
-		b = RL(b + f1(c,d,e) + X[14],  9) + a; d = RL(d, 10);
-		a = RL(a + f1(b,c,d) + X[15],  8) + e; c = RL(c, 10);
-
-		// right
-		aa = RL(aa + f5(bb,cc,dd) + X[ 5] + 0x50a28be6,  8) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f5(aa,bb,cc) + X[14] + 0x50a28be6,  9) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f5(ee,aa,bb) + X[ 7] + 0x50a28be6,  9) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f5(dd,ee,aa) + X[ 0] + 0x50a28be6, 11) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f5(cc,dd,ee) + X[ 9] + 0x50a28be6, 13) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f5(bb,cc,dd) + X[ 2] + 0x50a28be6, 15) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f5(aa,bb,cc) + X[11] + 0x50a28be6, 15) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f5(ee,aa,bb) + X[ 4] + 0x50a28be6,  5) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f5(dd,ee,aa) + X[13] + 0x50a28be6,  7) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f5(cc,dd,ee) + X[ 6] + 0x50a28be6,  7) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f5(bb,cc,dd) + X[15] + 0x50a28be6,  8) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f5(aa,bb,cc) + X[ 8] + 0x50a28be6, 11) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f5(ee,aa,bb) + X[ 1] + 0x50a28be6, 14) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f5(dd,ee,aa) + X[10] + 0x50a28be6, 14) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f5(cc,dd,ee) + X[ 3] + 0x50a28be6, 12) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f5(bb,cc,dd) + X[12] + 0x50a28be6,  6) + ee; cc = RL(cc, 10);
-
-        t = a; a = aa; aa = t;
-
-		//
-		// Rounds 16-31
-		//
-		// left
-		e = RL(e + f2(a,b,c) + X[ 7] + 0x5a827999,  7) + d; b = RL(b, 10);
-		d = RL(d + f2(e,a,b) + X[ 4] + 0x5a827999,  6) + c; a = RL(a, 10);
-		c = RL(c + f2(d,e,a) + X[13] + 0x5a827999,  8) + b; e = RL(e, 10);
-		b = RL(b + f2(c,d,e) + X[ 1] + 0x5a827999, 13) + a; d = RL(d, 10);
-		a = RL(a + f2(b,c,d) + X[10] + 0x5a827999, 11) + e; c = RL(c, 10);
-		e = RL(e + f2(a,b,c) + X[ 6] + 0x5a827999,  9) + d; b = RL(b, 10);
-		d = RL(d + f2(e,a,b) + X[15] + 0x5a827999,  7) + c; a = RL(a, 10);
-		c = RL(c + f2(d,e,a) + X[ 3] + 0x5a827999, 15) + b; e = RL(e, 10);
-		b = RL(b + f2(c,d,e) + X[12] + 0x5a827999,  7) + a; d = RL(d, 10);
-		a = RL(a + f2(b,c,d) + X[ 0] + 0x5a827999, 12) + e; c = RL(c, 10);
-		e = RL(e + f2(a,b,c) + X[ 9] + 0x5a827999, 15) + d; b = RL(b, 10);
-		d = RL(d + f2(e,a,b) + X[ 5] + 0x5a827999,  9) + c; a = RL(a, 10);
-		c = RL(c + f2(d,e,a) + X[ 2] + 0x5a827999, 11) + b; e = RL(e, 10);
-		b = RL(b + f2(c,d,e) + X[14] + 0x5a827999,  7) + a; d = RL(d, 10);
-		a = RL(a + f2(b,c,d) + X[11] + 0x5a827999, 13) + e; c = RL(c, 10);
-		e = RL(e + f2(a,b,c) + X[ 8] + 0x5a827999, 12) + d; b = RL(b, 10);
-
-		// right
-		ee = RL(ee + f4(aa,bb,cc) + X[ 6] + 0x5c4dd124,  9) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f4(ee,aa,bb) + X[11] + 0x5c4dd124, 13) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f4(dd,ee,aa) + X[ 3] + 0x5c4dd124, 15) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f4(cc,dd,ee) + X[ 7] + 0x5c4dd124,  7) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f4(bb,cc,dd) + X[ 0] + 0x5c4dd124, 12) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f4(aa,bb,cc) + X[13] + 0x5c4dd124,  8) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f4(ee,aa,bb) + X[ 5] + 0x5c4dd124,  9) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f4(dd,ee,aa) + X[10] + 0x5c4dd124, 11) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f4(cc,dd,ee) + X[14] + 0x5c4dd124,  7) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f4(bb,cc,dd) + X[15] + 0x5c4dd124,  7) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f4(aa,bb,cc) + X[ 8] + 0x5c4dd124, 12) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f4(ee,aa,bb) + X[12] + 0x5c4dd124,  7) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f4(dd,ee,aa) + X[ 4] + 0x5c4dd124,  6) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f4(cc,dd,ee) + X[ 9] + 0x5c4dd124, 15) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f4(bb,cc,dd) + X[ 1] + 0x5c4dd124, 13) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f4(aa,bb,cc) + X[ 2] + 0x5c4dd124, 11) + dd; bb = RL(bb, 10);
-
-        t = b; b = bb; bb = t;
-
-		//
-		// Rounds 32-47
-		//
-		// left
-		d = RL(d + f3(e,a,b) + X[ 3] + 0x6ed9eba1, 11) + c; a = RL(a, 10);
-		c = RL(c + f3(d,e,a) + X[10] + 0x6ed9eba1, 13) + b; e = RL(e, 10);
-		b = RL(b + f3(c,d,e) + X[14] + 0x6ed9eba1,  6) + a; d = RL(d, 10);
-		a = RL(a + f3(b,c,d) + X[ 4] + 0x6ed9eba1,  7) + e; c = RL(c, 10);
-		e = RL(e + f3(a,b,c) + X[ 9] + 0x6ed9eba1, 14) + d; b = RL(b, 10);
-		d = RL(d + f3(e,a,b) + X[15] + 0x6ed9eba1,  9) + c; a = RL(a, 10);
-		c = RL(c + f3(d,e,a) + X[ 8] + 0x6ed9eba1, 13) + b; e = RL(e, 10);
-		b = RL(b + f3(c,d,e) + X[ 1] + 0x6ed9eba1, 15) + a; d = RL(d, 10);
-		a = RL(a + f3(b,c,d) + X[ 2] + 0x6ed9eba1, 14) + e; c = RL(c, 10);
-		e = RL(e + f3(a,b,c) + X[ 7] + 0x6ed9eba1,  8) + d; b = RL(b, 10);
-		d = RL(d + f3(e,a,b) + X[ 0] + 0x6ed9eba1, 13) + c; a = RL(a, 10);
-		c = RL(c + f3(d,e,a) + X[ 6] + 0x6ed9eba1,  6) + b; e = RL(e, 10);
-		b = RL(b + f3(c,d,e) + X[13] + 0x6ed9eba1,  5) + a; d = RL(d, 10);
-		a = RL(a + f3(b,c,d) + X[11] + 0x6ed9eba1, 12) + e; c = RL(c, 10);
-		e = RL(e + f3(a,b,c) + X[ 5] + 0x6ed9eba1,  7) + d; b = RL(b, 10);
-		d = RL(d + f3(e,a,b) + X[12] + 0x6ed9eba1,  5) + c; a = RL(a, 10);
-
-		// right
-		dd = RL(dd + f3(ee,aa,bb) + X[15] + 0x6d703ef3,  9) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f3(dd,ee,aa) + X[ 5] + 0x6d703ef3,  7) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f3(cc,dd,ee) + X[ 1] + 0x6d703ef3, 15) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f3(bb,cc,dd) + X[ 3] + 0x6d703ef3, 11) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f3(aa,bb,cc) + X[ 7] + 0x6d703ef3,  8) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f3(ee,aa,bb) + X[14] + 0x6d703ef3,  6) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f3(dd,ee,aa) + X[ 6] + 0x6d703ef3,  6) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f3(cc,dd,ee) + X[ 9] + 0x6d703ef3, 14) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f3(bb,cc,dd) + X[11] + 0x6d703ef3, 12) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f3(aa,bb,cc) + X[ 8] + 0x6d703ef3, 13) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f3(ee,aa,bb) + X[12] + 0x6d703ef3,  5) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f3(dd,ee,aa) + X[ 2] + 0x6d703ef3, 14) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f3(cc,dd,ee) + X[10] + 0x6d703ef3, 13) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f3(bb,cc,dd) + X[ 0] + 0x6d703ef3, 13) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f3(aa,bb,cc) + X[ 4] + 0x6d703ef3,  7) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f3(ee,aa,bb) + X[13] + 0x6d703ef3,  5) + cc; aa = RL(aa, 10);
-
-        t = c; c = cc; cc = t;
-
-		//
-		// Rounds 48-63
-		//
-		// left
-		c = RL(c + f4(d,e,a) + X[ 1] + 0x8f1bbcdc, 11) + b; e = RL(e, 10);
-		b = RL(b + f4(c,d,e) + X[ 9] + 0x8f1bbcdc, 12) + a; d = RL(d, 10);
-		a = RL(a + f4(b,c,d) + X[11] + 0x8f1bbcdc, 14) + e; c = RL(c, 10);
-		e = RL(e + f4(a,b,c) + X[10] + 0x8f1bbcdc, 15) + d; b = RL(b, 10);
-		d = RL(d + f4(e,a,b) + X[ 0] + 0x8f1bbcdc, 14) + c; a = RL(a, 10);
-		c = RL(c + f4(d,e,a) + X[ 8] + 0x8f1bbcdc, 15) + b; e = RL(e, 10);
-		b = RL(b + f4(c,d,e) + X[12] + 0x8f1bbcdc,  9) + a; d = RL(d, 10);
-		a = RL(a + f4(b,c,d) + X[ 4] + 0x8f1bbcdc,  8) + e; c = RL(c, 10);
-		e = RL(e + f4(a,b,c) + X[13] + 0x8f1bbcdc,  9) + d; b = RL(b, 10);
-		d = RL(d + f4(e,a,b) + X[ 3] + 0x8f1bbcdc, 14) + c; a = RL(a, 10);
-		c = RL(c + f4(d,e,a) + X[ 7] + 0x8f1bbcdc,  5) + b; e = RL(e, 10);
-		b = RL(b + f4(c,d,e) + X[15] + 0x8f1bbcdc,  6) + a; d = RL(d, 10);
-		a = RL(a + f4(b,c,d) + X[14] + 0x8f1bbcdc,  8) + e; c = RL(c, 10);
-		e = RL(e + f4(a,b,c) + X[ 5] + 0x8f1bbcdc,  6) + d; b = RL(b, 10);
-		d = RL(d + f4(e,a,b) + X[ 6] + 0x8f1bbcdc,  5) + c; a = RL(a, 10);
-		c = RL(c + f4(d,e,a) + X[ 2] + 0x8f1bbcdc, 12) + b; e = RL(e, 10);
-
-		// right
-		cc = RL(cc + f2(dd,ee,aa) + X[ 8] + 0x7a6d76e9, 15) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f2(cc,dd,ee) + X[ 6] + 0x7a6d76e9,  5) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f2(bb,cc,dd) + X[ 4] + 0x7a6d76e9,  8) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f2(aa,bb,cc) + X[ 1] + 0x7a6d76e9, 11) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f2(ee,aa,bb) + X[ 3] + 0x7a6d76e9, 14) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f2(dd,ee,aa) + X[11] + 0x7a6d76e9, 14) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f2(cc,dd,ee) + X[15] + 0x7a6d76e9,  6) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f2(bb,cc,dd) + X[ 0] + 0x7a6d76e9, 14) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f2(aa,bb,cc) + X[ 5] + 0x7a6d76e9,  6) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f2(ee,aa,bb) + X[12] + 0x7a6d76e9,  9) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f2(dd,ee,aa) + X[ 2] + 0x7a6d76e9, 12) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f2(cc,dd,ee) + X[13] + 0x7a6d76e9,  9) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f2(bb,cc,dd) + X[ 9] + 0x7a6d76e9, 12) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f2(aa,bb,cc) + X[ 7] + 0x7a6d76e9,  5) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f2(ee,aa,bb) + X[10] + 0x7a6d76e9, 15) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f2(dd,ee,aa) + X[14] + 0x7a6d76e9,  8) + bb; ee = RL(ee, 10);
-
-       t = d; d = dd; dd = t;
-
-		//
-		// Rounds 64-79
-		//
-		// left
-		b = RL(b + f5(c,d,e) + X[ 4] + 0xa953fd4e,  9) + a; d = RL(d, 10);
-		a = RL(a + f5(b,c,d) + X[ 0] + 0xa953fd4e, 15) + e; c = RL(c, 10);
-		e = RL(e + f5(a,b,c) + X[ 5] + 0xa953fd4e,  5) + d; b = RL(b, 10);
-		d = RL(d + f5(e,a,b) + X[ 9] + 0xa953fd4e, 11) + c; a = RL(a, 10);
-		c = RL(c + f5(d,e,a) + X[ 7] + 0xa953fd4e,  6) + b; e = RL(e, 10);
-		b = RL(b + f5(c,d,e) + X[12] + 0xa953fd4e,  8) + a; d = RL(d, 10);
-		a = RL(a + f5(b,c,d) + X[ 2] + 0xa953fd4e, 13) + e; c = RL(c, 10);
-		e = RL(e + f5(a,b,c) + X[10] + 0xa953fd4e, 12) + d; b = RL(b, 10);
-		d = RL(d + f5(e,a,b) + X[14] + 0xa953fd4e,  5) + c; a = RL(a, 10);
-		c = RL(c + f5(d,e,a) + X[ 1] + 0xa953fd4e, 12) + b; e = RL(e, 10);
-		b = RL(b + f5(c,d,e) + X[ 3] + 0xa953fd4e, 13) + a; d = RL(d, 10);
-		a = RL(a + f5(b,c,d) + X[ 8] + 0xa953fd4e, 14) + e; c = RL(c, 10);
-		e = RL(e + f5(a,b,c) + X[11] + 0xa953fd4e, 11) + d; b = RL(b, 10);
-		d = RL(d + f5(e,a,b) + X[ 6] + 0xa953fd4e,  8) + c; a = RL(a, 10);
-		c = RL(c + f5(d,e,a) + X[15] + 0xa953fd4e,  5) + b; e = RL(e, 10);
-		b = RL(b + f5(c,d,e) + X[13] + 0xa953fd4e,  6) + a; d = RL(d, 10);
-
-		// right
-		bb = RL(bb + f1(cc,dd,ee) + X[12],  8) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f1(bb,cc,dd) + X[15],  5) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f1(aa,bb,cc) + X[10], 12) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f1(ee,aa,bb) + X[ 4],  9) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f1(dd,ee,aa) + X[ 1], 12) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f1(cc,dd,ee) + X[ 5],  5) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f1(bb,cc,dd) + X[ 8], 14) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f1(aa,bb,cc) + X[ 7],  6) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f1(ee,aa,bb) + X[ 6],  8) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f1(dd,ee,aa) + X[ 2], 13) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f1(cc,dd,ee) + X[13],  6) + aa; dd = RL(dd, 10);
-		aa = RL(aa + f1(bb,cc,dd) + X[14],  5) + ee; cc = RL(cc, 10);
-		ee = RL(ee + f1(aa,bb,cc) + X[ 0], 15) + dd; bb = RL(bb, 10);
-		dd = RL(dd + f1(ee,aa,bb) + X[ 3], 13) + cc; aa = RL(aa, 10);
-		cc = RL(cc + f1(dd,ee,aa) + X[ 9], 11) + bb; ee = RL(ee, 10);
-		bb = RL(bb + f1(cc,dd,ee) + X[11], 11) + aa; dd = RL(dd, 10);
-
-        //
-        // do (e, ee) swap as part of assignment.
-        //
-
-		H0 += a;
-		H1 += b;
-		H2 += c;
-		H3 += d;
-		H4 += ee;
-		H5 += aa;
-		H6 += bb;
-		H7 += cc;
-		H8 += dd;
-		H9 += e;
-		
-		//
-		// reset the offset and clean out the word buffer.
-		//
-		xOff = 0;
-		for (int i = 0; i != X.length; i++)
-		{
-			X[i] = 0;
-		}
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/digests/SHA1Digest.java b/azureus2/src/org/bouncycastle/crypto/digests/SHA1Digest.java
deleted file mode 100644
index 0a3fad7..0000000
--- a/azureus2/src/org/bouncycastle/crypto/digests/SHA1Digest.java
+++ /dev/null
@@ -1,258 +0,0 @@
-package org.bouncycastle.crypto.digests;
-
-
-/**
- * implementation of SHA-1 as outlined in "Handbook of Applied Cryptography", pages 346 - 349.
- *
- * It is interesting to ponder why the, apart from the extra IV, the other difference here from MD5
- * is the "endienness" of the word processing!
- */
-public class SHA1Digest
-    extends GeneralDigest
-{
-    private static final int    DIGEST_LENGTH = 20;
-
-    private int     H1, H2, H3, H4, H5;
-
-    private int[]   X = new int[80];
-    private int     xOff;
-
-	/**
-	 * Standard constructor
-	 */
-    public SHA1Digest()
-    {
-        reset();
-    }
-
-	/**
-	 * Copy constructor.  This will copy the state of the provided
-	 * message digest.
-	 */
-	public SHA1Digest(SHA1Digest t)
-	{
-		super(t);
-
-		H1 = t.H1;
-		H2 = t.H2;
-		H3 = t.H3;
-		H4 = t.H4;
-		H5 = t.H5;
-
-		System.arraycopy(t.X, 0, X, 0, t.X.length);
-		xOff = t.xOff;
-	}
-
-    public String getAlgorithmName()
-    {
-        return "SHA-1";
-    }
-
-    public int getDigestSize()
-    {
-        return DIGEST_LENGTH;
-    }
-
-    protected void processWord(
-        byte[]  in,
-        int     inOff)
-    {
-        X[xOff++] = ((in[inOff] & 0xff) << 24) | ((in[inOff + 1] & 0xff) << 16)
-                    | ((in[inOff + 2] & 0xff) << 8) | ((in[inOff + 3] & 0xff)); 
-
-        if (xOff == 16)
-        {
-            processBlock();
-        }
-    }
-
-    private void unpackWord(
-        int     word,
-        byte[]  out,
-        int     outOff)
-    {
-        out[outOff]     = (byte)(word >>> 24);
-        out[outOff + 1] = (byte)(word >>> 16);
-        out[outOff + 2] = (byte)(word >>> 8);
-        out[outOff + 3] = (byte)word;
-    }
-
-    protected void processLength(
-        long    bitLength)
-    {
-        if (xOff > 14)
-        {
-            processBlock();
-        }
-
-        X[14] = (int)(bitLength >>> 32);
-        X[15] = (int)(bitLength & 0xffffffff);
-    }
-
-    public int doFinal(
-        byte[]  out,
-        int     outOff)
-    {
-        finish();
-
-        unpackWord(H1, out, outOff);
-        unpackWord(H2, out, outOff + 4);
-        unpackWord(H3, out, outOff + 8);
-        unpackWord(H4, out, outOff + 12);
-        unpackWord(H5, out, outOff + 16);
-
-        reset();
-
-        return DIGEST_LENGTH;
-    }
-
-    /**
-     * reset the chaining variables
-     */
-    public void reset()
-    {
-        super.reset();
-
-        H1 = 0x67452301;
-        H2 = 0xefcdab89;
-        H3 = 0x98badcfe;
-        H4 = 0x10325476;
-        H5 = 0xc3d2e1f0;
-
-        xOff = 0;
-        for (int i = 0; i != X.length; i++)
-        {
-            X[i] = 0;
-        }
-    }
-
-    //
-    // Additive constants
-    //
-    private static final int    Y1 = 0x5a827999;
-    private static final int    Y2 = 0x6ed9eba1;
-    private static final int    Y3 = 0x8f1bbcdc;
-    private static final int    Y4 = 0xca62c1d6;
-
-    private int f(
-        int    u,
-        int    v,
-        int    w)
-    {
-        return ((u & v) | ((~u) & w));
-    }
-
-    private int h(
-        int    u,
-        int    v,
-        int    w)
-    {
-        return (u ^ v ^ w);
-    }
-
-    private int g(
-        int    u,
-        int    v,
-        int    w)
-    {
-        return ((u & v) | (u & w) | (v & w));
-    }
-
-    private int rotateLeft(
-        int    x,
-        int    n)
-    {
-        return (x << n) | (x >>> (32 - n));
-    }
-
-    protected void processBlock()
-    {
-        //
-        // expand 16 word block into 80 word block.
-        //
-        for (int i = 16; i <= 79; i++)
-        {
-            X[i] = rotateLeft((X[i - 3] ^ X[i - 8] ^ X[i - 14] ^ X[i - 16]), 1);
-        }
-
-        //
-        // set up working variables.
-        //
-        int     A = H1;
-        int     B = H2;
-        int     C = H3;
-        int     D = H4;
-        int     E = H5;
-
-        //
-        // round 1
-        //
-        for (int j = 0; j <= 19; j++)
-        {
-            int     t = rotateLeft(A, 5) + f(B, C, D) + E + X[j] + Y1;
-
-            E = D;
-            D = C;
-            C = rotateLeft(B, 30);
-            B = A;
-            A = t;
-        }
-
-        //
-        // round 2
-        //
-        for (int j = 20; j <= 39; j++)
-        {
-            int     t = rotateLeft(A, 5) + h(B, C, D) + E + X[j] + Y2;
-
-            E = D;
-            D = C;
-            C = rotateLeft(B, 30);
-            B = A;
-            A = t;
-        }
-
-        //
-        // round 3
-        //
-        for (int j = 40; j <= 59; j++)
-        {
-            int     t = rotateLeft(A, 5) + g(B, C, D) + E + X[j] + Y3;
-
-            E = D;
-            D = C;
-            C = rotateLeft(B, 30);
-            B = A;
-            A = t;
-        }
-
-        //
-        // round 4
-        //
-        for (int j = 60; j <= 79; j++)
-        {
-            int     t = rotateLeft(A, 5) + h(B, C, D) + E + X[j] + Y4;
-
-            E = D;
-            D = C;
-            C = rotateLeft(B, 30);
-            B = A;
-            A = t;
-        }
-
-        H1 += A;
-        H2 += B;
-        H3 += C;
-        H4 += D;
-        H5 += E;
-
-        //
-        // reset the offset and clean out the word buffer.
-        //
-        xOff = 0;
-        for (int i = 0; i != X.length; i++)
-        {
-            X[i] = 0;
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/digests/SHA256Digest.java b/azureus2/src/org/bouncycastle/crypto/digests/SHA256Digest.java
deleted file mode 100644
index 9e7e55b..0000000
--- a/azureus2/src/org/bouncycastle/crypto/digests/SHA256Digest.java
+++ /dev/null
@@ -1,268 +0,0 @@
-package org.bouncycastle.crypto.digests;
-
-
-/**
- * Draft FIPS 180-2 implementation of SHA-256. <b>Note:</b> As this is
- * based on a draft this implementation is subject to change.
- *
- * <pre>
- *         block  word  digest
- * SHA-1   512    32    160
- * SHA-256 512    32    256
- * SHA-384 1024   64    384
- * SHA-512 1024   64    512
- * </pre>
- */
-public class SHA256Digest
-    extends GeneralDigest
-{
-    private static final int    DIGEST_LENGTH = 32;
-
-    private int     H1, H2, H3, H4, H5, H6, H7, H8;
-
-    private int[]   X = new int[64];
-    private int     xOff;
-
-	/**
-	 * Standard constructor
-	 */
-    public SHA256Digest()
-    {
-        reset();
-    }
-
-	/**
-	 * Copy constructor.  This will copy the state of the provided
-	 * message digest.
-	 */
-	public SHA256Digest(SHA256Digest t)
-	{
-		super(t);
-
-		H1 = t.H1;
-		H2 = t.H2;
-		H3 = t.H3;
-		H4 = t.H4;
-		H5 = t.H5;
-		H6 = t.H6;
-		H7 = t.H7;
-		H8 = t.H8;
-
-		System.arraycopy(t.X, 0, X, 0, t.X.length);
-		xOff = t.xOff;
-	}
-
-    public String getAlgorithmName()
-    {
-        return "SHA-256";
-    }
-
-    public int getDigestSize()
-    {
-        return DIGEST_LENGTH;
-    }
-
-    protected void processWord(
-        byte[]  in,
-        int     inOff)
-    {
-        X[xOff++] = ((in[inOff] & 0xff) << 24) | ((in[inOff + 1] & 0xff) << 16)
-                    | ((in[inOff + 2] & 0xff) << 8) | ((in[inOff + 3] & 0xff)); 
-
-        if (xOff == 16)
-        {
-            processBlock();
-        }
-    }
-
-    private void unpackWord(
-        int     word,
-        byte[]  out,
-        int     outOff)
-    {
-        out[outOff]     = (byte)(word >>> 24);
-        out[outOff + 1] = (byte)(word >>> 16);
-        out[outOff + 2] = (byte)(word >>> 8);
-        out[outOff + 3] = (byte)word;
-    }
-
-    protected void processLength(
-        long    bitLength)
-    {
-        if (xOff > 14)
-        {
-            processBlock();
-        }
-
-        X[14] = (int)(bitLength >>> 32);
-        X[15] = (int)(bitLength & 0xffffffff);
-    }
-
-    public int doFinal(
-        byte[]  out,
-        int     outOff)
-    {
-        finish();
-
-        unpackWord(H1, out, outOff);
-        unpackWord(H2, out, outOff + 4);
-        unpackWord(H3, out, outOff + 8);
-        unpackWord(H4, out, outOff + 12);
-        unpackWord(H5, out, outOff + 16);
-        unpackWord(H6, out, outOff + 20);
-        unpackWord(H7, out, outOff + 24);
-        unpackWord(H8, out, outOff + 28);
-
-        reset();
-
-        return DIGEST_LENGTH;
-    }
-
-    /**
-     * reset the chaining variables
-     */
-    public void reset()
-    {
-        super.reset();
-
-		/* SHA-256 initial hash value
-		 * The first 32 bits of the fractional parts of the square roots
-		 * of the first eight prime numbers
-		 */
-
-		H1 = 0x6a09e667;
-		H2 = 0xbb67ae85;
-		H3 = 0x3c6ef372;
-		H4 = 0xa54ff53a;
-		H5 = 0x510e527f;
-		H6 = 0x9b05688c;
-		H7 = 0x1f83d9ab;
-		H8 = 0x5be0cd19;
-
-        xOff = 0;
-        for (int i = 0; i != X.length; i++)
-        {
-            X[i] = 0;
-        }
-    }
-
-    protected void processBlock()
-    {
-        //
-        // expand 16 word block into 64 word blocks.
-        //
-        for (int t = 16; t <= 63; t++)
-        {
-            X[t] = Theta1(X[t - 2]) + X[t - 7] + Theta0(X[t - 15]) + X[t - 16];
-        }
-
-        //
-        // set up working variables.
-        //
-        int     a = H1;
-        int     b = H2;
-        int     c = H3;
-        int     d = H4;
-        int     e = H5;
-        int     f = H6;
-        int     g = H7;
-        int     h = H8;
-
-		for (int t = 0; t <= 63; t++)
-		{
-			int		T1, T2;
-
-			T1 = h + Sum1(e) + Ch(e, f, g) + K[t] + X[t];
-			T2 = Sum0(a) + Maj(a, b, c);
-			h = g;
-			g = f;
-			f = e;
-			e = d + T1;
-			d = c;
-			c = b;
-			b = a;
-			a = T1 + T2;
-		}
-
-        H1 += a;
-        H2 += b;
-        H3 += c;
-        H4 += d;
-        H5 += e;
-        H6 += f;
-        H7 += g;
-        H8 += h;
-
-        //
-        // reset the offset and clean out the word buffer.
-        //
-        xOff = 0;
-        for (int i = 0; i != X.length; i++)
-        {
-            X[i] = 0;
-        }
-    }
-
-    private int rotateRight(
-        int    x,
-        int    n)
-    {
-        return (x >>> n) | (x << (32 - n));
-    }
-
-	/* SHA-256 functions */
-    private int Ch(
-        int    x,
-        int    y,
-        int    z)
-    {
-        return ((x & y) ^ ((~x) & z));
-    }
-
-    private int Maj(
-        int    x,
-        int    y,
-        int    z)
-    {
-        return ((x & y) ^ (x & z) ^ (y & z));
-    }
-
-    private int Sum0(
-        int    x)
-    {
-        return rotateRight(x, 2) ^ rotateRight(x, 13) ^ rotateRight(x, 22);
-    }
-
-    private int Sum1(
-        int    x)
-    {
-        return rotateRight(x, 6) ^ rotateRight(x, 11) ^ rotateRight(x, 25);
-    }
-
-    private int Theta0(
-        int    x)
-    {
-        return rotateRight(x, 7) ^ rotateRight(x, 18) ^ (x >>> 3);
-    }
-
-    private int Theta1(
-        int    x)
-    {
-        return rotateRight(x, 17) ^ rotateRight(x, 19) ^ (x >>> 10);
-    }
-
-	/* SHA-256 Constants
-	 * (represent the first 32 bits of the fractional parts of the
-     * cube roots of the first sixty-four prime numbers)
-	 */
-	static final int K[] = {
-		0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
-		0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
-		0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
-		0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
-		0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
-		0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
-		0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
-	};
-}
-
diff --git a/azureus2/src/org/bouncycastle/crypto/digests/SHA384Digest.java b/azureus2/src/org/bouncycastle/crypto/digests/SHA384Digest.java
deleted file mode 100644
index 06998b1..0000000
--- a/azureus2/src/org/bouncycastle/crypto/digests/SHA384Digest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.bouncycastle.crypto.digests;
-
-
-/**
- * Draft FIPS 180-2 implementation of SHA-384. <b>Note:</b> As this is
- * based on a draft this implementation is subject to change.
- *
- * <pre>
- *         block  word  digest
- * SHA-1   512    32    160
- * SHA-256 512    32    256
- * SHA-384 1024   64    384
- * SHA-512 1024   64    512
- * </pre>
- */
-public class SHA384Digest
-    extends LongDigest
-{
-
-	private static final int	DIGEST_LENGTH = 48;
-
-	/**
-	 * Standard constructor
-	 */
-    public SHA384Digest()
-    {
-    }
-
-	/**
-	 * Copy constructor.  This will copy the state of the provided
-	 * message digest.
-	 */
-	public SHA384Digest(SHA384Digest t)
-	{
-		super(t);
-	}
-
-    public String getAlgorithmName()
-	{
-		return "SHA-384";
-	}
-
-	public int getDigestSize()
-	{
-		return DIGEST_LENGTH;
-	}
-
-    public int doFinal(
-        byte[]  out,
-        int     outOff)
-    {
-        finish();
-
-        unpackWord(H1, out, outOff);
-        unpackWord(H2, out, outOff + 8);
-        unpackWord(H3, out, outOff + 16);
-        unpackWord(H4, out, outOff + 24);
-        unpackWord(H5, out, outOff + 32);
-        unpackWord(H6, out, outOff + 40);
-
-        reset();
-
-        return DIGEST_LENGTH;
-    }
-
-    /**
-     * reset the chaining variables
-     */
-    public void reset()
-    {
-        super.reset();
-
-		/* SHA-384 initial hash value
-		 * The first 64 bits of the fractional parts of the square roots
-		 * of the 9th through 16th prime numbers
-		 */
-		H1 = 0xcbbb9d5dc1059ed8l;
-		H2 = 0x629a292a367cd507l;
-		H3 = 0x9159015a3070dd17l;
-		H4 = 0x152fecd8f70e5939l;
-		H5 = 0x67332667ffc00b31l;
-		H6 = 0x8eb44a8768581511l;
-		H7 = 0xdb0c2e0d64f98fa7l;
-		H8 = 0x47b5481dbefa4fa4l;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/digests/SHA512Digest.java b/azureus2/src/org/bouncycastle/crypto/digests/SHA512Digest.java
deleted file mode 100644
index 82d7f86..0000000
--- a/azureus2/src/org/bouncycastle/crypto/digests/SHA512Digest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.bouncycastle.crypto.digests;
-
-
-/**
- * Draft FIPS 180-2 implementation of SHA-512. <b>Note:</b> As this is
- * based on a draft this implementation is subject to change.
- *
- * <pre>
- *         block  word  digest
- * SHA-1   512    32    160
- * SHA-256 512    32    256
- * SHA-384 1024   64    384
- * SHA-512 1024   64    512
- * </pre>
- */
-public class SHA512Digest
-    extends LongDigest
-{
-    private static final int    DIGEST_LENGTH = 64;
-
-	/**
-	 * Standard constructor
-	 */
-    public SHA512Digest()
-    {
-    }
-
-	/**
-	 * Copy constructor.  This will copy the state of the provided
-	 * message digest.
-	 */
-	public SHA512Digest(SHA512Digest t)
-	{
-		super(t);
-	}
-
-    public String getAlgorithmName()
-    {
-        return "SHA-512";
-    }
-
-    public int getDigestSize()
-    {
-        return DIGEST_LENGTH;
-    }
-
-    public int doFinal(
-        byte[]  out,
-        int     outOff)
-    {
-        finish();
-
-        unpackWord(H1, out, outOff);
-        unpackWord(H2, out, outOff + 8);
-        unpackWord(H3, out, outOff + 16);
-        unpackWord(H4, out, outOff + 24);
-        unpackWord(H5, out, outOff + 32);
-        unpackWord(H6, out, outOff + 40);
-        unpackWord(H7, out, outOff + 48);
-        unpackWord(H8, out, outOff + 56);
-
-        reset();
-
-        return DIGEST_LENGTH;
-    }
-
-    /**
-     * reset the chaining variables
-     */
-    public void reset()
-    {
-        super.reset();
-
-		/* SHA-512 initial hash value
-		 * The first 64 bits of the fractional parts of the square roots
-		 * of the first eight prime numbers
-		 */
-		H1 = 0x6a09e667f3bcc908l;
-		H2 = 0xbb67ae8584caa73bl;
-		H3 = 0x3c6ef372fe94f82bl;
-		H4 = 0xa54ff53a5f1d36f1l;
-		H5 = 0x510e527fade682d1l;
-		H6 = 0x9b05688c2b3e6c1fl;
-		H7 = 0x1f83d9abfb41bd6bl;
-		H8 = 0x5be0cd19137e2179L;
-    }
-}
-
diff --git a/azureus2/src/org/bouncycastle/crypto/digests/TigerDigest.java b/azureus2/src/org/bouncycastle/crypto/digests/TigerDigest.java
deleted file mode 100644
index 04d62b2..0000000
--- a/azureus2/src/org/bouncycastle/crypto/digests/TigerDigest.java
+++ /dev/null
@@ -1,859 +0,0 @@
-package org.bouncycastle.crypto.digests;
-
-import org.bouncycastle.crypto.Digest;
-
-/**
- * implementation of Tiger based on:
- * <a href="http://www.cs.technion.ac.il/~biham/Reports/Tiger">
- *  http://www.cs.technion.ac.il/~biham/Reports/Tiger</a>
- */
-public class TigerDigest
-    implements Digest
-{
-    /*
-     * S-Boxes.
-     */
-    private static final long[] t1 = {
-        0x02AAB17CF7E90C5EL   /*    0 */,    0xAC424B03E243A8ECL   /*    1 */,
-        0x72CD5BE30DD5FCD3L   /*    2 */,    0x6D019B93F6F97F3AL   /*    3 */,
-        0xCD9978FFD21F9193L   /*    4 */,    0x7573A1C9708029E2L   /*    5 */,
-        0xB164326B922A83C3L   /*    6 */,    0x46883EEE04915870L   /*    7 */,
-        0xEAACE3057103ECE6L   /*    8 */,    0xC54169B808A3535CL   /*    9 */,
-        0x4CE754918DDEC47CL   /*   10 */,    0x0AA2F4DFDC0DF40CL   /*   11 */,
-        0x10B76F18A74DBEFAL   /*   12 */,    0xC6CCB6235AD1AB6AL   /*   13 */,
-        0x13726121572FE2FFL   /*   14 */,    0x1A488C6F199D921EL   /*   15 */,
-        0x4BC9F9F4DA0007CAL   /*   16 */,    0x26F5E6F6E85241C7L   /*   17 */,
-        0x859079DBEA5947B6L   /*   18 */,    0x4F1885C5C99E8C92L   /*   19 */,
-        0xD78E761EA96F864BL   /*   20 */,    0x8E36428C52B5C17DL   /*   21 */,
-        0x69CF6827373063C1L   /*   22 */,    0xB607C93D9BB4C56EL   /*   23 */,
-        0x7D820E760E76B5EAL   /*   24 */,    0x645C9CC6F07FDC42L   /*   25 */,
-        0xBF38A078243342E0L   /*   26 */,    0x5F6B343C9D2E7D04L   /*   27 */,
-        0xF2C28AEB600B0EC6L   /*   28 */,    0x6C0ED85F7254BCACL   /*   29 */,
-        0x71592281A4DB4FE5L   /*   30 */,    0x1967FA69CE0FED9FL   /*   31 */,
-        0xFD5293F8B96545DBL   /*   32 */,    0xC879E9D7F2A7600BL   /*   33 */,
-        0x860248920193194EL   /*   34 */,    0xA4F9533B2D9CC0B3L   /*   35 */,
-        0x9053836C15957613L   /*   36 */,    0xDB6DCF8AFC357BF1L   /*   37 */,
-        0x18BEEA7A7A370F57L   /*   38 */,    0x037117CA50B99066L   /*   39 */,
-        0x6AB30A9774424A35L   /*   40 */,    0xF4E92F02E325249BL   /*   41 */,
-        0x7739DB07061CCAE1L   /*   42 */,    0xD8F3B49CECA42A05L   /*   43 */,
-        0xBD56BE3F51382F73L   /*   44 */,    0x45FAED5843B0BB28L   /*   45 */,
-        0x1C813D5C11BF1F83L   /*   46 */,    0x8AF0E4B6D75FA169L   /*   47 */,
-        0x33EE18A487AD9999L   /*   48 */,    0x3C26E8EAB1C94410L   /*   49 */,
-        0xB510102BC0A822F9L   /*   50 */,    0x141EEF310CE6123BL   /*   51 */,
-        0xFC65B90059DDB154L   /*   52 */,    0xE0158640C5E0E607L   /*   53 */,
-        0x884E079826C3A3CFL   /*   54 */,    0x930D0D9523C535FDL   /*   55 */,
-        0x35638D754E9A2B00L   /*   56 */,    0x4085FCCF40469DD5L   /*   57 */,
-        0xC4B17AD28BE23A4CL   /*   58 */,    0xCAB2F0FC6A3E6A2EL   /*   59 */,
-        0x2860971A6B943FCDL   /*   60 */,    0x3DDE6EE212E30446L   /*   61 */,
-        0x6222F32AE01765AEL   /*   62 */,    0x5D550BB5478308FEL   /*   63 */,
-        0xA9EFA98DA0EDA22AL   /*   64 */,    0xC351A71686C40DA7L   /*   65 */,
-        0x1105586D9C867C84L   /*   66 */,    0xDCFFEE85FDA22853L   /*   67 */,
-        0xCCFBD0262C5EEF76L   /*   68 */,    0xBAF294CB8990D201L   /*   69 */,
-        0xE69464F52AFAD975L   /*   70 */,    0x94B013AFDF133E14L   /*   71 */,
-        0x06A7D1A32823C958L   /*   72 */,    0x6F95FE5130F61119L   /*   73 */,
-        0xD92AB34E462C06C0L   /*   74 */,    0xED7BDE33887C71D2L   /*   75 */,
-        0x79746D6E6518393EL   /*   76 */,    0x5BA419385D713329L   /*   77 */,
-        0x7C1BA6B948A97564L   /*   78 */,    0x31987C197BFDAC67L   /*   79 */,
-        0xDE6C23C44B053D02L   /*   80 */,    0x581C49FED002D64DL   /*   81 */,
-        0xDD474D6338261571L   /*   82 */,    0xAA4546C3E473D062L   /*   83 */,
-        0x928FCE349455F860L   /*   84 */,    0x48161BBACAAB94D9L   /*   85 */,
-        0x63912430770E6F68L   /*   86 */,    0x6EC8A5E602C6641CL   /*   87 */,
-        0x87282515337DDD2BL   /*   88 */,    0x2CDA6B42034B701BL   /*   89 */,
-        0xB03D37C181CB096DL   /*   90 */,    0xE108438266C71C6FL   /*   91 */,
-        0x2B3180C7EB51B255L   /*   92 */,    0xDF92B82F96C08BBCL   /*   93 */,
-        0x5C68C8C0A632F3BAL   /*   94 */,    0x5504CC861C3D0556L   /*   95 */,
-        0xABBFA4E55FB26B8FL   /*   96 */,    0x41848B0AB3BACEB4L   /*   97 */,
-        0xB334A273AA445D32L   /*   98 */,    0xBCA696F0A85AD881L   /*   99 */,
-        0x24F6EC65B528D56CL   /*  100 */,    0x0CE1512E90F4524AL   /*  101 */,
-        0x4E9DD79D5506D35AL   /*  102 */,    0x258905FAC6CE9779L   /*  103 */,
-        0x2019295B3E109B33L   /*  104 */,    0xF8A9478B73A054CCL   /*  105 */,
-        0x2924F2F934417EB0L   /*  106 */,    0x3993357D536D1BC4L   /*  107 */,
-        0x38A81AC21DB6FF8BL   /*  108 */,    0x47C4FBF17D6016BFL   /*  109 */,
-        0x1E0FAADD7667E3F5L   /*  110 */,    0x7ABCFF62938BEB96L   /*  111 */,
-        0xA78DAD948FC179C9L   /*  112 */,    0x8F1F98B72911E50DL   /*  113 */,
-        0x61E48EAE27121A91L   /*  114 */,    0x4D62F7AD31859808L   /*  115 */,
-        0xECEBA345EF5CEAEBL   /*  116 */,    0xF5CEB25EBC9684CEL   /*  117 */,
-        0xF633E20CB7F76221L   /*  118 */,    0xA32CDF06AB8293E4L   /*  119 */,
-        0x985A202CA5EE2CA4L   /*  120 */,    0xCF0B8447CC8A8FB1L   /*  121 */,
-        0x9F765244979859A3L   /*  122 */,    0xA8D516B1A1240017L   /*  123 */,
-        0x0BD7BA3EBB5DC726L   /*  124 */,    0xE54BCA55B86ADB39L   /*  125 */,
-        0x1D7A3AFD6C478063L   /*  126 */,    0x519EC608E7669EDDL   /*  127 */,
-        0x0E5715A2D149AA23L   /*  128 */,    0x177D4571848FF194L   /*  129 */,
-        0xEEB55F3241014C22L   /*  130 */,    0x0F5E5CA13A6E2EC2L   /*  131 */,
-        0x8029927B75F5C361L   /*  132 */,    0xAD139FABC3D6E436L   /*  133 */,
-        0x0D5DF1A94CCF402FL   /*  134 */,    0x3E8BD948BEA5DFC8L   /*  135 */,
-        0xA5A0D357BD3FF77EL   /*  136 */,    0xA2D12E251F74F645L   /*  137 */,
-        0x66FD9E525E81A082L   /*  138 */,    0x2E0C90CE7F687A49L   /*  139 */,
-        0xC2E8BCBEBA973BC5L   /*  140 */,    0x000001BCE509745FL   /*  141 */,
-        0x423777BBE6DAB3D6L   /*  142 */,    0xD1661C7EAEF06EB5L   /*  143 */,
-        0xA1781F354DAACFD8L   /*  144 */,    0x2D11284A2B16AFFCL   /*  145 */,
-        0xF1FC4F67FA891D1FL   /*  146 */,    0x73ECC25DCB920ADAL   /*  147 */,
-        0xAE610C22C2A12651L   /*  148 */,    0x96E0A810D356B78AL   /*  149 */,
-        0x5A9A381F2FE7870FL   /*  150 */,    0xD5AD62EDE94E5530L   /*  151 */,
-        0xD225E5E8368D1427L   /*  152 */,    0x65977B70C7AF4631L   /*  153 */,
-        0x99F889B2DE39D74FL   /*  154 */,    0x233F30BF54E1D143L   /*  155 */,
-        0x9A9675D3D9A63C97L   /*  156 */,    0x5470554FF334F9A8L   /*  157 */,
-        0x166ACB744A4F5688L   /*  158 */,    0x70C74CAAB2E4AEADL   /*  159 */,
-        0xF0D091646F294D12L   /*  160 */,    0x57B82A89684031D1L   /*  161 */,
-        0xEFD95A5A61BE0B6BL   /*  162 */,    0x2FBD12E969F2F29AL   /*  163 */,
-        0x9BD37013FEFF9FE8L   /*  164 */,    0x3F9B0404D6085A06L   /*  165 */,
-        0x4940C1F3166CFE15L   /*  166 */,    0x09542C4DCDF3DEFBL   /*  167 */,
-        0xB4C5218385CD5CE3L   /*  168 */,    0xC935B7DC4462A641L   /*  169 */,
-        0x3417F8A68ED3B63FL   /*  170 */,    0xB80959295B215B40L   /*  171 */,
-        0xF99CDAEF3B8C8572L   /*  172 */,    0x018C0614F8FCB95DL   /*  173 */,
-        0x1B14ACCD1A3ACDF3L   /*  174 */,    0x84D471F200BB732DL   /*  175 */,
-        0xC1A3110E95E8DA16L   /*  176 */,    0x430A7220BF1A82B8L   /*  177 */,
-        0xB77E090D39DF210EL   /*  178 */,    0x5EF4BD9F3CD05E9DL   /*  179 */,
-        0x9D4FF6DA7E57A444L   /*  180 */,    0xDA1D60E183D4A5F8L   /*  181 */,
-        0xB287C38417998E47L   /*  182 */,    0xFE3EDC121BB31886L   /*  183 */,
-        0xC7FE3CCC980CCBEFL   /*  184 */,    0xE46FB590189BFD03L   /*  185 */,
-        0x3732FD469A4C57DCL   /*  186 */,    0x7EF700A07CF1AD65L   /*  187 */,
-        0x59C64468A31D8859L   /*  188 */,    0x762FB0B4D45B61F6L   /*  189 */,
-        0x155BAED099047718L   /*  190 */,    0x68755E4C3D50BAA6L   /*  191 */,
-        0xE9214E7F22D8B4DFL   /*  192 */,    0x2ADDBF532EAC95F4L   /*  193 */,
-        0x32AE3909B4BD0109L   /*  194 */,    0x834DF537B08E3450L   /*  195 */,
-        0xFA209DA84220728DL   /*  196 */,    0x9E691D9B9EFE23F7L   /*  197 */,
-        0x0446D288C4AE8D7FL   /*  198 */,    0x7B4CC524E169785BL   /*  199 */,
-        0x21D87F0135CA1385L   /*  200 */,    0xCEBB400F137B8AA5L   /*  201 */,
-        0x272E2B66580796BEL   /*  202 */,    0x3612264125C2B0DEL   /*  203 */,
-        0x057702BDAD1EFBB2L   /*  204 */,    0xD4BABB8EACF84BE9L   /*  205 */,
-        0x91583139641BC67BL   /*  206 */,    0x8BDC2DE08036E024L   /*  207 */,
-        0x603C8156F49F68EDL   /*  208 */,    0xF7D236F7DBEF5111L   /*  209 */,
-        0x9727C4598AD21E80L   /*  210 */,    0xA08A0896670A5FD7L   /*  211 */,
-        0xCB4A8F4309EBA9CBL   /*  212 */,    0x81AF564B0F7036A1L   /*  213 */,
-        0xC0B99AA778199ABDL   /*  214 */,    0x959F1EC83FC8E952L   /*  215 */,
-        0x8C505077794A81B9L   /*  216 */,    0x3ACAAF8F056338F0L   /*  217 */,
-        0x07B43F50627A6778L   /*  218 */,    0x4A44AB49F5ECCC77L   /*  219 */,
-        0x3BC3D6E4B679EE98L   /*  220 */,    0x9CC0D4D1CF14108CL   /*  221 */,
-        0x4406C00B206BC8A0L   /*  222 */,    0x82A18854C8D72D89L   /*  223 */,
-        0x67E366B35C3C432CL   /*  224 */,    0xB923DD61102B37F2L   /*  225 */,
-        0x56AB2779D884271DL   /*  226 */,    0xBE83E1B0FF1525AFL   /*  227 */,
-        0xFB7C65D4217E49A9L   /*  228 */,    0x6BDBE0E76D48E7D4L   /*  229 */,
-        0x08DF828745D9179EL   /*  230 */,    0x22EA6A9ADD53BD34L   /*  231 */,
-        0xE36E141C5622200AL   /*  232 */,    0x7F805D1B8CB750EEL   /*  233 */,
-        0xAFE5C7A59F58E837L   /*  234 */,    0xE27F996A4FB1C23CL   /*  235 */,
-        0xD3867DFB0775F0D0L   /*  236 */,    0xD0E673DE6E88891AL   /*  237 */,
-        0x123AEB9EAFB86C25L   /*  238 */,    0x30F1D5D5C145B895L   /*  239 */,
-        0xBB434A2DEE7269E7L   /*  240 */,    0x78CB67ECF931FA38L   /*  241 */,
-        0xF33B0372323BBF9CL   /*  242 */,    0x52D66336FB279C74L   /*  243 */,
-        0x505F33AC0AFB4EAAL   /*  244 */,    0xE8A5CD99A2CCE187L   /*  245 */,
-        0x534974801E2D30BBL   /*  246 */,    0x8D2D5711D5876D90L   /*  247 */,
-        0x1F1A412891BC038EL   /*  248 */,    0xD6E2E71D82E56648L   /*  249 */,
-        0x74036C3A497732B7L   /*  250 */,    0x89B67ED96361F5ABL   /*  251 */,
-        0xFFED95D8F1EA02A2L   /*  252 */,    0xE72B3BD61464D43DL   /*  253 */,
-        0xA6300F170BDC4820L   /*  254 */,    0xEBC18760ED78A77AL   /*  255 */,
-    };
-
-    private static final long[] t2 = {
-        0xE6A6BE5A05A12138L   /*  256 */,    0xB5A122A5B4F87C98L   /*  257 */,
-        0x563C6089140B6990L   /*  258 */,    0x4C46CB2E391F5DD5L   /*  259 */,
-        0xD932ADDBC9B79434L   /*  260 */,    0x08EA70E42015AFF5L   /*  261 */,
-        0xD765A6673E478CF1L   /*  262 */,    0xC4FB757EAB278D99L   /*  263 */,
-        0xDF11C6862D6E0692L   /*  264 */,    0xDDEB84F10D7F3B16L   /*  265 */,
-        0x6F2EF604A665EA04L   /*  266 */,    0x4A8E0F0FF0E0DFB3L   /*  267 */,
-        0xA5EDEEF83DBCBA51L   /*  268 */,    0xFC4F0A2A0EA4371EL   /*  269 */,
-        0xE83E1DA85CB38429L   /*  270 */,    0xDC8FF882BA1B1CE2L   /*  271 */,
-        0xCD45505E8353E80DL   /*  272 */,    0x18D19A00D4DB0717L   /*  273 */,
-        0x34A0CFEDA5F38101L   /*  274 */,    0x0BE77E518887CAF2L   /*  275 */,
-        0x1E341438B3C45136L   /*  276 */,    0xE05797F49089CCF9L   /*  277 */,
-        0xFFD23F9DF2591D14L   /*  278 */,    0x543DDA228595C5CDL   /*  279 */,
-        0x661F81FD99052A33L   /*  280 */,    0x8736E641DB0F7B76L   /*  281 */,
-        0x15227725418E5307L   /*  282 */,    0xE25F7F46162EB2FAL   /*  283 */,
-        0x48A8B2126C13D9FEL   /*  284 */,    0xAFDC541792E76EEAL   /*  285 */,
-        0x03D912BFC6D1898FL   /*  286 */,    0x31B1AAFA1B83F51BL   /*  287 */,
-        0xF1AC2796E42AB7D9L   /*  288 */,    0x40A3A7D7FCD2EBACL   /*  289 */,
-        0x1056136D0AFBBCC5L   /*  290 */,    0x7889E1DD9A6D0C85L   /*  291 */,
-        0xD33525782A7974AAL   /*  292 */,    0xA7E25D09078AC09BL   /*  293 */,
-        0xBD4138B3EAC6EDD0L   /*  294 */,    0x920ABFBE71EB9E70L   /*  295 */,
-        0xA2A5D0F54FC2625CL   /*  296 */,    0xC054E36B0B1290A3L   /*  297 */,
-        0xF6DD59FF62FE932BL   /*  298 */,    0x3537354511A8AC7DL   /*  299 */,
-        0xCA845E9172FADCD4L   /*  300 */,    0x84F82B60329D20DCL   /*  301 */,
-        0x79C62CE1CD672F18L   /*  302 */,    0x8B09A2ADD124642CL   /*  303 */,
-        0xD0C1E96A19D9E726L   /*  304 */,    0x5A786A9B4BA9500CL   /*  305 */,
-        0x0E020336634C43F3L   /*  306 */,    0xC17B474AEB66D822L   /*  307 */,
-        0x6A731AE3EC9BAAC2L   /*  308 */,    0x8226667AE0840258L   /*  309 */,
-        0x67D4567691CAECA5L   /*  310 */,    0x1D94155C4875ADB5L   /*  311 */,
-        0x6D00FD985B813FDFL   /*  312 */,    0x51286EFCB774CD06L   /*  313 */,
-        0x5E8834471FA744AFL   /*  314 */,    0xF72CA0AEE761AE2EL   /*  315 */,
-        0xBE40E4CDAEE8E09AL   /*  316 */,    0xE9970BBB5118F665L   /*  317 */,
-        0x726E4BEB33DF1964L   /*  318 */,    0x703B000729199762L   /*  319 */,
-        0x4631D816F5EF30A7L   /*  320 */,    0xB880B5B51504A6BEL   /*  321 */,
-        0x641793C37ED84B6CL   /*  322 */,    0x7B21ED77F6E97D96L   /*  323 */,
-        0x776306312EF96B73L   /*  324 */,    0xAE528948E86FF3F4L   /*  325 */,
-        0x53DBD7F286A3F8F8L   /*  326 */,    0x16CADCE74CFC1063L   /*  327 */,
-        0x005C19BDFA52C6DDL   /*  328 */,    0x68868F5D64D46AD3L   /*  329 */,
-        0x3A9D512CCF1E186AL   /*  330 */,    0x367E62C2385660AEL   /*  331 */,
-        0xE359E7EA77DCB1D7L   /*  332 */,    0x526C0773749ABE6EL   /*  333 */,
-        0x735AE5F9D09F734BL   /*  334 */,    0x493FC7CC8A558BA8L   /*  335 */,
-        0xB0B9C1533041AB45L   /*  336 */,    0x321958BA470A59BDL   /*  337 */,
-        0x852DB00B5F46C393L   /*  338 */,    0x91209B2BD336B0E5L   /*  339 */,
-        0x6E604F7D659EF19FL   /*  340 */,    0xB99A8AE2782CCB24L   /*  341 */,
-        0xCCF52AB6C814C4C7L   /*  342 */,    0x4727D9AFBE11727BL   /*  343 */,
-        0x7E950D0C0121B34DL   /*  344 */,    0x756F435670AD471FL   /*  345 */,
-        0xF5ADD442615A6849L   /*  346 */,    0x4E87E09980B9957AL   /*  347 */,
-        0x2ACFA1DF50AEE355L   /*  348 */,    0xD898263AFD2FD556L   /*  349 */,
-        0xC8F4924DD80C8FD6L   /*  350 */,    0xCF99CA3D754A173AL   /*  351 */,
-        0xFE477BACAF91BF3CL   /*  352 */,    0xED5371F6D690C12DL   /*  353 */,
-        0x831A5C285E687094L   /*  354 */,    0xC5D3C90A3708A0A4L   /*  355 */,
-        0x0F7F903717D06580L   /*  356 */,    0x19F9BB13B8FDF27FL   /*  357 */,
-        0xB1BD6F1B4D502843L   /*  358 */,    0x1C761BA38FFF4012L   /*  359 */,
-        0x0D1530C4E2E21F3BL   /*  360 */,    0x8943CE69A7372C8AL   /*  361 */,
-        0xE5184E11FEB5CE66L   /*  362 */,    0x618BDB80BD736621L   /*  363 */,
-        0x7D29BAD68B574D0BL   /*  364 */,    0x81BB613E25E6FE5BL   /*  365 */,
-        0x071C9C10BC07913FL   /*  366 */,    0xC7BEEB7909AC2D97L   /*  367 */,
-        0xC3E58D353BC5D757L   /*  368 */,    0xEB017892F38F61E8L   /*  369 */,
-        0xD4EFFB9C9B1CC21AL   /*  370 */,    0x99727D26F494F7ABL   /*  371 */,
-        0xA3E063A2956B3E03L   /*  372 */,    0x9D4A8B9A4AA09C30L   /*  373 */,
-        0x3F6AB7D500090FB4L   /*  374 */,    0x9CC0F2A057268AC0L   /*  375 */,
-        0x3DEE9D2DEDBF42D1L   /*  376 */,    0x330F49C87960A972L   /*  377 */,
-        0xC6B2720287421B41L   /*  378 */,    0x0AC59EC07C00369CL   /*  379 */,
-        0xEF4EAC49CB353425L   /*  380 */,    0xF450244EEF0129D8L   /*  381 */,
-        0x8ACC46E5CAF4DEB6L   /*  382 */,    0x2FFEAB63989263F7L   /*  383 */,
-        0x8F7CB9FE5D7A4578L   /*  384 */,    0x5BD8F7644E634635L   /*  385 */,
-        0x427A7315BF2DC900L   /*  386 */,    0x17D0C4AA2125261CL   /*  387 */,
-        0x3992486C93518E50L   /*  388 */,    0xB4CBFEE0A2D7D4C3L   /*  389 */,
-        0x7C75D6202C5DDD8DL   /*  390 */,    0xDBC295D8E35B6C61L   /*  391 */,
-        0x60B369D302032B19L   /*  392 */,    0xCE42685FDCE44132L   /*  393 */,
-        0x06F3DDB9DDF65610L   /*  394 */,    0x8EA4D21DB5E148F0L   /*  395 */,
-        0x20B0FCE62FCD496FL   /*  396 */,    0x2C1B912358B0EE31L   /*  397 */,
-        0xB28317B818F5A308L   /*  398 */,    0xA89C1E189CA6D2CFL   /*  399 */,
-        0x0C6B18576AAADBC8L   /*  400 */,    0xB65DEAA91299FAE3L   /*  401 */,
-        0xFB2B794B7F1027E7L   /*  402 */,    0x04E4317F443B5BEBL   /*  403 */,
-        0x4B852D325939D0A6L   /*  404 */,    0xD5AE6BEEFB207FFCL   /*  405 */,
-        0x309682B281C7D374L   /*  406 */,    0xBAE309A194C3B475L   /*  407 */,
-        0x8CC3F97B13B49F05L   /*  408 */,    0x98A9422FF8293967L   /*  409 */,
-        0x244B16B01076FF7CL   /*  410 */,    0xF8BF571C663D67EEL   /*  411 */,
-        0x1F0D6758EEE30DA1L   /*  412 */,    0xC9B611D97ADEB9B7L   /*  413 */,
-        0xB7AFD5887B6C57A2L   /*  414 */,    0x6290AE846B984FE1L   /*  415 */,
-        0x94DF4CDEACC1A5FDL   /*  416 */,    0x058A5BD1C5483AFFL   /*  417 */,
-        0x63166CC142BA3C37L   /*  418 */,    0x8DB8526EB2F76F40L   /*  419 */,
-        0xE10880036F0D6D4EL   /*  420 */,    0x9E0523C9971D311DL   /*  421 */,
-        0x45EC2824CC7CD691L   /*  422 */,    0x575B8359E62382C9L   /*  423 */,
-        0xFA9E400DC4889995L   /*  424 */,    0xD1823ECB45721568L   /*  425 */,
-        0xDAFD983B8206082FL   /*  426 */,    0xAA7D29082386A8CBL   /*  427 */,
-        0x269FCD4403B87588L   /*  428 */,    0x1B91F5F728BDD1E0L   /*  429 */,
-        0xE4669F39040201F6L   /*  430 */,    0x7A1D7C218CF04ADEL   /*  431 */,
-        0x65623C29D79CE5CEL   /*  432 */,    0x2368449096C00BB1L   /*  433 */,
-        0xAB9BF1879DA503BAL   /*  434 */,    0xBC23ECB1A458058EL   /*  435 */,
-        0x9A58DF01BB401ECCL   /*  436 */,    0xA070E868A85F143DL   /*  437 */,
-        0x4FF188307DF2239EL   /*  438 */,    0x14D565B41A641183L   /*  439 */,
-        0xEE13337452701602L   /*  440 */,    0x950E3DCF3F285E09L   /*  441 */,
-        0x59930254B9C80953L   /*  442 */,    0x3BF299408930DA6DL   /*  443 */,
-        0xA955943F53691387L   /*  444 */,    0xA15EDECAA9CB8784L   /*  445 */,
-        0x29142127352BE9A0L   /*  446 */,    0x76F0371FFF4E7AFBL   /*  447 */,
-        0x0239F450274F2228L   /*  448 */,    0xBB073AF01D5E868BL   /*  449 */,
-        0xBFC80571C10E96C1L   /*  450 */,    0xD267088568222E23L   /*  451 */,
-        0x9671A3D48E80B5B0L   /*  452 */,    0x55B5D38AE193BB81L   /*  453 */,
-        0x693AE2D0A18B04B8L   /*  454 */,    0x5C48B4ECADD5335FL   /*  455 */,
-        0xFD743B194916A1CAL   /*  456 */,    0x2577018134BE98C4L   /*  457 */,
-        0xE77987E83C54A4ADL   /*  458 */,    0x28E11014DA33E1B9L   /*  459 */,
-        0x270CC59E226AA213L   /*  460 */,    0x71495F756D1A5F60L   /*  461 */,
-        0x9BE853FB60AFEF77L   /*  462 */,    0xADC786A7F7443DBFL   /*  463 */,
-        0x0904456173B29A82L   /*  464 */,    0x58BC7A66C232BD5EL   /*  465 */,
-        0xF306558C673AC8B2L   /*  466 */,    0x41F639C6B6C9772AL   /*  467 */,
-        0x216DEFE99FDA35DAL   /*  468 */,    0x11640CC71C7BE615L   /*  469 */,
-        0x93C43694565C5527L   /*  470 */,    0xEA038E6246777839L   /*  471 */,
-        0xF9ABF3CE5A3E2469L   /*  472 */,    0x741E768D0FD312D2L   /*  473 */,
-        0x0144B883CED652C6L   /*  474 */,    0xC20B5A5BA33F8552L   /*  475 */,
-        0x1AE69633C3435A9DL   /*  476 */,    0x97A28CA4088CFDECL   /*  477 */,
-        0x8824A43C1E96F420L   /*  478 */,    0x37612FA66EEEA746L   /*  479 */,
-        0x6B4CB165F9CF0E5AL   /*  480 */,    0x43AA1C06A0ABFB4AL   /*  481 */,
-        0x7F4DC26FF162796BL   /*  482 */,    0x6CBACC8E54ED9B0FL   /*  483 */,
-        0xA6B7FFEFD2BB253EL   /*  484 */,    0x2E25BC95B0A29D4FL   /*  485 */,
-        0x86D6A58BDEF1388CL   /*  486 */,    0xDED74AC576B6F054L   /*  487 */,
-        0x8030BDBC2B45805DL   /*  488 */,    0x3C81AF70E94D9289L   /*  489 */,
-        0x3EFF6DDA9E3100DBL   /*  490 */,    0xB38DC39FDFCC8847L   /*  491 */,
-        0x123885528D17B87EL   /*  492 */,    0xF2DA0ED240B1B642L   /*  493 */,
-        0x44CEFADCD54BF9A9L   /*  494 */,    0x1312200E433C7EE6L   /*  495 */,
-        0x9FFCC84F3A78C748L   /*  496 */,    0xF0CD1F72248576BBL   /*  497 */,
-        0xEC6974053638CFE4L   /*  498 */,    0x2BA7B67C0CEC4E4CL   /*  499 */,
-        0xAC2F4DF3E5CE32EDL   /*  500 */,    0xCB33D14326EA4C11L   /*  501 */,
-        0xA4E9044CC77E58BCL   /*  502 */,    0x5F513293D934FCEFL   /*  503 */,
-        0x5DC9645506E55444L   /*  504 */,    0x50DE418F317DE40AL   /*  505 */,
-        0x388CB31A69DDE259L   /*  506 */,    0x2DB4A83455820A86L   /*  507 */,
-        0x9010A91E84711AE9L   /*  508 */,    0x4DF7F0B7B1498371L   /*  509 */,
-        0xD62A2EABC0977179L   /*  510 */,    0x22FAC097AA8D5C0EL   /*  511 */,
-    };
-
-    private static final long[] t3 = {
-        0xF49FCC2FF1DAF39BL   /*  512 */,    0x487FD5C66FF29281L   /*  513 */,
-        0xE8A30667FCDCA83FL   /*  514 */,    0x2C9B4BE3D2FCCE63L   /*  515 */,
-        0xDA3FF74B93FBBBC2L   /*  516 */,    0x2FA165D2FE70BA66L   /*  517 */,
-        0xA103E279970E93D4L   /*  518 */,    0xBECDEC77B0E45E71L   /*  519 */,
-        0xCFB41E723985E497L   /*  520 */,    0xB70AAA025EF75017L   /*  521 */,
-        0xD42309F03840B8E0L   /*  522 */,    0x8EFC1AD035898579L   /*  523 */,
-        0x96C6920BE2B2ABC5L   /*  524 */,    0x66AF4163375A9172L   /*  525 */,
-        0x2174ABDCCA7127FBL   /*  526 */,    0xB33CCEA64A72FF41L   /*  527 */,
-        0xF04A4933083066A5L   /*  528 */,    0x8D970ACDD7289AF5L   /*  529 */,
-        0x8F96E8E031C8C25EL   /*  530 */,    0xF3FEC02276875D47L   /*  531 */,
-        0xEC7BF310056190DDL   /*  532 */,    0xF5ADB0AEBB0F1491L   /*  533 */,
-        0x9B50F8850FD58892L   /*  534 */,    0x4975488358B74DE8L   /*  535 */,
-        0xA3354FF691531C61L   /*  536 */,    0x0702BBE481D2C6EEL   /*  537 */,
-        0x89FB24057DEDED98L   /*  538 */,    0xAC3075138596E902L   /*  539 */,
-        0x1D2D3580172772EDL   /*  540 */,    0xEB738FC28E6BC30DL   /*  541 */,
-        0x5854EF8F63044326L   /*  542 */,    0x9E5C52325ADD3BBEL   /*  543 */,
-        0x90AA53CF325C4623L   /*  544 */,    0xC1D24D51349DD067L   /*  545 */,
-        0x2051CFEEA69EA624L   /*  546 */,    0x13220F0A862E7E4FL   /*  547 */,
-        0xCE39399404E04864L   /*  548 */,    0xD9C42CA47086FCB7L   /*  549 */,
-        0x685AD2238A03E7CCL   /*  550 */,    0x066484B2AB2FF1DBL   /*  551 */,
-        0xFE9D5D70EFBF79ECL   /*  552 */,    0x5B13B9DD9C481854L   /*  553 */,
-        0x15F0D475ED1509ADL   /*  554 */,    0x0BEBCD060EC79851L   /*  555 */,
-        0xD58C6791183AB7F8L   /*  556 */,    0xD1187C5052F3EEE4L   /*  557 */,
-        0xC95D1192E54E82FFL   /*  558 */,    0x86EEA14CB9AC6CA2L   /*  559 */,
-        0x3485BEB153677D5DL   /*  560 */,    0xDD191D781F8C492AL   /*  561 */,
-        0xF60866BAA784EBF9L   /*  562 */,    0x518F643BA2D08C74L   /*  563 */,
-        0x8852E956E1087C22L   /*  564 */,    0xA768CB8DC410AE8DL   /*  565 */,
-        0x38047726BFEC8E1AL   /*  566 */,    0xA67738B4CD3B45AAL   /*  567 */,
-        0xAD16691CEC0DDE19L   /*  568 */,    0xC6D4319380462E07L   /*  569 */,
-        0xC5A5876D0BA61938L   /*  570 */,    0x16B9FA1FA58FD840L   /*  571 */,
-        0x188AB1173CA74F18L   /*  572 */,    0xABDA2F98C99C021FL   /*  573 */,
-        0x3E0580AB134AE816L   /*  574 */,    0x5F3B05B773645ABBL   /*  575 */,
-        0x2501A2BE5575F2F6L   /*  576 */,    0x1B2F74004E7E8BA9L   /*  577 */,
-        0x1CD7580371E8D953L   /*  578 */,    0x7F6ED89562764E30L   /*  579 */,
-        0xB15926FF596F003DL   /*  580 */,    0x9F65293DA8C5D6B9L   /*  581 */,
-        0x6ECEF04DD690F84CL   /*  582 */,    0x4782275FFF33AF88L   /*  583 */,
-        0xE41433083F820801L   /*  584 */,    0xFD0DFE409A1AF9B5L   /*  585 */,
-        0x4325A3342CDB396BL   /*  586 */,    0x8AE77E62B301B252L   /*  587 */,
-        0xC36F9E9F6655615AL   /*  588 */,    0x85455A2D92D32C09L   /*  589 */,
-        0xF2C7DEA949477485L   /*  590 */,    0x63CFB4C133A39EBAL   /*  591 */,
-        0x83B040CC6EBC5462L   /*  592 */,    0x3B9454C8FDB326B0L   /*  593 */,
-        0x56F56A9E87FFD78CL   /*  594 */,    0x2DC2940D99F42BC6L   /*  595 */,
-        0x98F7DF096B096E2DL   /*  596 */,    0x19A6E01E3AD852BFL   /*  597 */,
-        0x42A99CCBDBD4B40BL   /*  598 */,    0xA59998AF45E9C559L   /*  599 */,
-        0x366295E807D93186L   /*  600 */,    0x6B48181BFAA1F773L   /*  601 */,
-        0x1FEC57E2157A0A1DL   /*  602 */,    0x4667446AF6201AD5L   /*  603 */,
-        0xE615EBCACFB0F075L   /*  604 */,    0xB8F31F4F68290778L   /*  605 */,
-        0x22713ED6CE22D11EL   /*  606 */,    0x3057C1A72EC3C93BL   /*  607 */,
-        0xCB46ACC37C3F1F2FL   /*  608 */,    0xDBB893FD02AAF50EL   /*  609 */,
-        0x331FD92E600B9FCFL   /*  610 */,    0xA498F96148EA3AD6L   /*  611 */,
-        0xA8D8426E8B6A83EAL   /*  612 */,    0xA089B274B7735CDCL   /*  613 */,
-        0x87F6B3731E524A11L   /*  614 */,    0x118808E5CBC96749L   /*  615 */,
-        0x9906E4C7B19BD394L   /*  616 */,    0xAFED7F7E9B24A20CL   /*  617 */,
-        0x6509EADEEB3644A7L   /*  618 */,    0x6C1EF1D3E8EF0EDEL   /*  619 */,
-        0xB9C97D43E9798FB4L   /*  620 */,    0xA2F2D784740C28A3L   /*  621 */,
-        0x7B8496476197566FL   /*  622 */,    0x7A5BE3E6B65F069DL   /*  623 */,
-        0xF96330ED78BE6F10L   /*  624 */,    0xEEE60DE77A076A15L   /*  625 */,
-        0x2B4BEE4AA08B9BD0L   /*  626 */,    0x6A56A63EC7B8894EL   /*  627 */,
-        0x02121359BA34FEF4L   /*  628 */,    0x4CBF99F8283703FCL   /*  629 */,
-        0x398071350CAF30C8L   /*  630 */,    0xD0A77A89F017687AL   /*  631 */,
-        0xF1C1A9EB9E423569L   /*  632 */,    0x8C7976282DEE8199L   /*  633 */,
-        0x5D1737A5DD1F7ABDL   /*  634 */,    0x4F53433C09A9FA80L   /*  635 */,
-        0xFA8B0C53DF7CA1D9L   /*  636 */,    0x3FD9DCBC886CCB77L   /*  637 */,
-        0xC040917CA91B4720L   /*  638 */,    0x7DD00142F9D1DCDFL   /*  639 */,
-        0x8476FC1D4F387B58L   /*  640 */,    0x23F8E7C5F3316503L   /*  641 */,
-        0x032A2244E7E37339L   /*  642 */,    0x5C87A5D750F5A74BL   /*  643 */,
-        0x082B4CC43698992EL   /*  644 */,    0xDF917BECB858F63CL   /*  645 */,
-        0x3270B8FC5BF86DDAL   /*  646 */,    0x10AE72BB29B5DD76L   /*  647 */,
-        0x576AC94E7700362BL   /*  648 */,    0x1AD112DAC61EFB8FL   /*  649 */,
-        0x691BC30EC5FAA427L   /*  650 */,    0xFF246311CC327143L   /*  651 */,
-        0x3142368E30E53206L   /*  652 */,    0x71380E31E02CA396L   /*  653 */,
-        0x958D5C960AAD76F1L   /*  654 */,    0xF8D6F430C16DA536L   /*  655 */,
-        0xC8FFD13F1BE7E1D2L   /*  656 */,    0x7578AE66004DDBE1L   /*  657 */,
-        0x05833F01067BE646L   /*  658 */,    0xBB34B5AD3BFE586DL   /*  659 */,
-        0x095F34C9A12B97F0L   /*  660 */,    0x247AB64525D60CA8L   /*  661 */,
-        0xDCDBC6F3017477D1L   /*  662 */,    0x4A2E14D4DECAD24DL   /*  663 */,
-        0xBDB5E6D9BE0A1EEBL   /*  664 */,    0x2A7E70F7794301ABL   /*  665 */,
-        0xDEF42D8A270540FDL   /*  666 */,    0x01078EC0A34C22C1L   /*  667 */,
-        0xE5DE511AF4C16387L   /*  668 */,    0x7EBB3A52BD9A330AL   /*  669 */,
-        0x77697857AA7D6435L   /*  670 */,    0x004E831603AE4C32L   /*  671 */,
-        0xE7A21020AD78E312L   /*  672 */,    0x9D41A70C6AB420F2L   /*  673 */,
-        0x28E06C18EA1141E6L   /*  674 */,    0xD2B28CBD984F6B28L   /*  675 */,
-        0x26B75F6C446E9D83L   /*  676 */,    0xBA47568C4D418D7FL   /*  677 */,
-        0xD80BADBFE6183D8EL   /*  678 */,    0x0E206D7F5F166044L   /*  679 */,
-        0xE258A43911CBCA3EL   /*  680 */,    0x723A1746B21DC0BCL   /*  681 */,
-        0xC7CAA854F5D7CDD3L   /*  682 */,    0x7CAC32883D261D9CL   /*  683 */,
-        0x7690C26423BA942CL   /*  684 */,    0x17E55524478042B8L   /*  685 */,
-        0xE0BE477656A2389FL   /*  686 */,    0x4D289B5E67AB2DA0L   /*  687 */,
-        0x44862B9C8FBBFD31L   /*  688 */,    0xB47CC8049D141365L   /*  689 */,
-        0x822C1B362B91C793L   /*  690 */,    0x4EB14655FB13DFD8L   /*  691 */,
-        0x1ECBBA0714E2A97BL   /*  692 */,    0x6143459D5CDE5F14L   /*  693 */,
-        0x53A8FBF1D5F0AC89L   /*  694 */,    0x97EA04D81C5E5B00L   /*  695 */,
-        0x622181A8D4FDB3F3L   /*  696 */,    0xE9BCD341572A1208L   /*  697 */,
-        0x1411258643CCE58AL   /*  698 */,    0x9144C5FEA4C6E0A4L   /*  699 */,
-        0x0D33D06565CF620FL   /*  700 */,    0x54A48D489F219CA1L   /*  701 */,
-        0xC43E5EAC6D63C821L   /*  702 */,    0xA9728B3A72770DAFL   /*  703 */,
-        0xD7934E7B20DF87EFL   /*  704 */,    0xE35503B61A3E86E5L   /*  705 */,
-        0xCAE321FBC819D504L   /*  706 */,    0x129A50B3AC60BFA6L   /*  707 */,
-        0xCD5E68EA7E9FB6C3L   /*  708 */,    0xB01C90199483B1C7L   /*  709 */,
-        0x3DE93CD5C295376CL   /*  710 */,    0xAED52EDF2AB9AD13L   /*  711 */,
-        0x2E60F512C0A07884L   /*  712 */,    0xBC3D86A3E36210C9L   /*  713 */,
-        0x35269D9B163951CEL   /*  714 */,    0x0C7D6E2AD0CDB5FAL   /*  715 */,
-        0x59E86297D87F5733L   /*  716 */,    0x298EF221898DB0E7L   /*  717 */,
-        0x55000029D1A5AA7EL   /*  718 */,    0x8BC08AE1B5061B45L   /*  719 */,
-        0xC2C31C2B6C92703AL   /*  720 */,    0x94CC596BAF25EF42L   /*  721 */,
-        0x0A1D73DB22540456L   /*  722 */,    0x04B6A0F9D9C4179AL   /*  723 */,
-        0xEFFDAFA2AE3D3C60L   /*  724 */,    0xF7C8075BB49496C4L   /*  725 */,
-        0x9CC5C7141D1CD4E3L   /*  726 */,    0x78BD1638218E5534L   /*  727 */,
-        0xB2F11568F850246AL   /*  728 */,    0xEDFABCFA9502BC29L   /*  729 */,
-        0x796CE5F2DA23051BL   /*  730 */,    0xAAE128B0DC93537CL   /*  731 */,
-        0x3A493DA0EE4B29AEL   /*  732 */,    0xB5DF6B2C416895D7L   /*  733 */,
-        0xFCABBD25122D7F37L   /*  734 */,    0x70810B58105DC4B1L   /*  735 */,
-        0xE10FDD37F7882A90L   /*  736 */,    0x524DCAB5518A3F5CL   /*  737 */,
-        0x3C9E85878451255BL   /*  738 */,    0x4029828119BD34E2L   /*  739 */,
-        0x74A05B6F5D3CECCBL   /*  740 */,    0xB610021542E13ECAL   /*  741 */,
-        0x0FF979D12F59E2ACL   /*  742 */,    0x6037DA27E4F9CC50L   /*  743 */,
-        0x5E92975A0DF1847DL   /*  744 */,    0xD66DE190D3E623FEL   /*  745 */,
-        0x5032D6B87B568048L   /*  746 */,    0x9A36B7CE8235216EL   /*  747 */,
-        0x80272A7A24F64B4AL   /*  748 */,    0x93EFED8B8C6916F7L   /*  749 */,
-        0x37DDBFF44CCE1555L   /*  750 */,    0x4B95DB5D4B99BD25L   /*  751 */,
-        0x92D3FDA169812FC0L   /*  752 */,    0xFB1A4A9A90660BB6L   /*  753 */,
-        0x730C196946A4B9B2L   /*  754 */,    0x81E289AA7F49DA68L   /*  755 */,
-        0x64669A0F83B1A05FL   /*  756 */,    0x27B3FF7D9644F48BL   /*  757 */,
-        0xCC6B615C8DB675B3L   /*  758 */,    0x674F20B9BCEBBE95L   /*  759 */,
-        0x6F31238275655982L   /*  760 */,    0x5AE488713E45CF05L   /*  761 */,
-        0xBF619F9954C21157L   /*  762 */,    0xEABAC46040A8EAE9L   /*  763 */,
-        0x454C6FE9F2C0C1CDL   /*  764 */,    0x419CF6496412691CL   /*  765 */,
-        0xD3DC3BEF265B0F70L   /*  766 */,    0x6D0E60F5C3578A9EL   /*  767 */,
-    };
-
-    private static final long[] t4 = {
-        0x5B0E608526323C55L   /*  768 */,    0x1A46C1A9FA1B59F5L   /*  769 */,
-        0xA9E245A17C4C8FFAL   /*  770 */,    0x65CA5159DB2955D7L   /*  771 */,
-        0x05DB0A76CE35AFC2L   /*  772 */,    0x81EAC77EA9113D45L   /*  773 */,
-        0x528EF88AB6AC0A0DL   /*  774 */,    0xA09EA253597BE3FFL   /*  775 */,
-        0x430DDFB3AC48CD56L   /*  776 */,    0xC4B3A67AF45CE46FL   /*  777 */,
-        0x4ECECFD8FBE2D05EL   /*  778 */,    0x3EF56F10B39935F0L   /*  779 */,
-        0x0B22D6829CD619C6L   /*  780 */,    0x17FD460A74DF2069L   /*  781 */,
-        0x6CF8CC8E8510ED40L   /*  782 */,    0xD6C824BF3A6ECAA7L   /*  783 */,
-        0x61243D581A817049L   /*  784 */,    0x048BACB6BBC163A2L   /*  785 */,
-        0xD9A38AC27D44CC32L   /*  786 */,    0x7FDDFF5BAAF410ABL   /*  787 */,
-        0xAD6D495AA804824BL   /*  788 */,    0xE1A6A74F2D8C9F94L   /*  789 */,
-        0xD4F7851235DEE8E3L   /*  790 */,    0xFD4B7F886540D893L   /*  791 */,
-        0x247C20042AA4BFDAL   /*  792 */,    0x096EA1C517D1327CL   /*  793 */,
-        0xD56966B4361A6685L   /*  794 */,    0x277DA5C31221057DL   /*  795 */,
-        0x94D59893A43ACFF7L   /*  796 */,    0x64F0C51CCDC02281L   /*  797 */,
-        0x3D33BCC4FF6189DBL   /*  798 */,    0xE005CB184CE66AF1L   /*  799 */,
-        0xFF5CCD1D1DB99BEAL   /*  800 */,    0xB0B854A7FE42980FL   /*  801 */,
-        0x7BD46A6A718D4B9FL   /*  802 */,    0xD10FA8CC22A5FD8CL   /*  803 */,
-        0xD31484952BE4BD31L   /*  804 */,    0xC7FA975FCB243847L   /*  805 */,
-        0x4886ED1E5846C407L   /*  806 */,    0x28CDDB791EB70B04L   /*  807 */,
-        0xC2B00BE2F573417FL   /*  808 */,    0x5C9590452180F877L   /*  809 */,
-        0x7A6BDDFFF370EB00L   /*  810 */,    0xCE509E38D6D9D6A4L   /*  811 */,
-        0xEBEB0F00647FA702L   /*  812 */,    0x1DCC06CF76606F06L   /*  813 */,
-        0xE4D9F28BA286FF0AL   /*  814 */,    0xD85A305DC918C262L   /*  815 */,
-        0x475B1D8732225F54L   /*  816 */,    0x2D4FB51668CCB5FEL   /*  817 */,
-        0xA679B9D9D72BBA20L   /*  818 */,    0x53841C0D912D43A5L   /*  819 */,
-        0x3B7EAA48BF12A4E8L   /*  820 */,    0x781E0E47F22F1DDFL   /*  821 */,
-        0xEFF20CE60AB50973L   /*  822 */,    0x20D261D19DFFB742L   /*  823 */,
-        0x16A12B03062A2E39L   /*  824 */,    0x1960EB2239650495L   /*  825 */,
-        0x251C16FED50EB8B8L   /*  826 */,    0x9AC0C330F826016EL   /*  827 */,
-        0xED152665953E7671L   /*  828 */,    0x02D63194A6369570L   /*  829 */,
-        0x5074F08394B1C987L   /*  830 */,    0x70BA598C90B25CE1L   /*  831 */,
-        0x794A15810B9742F6L   /*  832 */,    0x0D5925E9FCAF8C6CL   /*  833 */,
-        0x3067716CD868744EL   /*  834 */,    0x910AB077E8D7731BL   /*  835 */,
-        0x6A61BBDB5AC42F61L   /*  836 */,    0x93513EFBF0851567L   /*  837 */,
-        0xF494724B9E83E9D5L   /*  838 */,    0xE887E1985C09648DL   /*  839 */,
-        0x34B1D3C675370CFDL   /*  840 */,    0xDC35E433BC0D255DL   /*  841 */,
-        0xD0AAB84234131BE0L   /*  842 */,    0x08042A50B48B7EAFL   /*  843 */,
-        0x9997C4EE44A3AB35L   /*  844 */,    0x829A7B49201799D0L   /*  845 */,
-        0x263B8307B7C54441L   /*  846 */,    0x752F95F4FD6A6CA6L   /*  847 */,
-        0x927217402C08C6E5L   /*  848 */,    0x2A8AB754A795D9EEL   /*  849 */,
-        0xA442F7552F72943DL   /*  850 */,    0x2C31334E19781208L   /*  851 */,
-        0x4FA98D7CEAEE6291L   /*  852 */,    0x55C3862F665DB309L   /*  853 */,
-        0xBD0610175D53B1F3L   /*  854 */,    0x46FE6CB840413F27L   /*  855 */,
-        0x3FE03792DF0CFA59L   /*  856 */,    0xCFE700372EB85E8FL   /*  857 */,
-        0xA7BE29E7ADBCE118L   /*  858 */,    0xE544EE5CDE8431DDL   /*  859 */,
-        0x8A781B1B41F1873EL   /*  860 */,    0xA5C94C78A0D2F0E7L   /*  861 */,
-        0x39412E2877B60728L   /*  862 */,    0xA1265EF3AFC9A62CL   /*  863 */,
-        0xBCC2770C6A2506C5L   /*  864 */,    0x3AB66DD5DCE1CE12L   /*  865 */,
-        0xE65499D04A675B37L   /*  866 */,    0x7D8F523481BFD216L   /*  867 */,
-        0x0F6F64FCEC15F389L   /*  868 */,    0x74EFBE618B5B13C8L   /*  869 */,
-        0xACDC82B714273E1DL   /*  870 */,    0xDD40BFE003199D17L   /*  871 */,
-        0x37E99257E7E061F8L   /*  872 */,    0xFA52626904775AAAL   /*  873 */,
-        0x8BBBF63A463D56F9L   /*  874 */,    0xF0013F1543A26E64L   /*  875 */,
-        0xA8307E9F879EC898L   /*  876 */,    0xCC4C27A4150177CCL   /*  877 */,
-        0x1B432F2CCA1D3348L   /*  878 */,    0xDE1D1F8F9F6FA013L   /*  879 */,
-        0x606602A047A7DDD6L   /*  880 */,    0xD237AB64CC1CB2C7L   /*  881 */,
-        0x9B938E7225FCD1D3L   /*  882 */,    0xEC4E03708E0FF476L   /*  883 */,
-        0xFEB2FBDA3D03C12DL   /*  884 */,    0xAE0BCED2EE43889AL   /*  885 */,
-        0x22CB8923EBFB4F43L   /*  886 */,    0x69360D013CF7396DL   /*  887 */,
-        0x855E3602D2D4E022L   /*  888 */,    0x073805BAD01F784CL   /*  889 */,
-        0x33E17A133852F546L   /*  890 */,    0xDF4874058AC7B638L   /*  891 */,
-        0xBA92B29C678AA14AL   /*  892 */,    0x0CE89FC76CFAADCDL   /*  893 */,
-        0x5F9D4E0908339E34L   /*  894 */,    0xF1AFE9291F5923B9L   /*  895 */,
-        0x6E3480F60F4A265FL   /*  896 */,    0xEEBF3A2AB29B841CL   /*  897 */,
-        0xE21938A88F91B4ADL   /*  898 */,    0x57DFEFF845C6D3C3L   /*  899 */,
-        0x2F006B0BF62CAAF2L   /*  900 */,    0x62F479EF6F75EE78L   /*  901 */,
-        0x11A55AD41C8916A9L   /*  902 */,    0xF229D29084FED453L   /*  903 */,
-        0x42F1C27B16B000E6L   /*  904 */,    0x2B1F76749823C074L   /*  905 */,
-        0x4B76ECA3C2745360L   /*  906 */,    0x8C98F463B91691BDL   /*  907 */,
-        0x14BCC93CF1ADE66AL   /*  908 */,    0x8885213E6D458397L   /*  909 */,
-        0x8E177DF0274D4711L   /*  910 */,    0xB49B73B5503F2951L   /*  911 */,
-        0x10168168C3F96B6BL   /*  912 */,    0x0E3D963B63CAB0AEL   /*  913 */,
-        0x8DFC4B5655A1DB14L   /*  914 */,    0xF789F1356E14DE5CL   /*  915 */,
-        0x683E68AF4E51DAC1L   /*  916 */,    0xC9A84F9D8D4B0FD9L   /*  917 */,
-        0x3691E03F52A0F9D1L   /*  918 */,    0x5ED86E46E1878E80L   /*  919 */,
-        0x3C711A0E99D07150L   /*  920 */,    0x5A0865B20C4E9310L   /*  921 */,
-        0x56FBFC1FE4F0682EL   /*  922 */,    0xEA8D5DE3105EDF9BL   /*  923 */,
-        0x71ABFDB12379187AL   /*  924 */,    0x2EB99DE1BEE77B9CL   /*  925 */,
-        0x21ECC0EA33CF4523L   /*  926 */,    0x59A4D7521805C7A1L   /*  927 */,
-        0x3896F5EB56AE7C72L   /*  928 */,    0xAA638F3DB18F75DCL   /*  929 */,
-        0x9F39358DABE9808EL   /*  930 */,    0xB7DEFA91C00B72ACL   /*  931 */,
-        0x6B5541FD62492D92L   /*  932 */,    0x6DC6DEE8F92E4D5BL   /*  933 */,
-        0x353F57ABC4BEEA7EL   /*  934 */,    0x735769D6DA5690CEL   /*  935 */,
-        0x0A234AA642391484L   /*  936 */,    0xF6F9508028F80D9DL   /*  937 */,
-        0xB8E319A27AB3F215L   /*  938 */,    0x31AD9C1151341A4DL   /*  939 */,
-        0x773C22A57BEF5805L   /*  940 */,    0x45C7561A07968633L   /*  941 */,
-        0xF913DA9E249DBE36L   /*  942 */,    0xDA652D9B78A64C68L   /*  943 */,
-        0x4C27A97F3BC334EFL   /*  944 */,    0x76621220E66B17F4L   /*  945 */,
-        0x967743899ACD7D0BL   /*  946 */,    0xF3EE5BCAE0ED6782L   /*  947 */,
-        0x409F753600C879FCL   /*  948 */,    0x06D09A39B5926DB6L   /*  949 */,
-        0x6F83AEB0317AC588L   /*  950 */,    0x01E6CA4A86381F21L   /*  951 */,
-        0x66FF3462D19F3025L   /*  952 */,    0x72207C24DDFD3BFBL   /*  953 */,
-        0x4AF6B6D3E2ECE2EBL   /*  954 */,    0x9C994DBEC7EA08DEL   /*  955 */,
-        0x49ACE597B09A8BC4L   /*  956 */,    0xB38C4766CF0797BAL   /*  957 */,
-        0x131B9373C57C2A75L   /*  958 */,    0xB1822CCE61931E58L   /*  959 */,
-        0x9D7555B909BA1C0CL   /*  960 */,    0x127FAFDD937D11D2L   /*  961 */,
-        0x29DA3BADC66D92E4L   /*  962 */,    0xA2C1D57154C2ECBCL   /*  963 */,
-        0x58C5134D82F6FE24L   /*  964 */,    0x1C3AE3515B62274FL   /*  965 */,
-        0xE907C82E01CB8126L   /*  966 */,    0xF8ED091913E37FCBL   /*  967 */,
-        0x3249D8F9C80046C9L   /*  968 */,    0x80CF9BEDE388FB63L   /*  969 */,
-        0x1881539A116CF19EL   /*  970 */,    0x5103F3F76BD52457L   /*  971 */,
-        0x15B7E6F5AE47F7A8L   /*  972 */,    0xDBD7C6DED47E9CCFL   /*  973 */,
-        0x44E55C410228BB1AL   /*  974 */,    0xB647D4255EDB4E99L   /*  975 */,
-        0x5D11882BB8AAFC30L   /*  976 */,    0xF5098BBB29D3212AL   /*  977 */,
-        0x8FB5EA14E90296B3L   /*  978 */,    0x677B942157DD025AL   /*  979 */,
-        0xFB58E7C0A390ACB5L   /*  980 */,    0x89D3674C83BD4A01L   /*  981 */,
-        0x9E2DA4DF4BF3B93BL   /*  982 */,    0xFCC41E328CAB4829L   /*  983 */,
-        0x03F38C96BA582C52L   /*  984 */,    0xCAD1BDBD7FD85DB2L   /*  985 */,
-        0xBBB442C16082AE83L   /*  986 */,    0xB95FE86BA5DA9AB0L   /*  987 */,
-        0xB22E04673771A93FL   /*  988 */,    0x845358C9493152D8L   /*  989 */,
-        0xBE2A488697B4541EL   /*  990 */,    0x95A2DC2DD38E6966L   /*  991 */,
-        0xC02C11AC923C852BL   /*  992 */,    0x2388B1990DF2A87BL   /*  993 */,
-        0x7C8008FA1B4F37BEL   /*  994 */,    0x1F70D0C84D54E503L   /*  995 */,
-        0x5490ADEC7ECE57D4L   /*  996 */,    0x002B3C27D9063A3AL   /*  997 */,
-        0x7EAEA3848030A2BFL   /*  998 */,    0xC602326DED2003C0L   /*  999 */,
-        0x83A7287D69A94086L   /* 1000 */,    0xC57A5FCB30F57A8AL   /* 1001 */,
-        0xB56844E479EBE779L   /* 1002 */,    0xA373B40F05DCBCE9L   /* 1003 */,
-        0xD71A786E88570EE2L   /* 1004 */,    0x879CBACDBDE8F6A0L   /* 1005 */,
-        0x976AD1BCC164A32FL   /* 1006 */,    0xAB21E25E9666D78BL   /* 1007 */,
-        0x901063AAE5E5C33CL   /* 1008 */,    0x9818B34448698D90L   /* 1009 */,
-        0xE36487AE3E1E8ABBL   /* 1010 */,    0xAFBDF931893BDCB4L   /* 1011 */,
-        0x6345A0DC5FBBD519L   /* 1012 */,    0x8628FE269B9465CAL   /* 1013 */,
-        0x1E5D01603F9C51ECL   /* 1014 */,    0x4DE44006A15049B7L   /* 1015 */,
-        0xBF6C70E5F776CBB1L   /* 1016 */,    0x411218F2EF552BEDL   /* 1017 */,
-        0xCB0C0708705A36A3L   /* 1018 */,    0xE74D14754F986044L   /* 1019 */,
-        0xCD56D9430EA8280EL   /* 1020 */,    0xC12591D7535F5065L   /* 1021 */,
-        0xC83223F1720AEF96L   /* 1022 */,    0xC3A0396F7363A51FL   /* 1023 */
-    };
-
-    private static final int    DIGEST_LENGTH = 24;
-
-    //
-    // registers
-    //
-    private long    a, b, c;
-    private long    byteCount;
-
-    //
-    // buffers
-    //
-    private byte[]  buf = new byte[8];
-    private int     bOff = 0;
-
-    private long[]  x = new long[8];
-    private int     xOff = 0;
-
-	/**
-	 * Standard constructor
-	 */
-    public TigerDigest()
-    {
-        reset();
-    }
-
-	/**
-	 * Copy constructor.  This will copy the state of the provided
-	 * message digest.
-	 */
-	public TigerDigest(TigerDigest t)
-	{
-		a = t.a;
-		b = t.b;
-		c = t.c;
-
-		System.arraycopy(t.x, 0, x, 0, t.x.length);
-		xOff = t.xOff;
-
-		System.arraycopy(t.buf, 0, buf, 0, t.buf.length);
-		bOff = t.bOff;
-
-        byteCount = t.byteCount;
-	}
-
-    public String getAlgorithmName()
-    {
-        return "Tiger";
-    }
-
-    public int getDigestSize()
-    {
-        return DIGEST_LENGTH;
-    }
-
-    private void processWord(
-        byte[]  b,
-        int     off)
-    {
-        x[xOff++] = ((long)(b[off + 7] & 0xff) << 56)
-             | ((long)(b[off + 6] & 0xff) << 48)
-             | ((long)(b[off + 5] & 0xff) << 40)
-             | ((long)(b[off + 4] & 0xff) << 32)
-             | ((long)(b[off + 3] & 0xff) << 24)
-             | ((long)(b[off + 2] & 0xff) << 16)
-             | ((long)(b[off + 1] & 0xff) << 8)
-             | ((b[off + 0] & 0xff));
-
-        if (xOff == x.length)
-        {
-            processBlock();
-        }
-
-        bOff = 0;
-    }
-
-    public void update(
-        byte in)
-    {
-        buf[bOff++] = in;
-
-        if (bOff == buf.length)
-        {
-            processWord(buf, 0);
-        }
-
-        byteCount++;
-    }
-
-    public void update(
-        byte[]  in,
-        int     inOff,
-        int     len)
-    {
-        //
-        // fill the current word
-        //
-        while ((bOff != 0) && (len > 0))
-        {
-            update(in[inOff]);
-
-            inOff++;
-            len--;
-        }
-
-        //
-        // process whole words.
-        //
-        while (len > 8)
-        {
-            processWord(in, inOff);
-
-            inOff += 8;
-            len -= 8;
-            byteCount += 8;
-        }
-
-        //
-        // load in the remainder.
-        //
-        while (len > 0)
-        {
-            update(in[inOff]);
-
-            inOff++;
-            len--;
-        }
-    }
-
-    private void roundABC(
-        long    x,
-        long    mul)
-    {
-         c ^= x ;
-         a -= t1[(int)c & 0xff] ^ t2[(int)(c >> 16) & 0xff]
-                ^ t3[(int)(c >> 32) & 0xff] ^ t4[(int)(c >> 48) & 0xff];
-         b += t4[(int)(c >> 8) & 0xff] ^ t3[(int)(c >> 24) & 0xff]
-                ^ t2[(int)(c >> 40) & 0xff] ^ t1[(int)(c >> 56) & 0xff];
-         b *= mul;
-    }
-
-    private void roundBCA(
-        long    x,
-        long    mul)
-    {
-         a ^= x ;
-         b -= t1[(int)a & 0xff] ^ t2[(int)(a >> 16) & 0xff]
-                ^ t3[(int)(a >> 32) & 0xff] ^ t4[(int)(a >> 48) & 0xff];
-         c += t4[(int)(a >> 8) & 0xff] ^ t3[(int)(a >> 24) & 0xff]
-                ^ t2[(int)(a >> 40) & 0xff] ^ t1[(int)(a >> 56) & 0xff];
-         c *= mul;
-    }
-
-    private void roundCAB(
-        long    x,
-        long    mul)
-    {
-         b ^= x ;
-         c -= t1[(int)b & 0xff] ^ t2[(int)(b >> 16) & 0xff]
-                ^ t3[(int)(b >> 32) & 0xff] ^ t4[(int)(b >> 48) & 0xff];
-         a += t4[(int)(b >> 8) & 0xff] ^ t3[(int)(b >> 24) & 0xff]
-                ^ t2[(int)(b >> 40) & 0xff] ^ t1[(int)(b >> 56) & 0xff];
-         a *= mul;
-    }
-
-    private void keySchedule()
-    {
-        x[0] -= x[7] ^ 0xA5A5A5A5A5A5A5A5L; 
-        x[1] ^= x[0]; 
-        x[2] += x[1]; 
-        x[3] -= x[2] ^ ((~x[1]) << 19); 
-        x[4] ^= x[3]; 
-        x[5] += x[4]; 
-        x[6] -= x[5] ^ ((~x[4]) >>> 23); 
-        x[7] ^= x[6]; 
-        x[0] += x[7]; 
-        x[1] -= x[0] ^ ((~x[7]) << 19); 
-        x[2] ^= x[1]; 
-        x[3] += x[2]; 
-        x[4] -= x[3] ^ ((~x[2]) >>> 23); 
-        x[5] ^= x[4]; 
-        x[6] += x[5]; 
-        x[7] -= x[6] ^ 0x0123456789ABCDEFL;
-    }
-
-    private void processBlock()
-    {
-        //
-        // save abc
-        //
-        long aa = a;
-        long bb = b;
-        long cc = c;
-
-        //
-        // rounds and schedule
-        //
-        roundABC(x[0], 5);
-        roundBCA(x[1], 5);
-        roundCAB(x[2], 5);
-        roundABC(x[3], 5);
-        roundBCA(x[4], 5);
-        roundCAB(x[5], 5);
-        roundABC(x[6], 5);
-        roundBCA(x[7], 5);
-
-        keySchedule();
-
-        roundCAB(x[0], 7);
-        roundABC(x[1], 7);
-        roundBCA(x[2], 7);
-        roundCAB(x[3], 7);
-        roundABC(x[4], 7);
-        roundBCA(x[5], 7);
-        roundCAB(x[6], 7);
-        roundABC(x[7], 7);
-
-        keySchedule();
-
-        roundBCA(x[0], 9);
-        roundCAB(x[1], 9);
-        roundABC(x[2], 9);
-        roundBCA(x[3], 9);
-        roundCAB(x[4], 9);
-        roundABC(x[5], 9);
-        roundBCA(x[6], 9);
-        roundCAB(x[7], 9);
-
-        //
-        // feed forward
-        //
-        a ^= aa;
-        b -= bb;
-        c += cc;
-
-        //
-        // clear the x buffer
-        //
-        xOff = 0;
-        for (int i = 0; i != x.length; i++)
-        {
-            x[i] = 0;
-        }
-    }
-
-    public void unpackWord(
-        long    r,
-        byte[]  out,
-        int     outOff)
-    {
-        out[outOff + 7]     = (byte)(r >> 56);
-        out[outOff + 6] = (byte)(r >> 48);
-        out[outOff + 5] = (byte)(r >> 40);
-        out[outOff + 4] = (byte)(r >> 32);
-        out[outOff + 3] = (byte)(r >> 24);
-        out[outOff + 2] = (byte)(r >> 16);
-        out[outOff + 1] = (byte)(r >> 8);
-        out[outOff] = (byte)r;
-    }
-        
-    private void processLength(
-        long    bitLength)
-    {
-        x[7] = bitLength;
-    }
-
-    private void finish()
-    {
-        long    bitLength = (byteCount << 3);
-
-        update((byte)0x01);
-
-        while (bOff != 0)
-        {
-            update((byte)0);
-        }
-
-        processLength(bitLength);
-
-        processBlock();
-    }
-
-    public int doFinal(
-        byte[]  out,
-        int     outOff)
-    {
-        finish();
-
-        unpackWord(a, out, outOff);
-        unpackWord(b, out, outOff + 8);
-        unpackWord(c, out, outOff + 16);
-
-        reset();
-
-        return DIGEST_LENGTH;
-    }
-
-    /**
-     * reset the chaining variables
-     */
-    public void reset()
-    {
-        a = 0x0123456789ABCDEFL;
-        b = 0xFEDCBA9876543210L;
-        c = 0xF096A5B4C3B2E187L;
-
-        xOff = 0;
-        for (int i = 0; i != x.length; i++)
-        {
-            x[i] = 0;
-        }
-
-        bOff = 0;
-        for (int i = 0; i != buf.length; i++)
-        {
-            buf[i] = 0;
-        }
-
-        byteCount = 0;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/encodings/ISO9796d1Encoding.java b/azureus2/src/org/bouncycastle/crypto/encodings/ISO9796d1Encoding.java
deleted file mode 100644
index 7e30023..0000000
--- a/azureus2/src/org/bouncycastle/crypto/encodings/ISO9796d1Encoding.java
+++ /dev/null
@@ -1,251 +0,0 @@
-package org.bouncycastle.crypto.encodings;
-
-import org.bouncycastle.crypto.AsymmetricBlockCipher;
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.InvalidCipherTextException;
-import org.bouncycastle.crypto.params.ParametersWithRandom;
-import org.bouncycastle.crypto.params.RSAKeyParameters;
-
-/**
- * ISO 9796-1 padding. Note in the light of recent results you should
- * only use this with RSA (rather than the "simpler" Rabin keys) and you
- * should never use it with anything other than a hash (ie. even if the 
- * message is small don't sign the message, sign it's hash) or some "random"
- * value. See your favorite search engine for details.
- */
-public class ISO9796d1Encoding
-    implements AsymmetricBlockCipher
-{
-    private static byte[]    shadows = { 0xe, 0x3, 0x5, 0x8, 0x9, 0x4, 0x2, 0xf,
-                                    0x0, 0xd, 0xb, 0x6, 0x7, 0xa, 0xc, 0x1 };
-    private static byte[]    inverse = { 0x8, 0xf, 0x6, 0x1, 0x5, 0x2, 0xb, 0xc,
-                                    0x3, 0x4, 0xd, 0xa, 0xe, 0x9, 0x0, 0x7 };
-
-    private AsymmetricBlockCipher   engine;
-    private boolean                 forEncryption;
-    private int                     bitSize;
-    private int                     padBits = 0;
-
-    public ISO9796d1Encoding(
-        AsymmetricBlockCipher   cipher)
-    {
-        this.engine = cipher;
-    }   
-
-    public AsymmetricBlockCipher getUnderlyingCipher()
-    {
-        return engine;
-    }
-
-    public void init(
-        boolean             forEncryption,
-        CipherParameters    param)
-    {
-        RSAKeyParameters  kParam = null;
-
-        if (param instanceof ParametersWithRandom)
-        {
-            ParametersWithRandom    rParam = (ParametersWithRandom)param;
-
-            kParam = (RSAKeyParameters)rParam.getParameters();
-        }
-        else
-        {
-            kParam = (RSAKeyParameters)param;
-        }
-
-        engine.init(forEncryption, kParam);
-
-        bitSize = kParam.getModulus().bitLength();
-
-        this.forEncryption = forEncryption;
-    }
-
-    /**
-     * return the input block size. The largest message we can process
-     * is (key_size_in_bits + 3)/16, which in our world comes to 
-     * key_size_in_bytes / 2.
-     */
-    public int getInputBlockSize()
-    {
-        int     baseBlockSize = engine.getInputBlockSize();
-
-        if (forEncryption)
-        {
-            return (baseBlockSize + 1) / 2;
-        }
-        else
-        {
-            return baseBlockSize;
-        }
-    }
-
-    /**
-     * return the maximum possible size for the output.
-     */
-    public int getOutputBlockSize()
-    {
-        int     baseBlockSize = engine.getOutputBlockSize();
-
-        if (forEncryption)
-        {
-            return baseBlockSize;
-        }
-        else
-        {
-            return (baseBlockSize + 1) / 2;
-        }
-    }
-
-    /**
-     * set the number of bits in the next message to be treated as 
-     * pad bits.
-     */
-    public void setPadBits(
-        int     padBits)
-    {
-        if (padBits > 7)
-        {
-            throw new IllegalArgumentException("padBits > 7");
-        }
-
-        this.padBits = padBits;
-    }
-
-    /**
-     * retrieve the number of pad bits in the last decoded message.
-     */
-    public int getPadBits()
-    {
-        return padBits;
-    }
-
-    public byte[] processBlock(
-        byte[]  in,
-        int     inOff,
-        int     inLen)
-        throws InvalidCipherTextException
-    {
-        if (forEncryption)
-        {
-            return encodeBlock(in, inOff, inLen);
-        }
-        else
-        {
-            return decodeBlock(in, inOff, inLen);
-        }
-    }
-
-    private byte[] encodeBlock(
-        byte[]  in,
-        int     inOff,
-        int     inLen)
-        throws InvalidCipherTextException
-    {
-        byte[]  block = new byte[(bitSize + 7) / 8];
-        int     r = padBits + 1;
-        int     z = inLen;
-        int     t = (bitSize + 13) / 16;
-
-        for (int i = 0; i < t; i += z)
-        {
-            if (i > t - z)
-            {
-                System.arraycopy(in, inOff + inLen - (t - i),
-                                    block, block.length - t, t - i);
-            }
-            else
-            {
-                System.arraycopy(in, inOff, block, block.length - (i + z), z);
-            }
-        }
-
-        for (int i = block.length - 2 * t; i != block.length; i += 2)
-        {
-            byte    val = block[block.length - t + i / 2];
-            
-            block[i] = (byte)((shadows[(val & 0xff) >>> 4] << 4)
-                                                | shadows[val & 0x0f]);
-            block[i + 1] = val;
-        }
-
-        block[block.length - 2 * z] ^= r;
-        block[block.length - 1] = (byte)((block[block.length - 1] << 4) | 0x06);
-
-        int maxBit = (8 - (bitSize - 1) % 8);
-        int offSet = 0;
-
-        if (maxBit != 8)
-        {
-            block[0] &= 0xff >>> maxBit;
-            block[0] |= 0x80 >>> maxBit;
-        }
-        else
-        {
-            block[0] = 0x00;
-            block[1] |= 0x80;
-            offSet = 1;
-        }
-
-        return engine.processBlock(block, offSet, block.length - offSet);
-    }
-
-    /**
-     * @exception InvalidCipherTextException if the decrypted block is not a valid ISO 9796 bit string
-     */
-    private byte[] decodeBlock(
-        byte[]  in,
-        int     inOff,
-        int     inLen)
-        throws InvalidCipherTextException
-    {
-        byte[]  block = engine.processBlock(in, inOff, inLen);
-        int     r = 1;
-        int     t = (bitSize + 13) / 16;
-
-        if ((block[block.length - 1] & 0x0f) != 0x6)
-        {
-            throw new InvalidCipherTextException("invalid forcing byte in block");
-        }
-
-        block[block.length - 1] = (byte)(((block[block.length - 1] & 0xff) >>> 4) | ((inverse[(block[block.length - 2] & 0xff) >> 4]) << 4));
-        block[0] = (byte)((shadows[(block[1] & 0xff) >>> 4] << 4)
-                                                | shadows[block[1] & 0x0f]);
-
-        boolean boundaryFound = false;
-        int     boundary = 0;
-        
-        for (int i = block.length - 1; i >= block.length - 2 * t; i -= 2)
-        {
-            int val = ((shadows[(block[i] & 0xff) >>> 4] << 4)
-                                        | shadows[block[i] & 0x0f]);
-            
-            if (((block[i - 1] ^ val) & 0xff) != 0)
-            {
-                if (!boundaryFound)
-                {
-                    boundaryFound = true;
-                    r = (block[i - 1] ^ val) & 0xff;
-                    boundary = i - 1;
-                }
-                else
-                {
-                    throw new InvalidCipherTextException("invalid tsums in block");
-                }
-            }
-        }
-
-        block[boundary] = 0;
-
-        byte[]  nblock = new byte[(block.length - boundary) / 2];
-
-        for (int i = 0; i < nblock.length; i++)
-        {
-            nblock[i] = block[2 * i + boundary + 1];
-        }
-
-        padBits = r - 1;
-
-        return nblock;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/encodings/OAEPEncoding.java b/azureus2/src/org/bouncycastle/crypto/encodings/OAEPEncoding.java
deleted file mode 100644
index 961c3cb..0000000
--- a/azureus2/src/org/bouncycastle/crypto/encodings/OAEPEncoding.java
+++ /dev/null
@@ -1,342 +0,0 @@
-package org.bouncycastle.crypto.encodings;
-
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.AsymmetricBlockCipher;
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.Digest;
-import org.bouncycastle.crypto.InvalidCipherTextException;
-import org.bouncycastle.crypto.digests.SHA1Digest;
-import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
-import org.bouncycastle.crypto.params.ParametersWithRandom;
-
-/**
- * Optimal Asymmetric Encryption Padding (OAEP) - see PKCS 1 V 2.
- */
-public class OAEPEncoding
-    implements AsymmetricBlockCipher
-{
-    private byte[]          defHash;
-    private Digest      	  hash;
-
-    private AsymmetricBlockCipher   engine;
-    private SecureRandom            random;
-    private boolean                 forEncryption;
-
-    public OAEPEncoding(
-        AsymmetricBlockCipher   cipher)
-    {
-        this(cipher, new SHA1Digest(), null);
-    }
-    
-	public OAEPEncoding(
-		AsymmetricBlockCipher   	cipher,
-		Digest							hash)
-	{
-		this(cipher, hash, null);
-	}
-    
-	public OAEPEncoding(
-		AsymmetricBlockCipher   	cipher,
-		Digest							hash,
-		byte[]							encodingParams)
-	{
-		this.engine = cipher;
-		this.hash = hash;
-		this.defHash = new byte[hash.getDigestSize()];
-        
-        if (encodingParams != null)
-        {
-        	hash.update(encodingParams, 0, encodingParams.length);
-        }
-        
-		hash.doFinal(defHash, 0);
-	}
-	
-    public AsymmetricBlockCipher getUnderlyingCipher()
-    {
-        return engine;
-    }
-
-    public void init(
-        boolean             forEncryption,
-        CipherParameters    param)
-    {
-        AsymmetricKeyParameter  kParam;
-
-        if (param instanceof ParametersWithRandom)
-        {
-            ParametersWithRandom  rParam = (ParametersWithRandom)param;
-
-            this.random = rParam.getRandom();
-            kParam = (AsymmetricKeyParameter)rParam.getParameters();
-        }
-        else
-        {   
-            this.random = new SecureRandom();
-            kParam = (AsymmetricKeyParameter)param;
-        }
-
-        engine.init(forEncryption, kParam);
-
-        this.forEncryption = forEncryption;
-    }
-
-    public int getInputBlockSize()
-    {
-        int     baseBlockSize = engine.getInputBlockSize();
-
-        if (forEncryption)
-        {
-            return baseBlockSize - 1 - 2 * defHash.length;
-        }
-        else
-        {
-            return baseBlockSize;
-        }
-    }
-
-    public int getOutputBlockSize()
-    {
-        int     baseBlockSize = engine.getOutputBlockSize();
-
-        if (forEncryption)
-        {
-            return baseBlockSize;
-        }
-        else
-        {
-            return baseBlockSize - 1 - 2 * defHash.length;
-        }
-    }
-
-    public byte[] processBlock(
-        byte[]  in,
-        int     inOff,
-        int     inLen)
-        throws InvalidCipherTextException
-    {
-        if (forEncryption)
-        {
-            return encodeBlock(in, inOff, inLen);
-        }
-        else
-        {
-            return decodeBlock(in, inOff, inLen);
-        }
-    }
-
-    public byte[] encodeBlock(
-        byte[]  in,
-        int     inOff,
-        int     inLen)
-        throws InvalidCipherTextException
-    {
-        byte[]  block = new byte[getInputBlockSize() + 1 + 2 * defHash.length];
-
-        //
-        // copy in the message
-        //
-        System.arraycopy(in, inOff, block, block.length - inLen, inLen);
-
-        //
-        // add sentinel
-        //
-        block[block.length - inLen - 1] = 0x01;
-
-        //
-        // as the block is already zeroed - there's no need to add PS (the >= 0 pad of 0)
-        //
-
-        //
-        // add the hash of the encoding params.
-        //
-        System.arraycopy(defHash, 0, block, defHash.length, defHash.length);
-
-        //
-        // generate the seed.
-        //
-        byte[]  seed = new byte[defHash.length];
-
-        random.nextBytes(seed);
-
-        //
-        // mask the message block.
-        //
-        byte[]  mask = maskGeneratorFunction1(seed, 0, seed.length, block.length - defHash.length);
-
-        for (int i = defHash.length; i != block.length; i++)
-        {
-            block[i] ^= mask[i - defHash.length];
-        }
-
-        //
-        // add in the seed
-        //
-        System.arraycopy(seed, 0, block, 0, defHash.length);
-
-        //
-        // mask the seed.
-        //
-        mask = maskGeneratorFunction1(
-                        block, defHash.length, block.length - defHash.length, defHash.length);
-
-        for (int i = 0; i != defHash.length; i++)
-        {
-            block[i] ^= mask[i];
-        }
-
-        return engine.processBlock(block, 0, block.length);
-    }
-
-    /**
-     * @exception InvalidCipherTextException if the decryypted block turns out to
-     * be badly formatted.
-     */
-    public byte[] decodeBlock(
-        byte[]  in,
-        int     inOff,
-        int     inLen)
-        throws InvalidCipherTextException
-    {
-        byte[]  data = engine.processBlock(in, inOff, inLen);
-        byte[]  block = null;
-
-        //
-        // as we may have zeros in our leading bytes for the block we produced
-        // on encryption, we need to make sure our decrypted block comes back
-        // the same size.
-        //
-        if (data.length < engine.getOutputBlockSize())
-        {
-            block = new byte[engine.getOutputBlockSize()];
-
-            System.arraycopy(data, 0, block, block.length - data.length, data.length);
-        }
-        else
-        {
-            block = data;
-        }
-
-        if (block.length < (2 * defHash.length) + 1)
-        {
-            throw new InvalidCipherTextException("data too short");
-        }
-
-        //
-        // unmask the seed.
-        //
-        byte[] mask = maskGeneratorFunction1(
-                    block, defHash.length, block.length - defHash.length, defHash.length);
-
-        for (int i = 0; i != defHash.length; i++)
-        {
-            block[i] ^= mask[i];
-        }
-
-        //
-        // unmask the message block.
-        //
-        mask = maskGeneratorFunction1(block, 0, defHash.length, block.length - defHash.length);
-
-        for (int i = defHash.length; i != block.length; i++)
-        {
-            block[i] ^= mask[i - defHash.length];
-        }
-
-        //
-        // check the hash of the encoding params.
-        //
-        for (int i = 0; i != defHash.length; i++)
-        {
-            if (defHash[i] != block[defHash.length + i])
-            {
-                throw new InvalidCipherTextException("data hash wrong");
-            }
-        }
-
-        //
-        // find the data block
-        //
-        int start;
-
-        for (start = 2 * defHash.length; start != block.length; start++)
-        {
-            if (block[start] == 1 || block[start] != 0)
-            {
-                break;
-            }
-        }
-
-        if (start >= (block.length - 1) || block[start] != 1)
-        {
-            throw new InvalidCipherTextException("data start wrong " + start);
-        }
-
-        start++;
-
-        //
-        // extract the data block
-        //
-        byte[]  output = new byte[block.length - start];
-
-        System.arraycopy(block, start, output, 0, output.length);
-
-        return output;
-    }
-
-    /**
-     * int to octet string.
-     */
-    private void ItoOSP(
-        int     i,
-        byte[]  sp)
-    {
-        sp[0] = (byte)(i >>> 24);
-        sp[1] = (byte)(i >>> 16);
-        sp[2] = (byte)(i >>> 8);
-        sp[3] = (byte)(i >>> 0);
-    }
-
-    /**
-     * mask generator function, as described in PKCS1v2.
-     */
-    private byte[] maskGeneratorFunction1(
-        byte[]  Z,
-        int     zOff,
-        int     zLen,
-        int     length)
-    {
-        byte[]  mask = new byte[length];
-        byte[]  hashBuf = new byte[defHash.length];
-        byte[]  C = new byte[4];
-        int     counter = 0;
-
-        hash.reset();
-
-        do
-        {
-            ItoOSP(counter, C);
-
-            hash.update(Z, zOff, zLen);
-            hash.update(C, 0, C.length);
-            hash.doFinal(hashBuf, 0);
-
-            System.arraycopy(hashBuf, 0, mask, counter * defHash.length, defHash.length);
-        }
-        while (++counter < (length / defHash.length));
-
-        if ((counter * defHash.length) < length)
-        {
-            ItoOSP(counter, C);
-
-            hash.update(Z, zOff, zLen);
-            hash.update(C, 0, C.length);
-            hash.doFinal(hashBuf, 0);
-
-            System.arraycopy(hashBuf, 0, mask, counter * defHash.length, mask.length - (counter * defHash.length));
-        }
-
-        return mask;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/encodings/PKCS1Encoding.java b/azureus2/src/org/bouncycastle/crypto/encodings/PKCS1Encoding.java
deleted file mode 100644
index 7f18e0b..0000000
--- a/azureus2/src/org/bouncycastle/crypto/encodings/PKCS1Encoding.java
+++ /dev/null
@@ -1,194 +0,0 @@
-package org.bouncycastle.crypto.encodings;
-
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.AsymmetricBlockCipher;
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.InvalidCipherTextException;
-import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
-import org.bouncycastle.crypto.params.ParametersWithRandom;
-
-/**
- * this does your basic PKCS 1 v1.5 padding - whether or not you should be using this
- * depends on your application - see PKCS1 Version 2 for details.
- */
-public class PKCS1Encoding
-    implements AsymmetricBlockCipher
-{
-    private static int      HEADER_LENGTH = 10;
-
-    private SecureRandom            random;
-    private AsymmetricBlockCipher   engine;
-    private boolean                 forEncryption;
-    private boolean                 forPrivateKey;
-
-    public PKCS1Encoding(
-        AsymmetricBlockCipher   cipher)
-    {
-        this.engine = cipher;
-    }   
-
-    public AsymmetricBlockCipher getUnderlyingCipher()
-    {
-        return engine;
-    }
-
-    public void init(
-        boolean             forEncryption,
-        CipherParameters    param)
-    {
-        AsymmetricKeyParameter  kParam;
-
-        if (param instanceof ParametersWithRandom)
-        {
-            ParametersWithRandom    rParam = (ParametersWithRandom)param;
-
-            this.random = rParam.getRandom();
-            kParam = (AsymmetricKeyParameter)rParam.getParameters();
-        }
-        else
-        {
-            this.random = new SecureRandom();
-            kParam = (AsymmetricKeyParameter)param;
-        }
-
-        engine.init(forEncryption, kParam);
-
-        this.forPrivateKey = kParam.isPrivate();
-        this.forEncryption = forEncryption;
-    }
-
-    public int getInputBlockSize()
-    {
-        int     baseBlockSize = engine.getInputBlockSize();
-
-        if (forEncryption)
-        {
-            return baseBlockSize - HEADER_LENGTH;
-        }
-        else
-        {
-            return baseBlockSize;
-        }
-    }
-
-    public int getOutputBlockSize()
-    {
-        int     baseBlockSize = engine.getOutputBlockSize();
-
-        if (forEncryption)
-        {
-            return baseBlockSize;
-        }
-        else
-        {
-            return baseBlockSize - HEADER_LENGTH;
-        }
-    }
-
-    public byte[] processBlock(
-        byte[]  in,
-        int     inOff,
-        int     inLen)
-        throws InvalidCipherTextException
-    {
-        if (forEncryption)
-        {
-            return encodeBlock(in, inOff, inLen);
-        }
-        else
-        {
-            return decodeBlock(in, inOff, inLen);
-        }
-    }
-
-    private byte[] encodeBlock(
-        byte[]  in,
-        int     inOff,
-        int     inLen)
-        throws InvalidCipherTextException
-    {
-        byte[]  block = new byte[engine.getInputBlockSize()];
-
-        if (forPrivateKey)
-        {
-            block[0] = 0x01;                        // type code 1
-
-            for (int i = 1; i != block.length - inLen - 1; i++)
-            {
-                block[i] = (byte)0xFF;
-            }
-        }
-        else
-        {
-            random.nextBytes(block);                // random fill
-
-            block[0] = 0x02;                        // type code 2
-
-            //
-            // a zero byte marks the end of the padding, so all
-            // the pad bytes must be non-zero.
-            //
-            for (int i = 1; i != block.length - inLen - 1; i++)
-            {
-                while (block[i] == 0)
-                {
-                    block[i] = (byte)random.nextInt();
-                }
-            }
-        }
-
-        block[block.length - inLen - 1] = 0x00;       // mark the end of the padding
-        System.arraycopy(in, inOff, block, block.length - inLen, inLen);
-
-        return engine.processBlock(block, 0, block.length);
-    }
-
-    /**
-     * @exception InvalidCipherTextException if the decrypted block is not in PKCS1 format.
-     */
-    private byte[] decodeBlock(
-        byte[]  in,
-        int     inOff,
-        int     inLen)
-        throws InvalidCipherTextException
-    {
-        byte[]  block = engine.processBlock(in, inOff, inLen);
-
-        if (block.length < getOutputBlockSize())
-        {
-            throw new InvalidCipherTextException("block truncated");
-        }
-
-        if (block[0] != 1 && block[0] != 2)
-        {
-            throw new InvalidCipherTextException("unknown block type");
-        }
-
-        //
-        // find and extract the message block.
-        //
-        int start;
-
-        for (start = 1; start != block.length; start++)
-        {
-            if (block[start] == 0)
-            {
-                break;
-            }
-        }
-
-        start++;           // data should start at the next byte
-
-        if (start >= block.length || start < HEADER_LENGTH)
-        {
-            throw new InvalidCipherTextException("no data in block");
-        }
-
-        byte[]  result = new byte[block.length - start];
-
-        System.arraycopy(block, start, result, 0, result.length);
-
-        return result;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/encodings/package.html b/azureus2/src/org/bouncycastle/crypto/encodings/package.html
deleted file mode 100644
index fc56f63..0000000
--- a/azureus2/src/org/bouncycastle/crypto/encodings/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body bgcolor="#ffffff">
-Block encodings for asymmetric ciphers.
-</body>
-</html>
diff --git a/azureus2/src/org/bouncycastle/crypto/engines/IESEngine.java b/azureus2/src/org/bouncycastle/crypto/engines/IESEngine.java
deleted file mode 100644
index e31b88e..0000000
--- a/azureus2/src/org/bouncycastle/crypto/engines/IESEngine.java
+++ /dev/null
@@ -1,245 +0,0 @@
-package org.bouncycastle.crypto.engines;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.crypto.BasicAgreement;
-import org.bouncycastle.crypto.BufferedBlockCipher;
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.DerivationFunction;
-import org.bouncycastle.crypto.InvalidCipherTextException;
-import org.bouncycastle.crypto.Mac;
-import org.bouncycastle.crypto.params.IESParameters;
-import org.bouncycastle.crypto.params.IESWithCipherParameters;
-import org.bouncycastle.crypto.params.KDFParameters;
-import org.bouncycastle.crypto.params.KeyParameter;
-
-/**
- * support class for constructing intergrated encryption ciphers
- * for doing basic message exchanges on top of key agreement ciphers
- */
-public class IESEngine
-{
-    BasicAgreement      agree;
-    DerivationFunction  kdf;
-    Mac                 mac;
-    BufferedBlockCipher cipher;
-    byte[]              macBuf;
-
-    boolean                     forEncryption;
-    CipherParameters            privParam, pubParam;
-    IESParameters               param;
-
-    /**
-     * set up for use with stream mode, where the key derivation function
-     * is used to provide a stream of bytes to xor with the message.
-     *
-     * @param agree the key agreement used as the basis for the encryption
-     * @param kdf the key derivation function used for byte generation
-     * @param mac the message authentication code generator for the message
-     */
-    public IESEngine(
-        BasicAgreement      agree,
-        DerivationFunction  kdf,
-        Mac                 mac)
-    {
-        this.agree = agree;
-        this.kdf = kdf;
-        this.mac = mac;
-        this.macBuf = new byte[mac.getMacSize()];
-        this.cipher = null;
-    }
-
-    /**
-     * set up for use in conjunction with a block cipher to handle the
-     * message.
-     *
-     * @param agree the key agreement used as the basis for the encryption
-     * @param kdf the key derivation function used for byte generation
-     * @param mac the message authentication code generator for the message
-     * @param cipher the cipher to used for encrypting the message
-     */
-    public IESEngine(
-        BasicAgreement      agree,
-        DerivationFunction  kdf,
-        Mac                 mac,
-        BufferedBlockCipher cipher)
-    {
-        this.agree = agree;
-        this.kdf = kdf;
-        this.mac = mac;
-        this.macBuf = new byte[mac.getMacSize()];
-        this.cipher = cipher;
-    }
-
-    /**
-     * Initialise the encryptor.
-     *
-     * @param forEncryption whether or not this is encryption/decryption.
-     * @param privParam our private key parameters
-     * @param pubParam the recipient's/sender's public key parameters
-     * @param param encoding and derivation parameters.
-     */
-    public void init(
-        boolean                     forEncryption,
-        CipherParameters            privParam,
-        CipherParameters            pubParam,
-        CipherParameters            param)
-    {
-        this.forEncryption = forEncryption;
-        this.privParam = privParam;
-        this.pubParam = pubParam;
-        this.param = (IESParameters)param;
-    }
-
-    private byte[] decryptBlock(
-        byte[]  in_enc,
-        int     inOff,
-        int     inLen,
-        byte[]  z)
-        throws InvalidCipherTextException
-    {
-        byte[]          M = null;
-        KeyParameter    macKey = null;
-        KDFParameters   kParam = new KDFParameters(z, param.getDerivationV());
-        int             macKeySize = param.getMacKeySize();
-
-        kdf.init(kParam);
-
-	    inLen -= mac.getMacSize();
-	
-        if (cipher == null)     // stream mode
-        {
-            byte[]  buf = new byte[inLen + (macKeySize / 8)];
-
-            M = new byte[inLen];
-
-            kdf.generateBytes(buf, 0, buf.length);
-
-            for (int i = 0; i != inLen; i++)
-            {
-                M[i] = (byte)(in_enc[inOff + i] ^ buf[i]);
-            }
-
-            macKey = new KeyParameter(buf, inLen, (macKeySize / 8));
-        }
-        else
-        {
-            int     cipherKeySize = ((IESWithCipherParameters)param).getCipherKeySize();
-            byte[]  buf = new byte[(cipherKeySize / 8) + (macKeySize / 8)];
-
-            cipher.init(false, new KeyParameter(buf, 0, (cipherKeySize / 8)));
-
-            byte[] tmp = new byte[cipher.getOutputSize(inLen)];
-
-            int off = cipher.processBytes(in_enc, inOff, inLen, tmp, 0);
-
-            off += cipher.doFinal(tmp, off);
-
-            M = new byte[off];
-
-            System.arraycopy(tmp, 0, M, 0, off);
-
-            macKey = new KeyParameter(buf, (cipherKeySize / 8), (macKeySize / 8));
-        }
-
-        byte[]  macIV = param.getEncodingV();
-
-        mac.init(macKey);
-        mac.update(in_enc, inOff, inLen);
-        mac.update(macIV, 0, macIV.length);
-	    mac.doFinal(macBuf, 0);
-	
-        inOff += inLen;
-
-        for (int t = 0; t < macBuf.length; t++)
-	    {	       
-            if (macBuf[t] != in_enc[inOff + t])
-		    {
-			    throw (new InvalidCipherTextException("Mac codes failed to equal."));
-		    }
-	    }
-	   
-        return M;
-    }
-
-    private byte[] encryptBlock(
-        byte[]  in,
-        int     inOff,
-        int     inLen,
-        byte[]  z)
-        throws InvalidCipherTextException
-    {
-        byte[]          C = null;
-        KeyParameter    macKey = null;
-        KDFParameters   kParam = new KDFParameters(z, param.getDerivationV());
-	    int             c_text_length = 0;
-        int             macKeySize = param.getMacKeySize();
-
-        kdf.init(kParam);
-
-        if (cipher == null)     // stream mode
-        {
-            byte[]  buf = new byte[inLen + (macKeySize / 8)];
-
-            C = new byte[inLen + mac.getMacSize()];
-	        c_text_length = inLen;
-
-            kdf.generateBytes(buf, 0, buf.length);
-
-            for (int i = 0; i != inLen; i++)
-            {
-                C[i] = (byte)(in[inOff + i] ^ buf[i]);
-            }
-
-            macKey = new KeyParameter(buf, inLen, (macKeySize / 8));
-        }
-        else
-        {
-            int     cipherKeySize = ((IESWithCipherParameters)param).getCipherKeySize();
-            byte[]  buf = new byte[(cipherKeySize / 8) + (macKeySize / 8)];
-
-            cipher.init(true, new KeyParameter(buf, 0, (cipherKeySize / 8)));
-
-            c_text_length = cipher.getOutputSize(inLen);
-
-            C = new byte[c_text_length + mac.getMacSize()];
-
-            int off = cipher.processBytes(in, inOff, inLen, C, 0);
-
-            cipher.doFinal(C, off);
-
-            macKey = new KeyParameter(buf, (cipherKeySize / 8), (macKeySize / 8));
-        }
-
-        byte[]  macIV = param.getEncodingV();
-
-        mac.init(macKey);
-        mac.update(C, 0, c_text_length);
-        mac.update(macIV, 0, macIV.length);
-        //
-        // return the message and it's MAC
-        //
-        mac.doFinal(C, c_text_length);
-        return C;
-    }
-
-    public byte[] processBlock(
-        byte[]  in,
-        int     inOff,
-        int     inLen)
-        throws InvalidCipherTextException
-    {
-        agree.init(privParam);
-
-        BigInteger  z = agree.calculateAgreement(pubParam);
-
-        if (forEncryption)
-        {
-            return encryptBlock(in, inOff, inLen, z.toByteArray());
-        }
-        else
-        {
-            return decryptBlock(in, inOff, inLen, z.toByteArray());
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/engines/RC4Engine.java b/azureus2/src/org/bouncycastle/crypto/engines/RC4Engine.java
deleted file mode 100644
index f511afa..0000000
--- a/azureus2/src/org/bouncycastle/crypto/engines/RC4Engine.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package org.bouncycastle.crypto.engines;
-
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.StreamCipher;
-import org.bouncycastle.crypto.params.KeyParameter;
-
-public class RC4Engine implements StreamCipher
-{
-    private final static int STATE_LENGTH = 256;
-
-    /*
-     * variables to hold the state of the RC4 engine
-     * during encryption and decryption
-     */
-
-    private byte[]      engineState = null;
-    private int         x = 0;
-    private int         y = 0;
-    private byte[]      workingKey = null;
-
-    /**
-     * initialise a RC4 cipher.
-     *
-     * @param forEncryption whether or not we are for encryption.
-     * @param params the parameters required to set up the cipher.
-     * @exception IllegalArgumentException if the params argument is
-     * inappropriate.
-     */
-    public void init(
-        boolean             forEncryption, 
-        CipherParameters     params
-    )
-    {
-        if (params instanceof KeyParameter)
-        {
-            /* 
-             * RC4 encryption and decryption is completely
-             * symmetrical, so the 'forEncryption' is 
-             * irrelevant.
-             */
-            workingKey = ((KeyParameter)params).getKey();
-            setKey(workingKey);
-
-            return;
-        }
-
-        throw new IllegalArgumentException("invalid parameter passed to RC4 init - " + params.getClass().getName());
-    }
-
-    public String getAlgorithmName()
-    {
-        return "RC4";
-    }
-
-    public byte returnByte(byte in)
-    {
-        x = (x + 1) & 0xff;
-        y = (engineState[x] + y) & 0xff;
-
-        // swap
-        byte tmp = engineState[x];
-        engineState[x] = engineState[y];
-        engineState[y] = tmp;
-
-        // xor
-        return (byte)(in ^ engineState[(engineState[x] + engineState[y]) & 0xff]);
-    }
-
-    public void processBytes(
-        byte[]     in, 
-        int     inOff, 
-        int     len, 
-        byte[]     out, 
-        int     outOff )
-    {
-        for (int i = 0; i < len ; i++)
-        {
-            x = (x + 1) & 0xff;
-            y = (engineState[x] + y) & 0xff;
-
-            // swap
-            byte tmp = engineState[x];
-            engineState[x] = engineState[y];
-            engineState[y] = tmp;
-
-            // xor
-            out[i+outOff] = (byte)(in[i + inOff]
-                    ^ engineState[(engineState[x] + engineState[y]) & 0xff]);
-        }
-    }
-    
-    /*
-    public void 
-    processBytes(
-        byte[]     in, 
-        byte[]     out )
-    {
-    	int	len = in.length;
-    	
-        for (int i = 0; i < len ; i++)
-        {
-            x = (x + 1) & 0xff;
-            y = (engineState[x] + y) & 0xff;
-
-            // swap
-            byte tmp = engineState[x];
-            engineState[x] = engineState[y];
-            engineState[y] = tmp;
-
-            // xor
-            out[i] = (byte)(in[i] ^ engineState[(engineState[x] + engineState[y]) & 0xff]);
-        }
-    }
-	*/
-    
-    public void reset()
-    {
-        setKey(workingKey);
-    }
-
-    // Private implementation
-
-    private void setKey(byte[] keyBytes)
-    {
-        workingKey = keyBytes;
-
-        // System.out.println("the key length is ; "+ workingKey.length);
-
-        x = 0;
-        y = 0;
-
-        if (engineState == null)
-        {
-            engineState = new byte[STATE_LENGTH];
-        }
-
-        // reset the state of the engine
-        for (int i=0; i < STATE_LENGTH; i++)
-        {
-            engineState[i] = (byte)i;
-        }
-        
-        int i1 = 0;
-        int i2 = 0;
-
-        for (int i=0; i < STATE_LENGTH; i++)
-        {
-            i2 = ((keyBytes[i1] & 0xff) + engineState[i] + i2) & 0xff;
-            // do the byte-swap inline
-            byte tmp = engineState[i];
-            engineState[i] = engineState[i2];
-            engineState[i2] = tmp;
-            i1 = (i1+1) % keyBytes.length; 
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/engines/RSAEngine.java b/azureus2/src/org/bouncycastle/crypto/engines/RSAEngine.java
deleted file mode 100644
index e8d4128..0000000
--- a/azureus2/src/org/bouncycastle/crypto/engines/RSAEngine.java
+++ /dev/null
@@ -1,188 +0,0 @@
-package org.bouncycastle.crypto.engines;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.crypto.AsymmetricBlockCipher;
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.DataLengthException;
-import org.bouncycastle.crypto.params.RSAKeyParameters;
-import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters;
-
-/**
- * this does your basic RSA algorithm. 
- */
-public class RSAEngine
-    implements AsymmetricBlockCipher
-{
-    private RSAKeyParameters        key;
-    private boolean                 forEncryption;
-
-    /**
-     * initialise the RSA engine.
-     *
-     * @param forEncryption true if we are encrypting, false otherwise.
-     * @param param the necessary RSA key parameters.
-     */
-    public void init(
-        boolean             forEncryption,
-        CipherParameters    param)
-    {
-        this.key = (RSAKeyParameters)param;
-        this.forEncryption = forEncryption;
-    }
-
-    /**
-     * Return the maximum size for an input block to this engine.
-     * For RSA this is always one byte less than the key size on
-     * encryption, and the same length as the key size on decryption.
-     *
-     * @return maximum size for an input block.
-     */
-    public int getInputBlockSize()
-    {
-        int     bitSize = key.getModulus().bitLength();
-
-        if (forEncryption)
-        {
-            return (bitSize + 7) / 8 - 1;
-        }
-        else
-        {
-            return (bitSize + 7) / 8;
-        }
-    }
-
-    /**
-     * Return the maximum size for an output block to this engine.
-     * For RSA this is always one byte less than the key size on
-     * decryption, and the same length as the key size on encryption.
-     *
-     * @return maximum size for an output block.
-     */
-    public int getOutputBlockSize()
-    {
-        int     bitSize = key.getModulus().bitLength();
-
-        if (forEncryption)
-        {
-            return (bitSize + 7) / 8;
-        }
-        else
-        {
-            return (bitSize + 7) / 8 - 1;
-        }
-    }
-
-    /**
-     * Process a single block using the basic RSA algorithm.
-     *
-     * @param in the input array.
-     * @param inOff the offset into the input buffer where the data starts.
-     * @param inLen the length of the data to be processed.
-     * @return the result of the RSA process.
-     * @exception DataLengthException the input block is too large.
-     */
-    public byte[] processBlock(
-        byte[]  in,
-        int     inOff,
-        int     inLen)
-    {
-        if (inLen > (getInputBlockSize() + 1))
-        {
-            throw new DataLengthException("input too large for RSA cipher.\n");
-        }
-        else if (inLen == (getInputBlockSize() + 1) && (in[inOff] & 0x80) != 0)
-        {
-            throw new DataLengthException("input too large for RSA cipher.\n");
-        }
-
-        byte[]  block;
-
-        if (inOff != 0 || inLen != in.length)
-        {
-            block = new byte[inLen];
-
-            System.arraycopy(in, inOff, block, 0, inLen);
-        }
-        else
-        {
-            block = in;
-        }
-
-        BigInteger  input = new BigInteger(1, block);
-        byte[]      output;
-
-        if (key instanceof RSAPrivateCrtKeyParameters)
-        {
-            //
-            // we have the extra factors, use the Chinese Remainder Theorem - the author
-            // wishes to express his thanks to Dirk Bonekaemper at rtsffm.com for 
-            // advice regarding the expression of this.
-            //
-            RSAPrivateCrtKeyParameters crtKey = (RSAPrivateCrtKeyParameters)key;
-
-            BigInteger p = crtKey.getP();
-            BigInteger q = crtKey.getQ();
-            BigInteger dP = crtKey.getDP();
-            BigInteger dQ = crtKey.getDQ();
-            BigInteger qInv = crtKey.getQInv();
-    
-            BigInteger mP, mQ, h, m;
-    
-            // mP = ((input mod p) ^ dP)) mod p
-            mP = (input.remainder(p)).modPow(dP, p);
-    
-            // mQ = ((input mod q) ^ dQ)) mod q
-            mQ = (input.remainder(q)).modPow(dQ, q);
-    
-            // h = qInv * (mP - mQ) mod p
-            h = mP.subtract(mQ);
-            h = h.multiply(qInv);
-            h = h.mod(p);               // mod (in Java) returns the positive residual
-    
-            // m = h * q + mQ
-            m = h.multiply(q);
-            m = m.add(mQ);
-    
-            output = m.toByteArray();
-        }
-        else
-        {
-            output = input.modPow(
-                        key.getExponent(), key.getModulus()).toByteArray();
-        }
-
-        if (forEncryption)
-        {
-            if (output[0] == 0 && output.length > getOutputBlockSize())        // have ended up with an extra zero byte, copy down.
-            {
-                byte[]  tmp = new byte[output.length - 1];
-
-                System.arraycopy(output, 1, tmp, 0, tmp.length);
-
-                return tmp;
-            }
-
-            if (output.length < getOutputBlockSize())     // have ended up with less bytes than normal, lengthen
-            {
-                byte[]  tmp = new byte[getOutputBlockSize()];
-
-                System.arraycopy(output, 0, tmp, tmp.length - output.length, output.length);
-
-                return tmp;
-            }
-        }
-        else
-        {
-            if (output[0] == 0)        // have ended up with an extra zero byte, copy down.
-            {
-                byte[]  tmp = new byte[output.length - 1];
-
-                System.arraycopy(output, 1, tmp, 0, tmp.length);
-
-                return tmp;
-            }
-        }
-        return output;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/generators/BaseKDFBytesGenerator.java b/azureus2/src/org/bouncycastle/crypto/generators/BaseKDFBytesGenerator.java
deleted file mode 100644
index 268ae9b..0000000
--- a/azureus2/src/org/bouncycastle/crypto/generators/BaseKDFBytesGenerator.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package org.bouncycastle.crypto.generators;
-
-import org.bouncycastle.crypto.DataLengthException;
-import org.bouncycastle.crypto.DerivationFunction;
-import org.bouncycastle.crypto.DerivationParameters;
-import org.bouncycastle.crypto.Digest;
-import org.bouncycastle.crypto.params.ISO18033KDFParameters;
-import org.bouncycastle.crypto.params.KDFParameters;
-
-/**
- * Basic KDF generator for derived keys and ivs as defined by IEEE P1363a/ISO 18033
- * <br>
- * This implementation is based on ISO 18033/P1363a.
- */
-public class BaseKDFBytesGenerator
-    implements DerivationFunction
-{
-    private int     counterStart;
-    private Digest  digest;
-    private byte[]  shared;
-    private byte[]  iv;
-
-    /**
-     * Construct a KDF Parameters generator.
-     * <p>
-     * @param counterStart value of counter.
-     * @param digest the digest to be used as the source of derived keys.
-     */
-    protected BaseKDFBytesGenerator(
-        int     counterStart,
-        Digest  digest)
-    {
-        this.counterStart = counterStart;
-        this.digest = digest;
-    }
-
-    public void init(
-        DerivationParameters    param)
-    {
-        if (param instanceof KDFParameters)
-        {
-            KDFParameters   p = (KDFParameters)param;
-
-            shared = p.getSharedSecret();
-            iv = p.getIV();
-        }
-        else if (param instanceof ISO18033KDFParameters)
-        {
-            ISO18033KDFParameters p = (ISO18033KDFParameters)param;
-            
-            shared = p.getSeed();
-            iv = null;
-        }
-        else
-        {
-            throw new IllegalArgumentException("KDF parameters required for KDF2Generator");
-        }
-    }
-
-    /**
-     * return the underlying digest.
-     */
-    public Digest getDigest()
-    {
-        return digest;
-    }
-
-    /**
-     * fill len bytes of the output buffer with bytes generated from
-     * the derivation function.
-     *
-     * @throws IllegalArgumentException if the size of the request will cause an overflow.
-     * @throws DataLengthException if the out buffer is too small.
-     */
-    public int generateBytes(
-        byte[]  out,
-        int     outOff,
-        int     len)
-        throws DataLengthException, IllegalArgumentException
-    {
-        if ((out.length - len) < outOff)
-        {
-            throw new DataLengthException("output buffer too small");
-        }
-
-        long    oBytes = len;
-        int     outLen = digest.getDigestSize(); 
-
-        //
-        // this is at odds with the standard implementation, the
-        // maximum value should be hBits * (2^32 - 1) where hBits
-        // is the digest output size in bits. We can't have an
-        // array with a long index at the moment...
-        //
-        if (oBytes > ((2L << 32) - 1))
-        {
-            throw new IllegalArgumentException("Output length too large");
-        }
-
-        int cThreshold = (int)((oBytes + outLen - 1) / outLen);
-
-        byte[] dig = null;
-
-        dig = new byte[digest.getDigestSize()];
-
-        int counter = counterStart;
-        
-        for (int i = 0; i < cThreshold; i++)
-        {
-            digest.update(shared, 0, shared.length);
-
-            digest.update((byte)(counter >> 24));
-            digest.update((byte)(counter >> 16));
-            digest.update((byte)(counter >> 8));
-            digest.update((byte)counter);
-            
-            if (iv != null)
-            {
-                digest.update(iv, 0, iv.length);
-            }
-
-            digest.doFinal(dig, 0);
-
-            if (len > outLen)
-            {
-                System.arraycopy(dig, 0, out, outOff, outLen);
-                outOff += outLen;
-                len -= outLen;
-            }
-            else
-            {
-                System.arraycopy(dig, 0, out, outOff, len);
-            }
-            
-            counter++;
-        }
-    
-        digest.reset();
-
-        return len;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/generators/DESKeyGenerator.java b/azureus2/src/org/bouncycastle/crypto/generators/DESKeyGenerator.java
deleted file mode 100644
index bb3f6d0..0000000
--- a/azureus2/src/org/bouncycastle/crypto/generators/DESKeyGenerator.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.bouncycastle.crypto.generators;
-
-import org.bouncycastle.crypto.CipherKeyGenerator;
-import org.bouncycastle.crypto.params.DESParameters;
-
-public class DESKeyGenerator
-    extends CipherKeyGenerator
-{
-    public byte[] generateKey()
-    {
-        byte[]  newKey = new byte[DESParameters.DES_KEY_LENGTH];
-
-        do
-        {
-            random.nextBytes(newKey);
-
-            DESParameters.setOddParity(newKey);
-        }
-        while (DESParameters.isWeakKey(newKey, 0));
-
-        return newKey;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/generators/DESedeKeyGenerator.java b/azureus2/src/org/bouncycastle/crypto/generators/DESedeKeyGenerator.java
deleted file mode 100644
index 101dc37..0000000
--- a/azureus2/src/org/bouncycastle/crypto/generators/DESedeKeyGenerator.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.bouncycastle.crypto.generators;
-
-import org.bouncycastle.crypto.KeyGenerationParameters;
-import org.bouncycastle.crypto.params.DESedeParameters;
-
-public class DESedeKeyGenerator
-    extends DESKeyGenerator
-{
-    /**
-     * initialise the key generator - if strength is set to zero
-     * the key generated will be 192 bits in size, otherwise
-     * strength can be 128 or 192 (or 112 or 168 if you don't count
-     * parity bits), depending on whether you wish to do 2-key or 3-key
-     * triple DES.
-     *
-     * @param param the parameters to be used for key generation
-     */
-    public void init(
-        KeyGenerationParameters param)
-    {
-        super.init(param);
-
-        if (strength == 0 || strength == (168 / 8))
-        {
-            strength = DESedeParameters.DES_EDE_KEY_LENGTH;
-        }
-        else if (strength == (112 / 8))
-        {
-            strength = 2 * DESedeParameters.DES_KEY_LENGTH;
-        }
-        else if (strength != DESedeParameters.DES_EDE_KEY_LENGTH
-                && strength != (2 * DESedeParameters.DES_KEY_LENGTH))
-        {
-            throw new IllegalArgumentException("DESede key must be "
-                + (DESedeParameters.DES_EDE_KEY_LENGTH * 8) + " or "
-                + (2 * 8 * DESedeParameters.DES_KEY_LENGTH)
-                + " bits long.");
-        }
-    }
-
-    public byte[] generateKey()
-    {
-        byte[]  newKey = new byte[strength];
-
-        do
-        {
-            random.nextBytes(newKey);
-
-            DESedeParameters.setOddParity(newKey);
-        }
-        while (DESedeParameters.isWeakKey(newKey, 0, newKey.length));
-
-        return newKey;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/generators/DHBasicKeyPairGenerator.java b/azureus2/src/org/bouncycastle/crypto/generators/DHBasicKeyPairGenerator.java
deleted file mode 100644
index 2fbf02c..0000000
--- a/azureus2/src/org/bouncycastle/crypto/generators/DHBasicKeyPairGenerator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.bouncycastle.crypto.generators;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
-import org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator;
-import org.bouncycastle.crypto.KeyGenerationParameters;
-import org.bouncycastle.crypto.params.DHKeyGenerationParameters;
-import org.bouncycastle.crypto.params.DHParameters;
-import org.bouncycastle.crypto.params.DHPrivateKeyParameters;
-import org.bouncycastle.crypto.params.DHPublicKeyParameters;
-
-/**
- * a basic Diffie-Helman key pair generator.
- *
- * This generates keys consistent for use with the basic algorithm for
- * Diffie-Helman.
- */
-public class DHBasicKeyPairGenerator
-    implements AsymmetricCipherKeyPairGenerator
-{
-    private DHKeyGenerationParameters param;
-
-    public void init(
-        KeyGenerationParameters param)
-    {
-        this.param = (DHKeyGenerationParameters)param;
-    }
-
-    public AsymmetricCipherKeyPair generateKeyPair()
-    {
-        BigInteger      p, g, x, y;
-        int             qLength = param.getStrength() - 1;
-        DHParameters    dhParams = param.getParameters();
-
-        p = dhParams.getP();
-        g = dhParams.getG();
-   
-        //
-        // calculate the private key
-        //
-		x = new BigInteger(qLength, param.getRandom());
-		
-        //
-        // calculate the public key.
-        //
-        y = g.modPow(x, p);
-
-        return new AsymmetricCipherKeyPair(
-                new DHPublicKeyParameters(y, dhParams),
-                new DHPrivateKeyParameters(x, dhParams));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/generators/DHKeyPairGenerator.java b/azureus2/src/org/bouncycastle/crypto/generators/DHKeyPairGenerator.java
deleted file mode 100644
index 9e53eab..0000000
--- a/azureus2/src/org/bouncycastle/crypto/generators/DHKeyPairGenerator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.bouncycastle.crypto.generators;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
-import org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator;
-import org.bouncycastle.crypto.KeyGenerationParameters;
-import org.bouncycastle.crypto.params.DHKeyGenerationParameters;
-import org.bouncycastle.crypto.params.DHParameters;
-import org.bouncycastle.crypto.params.DHPrivateKeyParameters;
-import org.bouncycastle.crypto.params.DHPublicKeyParameters;
-
-/**
- * a Diffie-Helman key pair generator.
- *
- * This generates keys consistent for use in the MTI/A0 key agreement protocol
- * as described in "Handbook of Applied Cryptography", Pages 516-519.
- */
-public class DHKeyPairGenerator
-    implements AsymmetricCipherKeyPairGenerator
-{
-    private DHKeyGenerationParameters param;
-
-    public void init(
-        KeyGenerationParameters param)
-    {
-        this.param = (DHKeyGenerationParameters)param;
-    }
-
-    public AsymmetricCipherKeyPair generateKeyPair()
-    {
-        BigInteger      p, g, x, y;
-        int             qLength = param.getStrength() - 1;
-        DHParameters    dhParams = param.getParameters();
-
-        p = dhParams.getP();
-        g = dhParams.getG();
-    
-        //
-        // calculate the private key
-        //
-		x = new BigInteger(qLength, param.getRandom());
-
-        //
-        // calculate the public key.
-        //
-        y = g.modPow(x, p);
-
-        return new AsymmetricCipherKeyPair(
-                new DHPublicKeyParameters(y, dhParams),
-                new DHPrivateKeyParameters(x, dhParams));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/generators/DHParametersGenerator.java b/azureus2/src/org/bouncycastle/crypto/generators/DHParametersGenerator.java
deleted file mode 100644
index 152682c..0000000
--- a/azureus2/src/org/bouncycastle/crypto/generators/DHParametersGenerator.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.bouncycastle.crypto.generators;
-
-import java.math.BigInteger;
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.params.DHParameters;
-
-public class DHParametersGenerator
-{
-    private int             size;
-    private int             certainty;
-    private SecureRandom    random;
-
-    private static BigInteger ONE = BigInteger.valueOf(1);
-    private static BigInteger TWO = BigInteger.valueOf(2);
-
-    public void init(
-        int             size,
-        int             certainty,
-        SecureRandom    random)
-    {
-        this.size = size;
-        this.certainty = certainty;
-        this.random = random;
-    }
-
-    /**
-     * which generates the p and g values from the given parameters,
-     * returning the DHParameters object.
-     * <p>
-     * Note: can take a while...
-     */
-    public DHParameters generateParameters()
-    {
-        BigInteger      g, p, q;
-        int             qLength = size - 1;
-
-        //
-        // find a safe prime p where p = 2*q + 1, where p and q are prime.
-        //
-		for (;;)
-		{
-			q = new BigInteger(qLength, certainty, random);
-            p = q.multiply(TWO).add(ONE);
-            if (p.isProbablePrime(certainty))
-            {
-                break;
-            }
-		}
-
-		//
-		// calculate the generator g - the advantage of using the 2q+1 
-        // approach is that we know the prime factorisation of (p - 1)...
-	    //
-        for (;;)
-        {
-            g = new BigInteger(qLength, random);
-
-            if (g.modPow(TWO, p).equals(ONE))
-            {
-                continue;
-            }
-
-            if (g.modPow(q, p).equals(ONE))
-            {
-                continue;
-            }
-
-            break;
-        }
-
-        return new DHParameters(p, g, q, 2);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/generators/DSAKeyPairGenerator.java b/azureus2/src/org/bouncycastle/crypto/generators/DSAKeyPairGenerator.java
deleted file mode 100644
index e1a9655..0000000
--- a/azureus2/src/org/bouncycastle/crypto/generators/DSAKeyPairGenerator.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.bouncycastle.crypto.generators;
-
-import java.math.BigInteger;
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
-import org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator;
-import org.bouncycastle.crypto.KeyGenerationParameters;
-import org.bouncycastle.crypto.params.DSAKeyGenerationParameters;
-import org.bouncycastle.crypto.params.DSAParameters;
-import org.bouncycastle.crypto.params.DSAPrivateKeyParameters;
-import org.bouncycastle.crypto.params.DSAPublicKeyParameters;
-
-/**
- * a DSA key pair generator.
- *
- * This generates DSA keys in line with the method described 
- * in FIPS 186-2.
- */
-public class DSAKeyPairGenerator
-    implements AsymmetricCipherKeyPairGenerator
-{
-    private static BigInteger ZERO = BigInteger.valueOf(0);
-
-    private DSAKeyGenerationParameters param;
-
-    public void init(
-        KeyGenerationParameters param)
-    {
-        this.param = (DSAKeyGenerationParameters)param;
-    }
-
-    public AsymmetricCipherKeyPair generateKeyPair()
-    {
-        BigInteger      p, q, g, x, y;
-        DSAParameters   dsaParams = param.getParameters();
-        SecureRandom    random = param.getRandom();
-
-        q = dsaParams.getQ();
-        p = dsaParams.getP();
-        g = dsaParams.getG();
-
-        do
-        {
-            x = new BigInteger(160, random);
-        }
-        while (x.equals(ZERO)  || x.compareTo(q) >= 0);
-
-        //
-        // calculate the public key.
-        //
-        y = g.modPow(x, p);
-
-        return new AsymmetricCipherKeyPair(
-                new DSAPublicKeyParameters(y, dsaParams),
-                new DSAPrivateKeyParameters(x, dsaParams));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/generators/DSAParametersGenerator.java b/azureus2/src/org/bouncycastle/crypto/generators/DSAParametersGenerator.java
deleted file mode 100644
index d29040b..0000000
--- a/azureus2/src/org/bouncycastle/crypto/generators/DSAParametersGenerator.java
+++ /dev/null
@@ -1,178 +0,0 @@
-package org.bouncycastle.crypto.generators;
-
-import java.math.BigInteger;
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.digests.SHA1Digest;
-import org.bouncycastle.crypto.params.DSAParameters;
-import org.bouncycastle.crypto.params.DSAValidationParameters;
-
-/**
- * generate suitable parameters for DSA, in line with FIPS 186-2.
- */
-public class DSAParametersGenerator
-{
-    private int             size;
-    private int             certainty;
-    private SecureRandom    random;
-
-    private static BigInteger ONE = BigInteger.valueOf(1);
-    private static BigInteger TWO = BigInteger.valueOf(2);
-
-    /**
-     * initialise the key generator.
-     *
-     * @param size size of the key (range 2^512 -> 2^1024 - 64 bit increments)
-     * @param certainty measure of robustness of prime (for FIPS 186-2 compliance this should be at least 80).
-     * @param random random byte source.
-     */
-    public void init(
-        int             size,
-        int             certainty,
-        SecureRandom    random)
-    {
-        this.size = size;
-        this.certainty = certainty;
-        this.random = random;
-    }
-
-    /**
-     * add value to b, returning the result in a. The a value is treated
-     * as a BigInteger of length (a.length * 8) bits. The result is
-     * modulo 2^a.length in case of overflow.
-     */
-    private void add(
-        byte[]  a,
-        byte[]  b,
-        int     value)
-    {
-        int     x = (b[b.length - 1] & 0xff) + value;
-
-        a[b.length - 1] = (byte)x;
-        x >>>= 8;
-
-        for (int i = b.length - 2; i >= 0; i--)
-        {
-            x += (b[i] & 0xff);
-            a[i] = (byte)x;
-            x >>>= 8;
-        }
-    }
-
-    /**
-     * which generates the p and g values from the given parameters,
-     * returning the DSAParameters object.
-     * <p>
-     * Note: can take a while...
-     */
-    public DSAParameters generateParameters()
-    {
-        byte[]          seed = new byte[20];
-        byte[]          part1 = new byte[20];
-        byte[]          part2 = new byte[20];
-        byte[]          u = new byte[20];
-        SHA1Digest      sha1 = new SHA1Digest();
-        int             n = (size - 1) / 160;
-        byte[]          w = new byte[size / 8];
-
-        BigInteger      q = null, p = null, g = null;
-        int             counter = 0;
-        boolean         primesFound = false;
-
-        while (!primesFound)
-        {
-            do
-            {
-                random.nextBytes(seed);
-
-                sha1.update(seed, 0, seed.length);
-
-                sha1.doFinal(part1, 0);
-
-                System.arraycopy(seed, 0, part2, 0, seed.length);
-
-                add(part2, seed, 1);
-
-                sha1.update(part2, 0, part2.length);
-
-                sha1.doFinal(part2, 0);
-
-                for (int i = 0; i != u.length; i++)
-                {
-                    u[i] = (byte)(part1[i] ^ part2[i]);
-                }
-
-                u[0] |= (byte)0x80;
-                u[19] |= (byte)0x01;
-
-                q = new BigInteger(1, u);
-            }
-            while (!q.isProbablePrime(certainty));
-
-            counter = 0;
-
-            int offset = 2;
-
-            while (counter < 4096)
-            {
-                for (int k = 0; k < n; k++)
-                {
-                    add(part1, seed, offset + k);
-                    sha1.update(part1, 0, part1.length);
-                    sha1.doFinal(part1, 0);
-                    System.arraycopy(part1, 0, w, w.length - (k + 1) * part1.length, part1.length);
-                }
-
-                add(part1, seed, offset + n);
-                sha1.update(part1, 0, part1.length);
-                sha1.doFinal(part1, 0);
-                System.arraycopy(part1, part1.length - ((w.length - (n) * part1.length)), w, 0, w.length - n * part1.length);
-
-                w[0] |= (byte)0x80;
-
-                BigInteger  x = new BigInteger(1, w);
-
-                BigInteger  c = x.mod(q.multiply(TWO));
-
-                p = x.subtract(c.subtract(ONE));
-
-                if (p.testBit(size - 1))
-                {
-                    if (p.isProbablePrime(certainty))
-                    {
-                        primesFound = true;
-                        break;
-                    }
-                }
-
-                counter += 1;
-                offset += n + 1;
-            }
-		}
-
-		//
-		// calculate the generator g
-	    //
-        BigInteger  pMinusOneOverQ = p.subtract(ONE).divide(q);
-
-        for (;;)
-        {
-            BigInteger h = new BigInteger(size, random);
-            
-            if (h.compareTo(ONE) <= 0 || h.compareTo(p.subtract(ONE)) >= 0)
-            {
-                continue;
-            }
-
-            g = h.modPow(pMinusOneOverQ, p);
-            if (g.compareTo(ONE) <= 0)
-            {
-                continue;
-            }
-
-            break;
-        }
-
-        return new DSAParameters(p, q, g, new DSAValidationParameters(seed, counter));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/generators/ECKeyPairGenerator.java b/azureus2/src/org/bouncycastle/crypto/generators/ECKeyPairGenerator.java
deleted file mode 100644
index 6ce15ea..0000000
--- a/azureus2/src/org/bouncycastle/crypto/generators/ECKeyPairGenerator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.bouncycastle.crypto.generators;
-
-import java.math.BigInteger;
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
-import org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator;
-import org.bouncycastle.crypto.KeyGenerationParameters;
-import org.bouncycastle.crypto.params.ECDomainParameters;
-import org.bouncycastle.crypto.params.ECKeyGenerationParameters;
-import org.bouncycastle.crypto.params.ECPrivateKeyParameters;
-import org.bouncycastle.crypto.params.ECPublicKeyParameters;
-import org.bouncycastle.math.ec.ECConstants;
-import org.bouncycastle.math.ec.ECPoint;
-
-public class ECKeyPairGenerator
-    implements AsymmetricCipherKeyPairGenerator, ECConstants
-{
-	ECDomainParameters  params;
-	SecureRandom        random;
-
-	public void init(
-        KeyGenerationParameters param)
-    {
-        ECKeyGenerationParameters  ecP = (ECKeyGenerationParameters)param;
-
-        this.random = ecP.getRandom();
-        this.params = ecP.getDomainParameters();
-    }
-
-    /**
-     * Given the domain parameters this routine generates an EC key
-     * pair in accordance with X9.62 section 5.2.1 pages 26, 27.
-     */
-    public AsymmetricCipherKeyPair generateKeyPair()
-    {
-		BigInteger n = params.getN();
-		int			  nBitLength = n.bitLength();
-		BigInteger d;
-
-		do
-		{
-			d = new BigInteger(nBitLength, random);
-		}
-		while (d.equals(ZERO)  || (d.compareTo(n) >= 0));
-
-		ECPoint Q = params.getG().multiply(d);
-
-		return new AsymmetricCipherKeyPair(
-            new ECPublicKeyParameters(Q, params),
-			new ECPrivateKeyParameters(d, params));
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/generators/ElGamalKeyPairGenerator.java b/azureus2/src/org/bouncycastle/crypto/generators/ElGamalKeyPairGenerator.java
deleted file mode 100644
index 33ec23c..0000000
--- a/azureus2/src/org/bouncycastle/crypto/generators/ElGamalKeyPairGenerator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.bouncycastle.crypto.generators;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
-import org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator;
-import org.bouncycastle.crypto.KeyGenerationParameters;
-import org.bouncycastle.crypto.params.ElGamalKeyGenerationParameters;
-import org.bouncycastle.crypto.params.ElGamalParameters;
-import org.bouncycastle.crypto.params.ElGamalPrivateKeyParameters;
-import org.bouncycastle.crypto.params.ElGamalPublicKeyParameters;
-
-/**
- * a ElGamal key pair generator.
- * <p>
- * This generates keys consistent for use with ElGamal as described in
- * page 164 of "Handbook of Applied Cryptography".
- */
-public class ElGamalKeyPairGenerator
-    implements AsymmetricCipherKeyPairGenerator
-{
-    private ElGamalKeyGenerationParameters param;
-
-    public void init(
-        KeyGenerationParameters param)
-    {
-        this.param = (ElGamalKeyGenerationParameters)param;
-    }
-
-    public AsymmetricCipherKeyPair generateKeyPair()
-    {
-        BigInteger           p, g, x, y;
-        int                  qLength = param.getStrength() - 1;
-        ElGamalParameters    elParams = param.getParameters();
-
-        p = elParams.getP();
-        g = elParams.getG();
-    
-        //
-        // calculate the private key
-        //
-		x = new BigInteger(qLength, param.getRandom());
-
-        //
-        // calculate the public key.
-        //
-        y = g.modPow(x, p);
-
-        return new AsymmetricCipherKeyPair(
-                new ElGamalPublicKeyParameters(y, elParams),
-                new ElGamalPrivateKeyParameters(x, elParams));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/generators/ElGamalParametersGenerator.java b/azureus2/src/org/bouncycastle/crypto/generators/ElGamalParametersGenerator.java
deleted file mode 100644
index 62e63f1..0000000
--- a/azureus2/src/org/bouncycastle/crypto/generators/ElGamalParametersGenerator.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.bouncycastle.crypto.generators;
-
-import java.math.BigInteger;
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.params.ElGamalParameters;
-
-public class ElGamalParametersGenerator
-{
-    private int             size;
-    private int             certainty;
-    private SecureRandom    random;
-
-    private static BigInteger ONE = BigInteger.valueOf(1);
-    private static BigInteger TWO = BigInteger.valueOf(2);
-
-    public void init(
-        int             size,
-        int             certainty,
-        SecureRandom    random)
-    {
-        this.size = size;
-        this.certainty = certainty;
-        this.random = random;
-    }
-
-    /**
-     * which generates the p and g values from the given parameters,
-     * returning the ElGamalParameters object.
-     * <p>
-     * Note: can take a while...
-     */
-    public ElGamalParameters generateParameters()
-    {
-        BigInteger      g, p, q;
-        int             qLength = size - 1;
-
-        //
-        // find a safe prime p where p = 2*q + 1, where p and q are prime.
-        //
-		for (;;)
-		{
-			q = new BigInteger(qLength, 1, random);
-			
-			if (q.bitLength() != qLength)
-			{
-				continue;
-			}
-			
-			if (!q.isProbablePrime(certainty))
-			{
-				continue;
-			}
-			
-            p = q.multiply(TWO).add(ONE);
-            if (p.isProbablePrime(certainty))
-            {
-                break;
-            }
-		}
-
-		//
-		// calculate the generator g - the advantage of using the 2q+1 
-        // approach is that we know the prime factorisation of (p - 1)...
-	    //
-        for (;;)
-        {
-            g = new BigInteger(qLength, random);
-
-            if (g.modPow(TWO, p).equals(ONE))
-            {
-                continue;
-            }
-
-            if (g.modPow(q, p).equals(ONE))
-            {
-                continue;
-            }
-
-            break;
-        }
-
-        return new ElGamalParameters(p, g);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/generators/KDF2BytesGenerator.java b/azureus2/src/org/bouncycastle/crypto/generators/KDF2BytesGenerator.java
deleted file mode 100644
index cab05ac..0000000
--- a/azureus2/src/org/bouncycastle/crypto/generators/KDF2BytesGenerator.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.bouncycastle.crypto.generators;
-
-import org.bouncycastle.crypto.Digest;
-
-/**
- * KFD2 generator for derived keys and ivs as defined by IEEE P1363a/ISO 18033
- * <br>
- * This implementation is based on IEEE P1363/ISO 18033.
- */
-public class KDF2BytesGenerator
-    extends BaseKDFBytesGenerator
-{
-    /**
-     * Construct a KDF2 bytes generator. Generates key material
-     * according to IEEE P1363 or ISO 18033 depending on the initialisation.
-     * <p>
-     * @param digest the digest to be used as the source of derived keys.
-     */
-    public KDF2BytesGenerator(
-        Digest  digest)
-    {
-        super(1, digest);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/generators/MGF1BytesGenerator.java b/azureus2/src/org/bouncycastle/crypto/generators/MGF1BytesGenerator.java
deleted file mode 100644
index 106ef10..0000000
--- a/azureus2/src/org/bouncycastle/crypto/generators/MGF1BytesGenerator.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.bouncycastle.crypto.generators;
-
-import org.bouncycastle.crypto.DataLengthException;
-import org.bouncycastle.crypto.DerivationFunction;
-import org.bouncycastle.crypto.DerivationParameters;
-import org.bouncycastle.crypto.Digest;
-import org.bouncycastle.crypto.params.MGFParameters;
-
-/**
- * Generator for MGF1 as defined in PKCS 1v2
- */
-public class MGF1BytesGenerator
-    implements DerivationFunction
-{
-    private Digest  digest;
-    private byte[]  seed;
-    private int     hLen;
-
-    /**
-     * @param digest the digest to be used as the source of generated bytes
-     */
-    public MGF1BytesGenerator(
-        Digest  digest)
-    {
-        this.digest = digest;
-        this.hLen = digest.getDigestSize();
-    }
-
-    public void init(
-        DerivationParameters    param)
-    {
-        if (!(param instanceof MGFParameters))
-        {
-            throw new IllegalArgumentException("MGF parameters required for MGF1Generator");
-        }
-
-        MGFParameters   p = (MGFParameters)param;
-
-        seed = p.getSeed();
-    }
-
-    /**
-     * return the underlying digest.
-     */
-    public Digest getDigest()
-    {
-        return digest;
-    }
-
-    /**
-     * int to octet string.
-     */
-    private void ItoOSP(
-        int     i,
-        byte[]  sp)
-    {
-        sp[0] = (byte)(i >>> 24);
-        sp[1] = (byte)(i >>> 16);
-        sp[2] = (byte)(i >>> 8);
-        sp[3] = (byte)(i >>> 0);
-    }
-
-    /**
-     * fill len bytes of the output buffer with bytes generated from
-     * the derivation function.
-     *
-     * @throws IllegalArgumentException if the size of the request will cause an overflow.
-     * @throws DataLengthException if the out buffer is too small.
-     */
-    public int generateBytes(
-        byte[]  out,
-        int     outOff,
-        int     len)
-        throws DataLengthException, IllegalArgumentException
-    {
-        byte[]  hashBuf = new byte[hLen];
-        byte[]  C = new byte[4];
-        int     counter = 0;
-
-        digest.reset();
-
-        do
-        {
-            ItoOSP(counter, C);
-
-            digest.update(seed, 0, seed.length);
-            digest.update(C, 0, C.length);
-            digest.doFinal(hashBuf, 0);
-
-            System.arraycopy(hashBuf, 0, out, outOff + counter * hLen, hLen);
-        }
-        while (++counter < (len / hLen));
-
-        if ((counter * hLen) < len)
-        {
-            ItoOSP(counter, C);
-
-            digest.update(seed, 0, seed.length);
-            digest.update(C, 0, C.length);
-            digest.doFinal(hashBuf, 0);
-
-            System.arraycopy(hashBuf, 0, out, outOff + counter * hLen, len - (counter * hLen));
-        }
-
-        return len;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/generators/OpenSSLPBEParametersGenerator.java b/azureus2/src/org/bouncycastle/crypto/generators/OpenSSLPBEParametersGenerator.java
deleted file mode 100644
index 8a4d28a..0000000
--- a/azureus2/src/org/bouncycastle/crypto/generators/OpenSSLPBEParametersGenerator.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package org.bouncycastle.crypto.generators;
-
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.Digest;
-import org.bouncycastle.crypto.PBEParametersGenerator;
-import org.bouncycastle.crypto.digests.MD5Digest;
-import org.bouncycastle.crypto.params.KeyParameter;
-import org.bouncycastle.crypto.params.ParametersWithIV;
-
-/**
- * Generator for PBE derived keys and ivs as usd by OpenSSL.
- * <p>
- * The scheme is a simple extension of PKCS 5 V2.0 Scheme 1 using MD5 with an
- * iteration count of 1.
- * <p>
- */
-public class OpenSSLPBEParametersGenerator
-    extends PBEParametersGenerator
-{
-    private Digest  digest = new MD5Digest();
-
-    /**
-     * Construct a OpenSSL Parameters generator. 
-     */
-    public OpenSSLPBEParametersGenerator()
-    {
-    }
-
-    /**
-     * Initialise - note the iteration count for this algorithm is fixed at 1.
-     * 
-     * @param password password to use.
-     * @param salt salt to use.
-     */
-    public void init(
-       byte[] password,
-       byte[] salt)
-    {
-        super.init(password, salt, 1);
-    }
-    
-    /**
-     * the derived key function, the ith hash of the password and the salt.
-     */
-    private byte[] generateDerivedKey(
-        int bytesNeeded)
-    {
-        byte[]  buf = new byte[digest.getDigestSize()];
-        byte[]  key = new byte[bytesNeeded];
-        int     offset = 0;
-        
-        for (;;)
-        {
-            digest.update(password, 0, password.length);
-            digest.update(salt, 0, salt.length);
-
-            digest.doFinal(buf, 0);
-            
-            int len = (bytesNeeded > buf.length) ? buf.length : bytesNeeded;
-            System.arraycopy(buf, 0, key, offset, len);
-            offset += len;
-
-            // check if we need any more
-            bytesNeeded -= len;
-            if (bytesNeeded == 0)
-            {
-                break;
-            }
-
-            // do another round
-            digest.reset();
-            digest.update(buf, 0, buf.length);
-        }
-        
-        return key;
-    }
-
-    /**
-     * Generate a key parameter derived from the password, salt, and iteration
-     * count we are currently initialised with.
-     *
-     * @param keySize the size of the key we want (in bits)
-     * @return a KeyParameter object.
-     * @exception IllegalArgumentException if the key length larger than the base hash size.
-     */
-    public CipherParameters generateDerivedParameters(
-        int keySize)
-    {
-        keySize = keySize / 8;
-
-        byte[]  dKey = generateDerivedKey(keySize);
-
-        return new KeyParameter(dKey, 0, keySize);
-    }
-
-    /**
-     * Generate a key with initialisation vector parameter derived from
-     * the password, salt, and iteration count we are currently initialised
-     * with.
-     *
-     * @param keySize the size of the key we want (in bits)
-     * @param ivSize the size of the iv we want (in bits)
-     * @return a ParametersWithIV object.
-     * @exception IllegalArgumentException if keySize + ivSize is larger than the base hash size.
-     */
-    public CipherParameters generateDerivedParameters(
-        int     keySize,
-        int     ivSize)
-    {
-        keySize = keySize / 8;
-        ivSize = ivSize / 8;
-
-        byte[]  dKey = generateDerivedKey(keySize + ivSize);
-
-        return new ParametersWithIV(new KeyParameter(dKey, 0, keySize), dKey, keySize, ivSize);
-    }
-
-    /**
-     * Generate a key parameter for use with a MAC derived from the password,
-     * salt, and iteration count we are currently initialised with.
-     *
-     * @param keySize the size of the key we want (in bits)
-     * @return a KeyParameter object.
-     * @exception IllegalArgumentException if the key length larger than the base hash size.
-     */
-    public CipherParameters generateDerivedMacParameters(
-        int keySize)
-    {
-        return generateDerivedParameters(keySize);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/generators/PKCS12ParametersGenerator.java b/azureus2/src/org/bouncycastle/crypto/generators/PKCS12ParametersGenerator.java
deleted file mode 100644
index f8db28f..0000000
--- a/azureus2/src/org/bouncycastle/crypto/generators/PKCS12ParametersGenerator.java
+++ /dev/null
@@ -1,233 +0,0 @@
-package org.bouncycastle.crypto.generators;
-
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.Digest;
-import org.bouncycastle.crypto.PBEParametersGenerator;
-import org.bouncycastle.crypto.digests.MD5Digest;
-import org.bouncycastle.crypto.digests.RIPEMD160Digest;
-import org.bouncycastle.crypto.digests.SHA1Digest;
-import org.bouncycastle.crypto.params.KeyParameter;
-import org.bouncycastle.crypto.params.ParametersWithIV;
-
-/**
- * Generator for PBE derived keys and ivs as defined by PKCS 12 V1.0.
- * <p>
- * The document this implementation is based on can be found at
- * <a href=http://www.rsasecurity.com/rsalabs/pkcs/pkcs-12/index.html>
- * RSA's PKCS12 Page</a>
- */
-public class PKCS12ParametersGenerator
-    extends PBEParametersGenerator
-{
-    public static final int KEY_MATERIAL = 1;
-    public static final int IV_MATERIAL  = 2;
-    public static final int MAC_MATERIAL = 3;
-
-    private Digest digest;
-
-    private int     u;
-    private int     v;
-
-    /**
-     * Construct a PKCS 12 Parameters generator. This constructor will
-     * accept MD5, SHA1, and RIPEMD160.
-     *
-     * @param digest the digest to be used as the source of derived keys.
-     * @exception IllegalArgumentException if an unknown digest is passed in.
-     */
-    public PKCS12ParametersGenerator(
-        Digest  digest)
-    {
-        this.digest = digest;
-        if (digest instanceof MD5Digest)
-        {
-            u = 128 / 8;
-            v = 512 / 8;
-        }
-        else if (digest instanceof SHA1Digest)
-        {
-            u = 160 / 8;
-            v = 512 / 8;
-        }
-        else if (digest instanceof RIPEMD160Digest)
-        {
-            u = 160 / 8;
-            v = 512 / 8;
-        }
-        else
-        {
-            throw new IllegalArgumentException("Digest " + digest.getAlgorithmName() + " unsupported");
-        }
-    }
-
-    /**
-     * add a + b + 1, returning the result in a. The a value is treated
-     * as a BigInteger of length (b.length * 8) bits. The result is 
-     * modulo 2^b.length in case of overflow.
-     */
-    private void adjust(
-        byte[]  a,
-        int     aOff,
-        byte[]  b)
-    {
-        int  x = (b[b.length - 1] & 0xff) + (a[aOff + b.length - 1] & 0xff) + 1;
-
-        a[aOff + b.length - 1] = (byte)x;
-        x >>>= 8;
-
-        for (int i = b.length - 2; i >= 0; i--)
-        {
-            x += (b[i] & 0xff) + (a[aOff + i] & 0xff);
-            a[aOff + i] = (byte)x;
-            x >>>= 8;
-        }
-    }
-
-    /**
-     * generation of a derived key ala PKCS12 V1.0.
-     */
-    private byte[] generateDerivedKey(
-        int idByte,
-        int n)
-    {
-        byte[]  D = new byte[v];
-        byte[]  dKey = new byte[n];
-
-        for (int i = 0; i != D.length; i++)
-        {
-            D[i] = (byte)idByte;
-        }
-
-        byte[]  S;
-
-        if ((salt != null) && (salt.length != 0))
-        {
-            S = new byte[v * ((salt.length + v - 1) / v)];
-
-            for (int i = 0; i != S.length; i++)
-            {
-                S[i] = salt[i % salt.length];
-            }
-        }
-        else
-        {
-            S = new byte[0];
-        }
-
-        byte[]  P;
-
-        if ((password != null) && (password.length != 0))
-        {
-            P = new byte[v * ((password.length + v - 1) / v)];
-
-            for (int i = 0; i != P.length; i++)
-            {
-                P[i] = password[i % password.length];
-            }
-        }
-        else
-        {
-            P = new byte[0];
-        }
-
-        byte[]  I = new byte[S.length + P.length];
-
-        System.arraycopy(S, 0, I, 0, S.length);
-        System.arraycopy(P, 0, I, S.length, P.length);
-
-        byte[]  B = new byte[v];
-        int     c = (n + u - 1) / u;
-
-        for (int i = 1; i <= c; i++)
-        {
-            byte[]  A = new byte[u];
-
-            digest.update(D, 0, D.length);
-            digest.update(I, 0, I.length);
-            digest.doFinal(A, 0);
-            for (int j = 1; j != iterationCount; j++)
-            {
-                digest.update(A, 0, A.length);
-                digest.doFinal(A, 0);
-            }
-
-            for (int j = 0; j != B.length; j++)
-            {
-                B[j] = A[j % A.length];
-            }
-
-            for (int j = 0; j != I.length / v; j++)
-            {
-                adjust(I, j * v, B);
-            }
-
-            if (i == c)
-            {
-                System.arraycopy(A, 0, dKey, (i - 1) * u, dKey.length - ((i - 1) * u));
-            }
-            else
-            {
-                System.arraycopy(A, 0, dKey, (i - 1) * u, A.length);
-            }
-        }
-
-        return dKey;
-    }
-
-    /**
-     * Generate a key parameter derived from the password, salt, and iteration
-     * count we are currently initialised with.
-     *
-     * @param keySize the size of the key we want (in bits)
-     * @return a KeyParameter object.
-     */
-    public CipherParameters generateDerivedParameters(
-        int keySize)
-    {
-        keySize = keySize / 8;
-
-        byte[]  dKey = generateDerivedKey(KEY_MATERIAL, keySize);
-
-        return new KeyParameter(dKey, 0, keySize);
-    }
-
-    /**
-     * Generate a key with initialisation vector parameter derived from
-     * the password, salt, and iteration count we are currently initialised
-     * with.
-     *
-     * @param keySize the size of the key we want (in bits)
-     * @param ivSize the size of the iv we want (in bits)
-     * @return a ParametersWithIV object.
-     */
-    public CipherParameters generateDerivedParameters(
-        int     keySize,
-        int     ivSize)
-    {
-        keySize = keySize / 8;
-        ivSize = ivSize / 8;
-
-        byte[]  dKey = generateDerivedKey(KEY_MATERIAL, keySize);
-
-        byte[]  iv = generateDerivedKey(IV_MATERIAL, ivSize);
-
-        return new ParametersWithIV(new KeyParameter(dKey, 0, keySize), iv, 0, ivSize);
-    }
-
-    /**
-     * Generate a key parameter for use with a MAC derived from the password,
-     * salt, and iteration count we are currently initialised with.
-     *
-     * @param keySize the size of the key we want (in bits)
-     * @return a KeyParameter object.
-     */
-    public CipherParameters generateDerivedMacParameters(
-        int keySize)
-    {
-        keySize = keySize / 8;
-
-        byte[]  dKey = generateDerivedKey(MAC_MATERIAL, keySize);
-
-        return new KeyParameter(dKey, 0, keySize);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/generators/PKCS5S1ParametersGenerator.java b/azureus2/src/org/bouncycastle/crypto/generators/PKCS5S1ParametersGenerator.java
deleted file mode 100644
index 1c62ecc..0000000
--- a/azureus2/src/org/bouncycastle/crypto/generators/PKCS5S1ParametersGenerator.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package org.bouncycastle.crypto.generators;
-
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.Digest;
-import org.bouncycastle.crypto.PBEParametersGenerator;
-import org.bouncycastle.crypto.params.KeyParameter;
-import org.bouncycastle.crypto.params.ParametersWithIV;
-
-/**
- * Generator for PBE derived keys and ivs as defined by PKCS 5 V2.0 Scheme 1.
- * Note this generator is limited to the size of the hash produced by the
- * digest used to drive it.
- * <p>
- * The document this implementation is based on can be found at
- * <a href=http://www.rsasecurity.com/rsalabs/pkcs/pkcs-5/index.html>
- * RSA's PKCS5 Page</a>
- */
-public class PKCS5S1ParametersGenerator
-    extends PBEParametersGenerator
-{
-    private Digest  digest;
-
-    /**
-     * Construct a PKCS 5 Scheme 1 Parameters generator. 
-     *
-     * @param digest the digest to be used as the source of derived keys.
-     */
-    public PKCS5S1ParametersGenerator(
-        Digest  digest)
-    {
-        this.digest = digest;
-    }
-
-    /**
-     * the derived key function, the ith hash of the password and the salt.
-     */
-    private byte[] generateDerivedKey()
-    {
-        byte[] digestBytes = new byte[digest.getDigestSize()];
-
-        digest.update(password, 0, password.length);
-        digest.update(salt, 0, salt.length);
-
-        digest.doFinal(digestBytes, 0);
-        for (int i = 1; i < iterationCount; i++)
-        {
-            digest.update(digestBytes, 0, digestBytes.length);
-            digest.doFinal(digestBytes, 0);
-        }
-
-        return digestBytes;
-    }
-
-    /**
-     * Generate a key parameter derived from the password, salt, and iteration
-     * count we are currently initialised with.
-     *
-     * @param keySize the size of the key we want (in bits)
-     * @return a KeyParameter object.
-     * @exception IllegalArgumentException if the key length larger than the base hash size.
-     */
-    public CipherParameters generateDerivedParameters(
-        int keySize)
-    {
-        keySize = keySize / 8;
-
-        if (keySize > digest.getDigestSize())
-        {
-            throw new IllegalArgumentException(
-                   "Can't generate a derived key " + keySize + " bytes long.");
-        }
-
-        byte[]  dKey = generateDerivedKey();
-
-        return new KeyParameter(dKey, 0, keySize);
-    }
-
-    /**
-     * Generate a key with initialisation vector parameter derived from
-     * the password, salt, and iteration count we are currently initialised
-     * with.
-     *
-     * @param keySize the size of the key we want (in bits)
-     * @param ivSize the size of the iv we want (in bits)
-     * @return a ParametersWithIV object.
-     * @exception IllegalArgumentException if keySize + ivSize is larger than the base hash size.
-     */
-    public CipherParameters generateDerivedParameters(
-        int     keySize,
-        int     ivSize)
-    {
-        keySize = keySize / 8;
-        ivSize = ivSize / 8;
-
-        if ((keySize + ivSize) > digest.getDigestSize())
-        {
-            throw new IllegalArgumentException(
-                   "Can't generate a derived key " + (keySize + ivSize) + " bytes long.");
-        }
-
-        byte[]  dKey = generateDerivedKey();
-
-        return new ParametersWithIV(new KeyParameter(dKey, 0, keySize), dKey, keySize, ivSize);
-    }
-
-    /**
-     * Generate a key parameter for use with a MAC derived from the password,
-     * salt, and iteration count we are currently initialised with.
-     *
-     * @param keySize the size of the key we want (in bits)
-     * @return a KeyParameter object.
-     * @exception IllegalArgumentException if the key length larger than the base hash size.
-     */
-    public CipherParameters generateDerivedMacParameters(
-        int keySize)
-    {
-        return generateDerivedParameters(keySize);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/generators/RSAKeyPairGenerator.java b/azureus2/src/org/bouncycastle/crypto/generators/RSAKeyPairGenerator.java
deleted file mode 100644
index 8c33c01..0000000
--- a/azureus2/src/org/bouncycastle/crypto/generators/RSAKeyPairGenerator.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.bouncycastle.crypto.generators;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
-import org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator;
-import org.bouncycastle.crypto.KeyGenerationParameters;
-import org.bouncycastle.crypto.params.RSAKeyGenerationParameters;
-import org.bouncycastle.crypto.params.RSAKeyParameters;
-import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters;
-
-/**
- * an RSA key pair generator.
- */
-public class RSAKeyPairGenerator
-    implements AsymmetricCipherKeyPairGenerator
-{
-    private static BigInteger ONE = BigInteger.valueOf(1);
-
-    private RSAKeyGenerationParameters param;
-
-    public void init(
-        KeyGenerationParameters param)
-    {
-        this.param = (RSAKeyGenerationParameters)param;
-    }
-
-    public AsymmetricCipherKeyPair generateKeyPair()
-    {
-        BigInteger    p, q, n, d, e, pSub1, qSub1, phi;
-
-        //
-        // p and q values should have a length of half the strength in bits
-        //
-        int pbitlength = (param.getStrength() + 1) / 2;
-		int qbitlength = (param.getStrength() - pbitlength);
-		e = param.getPublicExponent();
-
-        //
-        // generate p, prime and (p-1) relatively prime to e
-        //
-		for (;;)
-		{
-			p = new BigInteger(pbitlength, 1, param.getRandom());
-			
-			if (p.mod(e).equals(ONE))
-			{
-				continue;
-			}
-			
-			if (!p.isProbablePrime(param.getCertainty()))
-			{
-				continue;
-			}
-			
-			if (e.gcd(p.subtract(ONE)).equals(ONE)) 
-			{
-				break;
-			}
-		}
-
-        //
-        // generate a modulus of the required length
-		//
-        for (;;)
-        {
-		    // generate q, prime and (q-1) relatively prime to e,
-		    // and not equal to p
-		    //
-            for (;;)
-            {
-                q = new BigInteger(qbitlength, 1, param.getRandom());
-                
-                if (q.equals(p))
-                {
-                	continue;
-                }
-                
-				if (q.mod(e).equals(ONE))
-				{
-					continue;
-				}
-			
-				if (!q.isProbablePrime(param.getCertainty()))
-				{
-					continue;
-				}
-			
-			    if (e.gcd(q.subtract(ONE)).equals(ONE)) 
-			    {
-			    	break;
-			    } 
-            }
-
-            //
-            // calculate the modulus
-            //
-            n = p.multiply(q);
-
-            if (n.bitLength() == param.getStrength()) 
-            {
-            	break;
-            } 
-
-            //
-            // if we get here our primes aren't big enough, make the largest
-            // of the two p and try again
-            //
-            p = p.max(q);
-        }
-
-        if (p.compareTo(q) < 0)
-        {
-            phi = p;
-            p = q;
-            q = phi;
-        }
-
-        pSub1 = p.subtract(ONE);
-        qSub1 = q.subtract(ONE);
-        phi = pSub1.multiply(qSub1);
-
-        //
-        // calculate the private exponent
-        //
-        d = e.modInverse(phi);
-
-        //
-        // calculate the CRT factors
-        //
-        BigInteger    dP, dQ, qInv;
-
-        dP = d.remainder(pSub1);
-        dQ = d.remainder(qSub1);
-        qInv = q.modInverse(p);
-
-        return new AsymmetricCipherKeyPair(
-                new RSAKeyParameters(false, n, e),
-                new RSAPrivateCrtKeyParameters(n, e, d, p, q, dP, dQ, qInv));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/macs/HMac.java b/azureus2/src/org/bouncycastle/crypto/macs/HMac.java
deleted file mode 100644
index a3a6dda..0000000
--- a/azureus2/src/org/bouncycastle/crypto/macs/HMac.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package org.bouncycastle.crypto.macs;
-
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.Digest;
-import org.bouncycastle.crypto.Mac;
-import org.bouncycastle.crypto.params.KeyParameter;
-
-/**
- * HMAC implementation based on RFC2104
- *
- * H(K XOR opad, H(K XOR ipad, text))
- */
-public class HMac
-implements Mac
-{
-	private final static int BLOCK_LENGTH = 64;
-
-	private final static byte IPAD = (byte)0x36;
-	private final static byte OPAD = (byte)0x5C;
-
-	private Digest digest;
-	private int digestSize;
-    private byte[] inputPad = new byte[BLOCK_LENGTH];
-	private byte[] outputPad = new byte[BLOCK_LENGTH];
-
-	public HMac(
-		Digest digest)
-	{
-		this.digest = digest;
-		digestSize = digest.getDigestSize();
-	}
-
-	public String getAlgorithmName()
-	{
-		return digest.getAlgorithmName() + "/HMAC";
-	}
-
-    public Digest getUnderlyingDigest()
-    {
-        return digest;
-    }
-
-	public void init(
-		CipherParameters params)
-	{
-		digest.reset();
-
-		byte[] key = ((KeyParameter)params).getKey();
-
-		if (key.length > BLOCK_LENGTH)
-		{
-			digest.update(key, 0, key.length);
-			digest.doFinal(inputPad, 0);
-		    for (int i = digestSize; i < inputPad.length; i++)
-            {
-                inputPad[i] = 0;
-            }
-		}
-		else
-		{
-			System.arraycopy(key, 0, inputPad, 0, key.length);
-		    for (int i = key.length; i < inputPad.length; i++)
-            {
-                inputPad[i] = 0;
-            }
-		}
-
-		outputPad = new byte[inputPad.length];
-        System.arraycopy(inputPad, 0, outputPad, 0, inputPad.length);
-
-		for (int i = 0; i < inputPad.length; i++)
-		{
-			inputPad[i] ^= IPAD;
-		}
-
-		for (int i = 0; i < outputPad.length; i++)
-		{
-			outputPad[i] ^= OPAD;
-		}
-
-		digest.update(inputPad, 0, inputPad.length);
-	}
-
-	public int getMacSize()
-	{
-		return digestSize;
-	}
-
-	public void update(
-		byte in)
-	{
-		digest.update(in);
-	}
-
-	public void update(
-		byte[] in,
-		int inOff,
-		int len)
-	{
-		digest.update(in, inOff, len);
-	}
-
-	public int doFinal(
-		byte[] out,
-		int outOff)
-	{
-		byte[] tmp = new byte[digestSize];
-		digest.doFinal(tmp, 0);
-
-		digest.update(outputPad, 0, outputPad.length);
-		digest.update(tmp, 0, tmp.length);
-
-        int     len = digest.doFinal(out, outOff);
-
-        reset();
-
-		return len;
-	}
-
-	/**
-	 * Reset the mac generator.
-	 */
-	public void reset()
-	{
-		/*
-		 * reset the underlying digest.
-		 */
-		digest.reset();
-
-        /*
-         * reinitialize the digest.
-         */
-		digest.update(inputPad, 0, inputPad.length);
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/modes/CBCBlockCipher.java b/azureus2/src/org/bouncycastle/crypto/modes/CBCBlockCipher.java
deleted file mode 100644
index 2a197d7..0000000
--- a/azureus2/src/org/bouncycastle/crypto/modes/CBCBlockCipher.java
+++ /dev/null
@@ -1,233 +0,0 @@
-package org.bouncycastle.crypto.modes;
-
-import org.bouncycastle.crypto.BlockCipher;
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.DataLengthException;
-import org.bouncycastle.crypto.params.ParametersWithIV;
-
-/**
- * implements Cipher-Block-Chaining (CBC) mode on top of a simple cipher.
- */
-public class CBCBlockCipher
-    implements BlockCipher
-{
-	private byte[]          IV;
-	private byte[]          cbcV;
-	private byte[]          cbcNextV;
-
-    private int             blockSize;
-    private BlockCipher     cipher = null;
-    private boolean         encrypting;
-
-    /**
-     * Basic constructor.
-     *
-     * @param cipher the block cipher to be used as the basis of chaining.
-     */
-    public CBCBlockCipher(
-        BlockCipher cipher)
-    {
-        this.cipher = cipher;
-        this.blockSize = cipher.getBlockSize();
-
-        this.IV = new byte[blockSize];
-        this.cbcV = new byte[blockSize];
-        this.cbcNextV = new byte[blockSize];
-    }
-
-    /**
-     * return the underlying block cipher that we are wrapping.
-     *
-     * @return the underlying block cipher that we are wrapping.
-     */
-    public BlockCipher getUnderlyingCipher()
-    {
-        return cipher;
-    }
-
-    /**
-     * Initialise the cipher and, possibly, the initialisation vector (IV).
-     * If an IV isn't passed as part of the parameter, the IV will be all zeros.
-     *
-     * @param forEncryption if true the cipher is initialised for
-     *  encryption, if false for decryption.
-     * @param param the key and other data required by the cipher.
-     * @exception IllegalArgumentException if the params argument is
-     * inappropriate.
-     */
-    public void init(
-        boolean             encrypting,
-        CipherParameters    params)
-        throws IllegalArgumentException
-    {
-        this.encrypting = encrypting;
-        
-        if (params instanceof ParametersWithIV)
-        {
-                ParametersWithIV ivParam = (ParametersWithIV)params;
-                byte[]      iv = ivParam.getIV();
-
-                if (iv.length != blockSize)
-                {
-                    throw new IllegalArgumentException("initialisation vector must be the same length as block size");
-                }
-
-                System.arraycopy(iv, 0, IV, 0, iv.length);
-
-                reset();
-
-                cipher.init(encrypting, ivParam.getParameters());
-        }
-        else
-        {
-                reset();
-
-                cipher.init(encrypting, params);
-        }
-    }
-
-    /**
-     * return the algorithm name and mode.
-     *
-     * @return the name of the underlying algorithm followed by "/CBC".
-     */
-    public String getAlgorithmName()
-    {
-        return cipher.getAlgorithmName() + "/CBC";
-    }
-
-    /**
-     * return the block size of the underlying cipher.
-     *
-     * @return the block size of the underlying cipher.
-     */
-    public int getBlockSize()
-    {
-        return cipher.getBlockSize();
-    }
-
-    /**
-     * Process one block of input from the array in and write it to
-     * the out array.
-     *
-     * @param in the array containing the input data.
-     * @param inOff offset into the in array the data starts at.
-     * @param out the array the output data will be copied into.
-     * @param outOff the offset into the out array the output will start at.
-     * @exception DataLengthException if there isn't enough data in in, or
-     * space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     * @return the number of bytes processed and produced.
-     */
-    public int processBlock(
-        byte[]      in,
-        int         inOff,
-        byte[]      out,
-        int         outOff)
-        throws DataLengthException, IllegalStateException
-    {
-        return (encrypting) ? encryptBlock(in, inOff, out, outOff) : decryptBlock(in, inOff, out, outOff);
-    }
-
-    /**
-     * reset the chaining vector back to the IV and reset the underlying
-     * cipher.
-     */
-    public void reset()
-    {
-        System.arraycopy(IV, 0, cbcV, 0, IV.length);
-
-        cipher.reset();
-    }
-
-    /**
-     * Do the appropriate chaining step for CBC mode encryption.
-     *
-     * @param in the array containing the data to be encrypted.
-     * @param inOff offset into the in array the data starts at.
-     * @param out the array the encrypted data will be copied into.
-     * @param outOff the offset into the out array the output will start at.
-     * @exception DataLengthException if there isn't enough data in in, or
-     * space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     * @return the number of bytes processed and produced.
-     */
-    private int encryptBlock(
-        byte[]      in,
-        int         inOff,
-        byte[]      out,
-        int         outOff)
-        throws DataLengthException, IllegalStateException
-    {
-        if ((inOff + blockSize) > in.length)
-        {
-            throw new DataLengthException("input buffer too short");
-        }
-
-        /*
-         * XOR the cbcV and the input,
-         * then encrypt the cbcV
-         */
-        for (int i = 0; i < blockSize; i++)
-        {
-            cbcV[i] ^= in[inOff + i];
-        }
-
-        int length = cipher.processBlock(cbcV, 0, out, outOff);
-
-        /*
-         * copy ciphertext to cbcV
-         */
-        System.arraycopy(out, outOff, cbcV, 0, cbcV.length);
-
-        return length;
-    }
-
-    /**
-     * Do the appropriate chaining step for CBC mode decryption.
-     *
-     * @param in the array containing the data to be decrypted.
-     * @param inOff offset into the in array the data starts at.
-     * @param out the array the decrypted data will be copied into.
-     * @param outOff the offset into the out array the output will start at.
-     * @exception DataLengthException if there isn't enough data in in, or
-     * space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     * @return the number of bytes processed and produced.
-     */
-    private int decryptBlock(
-        byte[]      in,
-        int         inOff,
-        byte[]      out,
-        int         outOff)
-        throws DataLengthException, IllegalStateException
-    {
-        if ((inOff + blockSize) > in.length)
-        {
-            throw new DataLengthException("input buffer too short");
-        }
-
-        System.arraycopy(in, inOff, cbcNextV, 0, blockSize);
-
-        int length = cipher.processBlock(in, inOff, out, outOff);
-
-        /*
-         * XOR the cbcV and the output
-         */
-        for (int i = 0; i < blockSize; i++)
-        {
-            out[outOff + i] ^= cbcV[i];
-        }
-
-        /*
-         * swap the back up buffer into next position
-         */
-        byte[]  tmp;
-
-        tmp = cbcV;
-        cbcV = cbcNextV;
-        cbcNextV = tmp;
-
-		return length;
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/modes/CFBBlockCipher.java b/azureus2/src/org/bouncycastle/crypto/modes/CFBBlockCipher.java
deleted file mode 100644
index 8b321e4..0000000
--- a/azureus2/src/org/bouncycastle/crypto/modes/CFBBlockCipher.java
+++ /dev/null
@@ -1,250 +0,0 @@
-package org.bouncycastle.crypto.modes;
-
-import org.bouncycastle.crypto.BlockCipher;
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.DataLengthException;
-import org.bouncycastle.crypto.params.ParametersWithIV;
-
-/**
- * implements a Cipher-FeedBack (CFB) mode on top of a simple cipher.
- */
-public class CFBBlockCipher
-    implements BlockCipher
-{
-	private byte[]          IV;
-	private byte[]          cfbV;
-	private byte[]          cfbOutV;
-
-    private int             blockSize;
-    private BlockCipher     cipher = null;
-    private boolean         encrypting;
-
-    /**
-     * Basic constructor.
-     *
-     * @param cipher the block cipher to be used as the basis of the
-     * feedback mode.
-     * @param blockSize the block size in bits (note: a multiple of 8)
-     */
-    public CFBBlockCipher(
-        BlockCipher cipher,
-        int         bitBlockSize)
-    {
-        this.cipher = cipher;
-        this.blockSize = bitBlockSize / 8;
-
-        this.IV = new byte[cipher.getBlockSize()];
-        this.cfbV = new byte[cipher.getBlockSize()];
-        this.cfbOutV = new byte[cipher.getBlockSize()];
-    }
-
-    /**
-     * return the underlying block cipher that we are wrapping.
-     *
-     * @return the underlying block cipher that we are wrapping.
-     */
-    public BlockCipher getUnderlyingCipher()
-    {
-        return cipher;
-    }
-
-    /**
-     * Initialise the cipher and, possibly, the initialisation vector (IV).
-     * If an IV isn't passed as part of the parameter, the IV will be all zeros.
-     * An IV which is too short is handled in FIPS compliant fashion.
-     *
-     * @param forEncryption if true the cipher is initialised for
-     *  encryption, if false for decryption.
-     * @param param the key and other data required by the cipher.
-     * @exception IllegalArgumentException if the params argument is
-     * inappropriate.
-     */
-    public void init(
-        boolean             encrypting,
-        CipherParameters    params)
-        throws IllegalArgumentException
-    {
-        this.encrypting = encrypting;
-        
-        if (params instanceof ParametersWithIV)
-        {
-                ParametersWithIV ivParam = (ParametersWithIV)params;
-                byte[]      iv = ivParam.getIV();
-
-                if (iv.length < IV.length)
-                {
-					// prepend the supplied IV with zeros (per FIPS PUB 81)
-                    System.arraycopy(iv, 0, IV, IV.length - iv.length, iv.length);
-					for (int i = 0; i < IV.length - iv.length; i++)
-					{
-						IV[i] = 0;
-					}
-                }
-                else
-                {
-                    System.arraycopy(iv, 0, IV, 0, IV.length);
-                }
-
-                reset();
-
-                cipher.init(true, ivParam.getParameters());
-        }
-        else
-        {
-                reset();
-
-                cipher.init(true, params);
-        }
-    }
-
-    /**
-     * return the algorithm name and mode.
-     *
-     * @return the name of the underlying algorithm followed by "/CFB"
-     * and the block size in bits.
-     */
-    public String getAlgorithmName()
-    {
-        return cipher.getAlgorithmName() + "/CFB" + (blockSize * 8);
-    }
-
-    /**
-     * return the block size we are operating at.
-     *
-     * @return the block size we are operating at (in bytes).
-     */
-    public int getBlockSize()
-    {
-        return blockSize;
-    }
-
-    /**
-     * Process one block of input from the array in and write it to
-     * the out array.
-     *
-     * @param in the array containing the input data.
-     * @param inOff offset into the in array the data starts at.
-     * @param out the array the output data will be copied into.
-     * @param outOff the offset into the out array the output will start at.
-     * @exception DataLengthException if there isn't enough data in in, or
-     * space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     * @return the number of bytes processed and produced.
-     */
-    public int processBlock(
-        byte[]      in,
-        int         inOff,
-        byte[]      out,
-        int         outOff)
-        throws DataLengthException, IllegalStateException
-    {
-        return (encrypting) ? encryptBlock(in, inOff, out, outOff) : decryptBlock(in, inOff, out, outOff);
-    }
-
-    /**
-     * Do the appropriate processing for CFB mode encryption.
-     *
-     * @param in the array containing the data to be encrypted.
-     * @param inOff offset into the in array the data starts at.
-     * @param out the array the encrypted data will be copied into.
-     * @param outOff the offset into the out array the output will start at.
-     * @exception DataLengthException if there isn't enough data in in, or
-     * space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     * @return the number of bytes processed and produced.
-     */
-    public int encryptBlock(
-        byte[]      in,
-        int         inOff,
-        byte[]      out,
-        int         outOff)
-        throws DataLengthException, IllegalStateException
-    {
-        if ((inOff + blockSize) > in.length)
-        {
-            throw new DataLengthException("input buffer too short");
-        }
-
-        if ((outOff + blockSize) > out.length)
-        {
-            throw new DataLengthException("output buffer too short");
-        }
-
-        cipher.processBlock(cfbV, 0, cfbOutV, 0);
-
-        //
-        // XOR the cfbV with the plaintext producing the cipher text
-        //
-        for (int i = 0; i < blockSize; i++)
-        {
-            out[outOff + i] = (byte)(cfbOutV[i] ^ in[inOff + i]);
-        }
-
-        //
-        // change over the input block.
-        //
-        System.arraycopy(cfbV, blockSize, cfbV, 0, cfbV.length - blockSize);
-        System.arraycopy(out, outOff, cfbV, cfbV.length - blockSize, blockSize);
-
-        return blockSize;
-    }
-
-    /**
-     * Do the appropriate processing for CFB mode decryption.
-     *
-     * @param in the array containing the data to be decrypted.
-     * @param inOff offset into the in array the data starts at.
-     * @param out the array the encrypted data will be copied into.
-     * @param outOff the offset into the out array the output will start at.
-     * @exception DataLengthException if there isn't enough data in in, or
-     * space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     * @return the number of bytes processed and produced.
-     */
-    public int decryptBlock(
-        byte[]      in,
-        int         inOff,
-        byte[]      out,
-        int         outOff)
-        throws DataLengthException, IllegalStateException
-    {
-        if ((inOff + blockSize) > in.length)
-        {
-            throw new DataLengthException("input buffer too short");
-        }
-
-        if ((outOff + blockSize) > out.length)
-        {
-            throw new DataLengthException("output buffer too short");
-        }
-
-        cipher.processBlock(cfbV, 0, cfbOutV, 0);
-
-        //
-        // change over the input block.
-        //
-        System.arraycopy(cfbV, blockSize, cfbV, 0, cfbV.length - blockSize);
-        System.arraycopy(in, inOff, cfbV, cfbV.length - blockSize, blockSize);
-
-        //
-        // XOR the cfbV with the plaintext producing the plain text
-        //
-        for (int i = 0; i < blockSize; i++)
-        {
-            out[outOff + i] = (byte)(cfbOutV[i] ^ in[inOff + i]);
-        }
-
-        return blockSize;
-    }
-
-    /**
-     * reset the chaining vector back to the IV and reset the underlying
-     * cipher.
-     */
-    public void reset()
-    {
-        System.arraycopy(IV, 0, cfbV, 0, IV.length);
-
-        cipher.reset();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/modes/CTSBlockCipher.java b/azureus2/src/org/bouncycastle/crypto/modes/CTSBlockCipher.java
deleted file mode 100644
index 30ba4cb..0000000
--- a/azureus2/src/org/bouncycastle/crypto/modes/CTSBlockCipher.java
+++ /dev/null
@@ -1,260 +0,0 @@
-package org.bouncycastle.crypto.modes;
-
-import org.bouncycastle.crypto.BlockCipher;
-import org.bouncycastle.crypto.BufferedBlockCipher;
-import org.bouncycastle.crypto.DataLengthException;
-import org.bouncycastle.crypto.InvalidCipherTextException;
-
-/**
- * A Cipher Text Stealing (CTS) mode cipher. CTS allows block ciphers to
- * be used to produce cipher text which is the same length as the plain text.
- */
-public class CTSBlockCipher
-    extends BufferedBlockCipher
-{
-    private int     blockSize;
-
-    /**
-     * Create a buffered block cipher that uses Cipher Text Stealing
-     *
-     * @param cipher the underlying block cipher this buffering object wraps.
-     */
-	public CTSBlockCipher(
-        BlockCipher     cipher)
-	{
-        if ((cipher instanceof OFBBlockCipher) || (cipher instanceof CFBBlockCipher))
-        {
-            throw new IllegalArgumentException("CTSBlockCipher can only accept ECB, or CBC ciphers");
-        }
-
-        this.cipher = cipher;
-
-        blockSize = cipher.getBlockSize();
-
-        buf = new byte[blockSize * 2];
-        bufOff = 0;
-	}
-
-    /**
-     * return the size of the output buffer required for an update 
-     * an input of len bytes.
-     *
-     * @param len the length of the input.
-     * @return the space required to accommodate a call to update
-     * with len bytes of input.
-     */
-    public int getUpdateOutputSize(
-        int len)
-    {
-        int total       = len + bufOff;
-        int leftOver    = total % buf.length;
-
-        if (leftOver == 0)
-        {
-            return total - buf.length;
-        }
-
-        return total - leftOver;
-    }
-
-    /**
-     * return the size of the output buffer required for an update plus a
-     * doFinal with an input of len bytes.
-     *
-     * @param len the length of the input.
-     * @return the space required to accommodate a call to update and doFinal
-     * with len bytes of input.
-     */
-    public int getOutputSize(
-        int len)
-    {
-        return len + bufOff;
-    }
-
-    /**
-     * process a single byte, producing an output block if neccessary.
-     *
-     * @param in the input byte.
-     * @param out the space for any output that might be produced.
-     * @param outOff the offset from which the output will be copied.
-     * @return the number of output bytes copied to out.
-     * @exception DataLengthException if there isn't enough space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     */
-	public int processByte(
-        byte        in,
-		byte[]      out,
-		int         outOff)
-        throws DataLengthException, IllegalStateException
-    {
-        int         resultLen = 0;
-
-        if (bufOff == buf.length)
-        {
-            resultLen = cipher.processBlock(buf, 0, out, outOff);
-            System.arraycopy(buf, blockSize, buf, 0, blockSize);
-
-            bufOff = blockSize;
-        }
-
-        buf[bufOff++] = in;
-
-        return resultLen;
-    }
-
-    /**
-     * process an array of bytes, producing output if necessary.
-     *
-     * @param in the input byte array.
-     * @param inOff the offset at which the input data starts.
-     * @param len the number of bytes to be copied out of the input array.
-     * @param out the space for any output that might be produced.
-     * @param outOff the offset from which the output will be copied.
-     * @return the number of output bytes copied to out.
-     * @exception DataLengthException if there isn't enough space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     */
-	public int processBytes(
-		byte[]      in,
-		int         inOff,
-		int         len,
-		byte[]      out,
-		int         outOff)
-        throws DataLengthException, IllegalStateException
-	{
-        if (len < 0)
-        {
-            throw new IllegalArgumentException("Can't have a negative input length!");
-        }
-
-        int blockSize   = getBlockSize();
-        int length      = getUpdateOutputSize(len);
-        
-        if (length > 0)
-        {
-            if ((outOff + length) > out.length)
-            {
-                throw new DataLengthException("output buffer too short");
-            }
-        }
-
-		int resultLen = 0;
-        int gapLen = buf.length - bufOff;
-
-        if (len > gapLen)
-        {
-            System.arraycopy(in, inOff, buf, bufOff, gapLen);
-
-            resultLen += cipher.processBlock(buf, 0, out, outOff);
-            System.arraycopy(buf, blockSize, buf, 0, blockSize);
-
-            bufOff = blockSize;
-
-            len -= gapLen;
-            inOff += gapLen;
-
-            while (len > blockSize)
-            {
-                System.arraycopy(in, inOff, buf, bufOff, blockSize);
-                resultLen += cipher.processBlock(buf, 0, out, outOff + resultLen);
-                System.arraycopy(buf, blockSize, buf, 0, blockSize);
-
-                len -= blockSize;
-                inOff += blockSize;
-            }
-        }
-
-        System.arraycopy(in, inOff, buf, bufOff, len);
-
-        bufOff += len;
-
-        return resultLen;
-	}
-
-    /**
-     * Process the last block in the buffer.
-     *
-     * @param out the array the block currently being held is copied into.
-     * @param outOff the offset at which the copying starts.
-     * @return the number of output bytes copied to out.
-     * @exception DataLengthException if there is insufficient space in out for
-     * the output.
-     * @exception IllegalStateException if the underlying cipher is not
-     * initialised.
-     * @exception InvalidCipherTextException if cipher text decrypts wrongly (in
-     * case the exception will never get thrown).
-     */
-	public int doFinal(
-        byte[]  out,
-        int     outOff)
-        throws DataLengthException, IllegalStateException, InvalidCipherTextException
-	{
-        if (bufOff + outOff > out.length)
-        {
-            throw new DataLengthException("output buffer to small in doFinal");
-        }
-
-        int     blockSize = cipher.getBlockSize();
-        int     len = bufOff - blockSize;
-        byte[]  block = new byte[blockSize];
-
-        if (forEncryption)
-        {
-            cipher.processBlock(buf, 0, block, 0);
-
-            for (int i = bufOff; i != buf.length; i++)
-            {
-                buf[i] = block[i - blockSize];
-            }
-
-            for (int i = blockSize; i != bufOff; i++)
-            {
-                buf[i] ^= block[i - blockSize];
-            }
-
-            if (cipher instanceof CBCBlockCipher)
-            {
-                BlockCipher c = ((CBCBlockCipher)cipher).getUnderlyingCipher();
-
-                c.processBlock(buf, blockSize, out, outOff);
-            }
-            else
-            {
-                cipher.processBlock(buf, blockSize, out, outOff);
-            }
-
-            System.arraycopy(block, 0, out, outOff + blockSize, len);
-        }
-        else
-        {
-            byte[]  lastBlock = new byte[blockSize];
-
-            if (cipher instanceof CBCBlockCipher)
-            {
-                BlockCipher c = ((CBCBlockCipher)cipher).getUnderlyingCipher();
-
-                c.processBlock(buf, 0, block, 0);
-            }
-            else
-            {
-                cipher.processBlock(buf, 0, block, 0);
-            }
-
-            for (int i = blockSize; i != bufOff; i++)
-            {
-                lastBlock[i - blockSize] = (byte)(block[i - blockSize] ^ buf[i]);
-            }
-
-            System.arraycopy(buf, blockSize, block, 0, len);
-
-            cipher.processBlock(block, 0, out, outOff);
-            System.arraycopy(lastBlock, 0, out, outOff + blockSize, len);
-        }
-
-        int offset = bufOff;
-
-        reset();
-
-		return offset;
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/modes/OFBBlockCipher.java b/azureus2/src/org/bouncycastle/crypto/modes/OFBBlockCipher.java
deleted file mode 100644
index b8d9756..0000000
--- a/azureus2/src/org/bouncycastle/crypto/modes/OFBBlockCipher.java
+++ /dev/null
@@ -1,182 +0,0 @@
-package org.bouncycastle.crypto.modes;
-
-import org.bouncycastle.crypto.BlockCipher;
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.DataLengthException;
-import org.bouncycastle.crypto.params.ParametersWithIV;
-
-/**
- * implements a Output-FeedBack (OFB) mode on top of a simple cipher.
- */
-public class OFBBlockCipher
-    implements BlockCipher
-{
-	private byte[]          IV;
-	private byte[]          ofbV;
-	private byte[]          ofbOutV;
-
-    private int             blockSize;
-    private BlockCipher     cipher = null;
-    private boolean         encrypting;
-
-    /**
-     * Basic constructor.
-     *
-     * @param cipher the block cipher to be used as the basis of the
-     * feedback mode.
-     * @param blockSize the block size in bits (note: a multiple of 8)
-     */
-    public OFBBlockCipher(
-        BlockCipher cipher,
-        int         blockSize)
-    {
-        this.cipher = cipher;
-        this.blockSize = blockSize / 8;
-
-        this.IV = new byte[cipher.getBlockSize()];
-        this.ofbV = new byte[cipher.getBlockSize()];
-        this.ofbOutV = new byte[cipher.getBlockSize()];
-    }
-
-    /**
-     * return the underlying block cipher that we are wrapping.
-     *
-     * @return the underlying block cipher that we are wrapping.
-     */
-    public BlockCipher getUnderlyingCipher()
-    {
-        return cipher;
-    }
-
-    /**
-     * Initialise the cipher and, possibly, the initialisation vector (IV).
-     * If an IV isn't passed as part of the parameter, the IV will be all zeros.
-     * An IV which is too short is handled in FIPS compliant fashion.
-     *
-     * @param forEncryption if true the cipher is initialised for
-     *  encryption, if false for decryption.
-     * @param param the key and other data required by the cipher.
-     * @exception IllegalArgumentException if the params argument is
-     * inappropriate.
-     */
-    public void init(
-        boolean             encrypting,
-        CipherParameters    params)
-        throws IllegalArgumentException
-    {
-        this.encrypting = encrypting;
-        
-        if (params instanceof ParametersWithIV)
-        {
-                ParametersWithIV ivParam = (ParametersWithIV)params;
-                byte[]      iv = ivParam.getIV();
-
-                if (iv.length < IV.length)
-                {
-					// prepend the supplied IV with zeros (per FIPS PUB 81)
-                    System.arraycopy(iv, 0, IV, IV.length - iv.length, iv.length); 
-					for (int i = 0; i < IV.length - iv.length; i++)
-					{
-						IV[i] = 0;
-					}
-                }
-                else
-                {
-                    System.arraycopy(iv, 0, IV, 0, IV.length);
-                }
-
-                reset();
-
-                cipher.init(true, ivParam.getParameters());
-        }
-        else
-        {
-                reset();
-
-                cipher.init(true, params);
-        }
-    }
-
-    /**
-     * return the algorithm name and mode.
-     *
-     * @return the name of the underlying algorithm followed by "/OFB"
-     * and the block size in bits
-     */
-    public String getAlgorithmName()
-    {
-        return cipher.getAlgorithmName() + "/OFB" + (blockSize * 8);
-    }
-
-    
-    /**
-     * return the block size we are operating at (in bytes).
-     *
-     * @return the block size we are operating at (in bytes).
-     */
-    public int getBlockSize()
-    {
-        return blockSize;
-    }
-
-    /**
-     * Process one block of input from the array in and write it to
-     * the out array.
-     *
-     * @param in the array containing the input data.
-     * @param inOff offset into the in array the data starts at.
-     * @param out the array the output data will be copied into.
-     * @param outOff the offset into the out array the output will start at.
-     * @exception DataLengthException if there isn't enough data in in, or
-     * space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     * @return the number of bytes processed and produced.
-     */
-    public int processBlock(
-        byte[]      in,
-        int         inOff,
-        byte[]      out,
-        int         outOff)
-        throws DataLengthException, IllegalStateException
-    {
-        if ((inOff + blockSize) > in.length)
-        {
-            throw new DataLengthException("input buffer too short");
-        }
-
-        if ((outOff + blockSize) > out.length)
-        {
-            throw new DataLengthException("output buffer too short");
-        }
-
-        cipher.processBlock(ofbV, 0, ofbOutV, 0);
-
-        //
-        // XOR the ofbV with the plaintext producing the cipher text (and
-        // the next input block).
-        //
-        for (int i = 0; i < blockSize; i++)
-        {
-            out[outOff + i] = (byte)(ofbOutV[i] ^ in[inOff + i]);
-        }
-
-        //
-        // change over the input block.
-        //
-        System.arraycopy(ofbV, blockSize, ofbV, 0, ofbV.length - blockSize);
-        System.arraycopy(ofbOutV, 0, ofbV, ofbV.length - blockSize, blockSize);
-
-        return blockSize;
-    }
-
-    /**
-     * reset the feedback vector back to the IV and reset the underlying
-     * cipher.
-     */
-    public void reset()
-    {
-        System.arraycopy(IV, 0, ofbV, 0, IV.length);
-
-        cipher.reset();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/modes/OpenPGPCFBBlockCipher.java b/azureus2/src/org/bouncycastle/crypto/modes/OpenPGPCFBBlockCipher.java
deleted file mode 100644
index a8c8c7b..0000000
--- a/azureus2/src/org/bouncycastle/crypto/modes/OpenPGPCFBBlockCipher.java
+++ /dev/null
@@ -1,322 +0,0 @@
-package org.bouncycastle.crypto.modes;
-
-import org.bouncycastle.crypto.BlockCipher;
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.DataLengthException;
-
-/**
- * Implements OpenPGP's rather strange version of Cipher-FeedBack (CFB) mode
- * on top of a simple cipher. This class assumes the IV has been prepended
- * to the data stream already, and just accomodates the reset after
- * (blockSize + 2) bytes have been read.
- * <p>
- * For further info see <a href="http://www.ietf.org/rfc/rfc2440.html">RFC 2440</a>.
- */
-public class OpenPGPCFBBlockCipher
-    implements BlockCipher
-{
-    private byte[] IV;
-    private byte[] FR;
-    private byte[] FRE;
-    private byte[] tmp;
-
-    private BlockCipher cipher;
-
-    private int count;
-    private int blockSize;
-    private boolean forEncryption;
-    
-    /**
-     * Basic constructor.
-     *
-     * @param cipher the block cipher to be used as the basis of the
-     * feedback mode.
-     */
-    public OpenPGPCFBBlockCipher(
-        BlockCipher cipher)
-    {
-        this.cipher = cipher;
-
-        this.blockSize = cipher.getBlockSize();
-        this.IV = new byte[blockSize];
-        this.FR = new byte[blockSize];
-        this.FRE = new byte[blockSize];
-        this.tmp = new byte[blockSize];
-    }
-
-    /**
-     * return the underlying block cipher that we are wrapping.
-     *
-     * @return the underlying block cipher that we are wrapping.
-     */
-    public BlockCipher getUnderlyingCipher()
-    {
-        return cipher;
-    }
-    
-    /**
-     * return the algorithm name and mode.
-     *
-     * @return the name of the underlying algorithm followed by "/PGPCFB"
-     * and the block size in bits.
-     */
-    public String getAlgorithmName()
-    {
-        return cipher.getAlgorithmName() + "/OpenPGPCFB";
-    }
-    
-    /**
-     * return the block size we are operating at.
-     *
-     * @return the block size we are operating at (in bytes).
-     */
-    public int getBlockSize()
-    {
-        return cipher.getBlockSize();
-    }
-
-    /**
-     * Process one block of input from the array in and write it to
-     * the out array.
-     *
-     * @param in the array containing the input data.
-     * @param inOff offset into the in array the data starts at.
-     * @param out the array the output data will be copied into.
-     * @param outOff the offset into the out array the output will start at.
-     * @exception DataLengthException if there isn't enough data in in, or
-     * space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     * @return the number of bytes processed and produced.
-     */
-    public int processBlock(
-        byte[] in,
-        int inOff,
-        byte[] out,
-        int outOff)
-        throws DataLengthException, IllegalStateException
-    {
-        return (forEncryption) ? encryptBlock(in, inOff, out, outOff) : decryptBlock(in, inOff, out, outOff);
-    }
-    
-    /**
-     * reset the chaining vector back to the IV and reset the underlying
-     * cipher.
-     */
-    public void reset()
-    {
-        count = 0;
-
-        for (int i = 0; i != FR.length; i++)
-        {
-            FR[i] = IV[i];
-        }
-
-        cipher.reset();
-    }
-
-    /**
-     * Initialise the cipher and, possibly, the initialisation vector (IV).
-     * If an IV isn't passed as part of the parameter, the IV will be all zeros.
-     * An IV which is too short is handled in FIPS compliant fashion.
-     *
-     * @param forEncryption if true the cipher is initialised for
-     *  encryption, if false for decryption.
-     * @param param the key and other data required by the cipher.
-     * @exception IllegalArgumentException if the params argument is
-     * inappropriate.
-     */
-    public void init(
-        boolean forEncryption,
-        CipherParameters params)
-        throws IllegalArgumentException
-    {
-        this.forEncryption = forEncryption;
-     
-        reset();
-
-        cipher.init(true, params);
-    }
-    
-    /**
-     * Encrypt one byte of data according to CFB mode.
-     * @param data the byte to encrypt
-     * @param where am i in the current block, determines when to resync the block
-     * @returns the encrypted byte
-     */
-    private byte encryptByte(byte data, int blockOff)
-    {
-        return (byte)(FRE[blockOff] ^ data);
-    }
-    
-    /**
-     * Do the appropriate processing for CFB IV mode encryption.
-     *
-     * @param in the array containing the data to be encrypted.
-     * @param inOff offset into the in array the data starts at.
-     * @param out the array the encrypted data will be copied into.
-     * @param outOff the offset into the out array the output will start at.
-     * @exception DataLengthException if there isn't enough data in in, or
-     * space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     * @return the number of bytes processed and produced.
-     */
-    private int encryptBlock(
-        byte[] in,
-        int inOff,
-        byte[] out,
-        int outOff)
-        throws DataLengthException, IllegalStateException
-    {
-        if ((inOff + blockSize) > in.length)
-        {
-            throw new DataLengthException("input buffer too short");
-        }
-
-        if ((outOff + blockSize) > out.length)
-        {
-            throw new DataLengthException("output buffer too short");
-        }
-        
-        if (count > blockSize)
-        {
-            FR[blockSize - 2] = out[outOff] = encryptByte(in[inOff], blockSize - 2);
-            FR[blockSize - 1] = out[outOff + 1] = encryptByte(in[inOff + 1], blockSize - 1);
-
-            cipher.processBlock(FR, 0, FRE, 0);
-
-            for (int n = 2; n < blockSize; n++) 
-            {
-                out[outOff + n] = encryptByte(in[inOff + n], n - 2);
-            }
-            
-            System.arraycopy(out, outOff + 2, FR, 0, blockSize - 2);
-        }
-        else if (count == 0)
-        {
-            cipher.processBlock(FR, 0, FRE, 0);
-
-            for (int n = 0; n < blockSize; n++) 
-            {
-                out[outOff + n] = encryptByte(in[inOff + n], n);
-            }
-            
-            System.arraycopy(out, outOff, FR, 0, blockSize);
-
-            count += blockSize;
-        }
-        else if (count == blockSize)
-        {
-            cipher.processBlock(FR, 0, FRE, 0);
-
-            out[outOff] = encryptByte(in[inOff], 0);
-            out[outOff + 1] = encryptByte(in[inOff + 1], 1);
-
-            //
-            // do reset
-            //
-            System.arraycopy(FR, 2, FR, 0, blockSize - 2);
-            System.arraycopy(out, outOff, FR, blockSize - 2, 2);
-
-            cipher.processBlock(FR, 0, FRE, 0);
-
-            for (int n = 2; n < blockSize; n++) 
-            {
-                out[outOff + n] = encryptByte(in[inOff + n], n - 2);
-            }
-
-            System.arraycopy(out, outOff + 2, FR, 0, blockSize - 2);
-
-            count += blockSize;
-        }
-        
-        return blockSize;
-    }
-
-    /**
-     * Do the appropriate processing for CFB IV mode decryption.
-     *
-     * @param in the array containing the data to be decrypted.
-     * @param inOff offset into the in array the data starts at.
-     * @param out the array the encrypted data will be copied into.
-     * @param outOff the offset into the out array the output will start at.
-     * @exception DataLengthException if there isn't enough data in in, or
-     * space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     * @return the number of bytes processed and produced.
-     */
-    private int decryptBlock(
-        byte[] in,
-        int inOff,
-        byte[] out,
-        int outOff)
-        throws DataLengthException, IllegalStateException
-    {
-        if ((inOff + blockSize) > in.length)
-        {
-            throw new DataLengthException("input buffer too short");
-        }
-
-        if ((outOff + blockSize) > out.length)
-        {
-            throw new DataLengthException("output buffer too short");
-        }
-        
-        if (count > blockSize)
-        {
-            // copy in buffer so that this mode works if in and out are the same 
-            System.arraycopy(in, inOff, tmp, 0, blockSize);
-
-            out[outOff + 0] = encryptByte(tmp[0], blockSize - 2);
-            out[outOff + 1] = encryptByte(tmp[1], blockSize - 1);
-
-            System.arraycopy(tmp, 0, FR, blockSize - 2, 2);
-
-            cipher.processBlock(FR, 0, FRE, 0);
-            
-            for (int n = 2; n < blockSize; n++) 
-            {
-                out[outOff + n] = encryptByte(tmp[n], n - 2);
-            }
-            
-            System.arraycopy(tmp, 2, FR, 0, blockSize - 2);
-        } 
-        else if (count == 0)
-        {
-			cipher.processBlock(FR, 0, FRE, 0);
-			
-            for (int n = 0; n < blockSize; n++) 
-            {
-                FR[n] = in[inOff + n];
-                out[n] = encryptByte(in[inOff + n], n);
-            }
-            
-            count += blockSize;
-        }
-        else if (count == blockSize)
-        {
-			System.arraycopy(in, inOff, tmp, 0, blockSize);
-			
-			cipher.processBlock(FR, 0, FRE, 0);
-
-			out[outOff + 0] = encryptByte(tmp[0], 0);
-			out[outOff + 1] = encryptByte(tmp[1], 1);
-			
-            System.arraycopy(FR, 2, FR, 0, blockSize - 2);
-            
-            FR[blockSize - 2] = tmp[0];
-            FR[blockSize - 1] = tmp[1];
-
-            cipher.processBlock(FR, 0, FRE, 0);
-
-            for (int n = 2; n < blockSize; n++) 
-            {
-                FR[n - 2] = in[inOff + n];
-                out[outOff + n] = encryptByte(in[inOff + n], n - 2);
-            }
-
-            count += blockSize;;
-        }
-        
-        return blockSize;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/modes/PGPCFBBlockCipher.java b/azureus2/src/org/bouncycastle/crypto/modes/PGPCFBBlockCipher.java
deleted file mode 100644
index 1ab6089..0000000
--- a/azureus2/src/org/bouncycastle/crypto/modes/PGPCFBBlockCipher.java
+++ /dev/null
@@ -1,439 +0,0 @@
-package org.bouncycastle.crypto.modes;
-
-import org.bouncycastle.crypto.BlockCipher;
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.DataLengthException;
-import org.bouncycastle.crypto.params.ParametersWithIV;
-
-/**
- * Implements OpenPGP's rather strange version of Cipher-FeedBack (CFB) mode on top of a simple cipher. For further info see <a href="http://www.ietf.org/rfc/rfc2440.html">RFC 2440</a>.
- */
-public class PGPCFBBlockCipher
-    implements BlockCipher
-{
-    private byte[] IV;
-    private byte[] FR;
-    private byte[] FRE;
-    private byte[] tmp;
-
-    private BlockCipher cipher;
-
-    private int count;
-    private int blockSize;
-    private boolean forEncryption;
-    
-    private boolean inlineIv; // if false we don't need to prepend an IV
-
-    /**
-     * Basic constructor.
-     *
-     * @param cipher the block cipher to be used as the basis of the
-     * feedback mode.
-     * @param inlineIv if true this is for PGP CFB with a prepended iv.
-     */
-    public PGPCFBBlockCipher(
-        BlockCipher cipher,
-        boolean     inlineIv)
-    {
-        this.cipher = cipher;
-        this.inlineIv = inlineIv;
-
-        this.blockSize = cipher.getBlockSize();
-        this.IV = new byte[blockSize];
-        this.FR = new byte[blockSize];
-        this.FRE = new byte[blockSize];
-        this.tmp = new byte[blockSize];
-    }
-
-    /**
-     * return the underlying block cipher that we are wrapping.
-     *
-     * @return the underlying block cipher that we are wrapping.
-     */
-    public BlockCipher getUnderlyingCipher()
-    {
-        return cipher;
-    }
-    
-    /**
-     * return the algorithm name and mode.
-     *
-     * @return the name of the underlying algorithm followed by "/PGPCFB"
-     * and the block size in bits.
-     */
-    public String getAlgorithmName()
-    {
-        if (inlineIv)
-        {
-            return cipher.getAlgorithmName() + "/PGPCFBwithIV";
-        }
-        else
-        {
-            return cipher.getAlgorithmName() + "/PGPCFB";
-        }
-    }
-    
-    /**
-     * return the block size we are operating at.
-     *
-     * @return the block size we are operating at (in bytes).
-     */
-    public int getBlockSize()
-    {
-        return cipher.getBlockSize();
-    }
-
-    /**
-     * Process one block of input from the array in and write it to
-     * the out array.
-     *
-     * @param in the array containing the input data.
-     * @param inOff offset into the in array the data starts at.
-     * @param out the array the output data will be copied into.
-     * @param outOff the offset into the out array the output will start at.
-     * @exception DataLengthException if there isn't enough data in in, or
-     * space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     * @return the number of bytes processed and produced.
-     */
-    public int processBlock(
-        byte[] in,
-        int inOff,
-        byte[] out,
-        int outOff)
-        throws DataLengthException, IllegalStateException
-    {
-        if (inlineIv)
-        {
-            return (forEncryption) ? encryptBlockWithIV(in, inOff, out, outOff) : decryptBlockWithIV(in, inOff, out, outOff);
-        }
-        else
-        {
-            return (forEncryption) ? encryptBlock(in, inOff, out, outOff) : decryptBlock(in, inOff, out, outOff);
-        }
-    }
-    
-    /**
-     * reset the chaining vector back to the IV and reset the underlying
-     * cipher.
-     */
-    public void reset()
-    {
-        count = 0;
-
-        for (int i = 0; i != FR.length; i++)
-        {
-                if (inlineIv)
-                    FR[i] = 0;
-                else
-                    FR[i] = IV[i]; // if simple mode, key is IV (even if this is zero)
-        }
-
-        cipher.reset();
-    }
-
-    /**
-     * Initialise the cipher and, possibly, the initialisation vector (IV).
-     * If an IV isn't passed as part of the parameter, the IV will be all zeros.
-     * An IV which is too short is handled in FIPS compliant fashion.
-     *
-     * @param forEncryption if true the cipher is initialised for
-     *  encryption, if false for decryption.
-     * @param param the key and other data required by the cipher.
-     * @exception IllegalArgumentException if the params argument is
-     * inappropriate.
-     */
-    public void init(
-        boolean forEncryption,
-        CipherParameters params)
-        throws IllegalArgumentException
-    {
-        this.forEncryption = forEncryption;
-     
-        if (params instanceof ParametersWithIV)
-        {
-                ParametersWithIV ivParam = (ParametersWithIV)params;
-                byte[]      iv = ivParam.getIV();
-
-                if (iv.length < IV.length)
-                {
-                    // prepend the supplied IV with zeros (per FIPS PUB 81)
-                    System.arraycopy(iv, 0, IV, IV.length - iv.length, iv.length);
-                    for (int i = 0; i < IV.length - iv.length; i++)
-                    {
-                            IV[i] = 0;
-                    }
-                }
-                else
-                {
-                    System.arraycopy(iv, 0, IV, 0, IV.length);
-                }
-
-                reset();
-
-                cipher.init(true, ivParam.getParameters());
-        }
-        else
-        {
-                reset();
-
-                cipher.init(true, params);
-        }
-    }
-    
-    /**
-     * Encrypt one byte of data according to CFB mode.
-     * @param data the byte to encrypt
-     * @param where am i in the current block, determines when to resync the block
-     * @returns the encrypted byte
-     */
-    private byte encryptByte(byte data, int blockOff)
-    {
-        return (byte)(FRE[blockOff] ^ data);
-    }
-    
-    /**
-     * Do the appropriate processing for CFB IV mode encryption.
-     *
-     * @param in the array containing the data to be encrypted.
-     * @param inOff offset into the in array the data starts at.
-     * @param out the array the encrypted data will be copied into.
-     * @param outOff the offset into the out array the output will start at.
-     * @exception DataLengthException if there isn't enough data in in, or
-     * space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     * @return the number of bytes processed and produced.
-     */
-    private int encryptBlockWithIV(
-        byte[] in,
-        int inOff,
-        byte[] out,
-        int outOff)
-        throws DataLengthException, IllegalStateException
-    {
-        if ((inOff + blockSize) > in.length)
-        {
-            throw new DataLengthException("input buffer too short");
-        }
-
-        if ((outOff + blockSize) > out.length)
-        {
-            throw new DataLengthException("output buffer too short");
-        }
-        
-        if (count == 0)
-        {
-            cipher.processBlock(FR, 0, FRE, 0);
-
-            for (int n = 0; n < blockSize; n++) 
-            {
-                out[outOff + n] = encryptByte(IV[n], n);
-            }
-            
-            System.arraycopy(out, outOff, FR, 0, blockSize);
-
-            cipher.processBlock(FR, 0, FRE, 0);
-
-            out[outOff + blockSize] = encryptByte(IV[blockSize - 2], 0);
-            out[outOff + blockSize + 1] = encryptByte(IV[blockSize - 1], 1);
-
-            System.arraycopy(out, outOff + 2, FR, 0, blockSize);
-            
-            cipher.processBlock(FR, 0, FRE, 0);
-
-            for (int n = 0; n < blockSize; n++) 
-            {
-                out[outOff + blockSize + 2 + n] = encryptByte(in[inOff + n], n);
-            }
-
-            System.arraycopy(out, outOff + blockSize + 2, FR, 0, blockSize);
-
-            count += 2 * blockSize + 2;
-
-            return 2 * blockSize + 2;
-        }
-        else if (count >= blockSize + 2)
-        {
-            cipher.processBlock(FR, 0, FRE, 0);
-
-            for (int n = 0; n < blockSize; n++) 
-            {
-                out[outOff + n] = encryptByte(in[inOff + n], n);
-            }
-            
-            System.arraycopy(out, outOff, FR, 0, blockSize);
-        }
-        
-        return blockSize;
-    }
-
-    /**
-     * Do the appropriate processing for CFB IV mode decryption.
-     *
-     * @param in the array containing the data to be decrypted.
-     * @param inOff offset into the in array the data starts at.
-     * @param out the array the encrypted data will be copied into.
-     * @param outOff the offset into the out array the output will start at.
-     * @exception DataLengthException if there isn't enough data in in, or
-     * space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     * @return the number of bytes processed and produced.
-     */
-    private int decryptBlockWithIV(
-        byte[] in,
-        int inOff,
-        byte[] out,
-        int outOff)
-        throws DataLengthException, IllegalStateException
-    {
-        if ((inOff + blockSize) > in.length)
-        {
-            throw new DataLengthException("input buffer too short");
-        }
-
-        if ((outOff + blockSize) > out.length)
-        {
-            throw new DataLengthException("output buffer too short");
-        }
-        
-        if (count == 0)
-        {
-            for (int n = 0; n < blockSize; n++) 
-            {
-                FR[n] = in[inOff + n];
-            }
-            
-            cipher.processBlock(FR, 0, FRE, 0);
-
-            count += blockSize;
-
-            return 0;
-        }
-        else if (count == blockSize)
-        {
-            // copy in buffer so that this mode works if in and out are the same 
-            System.arraycopy(in, inOff, tmp, 0, blockSize);
-        
-            System.arraycopy(FR, 2, FR, 0, blockSize - 2);
-            
-            FR[blockSize - 2] = tmp[0];
-            FR[blockSize - 1] = tmp[1];
-
-            cipher.processBlock(FR, 0, FRE, 0);
-
-            for (int n = 0; n < blockSize - 2; n++) 
-            {
-                out[outOff + n] = encryptByte(tmp[n + 2], n);
-            }
-
-            System.arraycopy(tmp, 2, FR, 0, blockSize - 2);
-
-            count += 2;
-
-            return blockSize - 2;
-        }
-        else if (count >= blockSize + 2)
-        {
-            // copy in buffer so that this mode works if in and out are the same 
-            System.arraycopy(in, inOff, tmp, 0, blockSize);
-
-            out[outOff + 0] = encryptByte(tmp[0], blockSize - 2);
-            out[outOff + 1] = encryptByte(tmp[1], blockSize - 1);
-
-            System.arraycopy(tmp, 0, FR, blockSize - 2, 2);
-
-            cipher.processBlock(FR, 0, FRE, 0);
-            
-            for (int n = 0; n < blockSize - 2; n++) 
-            {
-                out[outOff + n + 2] = encryptByte(tmp[n + 2], n);
-            }
-            
-            System.arraycopy(tmp, 2, FR, 0, blockSize - 2);
-            
-        } 
-        
-        return blockSize;
-    }
-    
-    /**
-     * Do the appropriate processing for CFB mode encryption.
-     *
-     * @param in the array containing the data to be encrypted.
-     * @param inOff offset into the in array the data starts at.
-     * @param out the array the encrypted data will be copied into.
-     * @param outOff the offset into the out array the output will start at.
-     * @exception DataLengthException if there isn't enough data in in, or
-     * space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     * @return the number of bytes processed and produced.
-     */
-    private int encryptBlock(
-        byte[] in,
-        int inOff,
-        byte[] out,
-        int outOff)
-        throws DataLengthException, IllegalStateException
-    {        
-        if ((inOff + blockSize) > in.length)
-        {
-            throw new DataLengthException("input buffer too short");
-        }
-
-        if ((outOff + blockSize) > out.length)
-        {
-            throw new DataLengthException("output buffer too short");
-        }
-        
-        
-        cipher.processBlock(FR, 0, FRE, 0);
-        for (int n = 0; n < blockSize; n++) 
-            out[outOff + n] = encryptByte(in[inOff + n], n);
-        
-        for (int n = 0; n < blockSize; n++) 
-            FR[n] = out[outOff + n];
-        
-        return blockSize;
-        
-    }
-    
-    /**
-     * Do the appropriate processing for CFB mode decryption.
-     *
-     * @param in the array containing the data to be decrypted.
-     * @param inOff offset into the in array the data starts at.
-     * @param out the array the encrypted data will be copied into.
-     * @param outOff the offset into the out array the output will start at.
-     * @exception DataLengthException if there isn't enough data in in, or
-     * space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     * @return the number of bytes processed and produced.
-     */
-    private int decryptBlock(
-        byte[] in,
-        int inOff,
-        byte[] out,
-        int outOff)
-        throws DataLengthException, IllegalStateException
-    {
-        if ((inOff + blockSize) > in.length)
-        {
-            throw new DataLengthException("input buffer too short");
-        }
-
-        if ((outOff + blockSize) > out.length)
-        {
-            throw new DataLengthException("output buffer too short");
-        }
-        
-        cipher.processBlock(FR, 0, FRE, 0);
-        for (int n = 0; n < blockSize; n++) 
-            out[outOff + n] = encryptByte(in[inOff + n], n);
-        
-        for (int n = 0; n < blockSize; n++) 
-            FR[n] = in[inOff + n];
-        
-        return blockSize;
-        
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/modes/PaddedBlockCipher.java b/azureus2/src/org/bouncycastle/crypto/modes/PaddedBlockCipher.java
deleted file mode 100644
index 0571cbb..0000000
--- a/azureus2/src/org/bouncycastle/crypto/modes/PaddedBlockCipher.java
+++ /dev/null
@@ -1,253 +0,0 @@
-package org.bouncycastle.crypto.modes;
-
-import org.bouncycastle.crypto.BlockCipher;
-import org.bouncycastle.crypto.BufferedBlockCipher;
-import org.bouncycastle.crypto.DataLengthException;
-import org.bouncycastle.crypto.InvalidCipherTextException;
-
-/**
- * A wrapper class that allows block ciphers to be used to process data in
- * a piecemeal fashion with PKCS5/PKCS7 padding. The PaddedBlockCipher
- * outputs a block only when the buffer is full and more data is being added,
- * or on a doFinal (unless the current block in the buffer is a pad block).
- * The padding mechanism used is the one outlined in PKCS5/PKCS7.
- *
- * @deprecated use org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher instead.
- */
-public class PaddedBlockCipher
-    extends BufferedBlockCipher
-{
-    /**
-     * Create a buffered block cipher with, or without, padding.
-     *
-     * @param cipher the underlying block cipher this buffering object wraps.
-     */
-	public PaddedBlockCipher(
-        BlockCipher     cipher)
-	{
-        this.cipher = cipher;
-
-        buf = new byte[cipher.getBlockSize()];
-        bufOff = 0;
-	}
-
-    /**
-     * return the size of the output buffer required for an update plus a
-     * doFinal with an input of len bytes.
-     *
-     * @param len the length of the input.
-     * @return the space required to accommodate a call to update and doFinal
-     * with len bytes of input.
-     */
-    public int getOutputSize(
-        int len)
-    {
-        int total       = len + bufOff;
-        int leftOver    = total % buf.length;
-
-        if (leftOver == 0)
-        {
-            if (forEncryption)
-            {
-                return total + buf.length;
-            }
-
-            return total;
-        }
-
-        return total - leftOver + buf.length;
-    }
-
-    /**
-     * return the size of the output buffer required for an update 
-     * an input of len bytes.
-     *
-     * @param len the length of the input.
-     * @return the space required to accommodate a call to update
-     * with len bytes of input.
-     */
-    public int getUpdateOutputSize(
-        int len)
-    {
-        int total       = len + bufOff;
-        int leftOver    = total % buf.length;
-
-        if (leftOver == 0)
-        {
-            return total - buf.length;
-        }
-
-        return total - leftOver;
-    }
-
-    /**
-     * process a single byte, producing an output block if neccessary.
-     *
-     * @param in the input byte.
-     * @param out the space for any output that might be produced.
-     * @param outOff the offset from which the output will be copied.
-     * @exception DataLengthException if there isn't enough space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     */
-	public int processByte(
-        byte        in,
-		byte[]      out,
-		int         outOff)
-        throws DataLengthException, IllegalStateException
-    {
-        int         resultLen = 0;
-
-        if (bufOff == buf.length)
-        {
-            resultLen = cipher.processBlock(buf, 0, out, outOff);
-            bufOff = 0;
-        }
-
-        buf[bufOff++] = in;
-
-        return resultLen;
-    }
-
-    /**
-     * process an array of bytes, producing output if necessary.
-     *
-     * @param in the input byte array.
-     * @param inOff the offset at which the input data starts.
-     * @param len the number of bytes to be copied out of the input array.
-     * @param out the space for any output that might be produced.
-     * @param outOff the offset from which the output will be copied.
-     * @exception DataLengthException if there isn't enough space in out.
-     * @exception IllegalStateException if the cipher isn't initialised.
-     */
-	public int processBytes(
-		byte[]      in,
-		int         inOff,
-		int         len,
-		byte[]      out,
-		int         outOff)
-        throws DataLengthException, IllegalStateException
-	{
-        if (len < 0)
-        {
-            throw new IllegalArgumentException("Can't have a negative input length!");
-        }
-
-        int blockSize   = getBlockSize();
-        int length      = getUpdateOutputSize(len);
-        
-        if (length > 0)
-        {
-            if ((outOff + length) > out.length)
-            {
-                throw new DataLengthException("output buffer too short");
-            }
-        }
-
-		int resultLen = 0;
-        int gapLen = buf.length - bufOff;
-
-        if (len > gapLen)
-        {
-            System.arraycopy(in, inOff, buf, bufOff, gapLen);
-
-            resultLen += cipher.processBlock(buf, 0, out, outOff);
-
-            bufOff = 0;
-            len -= gapLen;
-            inOff += gapLen;
-
-            while (len > buf.length)
-            {
-                resultLen += cipher.processBlock(in, inOff, out, outOff + resultLen);
-
-                len -= blockSize;
-                inOff += blockSize;
-            }
-        }
-
-        System.arraycopy(in, inOff, buf, bufOff, len);
-
-        bufOff += len;
-
-        return resultLen;
-	}
-
-    /**
-     * Process the last block in the buffer. If the buffer is currently
-     * full and padding needs to be added a call to doFinal will produce
-     * 2 * getBlockSize() bytes.
-     *
-     * @param out the array the block currently being held is copied into.
-     * @param outOff the offset at which the copying starts.
-     * @exception DataLengthException if there is insufficient space in out for
-     * the output or we are decrypting and the input is not block size aligned.
-     * @exception IllegalStateException if the underlying cipher is not
-     * initialised.
-     * @exception InvalidCipherTextException if padding is expected and not found.
-     */
-	public int doFinal(
-        byte[]  out,
-        int     outOff)
-        throws DataLengthException, IllegalStateException, InvalidCipherTextException
-	{
-        int blockSize = cipher.getBlockSize();
-        int resultLen = 0;
-
-        if (forEncryption)
-        {
-            if (bufOff == blockSize)
-            {
-                if ((outOff + 2 * blockSize) > out.length)
-                {
-                    throw new DataLengthException("output buffer too short");
-                }
-
-                resultLen = cipher.processBlock(buf, 0, out, outOff);
-                bufOff = 0;
-            }
-
-            //
-            // add PKCS7 padding
-            //
-            byte code = (byte)(blockSize - bufOff);
-
-            while (bufOff < blockSize)
-            {
-                buf[bufOff] = code;
-                bufOff++;
-            }
-
-            resultLen += cipher.processBlock(buf, 0, out, outOff + resultLen);
-        }
-        else
-        {
-            if (bufOff == blockSize)
-            {
-                resultLen = cipher.processBlock(buf, 0, buf, 0);
-                bufOff = 0;
-            }
-            else
-            {
-                throw new DataLengthException("last block incomplete in decryption");
-            }
-
-            //
-            // remove PKCS7 padding
-            //
-            int count = buf[blockSize - 1] & 0xff;
-
-            if ((count < 0) || (count > blockSize))
-            {
-                throw new InvalidCipherTextException("pad block corrupted");
-            }
-
-            resultLen -= count;
-
-            System.arraycopy(buf, 0, out, outOff, resultLen);
-        }
-
-        reset();
-
-		return resultLen;
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/modes/SICBlockCipher.java b/azureus2/src/org/bouncycastle/crypto/modes/SICBlockCipher.java
deleted file mode 100644
index 3ae36d2..0000000
--- a/azureus2/src/org/bouncycastle/crypto/modes/SICBlockCipher.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.bouncycastle.crypto.modes;
-
-import org.bouncycastle.crypto.BlockCipher;
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.DataLengthException;
-import org.bouncycastle.crypto.params.ParametersWithIV;
-
-/**
- * Implements the Segmented Integer Counter (SIC) mode on top of a simple
- * block cipher. This mode is also known as CTR mode.
- */
-public class SICBlockCipher implements BlockCipher
-{
-  private BlockCipher     cipher = null;
-  private int             blockSize;
-  private byte[]          IV;
-  private byte[]          counter;
-  private byte[]          counterOut;
-  private boolean         encrypting;
-
-
-  /**
-   * Basic constructor.
-   *
-   * @param c the block cipher to be used.
-   */
-  public SICBlockCipher(BlockCipher c) {
-    this.cipher = c;
-    this.blockSize = cipher.getBlockSize();
-    this.IV = new byte[blockSize];
-    this.counter = new byte[blockSize];
-    this.counterOut = new byte[blockSize];
-  }
-
-
-  /**
-   * return the underlying block cipher that we are wrapping.
-   *
-   * @return the underlying block cipher that we are wrapping.
-   */
-  public BlockCipher getUnderlyingCipher() {
-    return cipher;
-  }
-
-
-  public void init(boolean forEncryption, CipherParameters params)
-      throws IllegalArgumentException {
-    this.encrypting = forEncryption;
-
-    if (params instanceof ParametersWithIV) {
-      ParametersWithIV ivParam = (ParametersWithIV)params;
-      byte[]           iv      = ivParam.getIV();
-      System.arraycopy(iv, 0, IV, 0, IV.length);
-
-      reset();
-      cipher.init(true, ivParam.getParameters());
-    }
-  }
-
-
-  public String getAlgorithmName() {
-    return cipher.getAlgorithmName() + "/SIC";
-  }
-
-
-  public int getBlockSize() {
-    return cipher.getBlockSize();
-  }
-
-
-  public int processBlock(byte[] in, int inOff, byte[] out, int outOff)
-      throws DataLengthException, IllegalStateException {
-    cipher.processBlock(counter, 0, counterOut, 0);
-
-    //
-    // XOR the counterOut with the plaintext producing the cipher text
-    //
-    for (int i = 0; i < counterOut.length; i++) {
-      out[outOff + i] = (byte)(counterOut[i] ^ in[inOff + i]);
-    }
-
-	int	carry = 1;
-	
-	for (int i = counter.length - 1; i >= 0; i--)
-	{
-		int	x = (counter[i] & 0xff) + carry;
-		
-		if (x > 0xff)
-		{
-			carry = 1;
-		}
-		else
-		{
-			carry = 0;
-		}
-		
-		counter[i] = (byte)x;
-	}
-
-    return counter.length;
-  }
-
-
-  public void reset() {
-    System.arraycopy(IV, 0, counter, 0, counter.length);
-    cipher.reset();
-  }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/modes/package.html b/azureus2/src/org/bouncycastle/crypto/modes/package.html
deleted file mode 100644
index 5402df4..0000000
--- a/azureus2/src/org/bouncycastle/crypto/modes/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body bgcolor="#ffffff">
-Modes for symmetric ciphers.
-</body>
-</html>
diff --git a/azureus2/src/org/bouncycastle/crypto/params/AsymmetricKeyParameter.java b/azureus2/src/org/bouncycastle/crypto/params/AsymmetricKeyParameter.java
deleted file mode 100644
index 5710395..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/AsymmetricKeyParameter.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class AsymmetricKeyParameter
-	implements CipherParameters
-{
-    boolean privateKey;
-
-    public AsymmetricKeyParameter(
-        boolean privateKey)
-    {
-        this.privateKey = privateKey;
-    }
-
-    public boolean isPrivate()
-    {
-        return privateKey;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/DESParameters.java b/azureus2/src/org/bouncycastle/crypto/params/DESParameters.java
deleted file mode 100644
index 5bee360..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/DESParameters.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-public class DESParameters
-    extends KeyParameter
-{
-    public DESParameters(
-        byte[]  key)
-    {
-        super(key);
-
-        if (isWeakKey(key, 0))
-        {
-            throw new IllegalArgumentException("attempt to create weak DES key");
-        }
-    }
-
-    /*
-     * DES Key length in bytes.
-     */
-    static public final int DES_KEY_LENGTH = 8;
-
-    /*
-     * Table of weak and semi-weak keys taken from Schneier pp281
-     */
-    static private final int N_DES_WEAK_KEYS = 16;
-
-    static private byte[] DES_weak_keys =
-    {
-        /* weak keys */
-        (byte)0x01,(byte)0x01,(byte)0x01,(byte)0x01, (byte)0x01,(byte)0x01,(byte)0x01,(byte)0x01,
-        (byte)0x1f,(byte)0x1f,(byte)0x1f,(byte)0x1f, (byte)0x0e,(byte)0x0e,(byte)0x0e,(byte)0x0e,
-        (byte)0xe0,(byte)0xe0,(byte)0xe0,(byte)0xe0, (byte)0xf1,(byte)0xf1,(byte)0xf1,(byte)0xf1,
-        (byte)0xfe,(byte)0xfe,(byte)0xfe,(byte)0xfe, (byte)0xfe,(byte)0xfe,(byte)0xfe,(byte)0xfe,
-
-        /* semi-weak keys */
-        (byte)0x01,(byte)0xfe,(byte)0x01,(byte)0xfe, (byte)0x01,(byte)0xfe,(byte)0x01,(byte)0xfe,
-        (byte)0x1f,(byte)0xe0,(byte)0x1f,(byte)0xe0, (byte)0x0e,(byte)0xf1,(byte)0x0e,(byte)0xf1,
-        (byte)0x01,(byte)0xe0,(byte)0x01,(byte)0xe0, (byte)0x01,(byte)0xf1,(byte)0x01,(byte)0xf1,
-        (byte)0x1f,(byte)0xfe,(byte)0x1f,(byte)0xfe, (byte)0x0e,(byte)0xfe,(byte)0x0e,(byte)0xfe,
-        (byte)0x01,(byte)0x1f,(byte)0x01,(byte)0x1f, (byte)0x01,(byte)0x0e,(byte)0x01,(byte)0x0e,
-        (byte)0xe0,(byte)0xfe,(byte)0xe0,(byte)0xfe, (byte)0xf1,(byte)0xfe,(byte)0xf1,(byte)0xfe,
-        (byte)0xfe,(byte)0x01,(byte)0xfe,(byte)0x01, (byte)0xfe,(byte)0x01,(byte)0xfe,(byte)0x01,
-        (byte)0xe0,(byte)0x1f,(byte)0xe0,(byte)0x1f, (byte)0xf1,(byte)0x0e,(byte)0xf1,(byte)0x0e,
-        (byte)0xe0,(byte)0x01,(byte)0xe0,(byte)0x01, (byte)0xf1,(byte)0x01,(byte)0xf1,(byte)0x01,
-        (byte)0xfe,(byte)0x1f,(byte)0xfe,(byte)0x1f, (byte)0xfe,(byte)0x0e,(byte)0xfe,(byte)0x0e,
-        (byte)0x1f,(byte)0x01,(byte)0x1f,(byte)0x01, (byte)0x0e,(byte)0x01,(byte)0x0e,(byte)0x01,
-        (byte)0xfe,(byte)0xe0,(byte)0xfe,(byte)0xe0, (byte)0xfe,(byte)0xf1,(byte)0xfe,(byte)0xf1
-    };
-
-    /**
-     * DES has 16 weak keys.  This method will check
-     * if the given DES key material is weak or semi-weak.
-     * Key material that is too short is regarded as weak.
-     * <p>
-     * See <a href="http://www.counterpane.com/applied.html">"Applied
-     * Cryptography"</a> by Bruce Schneier for more information.
-     *
-     * @return true if the given DES key material is weak or semi-weak,
-     *     false otherwise.
-     */
-    public static boolean isWeakKey(
-        byte[] key,
-        int offset)
-    {
-        if (key.length - offset < DES_KEY_LENGTH)
-        {
-            throw new IllegalArgumentException("key material too short.");
-        }
-
-        nextkey: for (int i = 0; i < N_DES_WEAK_KEYS; i++)
-        {
-            for (int j = 0; j < DES_KEY_LENGTH; j++)
-            {
-                if (key[j + offset] != DES_weak_keys[i * DES_KEY_LENGTH + j])
-                {
-                    continue nextkey;
-                }
-            }
-
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * DES Keys use the LSB as the odd parity bit.  This can
-     * be used to check for corrupt keys.
-     *
-     * @param bytes the byte array to set the parity on.
-     */
-    public static void setOddParity(
-        byte[] bytes)
-    {
-        for (int i = 0; i < bytes.length; i++)
-        {
-            int b = bytes[i];
-            bytes[i] = (byte)((b & 0xfe) |
-                            ((((b >> 1) ^
-                            (b >> 2) ^
-                            (b >> 3) ^
-                            (b >> 4) ^
-                            (b >> 5) ^
-                            (b >> 6) ^
-                            (b >> 7)) ^ 0x01) & 0x01));
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/DESedeParameters.java b/azureus2/src/org/bouncycastle/crypto/params/DESedeParameters.java
deleted file mode 100644
index d424fc1..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/DESedeParameters.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-public class DESedeParameters
-    extends DESParameters
-{
-    /*
-     * DES-EDE Key length in bytes.
-     */
-    static public final int DES_EDE_KEY_LENGTH = 24;
-
-    public DESedeParameters(
-        byte[]  key)
-    {
-        super(key);
-
-        if (isWeakKey(key, 0, 0))
-        {
-            throw new IllegalArgumentException("attempt to create weak DESede key");
-        }
-    }
-
-    /**
-     * return true if the passed in key is a DES-EDE weak key.
-     *
-     * @param key bytes making up the key
-     * @param offset offset into the byte array the key starts at
-     * @param length number of bytes making up the key
-     */
-    public static boolean isWeakKey(
-        byte[]  key,
-        int     offset,
-        int     length)
-    {
-        for (int i = offset; i < length; i += DES_KEY_LENGTH)
-        {
-            if (DESParameters.isWeakKey(key, i))
-            {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * return true if the passed in key is a DES-EDE weak key.
-     *
-     * @param key bytes making up the key
-     * @param offset offset into the byte array the key starts at
-     */
-    public static boolean isWeakKey(
-        byte[]  key,
-        int     offset)
-    {
-        return isWeakKey(key, offset, key.length - offset);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/DHKeyGenerationParameters.java b/azureus2/src/org/bouncycastle/crypto/params/DHKeyGenerationParameters.java
deleted file mode 100644
index 76c8037..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/DHKeyGenerationParameters.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.KeyGenerationParameters;
-
-public class DHKeyGenerationParameters
-    extends KeyGenerationParameters
-{
-    private DHParameters    params;
-
-    public DHKeyGenerationParameters(
-        SecureRandom    random,
-        DHParameters    params)
-    {
-        super(random, params.getP().bitLength() - 1);
-
-        this.params = params;
-    }
-
-    public DHParameters getParameters()
-    {
-        return params;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/DHKeyParameters.java b/azureus2/src/org/bouncycastle/crypto/params/DHKeyParameters.java
deleted file mode 100644
index aceadde..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/DHKeyParameters.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-
-public class DHKeyParameters
-    extends AsymmetricKeyParameter
-{
-    private DHParameters    params;
-
-    protected DHKeyParameters(
-        boolean         isPrivate,
-        DHParameters    params)
-    {
-        super(isPrivate);
-
-        this.params = params;
-    }   
-
-    public DHParameters getParameters()
-    {
-        return params;
-    }
-
-    public boolean equals(
-        Object  obj)
-    {
-        if (!(obj instanceof DHKeyParameters))
-        {
-            return false;
-        }
-
-        DHKeyParameters    dhKey = (DHKeyParameters)obj;
-
-        return (params != null && !params.equals(dhKey.getParameters()));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/DHParameters.java b/azureus2/src/org/bouncycastle/crypto/params/DHParameters.java
deleted file mode 100644
index 40f77ab..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/DHParameters.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class DHParameters
-    implements CipherParameters
-{
-    private BigInteger              g;
-    private BigInteger              p;
-    private BigInteger              q;
-    private int                     j;
-    private DHValidationParameters  validation;
-
-    public DHParameters(
-        BigInteger  p,
-        BigInteger  g)
-    {
-        this.g = g;
-        this.p = p;
-    }
-
-    public DHParameters(
-        BigInteger  p,
-        BigInteger  g,
-        BigInteger  q,
-        int         j)
-    {
-        this.g = g;
-        this.p = p;
-        this.q = q;
-        this.j = j;
-    }   
-
-    public DHParameters(
-        BigInteger              p,
-        BigInteger              g,
-        BigInteger              q,
-        int                     j,
-        DHValidationParameters  validation)
-    {
-        this.g = g;
-        this.p = p;
-        this.q = q;
-        this.j = j;
-    }   
-
-    public BigInteger getP()
-    {
-        return p;
-    }
-
-    public BigInteger getG()
-    {
-        return g;
-    }
-
-    public BigInteger getQ()
-    {
-        return q;
-    }
-
-    public int getJ()
-    {
-        return j;
-    }
-
-    public DHValidationParameters getValidationParameters()
-    {
-        return validation;
-    }
-
-    public boolean equals(
-        Object  obj)
-    {
-        if (!(obj instanceof DHParameters))
-        {
-            return false;
-        }
-
-        DHParameters    pm = (DHParameters)obj;
-
-        if (this.getValidationParameters() != null)
-        {
-            if (!this.getValidationParameters().equals(pm.getValidationParameters()))
-            {
-                return false;
-            }
-        }
-        else
-        {
-            if (pm.getValidationParameters() != null)
-            {
-                return false;
-            }
-        }
-
-        if (this.getQ() != null)
-        {
-            if (!this.getQ().equals(pm.getQ()))
-            {
-                return false;
-            }
-        }
-        else
-        {
-            if (pm.getQ() != null)
-            {
-                return false;
-            }
-        }
-        
-        return (j == pm.getJ()) && pm.getP().equals(p) && pm.getG().equals(g);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/DHPrivateKeyParameters.java b/azureus2/src/org/bouncycastle/crypto/params/DHPrivateKeyParameters.java
deleted file mode 100644
index 523f9a0..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/DHPrivateKeyParameters.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class DHPrivateKeyParameters
-    extends DHKeyParameters
-{
-    private BigInteger      x;
-
-    public DHPrivateKeyParameters(
-        BigInteger      x,
-        DHParameters    params)
-    {
-        super(true, params);
-
-        this.x = x;
-    }   
-
-    public BigInteger getX()
-    {
-        return x;
-    }
-
-    public boolean equals(
-        Object  obj)
-    {
-        if (!(obj instanceof DHPrivateKeyParameters))
-        {
-            return false;
-        }
-
-        DHPrivateKeyParameters  pKey = (DHPrivateKeyParameters)obj;
-
-        if (!pKey.getX().equals(x))
-        {
-            return false;
-        }
-
-        return super.equals(obj);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/DHPublicKeyParameters.java b/azureus2/src/org/bouncycastle/crypto/params/DHPublicKeyParameters.java
deleted file mode 100644
index 4f308ed..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/DHPublicKeyParameters.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class DHPublicKeyParameters
-    extends DHKeyParameters
-{
-    private BigInteger      y;
-
-    public DHPublicKeyParameters(
-        BigInteger      y,
-        DHParameters    params)
-    {
-        super(false, params);
-
-        this.y = y;
-    }   
-
-    public BigInteger getY()
-    {
-        return y;
-    }
-
-    public boolean equals(
-        Object  obj)
-    {
-        if (!(obj instanceof DHPublicKeyParameters))
-        {
-            return false;
-        }
-
-        DHPublicKeyParameters   pKey = (DHPublicKeyParameters)obj;
-
-        if (!pKey.getY().equals(y))
-        {
-            return false;
-        }
-
-        return super.equals(obj);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/DHValidationParameters.java b/azureus2/src/org/bouncycastle/crypto/params/DHValidationParameters.java
deleted file mode 100644
index fa3cf56..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/DHValidationParameters.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-public class DHValidationParameters
-{
-    private byte[]  seed;
-    private int     counter;
-
-    public DHValidationParameters(
-        byte[]  seed,
-        int     counter)
-    {
-        this.seed = seed;
-        this.counter = counter;
-    }
-
-    public boolean equals(
-        Object o)
-    {
-        if (o == null || !(o instanceof DHValidationParameters))
-        {
-            return false;
-        }
-
-        DHValidationParameters  other = (DHValidationParameters)o;
-
-        if (other.counter != this.counter)
-        {
-            return false;
-        }
-
-        if (other.seed.length != this.seed.length)
-        {
-            return false;
-        }
-
-        for (int i = 0; i != other.seed.length; i++)
-        {
-            if (other.seed[i] != this.seed[i])
-            {
-                return false;
-            }
-        }
-
-        return true;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/DSAKeyGenerationParameters.java b/azureus2/src/org/bouncycastle/crypto/params/DSAKeyGenerationParameters.java
deleted file mode 100644
index 29fa91e..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/DSAKeyGenerationParameters.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.KeyGenerationParameters;
-
-public class DSAKeyGenerationParameters
-    extends KeyGenerationParameters
-{
-    private DSAParameters    params;
-
-    public DSAKeyGenerationParameters(
-        SecureRandom    random,
-        DSAParameters   params)
-    {
-        super(random, params.getP().bitLength() - 1);
-
-        this.params = params;
-    }
-
-    public DSAParameters getParameters()
-    {
-        return params;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/DSAKeyParameters.java b/azureus2/src/org/bouncycastle/crypto/params/DSAKeyParameters.java
deleted file mode 100644
index 11bb9d9..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/DSAKeyParameters.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-public class DSAKeyParameters
-    extends AsymmetricKeyParameter
-{
-    private DSAParameters    params;
-
-    public DSAKeyParameters(
-        boolean         isPrivate,
-        DSAParameters   params)
-    {
-        super(isPrivate);
-
-        this.params = params;
-    }   
-
-    public DSAParameters getParameters()
-    {
-        return params;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/DSAParameters.java b/azureus2/src/org/bouncycastle/crypto/params/DSAParameters.java
deleted file mode 100644
index 02e054b..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/DSAParameters.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class DSAParameters
-    implements CipherParameters
-{
-    private BigInteger              g;
-    private BigInteger              q;
-    private BigInteger              p;
-    private DSAValidationParameters validation;
-
-    public DSAParameters(
-        BigInteger  p,
-        BigInteger  q,
-        BigInteger  g)
-    {
-        this.g = g;
-        this.p = p;
-        this.q = q;
-    }   
-
-    public DSAParameters(
-        BigInteger              p,
-        BigInteger              q,
-        BigInteger              g,
-        DSAValidationParameters params)
-    {
-        this.g = g;
-        this.p = p;
-        this.q = q;
-        this.validation = params;
-    }   
-
-    public BigInteger getP()
-    {
-        return p;
-    }
-
-    public BigInteger getQ()
-    {
-        return q;
-    }
-
-    public BigInteger getG()
-    {
-        return g;
-    }
-
-    public DSAValidationParameters getValidationParameters()
-    {
-        return validation;
-    }
-
-    public boolean equals(
-        Object  obj)
-    {
-        if (!(obj instanceof DSAParameters))
-        {
-            return false;
-        }
-
-        DSAParameters    pm = (DSAParameters)obj;
-
-        return (pm.getP().equals(p) && pm.getQ().equals(q) && pm.getG().equals(g));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/DSAPrivateKeyParameters.java b/azureus2/src/org/bouncycastle/crypto/params/DSAPrivateKeyParameters.java
deleted file mode 100644
index 3bef3f4..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/DSAPrivateKeyParameters.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class DSAPrivateKeyParameters
-    extends DSAKeyParameters
-{
-    private BigInteger      x;
-
-    public DSAPrivateKeyParameters(
-        BigInteger      x,
-        DSAParameters   params)
-    {
-        super(true, params);
-
-        this.x = x;
-    }   
-
-    public BigInteger getX()
-    {
-        return x;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/DSAPublicKeyParameters.java b/azureus2/src/org/bouncycastle/crypto/params/DSAPublicKeyParameters.java
deleted file mode 100644
index c006656..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/DSAPublicKeyParameters.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class DSAPublicKeyParameters
-    extends DSAKeyParameters
-{
-    private BigInteger      y;
-
-    public DSAPublicKeyParameters(
-        BigInteger      y,
-        DSAParameters   params)
-    {
-        super(false, params);
-
-        this.y = y;
-    }   
-
-    public BigInteger getY()
-    {
-        return y;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/DSAValidationParameters.java b/azureus2/src/org/bouncycastle/crypto/params/DSAValidationParameters.java
deleted file mode 100644
index 5cc67c2..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/DSAValidationParameters.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-public class DSAValidationParameters
-{
-    private byte[]  seed;
-    private int     counter;
-
-    public DSAValidationParameters(
-        byte[]  seed,
-        int     counter)
-    {
-        this.seed = seed;
-        this.counter = counter;
-    }
-
-    public int getCounter()
-    {
-        return counter;
-    }
-
-    public byte[] getSeed()
-    {
-        return seed;
-    }
-
-    public boolean equals(
-        Object o)
-    {
-        if (o == null || !(o instanceof DSAValidationParameters))
-        {
-            return false;
-        }
-
-        DSAValidationParameters  other = (DSAValidationParameters)o;
-
-        if (other.counter != this.counter)
-        {
-            return false;
-        }
-
-        if (other.seed.length != this.seed.length)
-        {
-            return false;
-        }
-
-        for (int i = 0; i != other.seed.length; i++)
-        {
-            if (other.seed[i] != this.seed[i])
-            {
-                return false;
-            }
-        }
-
-        return true;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/ECDomainParameters.java b/azureus2/src/org/bouncycastle/crypto/params/ECDomainParameters.java
deleted file mode 100644
index 32889c4..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/ECDomainParameters.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.math.ec.ECConstants;
-import org.bouncycastle.math.ec.ECCurve;
-import org.bouncycastle.math.ec.ECPoint;
-
-public class ECDomainParameters
-    implements ECConstants
-{
-	ECCurve     curve;
-	byte[]      seed;
-	ECPoint     G;
-	BigInteger  n;
-	BigInteger  h;
-
-	public ECDomainParameters(
-		ECCurve     curve,
-		ECPoint     G,
-		BigInteger  n)
-	{
-		this.curve = curve;
-		this.G = G;
-		this.n = n;
-        this.h = ONE;
-        this.seed = null;
-	}
-
-	public ECDomainParameters(
-		ECCurve     curve,
-		ECPoint     G,
-		BigInteger  n,
-        BigInteger  h)
-	{
-		this.curve = curve;
-		this.G = G;
-		this.n = n;
-		this.h = h;
-        this.seed = null;
-	}
-
-	public ECDomainParameters(
-		ECCurve     curve,
-		ECPoint     G,
-		BigInteger  n,
-        BigInteger  h,
-        byte[]      seed)
-	{
-		this.curve = curve;
-		this.G = G;
-		this.n = n;
-		this.h = h;
-        this.seed = seed;
-	}
-
-	public ECCurve getCurve()
-	{
-		return curve;
-	}
-
-	public ECPoint getG()
-	{
-		return G;
-	}
-
-	public BigInteger getN()
-	{
-		return n;
-	}
-
-	public BigInteger getH()
-	{
-		return h;
-	}
-
-	public byte[] getSeed()
-	{
-		return seed;
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/ECKeyGenerationParameters.java b/azureus2/src/org/bouncycastle/crypto/params/ECKeyGenerationParameters.java
deleted file mode 100644
index 0d8b206..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/ECKeyGenerationParameters.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.KeyGenerationParameters;
-
-public class ECKeyGenerationParameters
-    extends KeyGenerationParameters
-{
-	private ECDomainParameters  domainParams;
-
-    public ECKeyGenerationParameters(
-		ECDomainParameters		domainParams,
-        SecureRandom            random)
-    {
-        super(random, domainParams.getN().bitLength());
-
-		this.domainParams = domainParams;
-    }
-
-	public ECDomainParameters getDomainParameters()
-	{
-		return domainParams;
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/ECKeyParameters.java b/azureus2/src/org/bouncycastle/crypto/params/ECKeyParameters.java
deleted file mode 100644
index cb12b60..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/ECKeyParameters.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-public class ECKeyParameters
-    extends AsymmetricKeyParameter
-{
-	ECDomainParameters params;
-
-	protected ECKeyParameters(
-        boolean             isPrivate,
-        ECDomainParameters  params)
-	{
-        super(isPrivate);
-
-		this.params = params;
-	}
-
-	public ECDomainParameters getParameters()
-	{
-		return params;
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/ECPrivateKeyParameters.java b/azureus2/src/org/bouncycastle/crypto/params/ECPrivateKeyParameters.java
deleted file mode 100644
index 3e49983..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/ECPrivateKeyParameters.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class ECPrivateKeyParameters
-    extends ECKeyParameters
-{
-    BigInteger d;
-
-    public ECPrivateKeyParameters(
-        BigInteger          d,
-        ECDomainParameters  params)
-    {
-        super(true, params);
-        this.d = d;
-    }
-
-    public BigInteger getD()
-    {
-        return d;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/ECPublicKeyParameters.java b/azureus2/src/org/bouncycastle/crypto/params/ECPublicKeyParameters.java
deleted file mode 100644
index 5fbea19..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/ECPublicKeyParameters.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.math.ec.ECPoint;
-
-public class ECPublicKeyParameters
-    extends ECKeyParameters
-{
-    ECPoint Q;
-
-    public ECPublicKeyParameters(
-        ECPoint             Q,
-        ECDomainParameters  params)
-    {
-        super(false, params);
-        this.Q = Q;
-    }
-
-    public ECPoint getQ()
-    {
-        return Q;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/ElGamalKeyGenerationParameters.java b/azureus2/src/org/bouncycastle/crypto/params/ElGamalKeyGenerationParameters.java
deleted file mode 100644
index ffcc04d..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/ElGamalKeyGenerationParameters.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.KeyGenerationParameters;
-
-public class ElGamalKeyGenerationParameters
-    extends KeyGenerationParameters
-{
-    private ElGamalParameters    params;
-
-    public ElGamalKeyGenerationParameters(
-        SecureRandom        random,
-        ElGamalParameters   params)
-    {
-        super(random, params.getP().bitLength() - 1);
-
-        this.params = params;
-    }
-
-    public ElGamalParameters getParameters()
-    {
-        return params;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/ElGamalKeyParameters.java b/azureus2/src/org/bouncycastle/crypto/params/ElGamalKeyParameters.java
deleted file mode 100644
index 3e42647..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/ElGamalKeyParameters.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-
-public class ElGamalKeyParameters
-    extends AsymmetricKeyParameter
-{
-    private ElGamalParameters    params;
-
-    protected ElGamalKeyParameters(
-        boolean         isPrivate,
-        ElGamalParameters    params)
-    {
-        super(isPrivate);
-
-        this.params = params;
-    }   
-
-    public ElGamalParameters getParameters()
-    {
-        return params;
-    }
-
-    public boolean equals(
-        Object  obj)
-    {
-        if (!(obj instanceof ElGamalKeyParameters))
-        {
-            return false;
-        }
-
-        ElGamalKeyParameters    dhKey = (ElGamalKeyParameters)obj;
-
-        return (params != null && !params.equals(dhKey.getParameters()));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/ElGamalParameters.java b/azureus2/src/org/bouncycastle/crypto/params/ElGamalParameters.java
deleted file mode 100644
index a9a0f0f..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/ElGamalParameters.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class ElGamalParameters
-    implements CipherParameters
-{
-    private BigInteger              g;
-    private BigInteger              p;
-
-    public ElGamalParameters(
-        BigInteger  p,
-        BigInteger  g)
-    {
-        this.g = g;
-        this.p = p;
-    }
-
-    public BigInteger getP()
-    {
-        return p;
-    }
-
-    /**
-     * return the generator - g
-     */
-    public BigInteger getG()
-    {
-        return g;
-    }
-
-    public boolean equals(
-        Object  obj)
-    {
-        if (!(obj instanceof ElGamalParameters))
-        {
-            return false;
-        }
-
-        ElGamalParameters    pm = (ElGamalParameters)obj;
-
-        return pm.getP().equals(p) && pm.getG().equals(g);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/ElGamalPrivateKeyParameters.java b/azureus2/src/org/bouncycastle/crypto/params/ElGamalPrivateKeyParameters.java
deleted file mode 100644
index 58c8a7a..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/ElGamalPrivateKeyParameters.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class ElGamalPrivateKeyParameters
-    extends ElGamalKeyParameters
-{
-    private BigInteger      x;
-
-    public ElGamalPrivateKeyParameters(
-        BigInteger      x,
-        ElGamalParameters    params)
-    {
-        super(true, params);
-
-        this.x = x;
-    }   
-
-    public BigInteger getX()
-    {
-        return x;
-    }
-
-    public boolean equals(
-        Object  obj)
-    {
-        if (!(obj instanceof ElGamalPrivateKeyParameters))
-        {
-            return false;
-        }
-
-        ElGamalPrivateKeyParameters  pKey = (ElGamalPrivateKeyParameters)obj;
-
-        if (!pKey.getX().equals(x))
-        {
-            return false;
-        }
-
-        return super.equals(obj);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/ElGamalPublicKeyParameters.java b/azureus2/src/org/bouncycastle/crypto/params/ElGamalPublicKeyParameters.java
deleted file mode 100644
index 83ef293..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/ElGamalPublicKeyParameters.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class ElGamalPublicKeyParameters
-    extends ElGamalKeyParameters
-{
-    private BigInteger      y;
-
-    public ElGamalPublicKeyParameters(
-        BigInteger      y,
-        ElGamalParameters    params)
-    {
-        super(false, params);
-
-        this.y = y;
-    }   
-
-    public BigInteger getY()
-    {
-        return y;
-    }
-
-    public boolean equals(
-        Object  obj)
-    {
-        if (!(obj instanceof ElGamalPublicKeyParameters))
-        {
-            return false;
-        }
-
-        ElGamalPublicKeyParameters   pKey = (ElGamalPublicKeyParameters)obj;
-
-        if (!pKey.getY().equals(y))
-        {
-            return false;
-        }
-
-        return super.equals(obj);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/IESParameters.java b/azureus2/src/org/bouncycastle/crypto/params/IESParameters.java
deleted file mode 100644
index 0600b34..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/IESParameters.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-/**
- * parameters for using an integrated cipher in stream mode.
- */
-public class IESParameters
-    implements CipherParameters
-{
-    private byte[]  derivation;
-    private byte[]  encoding;
-    private int     macKeySize;
-
-    /**
-     * @param derivation the derivation parameter for the KDF function.
-     * @param encoding the encoding parameter for the KDF function.
-     * @param macKeySize the size of the MAC key (in bits).
-     */
-    public IESParameters(
-        byte[]  derivation,
-        byte[]  encoding,
-        int     macKeySize)
-    {
-        this.derivation = derivation;
-        this.encoding = encoding;
-        this.macKeySize = macKeySize;
-    }
-
-    public byte[] getDerivationV()
-    {
-        return derivation;
-    }
-
-    public byte[] getEncodingV()
-    {
-        return encoding;
-    }
-
-    public int getMacKeySize()
-    {
-        return macKeySize;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/IESWithCipherParameters.java b/azureus2/src/org/bouncycastle/crypto/params/IESWithCipherParameters.java
deleted file mode 100644
index ef61b2c..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/IESWithCipherParameters.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-
-public class IESWithCipherParameters
-    extends IESParameters
-{
-    private int cipherKeySize;
-
-    /**
-     * @param derivation the derivation parameter for the KDF function.
-     * @param encoding the encoding parameter for the KDF function.
-     * @param macKeySize the size of the MAC key (in bits).
-     * @param cipherKeySize the size of the associated Cipher key (in bits).
-     */
-    public IESWithCipherParameters(
-        byte[]  derivation,
-        byte[]  encoding,
-        int     macKeySize,
-        int     cipherKeySize)
-    {
-        super(derivation, encoding, macKeySize);
-
-        this.cipherKeySize = cipherKeySize;
-    }
-
-    public int getCipherKeySize()
-    {
-        return cipherKeySize;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/ISO18033KDFParameters.java b/azureus2/src/org/bouncycastle/crypto/params/ISO18033KDFParameters.java
deleted file mode 100644
index 8dffe2e..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/ISO18033KDFParameters.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.DerivationParameters;
-
-/**
- * parameters for Key derivation functions for ISO-18033
- */
-public class ISO18033KDFParameters
-    implements DerivationParameters
-{
-    byte[]  seed;
-
-    public ISO18033KDFParameters(
-        byte[]  seed)
-    {
-        this.seed = seed;
-    }
-
-    public byte[] getSeed()
-    {
-        return seed;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/KDFParameters.java b/azureus2/src/org/bouncycastle/crypto/params/KDFParameters.java
deleted file mode 100644
index b27089c..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/KDFParameters.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.DerivationParameters;
-
-/**
- * parameters for Key derivation functions.
- */
-public class KDFParameters
-    implements DerivationParameters
-{
-    byte[]  iv;
-    byte[]  shared;
-
-    public KDFParameters(
-        byte[]  shared,
-        byte[]  iv)
-    {
-        this.shared = shared;
-        this.iv = iv;
-    }
-
-    public byte[] getSharedSecret()
-    {
-        return shared;
-    }
-
-    public byte[] getIV()
-    {
-        return iv;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/KeyParameter.java b/azureus2/src/org/bouncycastle/crypto/params/KeyParameter.java
deleted file mode 100644
index 5a1c39d..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/KeyParameter.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class KeyParameter
-	implements CipherParameters
-{
-    private byte[]  key;
-
-    public KeyParameter(
-        byte[]  key)
-    {
-        this(key, 0, key.length);
-    }
-
-    public KeyParameter(
-        byte[]  key,
-        int     keyOff,
-        int     keyLen)
-    {
-        this.key = new byte[keyLen];
-
-        System.arraycopy(key, keyOff, this.key, 0, keyLen);
-    }
-
-    public byte[] getKey()
-    {
-        return key;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/MGFParameters.java b/azureus2/src/org/bouncycastle/crypto/params/MGFParameters.java
deleted file mode 100644
index 8c1ea5e..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/MGFParameters.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.DerivationParameters;
-
-/**
- * parameters for mask derivation functions.
- */
-public class MGFParameters
-    implements DerivationParameters
-{
-    byte[]  seed;
-
-    public MGFParameters(
-        byte[]  seed)
-    {
-        this.seed = seed;
-    }
-
-    public MGFParameters(
-        byte[]  seed,
-        int     off,
-        int     len)
-    {
-        this.seed = new byte[len];
-        System.arraycopy(seed, off, this.seed, 0, len);
-    }
-
-    public byte[] getSeed()
-    {
-        return seed;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/ParametersWithIV.java b/azureus2/src/org/bouncycastle/crypto/params/ParametersWithIV.java
deleted file mode 100644
index 4a1e6e9..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/ParametersWithIV.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class ParametersWithIV
-    implements CipherParameters
-{
-    private byte[]              iv;
-    private CipherParameters    parameters;
-
-    public ParametersWithIV(
-        CipherParameters    parameters,
-        byte[]              iv)
-    {
-        this(parameters, iv, 0, iv.length);
-    }
-
-    public ParametersWithIV(
-        CipherParameters    parameters,
-        byte[]              iv,
-        int                 ivOff,
-        int                 ivLen)
-    {
-        this.iv = new byte[ivLen];
-        this.parameters = parameters;
-
-        System.arraycopy(iv, ivOff, this.iv, 0, ivLen);
-    }
-
-    public byte[] getIV()
-    {
-        return iv;
-    }
-
-    public CipherParameters getParameters()
-    {
-        return parameters;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/ParametersWithRandom.java b/azureus2/src/org/bouncycastle/crypto/params/ParametersWithRandom.java
deleted file mode 100644
index f8b7c82..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/ParametersWithRandom.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class ParametersWithRandom
-    implements CipherParameters
-{
-    private SecureRandom        random;
-    private CipherParameters    parameters;
-
-    public ParametersWithRandom(
-        CipherParameters    parameters,
-        SecureRandom        random)
-    {
-        this.random = random;
-        this.parameters = parameters;
-    }
-
-    public ParametersWithRandom(
-        CipherParameters    parameters)
-    {
-        this.random = null;
-        this.parameters = parameters;
-    }
-
-    public SecureRandom getRandom()
-    {
-        if (random == null)
-        {
-            random = new SecureRandom();
-        }
-        return random;
-    }
-
-    public CipherParameters getParameters()
-    {
-        return parameters;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/RC2Parameters.java b/azureus2/src/org/bouncycastle/crypto/params/RC2Parameters.java
deleted file mode 100644
index 2bfcf69..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/RC2Parameters.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class RC2Parameters
-	implements CipherParameters
-{
-    private byte[]  key;
-    private int     bits;
-
-    public RC2Parameters(
-        byte[]  key)
-    {
-        this(key, (key.length > 128) ? 1024 : (key.length * 8));
-    }
-
-    public RC2Parameters(
-        byte[]  key,
-        int     bits)
-    {
-        this.key = new byte[key.length];
-        this.bits = bits;
-
-        System.arraycopy(key, 0, this.key, 0, key.length);
-    }
-
-    public byte[] getKey()
-    {
-        return key;
-    }
-
-    public int getEffectiveKeyBits()
-    {
-        return bits;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/RC5Parameters.java b/azureus2/src/org/bouncycastle/crypto/params/RC5Parameters.java
deleted file mode 100644
index cca0c51..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/RC5Parameters.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import org.bouncycastle.crypto.CipherParameters;
-
-public class RC5Parameters
-	implements CipherParameters
-{
-    private byte[]  key;
-    private int     rounds;
-
-    public RC5Parameters(
-        byte[]  key,
-        int     rounds)
-    {
-        if (key.length > 255)
-        {
-            throw new IllegalArgumentException("RC5 key length can be no greater than 255");
-        }
-
-        this.key = new byte[key.length];
-        this.rounds = rounds;
-
-        System.arraycopy(key, 0, this.key, 0, key.length);
-    }
-
-    public byte[] getKey()
-    {
-        return key;
-    }
-
-    public int getRounds()
-    {
-        return rounds;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/RSAKeyGenerationParameters.java b/azureus2/src/org/bouncycastle/crypto/params/RSAKeyGenerationParameters.java
deleted file mode 100644
index 22db224..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/RSAKeyGenerationParameters.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.KeyGenerationParameters;
-
-public class RSAKeyGenerationParameters
-    extends KeyGenerationParameters
-{
-	private BigInteger publicExponent;
-    private int certainty;
-
-    public RSAKeyGenerationParameters(
-		BigInteger		publicExponent,
-        SecureRandom    random,
-        int             strength,
-        int             certainty)
-    {
-        super(random, strength);
-
-		this.publicExponent = publicExponent;
-        this.certainty = certainty;
-    }
-
-	public BigInteger getPublicExponent()
-	{
-		return publicExponent;
-	}
-
-    public int getCertainty()
-    {
-        return certainty;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/RSAKeyParameters.java b/azureus2/src/org/bouncycastle/crypto/params/RSAKeyParameters.java
deleted file mode 100644
index 4a2d935..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/RSAKeyParameters.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class RSAKeyParameters
-    extends AsymmetricKeyParameter
-{
-    private BigInteger      modulus;
-    private BigInteger      exponent;
-
-    public RSAKeyParameters(
-        boolean     isPrivate,
-        BigInteger  modulus,
-        BigInteger  exponent)
-    {
-        super(isPrivate);
-
-        this.modulus = modulus;
-        this.exponent = exponent;
-    }   
-
-    public BigInteger getModulus()
-    {
-        return modulus;
-    }
-
-    public BigInteger getExponent()
-    {
-        return exponent;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/RSAPrivateCrtKeyParameters.java b/azureus2/src/org/bouncycastle/crypto/params/RSAPrivateCrtKeyParameters.java
deleted file mode 100644
index b61cb5c..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/RSAPrivateCrtKeyParameters.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.bouncycastle.crypto.params;
-
-import java.math.BigInteger;
-
-public class RSAPrivateCrtKeyParameters
-    extends RSAKeyParameters
-{
-    private BigInteger  e;
-    private BigInteger  p;
-    private BigInteger  q;
-    private BigInteger  dP;
-    private BigInteger  dQ;
-    private BigInteger  qInv;
-
-    /**
-     * 
-     */
-    public RSAPrivateCrtKeyParameters(
-        BigInteger  modulus,
-        BigInteger  publicExponent,
-        BigInteger  privateExponent,
-        BigInteger  p,
-        BigInteger  q,
-        BigInteger  dP,
-        BigInteger  dQ,
-        BigInteger  qInv)
-    {
-        super(true, modulus, privateExponent);
-
-        this.e = publicExponent;
-        this.p = p;
-        this.q = q;
-        this.dP = dP;
-        this.dQ = dQ;
-        this.qInv = qInv;
-    }
-
-    public BigInteger getPublicExponent()
-    {
-        return e;
-    }
-
-    public BigInteger getP()
-    {
-        return p;
-    }
-
-    public BigInteger getQ()
-    {
-        return q;
-    }
-
-    public BigInteger getDP()
-    {
-        return dP;
-    }
-
-    public BigInteger getDQ()
-    {
-        return dQ;
-    }
-
-    public BigInteger getQInv()
-    {
-        return qInv;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/crypto/params/package.html b/azureus2/src/org/bouncycastle/crypto/params/package.html
deleted file mode 100644
index 4e00a75..0000000
--- a/azureus2/src/org/bouncycastle/crypto/params/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body bgcolor="#ffffff">
-Classes for parameter objects for ciphers and generators.
-</body>
-</html>
diff --git a/azureus2/src/org/bouncycastle/crypto/signers/ECDSASigner.java b/azureus2/src/org/bouncycastle/crypto/signers/ECDSASigner.java
deleted file mode 100644
index 1cecf7d..0000000
--- a/azureus2/src/org/bouncycastle/crypto/signers/ECDSASigner.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package org.bouncycastle.crypto.signers;
-
-import java.math.BigInteger;
-import java.security.SecureRandom;
-
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.DSA;
-import org.bouncycastle.crypto.params.ECKeyParameters;
-import org.bouncycastle.crypto.params.ECPrivateKeyParameters;
-import org.bouncycastle.crypto.params.ECPublicKeyParameters;
-import org.bouncycastle.crypto.params.ParametersWithRandom;
-import org.bouncycastle.math.ec.ECConstants;
-import org.bouncycastle.math.ec.ECPoint;
-
-/**
- * EC-DSA as described in X9.62
- */
-public class ECDSASigner
-    implements ECConstants, DSA
-{
-	ECKeyParameters key;
-
-	SecureRandom    random;
-
-	public void init(
-        boolean                 forSigning,
-        CipherParameters        param)
-	{
-        if (forSigning)
-        {
-            if (param instanceof ParametersWithRandom)
-            {
-                ParametersWithRandom    rParam = (ParametersWithRandom)param;
-
-                this.random = rParam.getRandom();
-                this.key = (ECPrivateKeyParameters)rParam.getParameters();
-            }
-            else
-            {
-                this.random = new SecureRandom();
-                this.key = (ECPrivateKeyParameters)param;
-            }
-        }
-        else
-        {
-		    this.key = (ECPublicKeyParameters)param;
-        }
-	}
-
-	// 5.3 pg 28
-    /**
-     * generate a signature for the given message using the key we were
-     * initialised with. For conventional DSA the message should be a SHA-1
-     * hash of the message of interest.
-     *
-     * @param message the message that will be verified later.
-     */
-	public BigInteger[] generateSignature(
-        byte[] message)
-	{
-		BigInteger e = new BigInteger(1, message);
-		BigInteger n = key.getParameters().getN();
-
-		BigInteger r = null;
-		BigInteger s = null;
-
-		// 5.3.2
-		do // generate s
-		{
-			BigInteger k = null;
-			int			nBitLength = n.bitLength();
-
-			do // generate r
-			{
-				do
-				{
-					k = new BigInteger(nBitLength, random);
-				}
-				while (k.equals(ZERO));
-
-				ECPoint p = key.getParameters().getG().multiply(k);
-
-				// 5.3.3
-				BigInteger x = p.getX().toBigInteger();
-
-				r = x.mod(n);
-			}
-			while ( r.equals(ZERO) );
-
-			BigInteger d = ((ECPrivateKeyParameters)key).getD();
-
-			s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n);
-		}
-		while ( s.equals(ZERO) );
-
-        BigInteger[]  res = new BigInteger[2];
-
-        res[0] = r;
-        res[1] = s;
-
-        return res;
-	}
-
-	// 5.4 pg 29
-    /**
-     * return true if the value r and s represent a DSA signature for
-     * the passed in message (for standard DSA the message should be
-     * a SHA-1 hash of the real message to be verified).
-     */
-	public boolean verifySignature(
-        byte[]      message,
-        BigInteger  r,
-        BigInteger  s)
-	{
-		BigInteger e = new BigInteger(1, message);
-		BigInteger n = key.getParameters().getN();
-
-		// r in the range [1,n-1]
-		if ( r.compareTo(ONE) < 0 || r.compareTo(n) >= 0 )
-		{
-			return false;
-		}
-
-		// s in the range [1,n-1]
-		if ( s.compareTo(ONE) < 0 || s.compareTo(n) >= 0 )
-		{
-			return false;
-		}
-
-		BigInteger c = s.modInverse(n);
-
-		BigInteger u1 = e.multiply(c).mod(n);
-		BigInteger u2 = r.multiply(c).mod(n);
-
-		ECPoint G = key.getParameters().getG();
-		ECPoint Q = ((ECPublicKeyParameters)key).getQ();
-
-		ECPoint point = G.multiply(u1).add(Q.multiply(u2));
-
-		BigInteger v = point.getX().toBigInteger().mod(n);
-
-		return v.equals(r);
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/jce/ECNamedCurveTable.java b/azureus2/src/org/bouncycastle/jce/ECNamedCurveTable.java
deleted file mode 100644
index ef80efd..0000000
--- a/azureus2/src/org/bouncycastle/jce/ECNamedCurveTable.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.bouncycastle.jce;
-
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.x9.X962NamedCurves;
-import org.bouncycastle.asn1.x9.X9ECParameters;
-import org.bouncycastle.jce.spec.ECNamedCurveParameterSpec;
-
-/**
- * a table of locally supported named curves.
- */
-public class ECNamedCurveTable
-{
-    /**
-     * return a parameter spec representing the passed in named
-     * curve. The routine returns null if the curve is not present.
-     * 
-     * @param name the name of the curve requested
-     * @return a parameter spec for the curve, null if it is not available.
-     */
-    public static ECNamedCurveParameterSpec getParameterSpec(
-        String  name)
-    {
-        X9ECParameters  ecP = X962NamedCurves.getByName(name);
-        if (ecP == null)
-        {
-            return null;
-        }
-
-        return new ECNamedCurveParameterSpec(
-                                        name,
-                                        ecP.getCurve(),
-                                        ecP.getG(),
-                                        ecP.getN(),
-                                        ecP.getH(),
-                                        ecP.getSeed());
-
-    }
-
-    /**
-     * return an enumeration of the names of the available curves.
-     *
-     * @return an enumeration of the names of the available curves.
-     */
-    public static Enumeration getNames()
-    {
-        return X962NamedCurves.getNames();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/PKCS10CertificationRequest.java b/azureus2/src/org/bouncycastle/jce/PKCS10CertificationRequest.java
deleted file mode 100644
index 36348a6..0000000
--- a/azureus2/src/org/bouncycastle/jce/PKCS10CertificationRequest.java
+++ /dev/null
@@ -1,311 +0,0 @@
-package org.bouncycastle.jce;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.security.InvalidKeyException;
-import java.security.KeyFactory;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.X509EncodedKeySpec;
-import java.util.Hashtable;
-
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1Set;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DERInputStream;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DEROutputStream;
-import org.bouncycastle.asn1.pkcs.CertificationRequest;
-import org.bouncycastle.asn1.pkcs.CertificationRequestInfo;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
-import org.bouncycastle.asn1.x509.X509Name;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-
-/**
- * A class for verifying and creating PKCS10 Certification requests. 
- * <pre>
- * CertificationRequest ::= SEQUENCE {
- *   certificationRequestInfo  CertificationRequestInfo,
- *   signatureAlgorithm        AlgorithmIdentifier{{ SignatureAlgorithms }},
- *   signature                 BIT STRING
- * }
- *
- * CertificationRequestInfo ::= SEQUENCE {
- *   version             INTEGER { v1(0) } (v1,...),
- *   subject             Name,
- *   subjectPKInfo   SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
- *   attributes          [0] Attributes{{ CRIAttributes }}
- *  }
- *
- *  Attributes { ATTRIBUTE:IOSet } ::= SET OF Attribute{{ IOSet }}
- *
- *  Attribute { ATTRIBUTE:IOSet } ::= SEQUENCE {
- *    type    ATTRIBUTE.&id({IOSet}),
- *    values  SET SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{\@type})
- *  }
- * </pre>
- */
-public class PKCS10CertificationRequest
-    extends CertificationRequest
-{
-    private static Hashtable            algorithms = new Hashtable();
-    private static Hashtable            oids = new Hashtable();
-
-    static
-    {
-        algorithms.put("MD2WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.2"));
-        algorithms.put("MD2WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.2"));
-        algorithms.put("MD5WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.4"));
-        algorithms.put("MD5WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.4"));
-        algorithms.put("RSAWITHMD5", new DERObjectIdentifier("1.2.840.113549.1.1.4"));
-        algorithms.put("SHA1WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.5"));
-        algorithms.put("SHA1WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.5"));
-        algorithms.put("RSAWITHSHA1", new DERObjectIdentifier("1.2.840.113549.1.1.5"));
-        algorithms.put("RIPEMD160WITHRSAENCRYPTION", new DERObjectIdentifier("1.3.36.3.3.1.2"));
-        algorithms.put("RIPEMD160WITHRSA", new DERObjectIdentifier("1.3.36.3.3.1.2"));
-        algorithms.put("SHA1WITHDSA", new DERObjectIdentifier("1.2.840.10040.4.3"));
-        algorithms.put("DSAWITHSHA1", new DERObjectIdentifier("1.2.840.10040.4.3"));
-        algorithms.put("SHA1WITHECDSA", new DERObjectIdentifier("1.2.840.10045.4.1"));
-        algorithms.put("ECDSAWITHSHA1", new DERObjectIdentifier("1.2.840.10045.4.1"));
-
-        //
-        // reverse mappings
-        //
-        oids.put(new DERObjectIdentifier("1.2.840.113549.1.1.5"), "SHA1WITHRSA");
-        oids.put(new DERObjectIdentifier("1.2.840.113549.1.1.4"), "MD5WITHRSA");
-        oids.put(new DERObjectIdentifier("1.2.840.113549.1.1.2"), "MD2WITHRSA");
-        oids.put(new DERObjectIdentifier("1.2.840.10040.4.3"), "DSAWITHSHA1");
-    }
-
-    private static ASN1Sequence toDERSequence(
-        byte[]  bytes)
-    {
-        try
-        {
-            ByteArrayInputStream    bIn = new ByteArrayInputStream(bytes);
-            DERInputStream          dIn = new DERInputStream(bIn);
-
-            return (ASN1Sequence)dIn.readObject();
-        }
-        catch (Exception e)
-        {
-            throw new IllegalArgumentException("badly encoded request");
-        }
-    }
-
-    /**
-     * construct a PKCS10 certification request from a DER encoded
-     * byte stream.
-     */
-    public PKCS10CertificationRequest(
-        byte[]  bytes)
-    {
-        super(toDERSequence(bytes));
-    }
-
-    public PKCS10CertificationRequest(
-        ASN1Sequence  sequence)
-    {
-        super(sequence);
-    }
-
-    /**
-     * create a PKCS10 certfication request using the BC provider.
-     */
-    public PKCS10CertificationRequest(
-        String              signatureAlgorithm,
-        X509Name            subject,
-        PublicKey           key,
-        ASN1Set             attributes,
-        PrivateKey          signingKey)
-        throws NoSuchAlgorithmException, NoSuchProviderException,
-                InvalidKeyException, SignatureException
-    {
-        this(signatureAlgorithm, subject, key, attributes, signingKey, BouncyCastleProvider.PROVIDER_NAME);
-    }
-
-    /**
-     * create a PKCS10 certfication request using the named provider.
-     */
-    public PKCS10CertificationRequest(
-        String              signatureAlgorithm,
-        X509Name            subject,
-        PublicKey           key,
-        ASN1Set             attributes,
-        PrivateKey          signingKey,
-        String              provider)
-        throws NoSuchAlgorithmException, NoSuchProviderException,
-                InvalidKeyException, SignatureException
-    {
-        DERObjectIdentifier sigOID = (DERObjectIdentifier)algorithms.get(signatureAlgorithm.toUpperCase());
-
-        if (sigOID == null)
-        {
-            throw new IllegalArgumentException("Unknown signature type requested");
-        }
-
-        if (subject == null)
-        {
-            throw new IllegalArgumentException("subject must not be null");
-        }
-
-        if (key == null)
-        {
-            throw new IllegalArgumentException("public key must not be null");
-        }
-
-        this.sigAlgId = new AlgorithmIdentifier(sigOID, null);
-
-        byte[]                  bytes = key.getEncoded();
-        ByteArrayInputStream    bIn = new ByteArrayInputStream(bytes);
-        DERInputStream          dIn = new DERInputStream(bIn);
-
-        try
-        {
-            this.reqInfo = new CertificationRequestInfo(subject, new SubjectPublicKeyInfo((ASN1Sequence)dIn.readObject()), attributes);
-        }
-        catch (IOException e)
-        {
-            throw new IllegalArgumentException("can't encode public key");
-        }
-
-        Signature sig = null;
-        
-        try
-        {
-            sig = Signature.getInstance(sigAlgId.getObjectId().getId(), provider);
-        }
-        catch (NoSuchAlgorithmException e)
-        {
-            sig = Signature.getInstance(signatureAlgorithm, provider);
-        }
-
-        sig.initSign(signingKey);
-
-        try
-        {
-            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-            DEROutputStream         dOut = new DEROutputStream(bOut);
-
-            dOut.writeObject(reqInfo);
-
-            sig.update(bOut.toByteArray());
-        }
-        catch (Exception e)
-        {
-            throw new SecurityException("exception encoding TBS cert request - " + e);
-        }
-
-        this.sigBits = new DERBitString(sig.sign());
-    }
-
-    /**
-     * return the public key associated with the certification request -
-     * the public key is created using the BC provider.
-     */
-    public PublicKey getPublicKey()
-        throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
-    {
-        return getPublicKey(BouncyCastleProvider.PROVIDER_NAME);
-    }
-
-    public PublicKey getPublicKey(
-        String  provider)
-        throws NoSuchAlgorithmException, NoSuchProviderException,
-                InvalidKeyException
-    {
-        SubjectPublicKeyInfo    subjectPKInfo = reqInfo.getSubjectPublicKeyInfo();
-
-        try
-        {
-            X509EncodedKeySpec      xspec = new X509EncodedKeySpec(new DERBitString(subjectPKInfo).getBytes());
-            AlgorithmIdentifier     keyAlg = subjectPKInfo.getAlgorithmId ();
-
-            return KeyFactory.getInstance(keyAlg.getObjectId().getId (), provider).generatePublic(xspec);
-        }
-        catch (InvalidKeySpecException e)
-        {
-            throw new InvalidKeyException("error encoding public key");
-        }
-    }
-
-    /**
-     * verify the request using the BC provider.
-     */
-    public boolean verify()
-        throws NoSuchAlgorithmException, NoSuchProviderException,
-                InvalidKeyException, SignatureException
-    {
-        return verify(BouncyCastleProvider.PROVIDER_NAME);
-    }
-
-    public boolean verify(
-        String provider)
-        throws NoSuchAlgorithmException, NoSuchProviderException,
-                InvalidKeyException, SignatureException
-    {
-        Signature   sig = null;
-
-        try
-        {
-            sig = Signature.getInstance(sigAlgId.getObjectId().getId(), provider);
-        }
-        catch (NoSuchAlgorithmException e)
-        {
-            //
-            // try an alternate
-            //
-            if (oids.get(sigAlgId.getObjectId().getId()) != null)
-            {
-                String  signatureAlgorithm = (String)oids.get(sigAlgId.getObjectId().getId());
-
-                sig = Signature.getInstance(signatureAlgorithm, provider);
-            }
-        }
-
-        sig.initVerify(this.getPublicKey(provider));
-
-        try
-        {
-            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-            DEROutputStream         dOut = new DEROutputStream(bOut);
-
-            dOut.writeObject(reqInfo);
-
-            sig.update(bOut.toByteArray());
-        }
-        catch (Exception e)
-        {
-            throw new SecurityException("exception encoding TBS cert request - " + e);
-        }
-
-        return sig.verify(sigBits.getBytes());
-    }
-
-    /**
-     * return a DER encoded byte array representing this object
-     */
-    public byte[] getEncoded()
-    {
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-        DEROutputStream         dOut = new DEROutputStream(bOut);
-
-        try
-        {
-            dOut.writeObject(this);
-        }
-        catch (IOException e)
-        {
-            throw new RuntimeException(e.toString());
-        }
-
-        return bOut.toByteArray();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/PKCS7SignedData.java b/azureus2/src/org/bouncycastle/jce/PKCS7SignedData.java
deleted file mode 100644
index d7bf42d..0000000
--- a/azureus2/src/org/bouncycastle/jce/PKCS7SignedData.java
+++ /dev/null
@@ -1,597 +0,0 @@
-package org.bouncycastle.jce;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.PrivateKey;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.cert.CRL;
-import java.security.cert.CRLException;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.X509CRL;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.bouncycastle.asn1.*;
-import org.bouncycastle.asn1.pkcs.ContentInfo;
-import org.bouncycastle.asn1.pkcs.IssuerAndSerialNumber;
-import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-import org.bouncycastle.asn1.pkcs.SignedData;
-import org.bouncycastle.asn1.pkcs.SignerInfo;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-import org.bouncycastle.asn1.x509.CertificateList;
-import org.bouncycastle.asn1.x509.X509CertificateStructure;
-import org.bouncycastle.asn1.x509.X509Name;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.bouncycastle.jce.provider.X509CRLObject;
-import org.bouncycastle.jce.provider.X509CertificateObject;
-
-/**
- * Represents a PKCS#7 object - specifically the "Signed Data"
- * type.
- * <p>
- * How to use it? To verify a signature, do:
- * <pre>
- * PKCS7SignedData pkcs7 = new PKCS7SignedData(der_bytes);		// Create it
- * pkcs7.update(bytes, 0, bytes.length);	// Update checksum
- * boolean verified = pkcs7.verify();		// Does it add up?
- *
- * To sign, do this:
- * PKCS7SignedData pkcs7 = new PKCS7SignedData(privKey, certChain, "MD5");
- * pkcs7.update(bytes, 0, bytes.length);	// Update checksum
- * pkcs7.sign();				// Create digest
- *
- * bytes = pkcs7.getEncoded();			// Write it somewhere
- * </pre>
- * <p>
- * This class is pretty close to obsolete, for a much better (and more complete)
- * implementation of PKCS7 have a look at the org.bouncycastle.cms package.
- */
-public class PKCS7SignedData
-    implements PKCSObjectIdentifiers
-{
-    private int version, signerversion;
-    private Set digestalgos;
-    private Collection certs, crls;
-    private X509Certificate signCert;
-    private byte[] digest;
-    private String digestAlgorithm, digestEncryptionAlgorithm;
-    private Signature sig;
-    private transient PrivateKey privKey;
-
-    private final String ID_PKCS7_DATA = "1.2.840.113549.1.7.1";
-    private final String ID_PKCS7_SIGNED_DATA = "1.2.840.113549.1.7.2";
-    private final String ID_MD5 = "1.2.840.113549.2.5";
-    private final String ID_MD2 = "1.2.840.113549.2.2";
-    private final String ID_SHA1 = "1.3.14.3.2.26";
-    private final String ID_RSA = "1.2.840.113549.1.1.1";
-    private final String ID_DSA = "1.2.840.10040.4.1";
-
-    /**
-     * Read an existing PKCS#7 object from a DER encoded byte array using
-     * the BC provider.
-     */
-    public PKCS7SignedData(
-        byte[]  in)
-        throws SecurityException, CRLException, InvalidKeyException,
-        CertificateException, NoSuchProviderException, NoSuchAlgorithmException
-    {
-        this(in, BouncyCastleProvider.PROVIDER_NAME);
-    }
-
-    /**
-     * Read an existing PKCS#7 object from a DER encoded byte array 
-     */
-    public PKCS7SignedData(
-        byte[]  in,
-        String  provider)
-        throws SecurityException, CRLException, InvalidKeyException,
-        CertificateException, NoSuchProviderException, NoSuchAlgorithmException
-    {
-        DERInputStream din = new DERInputStream(new ByteArrayInputStream(in));
-
-        //
-        // Basic checks to make sure it's a PKCS#7 SignedData Object
-        //
-        DERObject pkcs;
-
-        try
-        {
-            pkcs = din.readObject();
-        }
-        catch (IOException e)
-        {
-            throw new SecurityException("can't decode PKCS7SignedData object");
-        }
-
-        if (!(pkcs instanceof ASN1Sequence))
-        {
-            throw new SecurityException("Not a valid PKCS#7 object - not a sequence");
-        }
-
-        ContentInfo content = ContentInfo.getInstance(pkcs);
-
-        if (!content.getContentType().equals(signedData))
-        {
-            throw new SecurityException("Not a valid PKCS#7 signed-data object - wrong header " + content.getContentType().getId());
-        }
-
-
-        SignedData  data = SignedData.getInstance(content.getContent());
-
-        certs = new ArrayList();
-
-        if (data.getCertificates() != null)
-        {
-            Enumeration ec = ASN1Set.getInstance(data.getCertificates()).getObjects();
-
-            while (ec.hasMoreElements())
-            {
-                certs.add(new X509CertificateObject(X509CertificateStructure.getInstance(ec.nextElement())));
-            }
-        }
-
-        crls = new ArrayList();
-
-        if (data.getCRLs() != null)
-        {
-            Enumeration ec = ASN1Set.getInstance(data.getCRLs()).getObjects();
-            while (ec.hasMoreElements())
-            {
-                crls.add(new X509CRLObject(CertificateList.getInstance(ec.nextElement())));
-            }
-        }
-
-        version = data.getVersion().getValue().intValue();
-
-        //
-        // Get the digest algorithm
-        //
-        digestalgos = new HashSet();
-        Enumeration e = data.getDigestAlgorithms().getObjects();
-
-        while (e.hasMoreElements())
-        {
-            ASN1Sequence s = (ASN1Sequence)e.nextElement();
-            DERObjectIdentifier o = (DERObjectIdentifier)s.getObjectAt(0);
-            digestalgos.add(o.getId());
-        }
-
-        //
-        // Get the SignerInfo
-        //
-        ASN1Set signerinfos = data.getSignerInfos();
-        if (signerinfos.size() != 1)
-        {
-            throw new SecurityException("This PKCS#7 object has multiple SignerInfos - only one is supported at this time");
-        }
-
-        SignerInfo signerInfo = SignerInfo.getInstance(signerinfos.getObjectAt(0));
-
-        signerversion = signerInfo.getVersion().getValue().intValue();
-
-        IssuerAndSerialNumber isAnds = signerInfo.getIssuerAndSerialNumber();
-
-        //
-        // Get the signing certificate
-        //
-        BigInteger      serialNumber = isAnds.getCertificateSerialNumber().getValue();
-        X509Principal   issuer = new X509Principal(isAnds.getName());
-
-        for (Iterator i = certs.iterator();i.hasNext();)
-        {
-            X509Certificate cert = (X509Certificate)i.next();
-            if (serialNumber.equals(cert.getSerialNumber())
-                    && issuer.equals(cert.getIssuerDN()))
-            {
-                signCert = cert;
-                break;
-            }
-        }
-
-        if (signCert == null)
-        {
-            throw new SecurityException("Can't find signing certificate with serial "+serialNumber.toString(16)); 
-        }
-
-        digestAlgorithm = signerInfo.getDigestAlgorithm().getObjectId().getId();
-
-        digest = signerInfo.getEncryptedDigest().getOctets();
-        digestEncryptionAlgorithm = signerInfo.getDigestEncryptionAlgorithm().getObjectId().getId();
-
-        sig = Signature.getInstance(getDigestAlgorithm(), provider);
-
-        sig.initVerify(signCert.getPublicKey());
-    }
-
-    /**
-     * Create a new PKCS#7 object from the specified key using the BC provider.
-     *
-     * @param the private key to be used for signing.
-     * @param the certifiacate chain associated with the private key.
-     * @param hashAlgorithm the hashing algorithm used to compute the message digest. Must be "MD5", "MD2", "SHA1" or "SHA"
-     */
-    public PKCS7SignedData(
-        PrivateKey      privKey,
-        Certificate[]   certChain,
-        String          hashAlgorithm)
-        throws SecurityException, InvalidKeyException,
-        NoSuchProviderException, NoSuchAlgorithmException
-    {
-        this(privKey, certChain, hashAlgorithm, BouncyCastleProvider.PROVIDER_NAME);
-    }
-
-    /**
-     * Create a new PKCS#7 object from the specified key.
-     *
-     * @param privKey the private key to be used for signing.
-     * @param certChain the certificate chain associated with the private key.
-     * @param hashAlgorithm the hashing algorithm used to compute the message digest. Must be "MD5", "MD2", "SHA1" or "SHA"
-     * @param provider the provider to use.
-     */
-    public PKCS7SignedData(
-        PrivateKey      privKey,
-        Certificate[]   certChain,
-        String          hashAlgorithm,
-        String          provider)
-        throws SecurityException, InvalidKeyException,
-        NoSuchProviderException, NoSuchAlgorithmException
-    {
-        this(privKey, certChain, null, hashAlgorithm, provider);
-    }
-
-    /**
-     * Create a new PKCS#7 object from the specified key.
-     *
-     * @param privKey the private key to be used for signing.
-     * @param certChain the certificate chain associated with the private key.
-     * @param crlList the crl list associated with the private key.
-     * @param hashAlgorithm the hashing algorithm used to compute the message digest. Must be "MD5", "MD2", "SHA1" or "SHA"
-     * @param provider the provider to use.
-     */
-    public PKCS7SignedData(
-        PrivateKey      privKey,
-        Certificate[]   certChain,
-        CRL[]           crlList,
-        String          hashAlgorithm,
-        String          provider)
-        throws SecurityException, InvalidKeyException,
-        NoSuchProviderException, NoSuchAlgorithmException
-    {
-        this.privKey = privKey;
-
-        if (hashAlgorithm.equals("MD5"))
-        {
-            digestAlgorithm = ID_MD5;
-        }
-        else if (hashAlgorithm.equals("MD2"))
-        {
-            digestAlgorithm = ID_MD2;
-        }
-        else if (hashAlgorithm.equals("SHA"))
-        {
-            digestAlgorithm = ID_SHA1;
-        }
-        else if (hashAlgorithm.equals("SHA1"))
-        {
-            digestAlgorithm = ID_SHA1;
-        }
-        else
-        {
-            throw new NoSuchAlgorithmException("Unknown Hash Algorithm "+hashAlgorithm);
-        }
-
-        version = signerversion = 1;
-        certs = new ArrayList();
-        crls = new ArrayList();
-        digestalgos = new HashSet();
-        digestalgos.add(digestAlgorithm);
-
-        //
-        // Copy in the certificates and crls used to sign the private key.
-        //
-        signCert = (X509Certificate)certChain[0];
-        for (int i = 0;i < certChain.length;i++)
-        {
-            certs.add(certChain[i]);
-        }
-
-        if (crlList != null)
-        {
-            for (int i = 0;i < crlList.length;i++)
-            {
-                crls.add(crlList[i]);
-            }
-        }
-
-        //
-        // Now we have private key, find out what the digestEncryptionAlgorithm is.
-        //
-        digestEncryptionAlgorithm = privKey.getAlgorithm();
-        if (digestEncryptionAlgorithm.equals("RSA"))
-        {
-            digestEncryptionAlgorithm = ID_RSA;
-        }
-        else if (digestEncryptionAlgorithm.equals("DSA"))
-        {
-            digestEncryptionAlgorithm = ID_DSA;
-        }
-        else
-        {
-            throw new NoSuchAlgorithmException("Unknown Key Algorithm "+digestEncryptionAlgorithm);
-        }
-
-        sig = Signature.getInstance(getDigestAlgorithm(), provider);
-
-        sig.initSign(privKey);
-    }
-
-    /**
-     * Get the algorithm used to calculate the message digest
-     */
-    public String getDigestAlgorithm()
-    {
-        String da = digestAlgorithm;
-        String dea = digestEncryptionAlgorithm;
-
-        if (digestAlgorithm.equals(ID_MD5))
-        {
-            da = "MD5";
-        }
-	    else if (digestAlgorithm.equals(ID_MD2))
-        {
-            da = "MD2";
-        }
-	    else if (digestAlgorithm.equals(ID_SHA1))
-        {
-            da = "SHA1";
-        }
-
-        if (digestEncryptionAlgorithm.equals(ID_RSA))
-        {
-            dea = "RSA";
-        }
-	    else if (digestEncryptionAlgorithm.equals(ID_DSA))
-        {
-            dea = "DSA";
-        }
-
-        return da + "with" + dea;
-    }
-
-    /**
-     * Resets the PKCS7SignedData object to it's initial state, ready
-     * to sign or verify a new buffer.
-     */
-    public void reset()
-    {
-        try
-        {
-            if (privKey==null)
-            {
-                sig.initVerify(signCert.getPublicKey());
-            }
-            else
-            {
-                sig.initSign(privKey);
-            }
-        }
-        catch (Exception e)
-        {
-            throw new RuntimeException(e.toString());
-        }
-    }
-
-    /**
-     * Get the X.509 certificates associated with this PKCS#7 object
-     */
-    public Certificate[] getCertificates()
-    {
-        return (X509Certificate[])certs.toArray(new X509Certificate[certs.size()]);
-    }
-
-    /**
-     * Get the X.509 certificate revocation lists associated with this PKCS#7 object
-     */
-    public Collection getCRLs()
-    {
-        return crls;
-    }
-    
-    /**
-     * Get the X.509 certificate actually used to sign the digest.
-     */
-    public X509Certificate getSigningCertificate()
-    {
-        return signCert;
-    }
-
-    /**
-     * Get the version of the PKCS#7 object. Always 1
-     */
-    public int getVersion()
-    {
-        return version;
-    }
-
-    /**
-     * Get the version of the PKCS#7 "SignerInfo" object. Always 1
-     */
-    public int getSigningInfoVersion()
-    {
-        return signerversion;
-    }
-
-    /**
-     * Update the digest with the specified byte. This method is used both for signing and verifying
-     */
-    public void update(byte buf)
-        throws SignatureException
-    {
-        sig.update(buf);
-    }
-
-    /**
-     * Update the digest with the specified bytes. This method is used both for signing and verifying
-     */
-    public void update(byte[] buf, int off, int len)
-        throws SignatureException
-    {
-        sig.update(buf, off, len);
-    }
-
-    /**
-     * Verify the digest
-     */
-    public boolean verify()
-        throws SignatureException
-    {
-        return sig.verify(digest);
-    }
-
-    /**
-     * Get the "issuer" from the TBSCertificate bytes that are passed in
-     */
-    private DERObject getIssuer(byte[] enc)
-    {
-        try
-        {
-            DERInputStream in = new DERInputStream(new ByteArrayInputStream(enc));
-            ASN1Sequence seq = (ASN1Sequence)in.readObject();
-            return (DERObject)seq.getObjectAt(seq.getObjectAt(0) instanceof DERTaggedObject ? 3 : 2);
-        }
-        catch (IOException e)
-        {
-            throw new Error("IOException reading from ByteArray: "+e);
-	    }
-    }
-
-    /**
-     * return the bytes for the PKCS7SignedData object.
-     */
-    public byte[] getEncoded()
-    {
-        try
-        {
-        
-            digest = sig.sign();
-
-            // Create the set of Hash algorithms. I've assumed this is the
-            // set of all hash agorithms used to created the digest in the
-            // "signerInfo" structure. I may be wrong.
-            //
-            ASN1EncodableVector v = new ASN1EncodableVector();
-            for (Iterator i = digestalgos.iterator(); i.hasNext();)
-            {
-                AlgorithmIdentifier a = new AlgorithmIdentifier(
-                            new DERObjectIdentifier((String)i.next()),
-                            null);
-                
-                v.add(a);
-            }
-
-            DERSet algos = new DERSet(v);
-
-            // Create the contentInfo. Empty, I didn't implement this bit
-            //
-            DERSequence contentinfo = new DERSequence(
-                                        new DERObjectIdentifier(ID_PKCS7_DATA));
-
-            // Get all the certificates
-            //
-            v = new ASN1EncodableVector();
-            for (Iterator i = certs.iterator();i.hasNext();)
-            {
-                DERInputStream tempstream = new DERInputStream(new ByteArrayInputStream(((X509Certificate)i.next()).getEncoded()));
-                v.add(tempstream.readObject());
-            }
-
-            DERSet dercertificates = new DERSet(v);
-
-            // Create signerinfo structure.
-            //
-            ASN1EncodableVector signerinfo = new ASN1EncodableVector();
-
-            // Add the signerInfo version
-            //
-            signerinfo.add(new DERInteger(signerversion));
-
-            IssuerAndSerialNumber isAnds = new IssuerAndSerialNumber(
-                        new X509Name((ASN1Sequence)getIssuer(signCert.getTBSCertificate())),
-                        new DERInteger(signCert.getSerialNumber()));
-            signerinfo.add(isAnds);
-
-            // Add the digestAlgorithm
-            //
-            signerinfo.add(new AlgorithmIdentifier(
-                                new DERObjectIdentifier(digestAlgorithm),
-                                new DERNull()));
-
-            //
-            // Add the digestEncryptionAlgorithm
-            //
-            signerinfo.add(new AlgorithmIdentifier(
-                                new DERObjectIdentifier(digestEncryptionAlgorithm),
-                                new DERNull()));
-
-            //
-            // Add the digest
-            //
-            signerinfo.add(new DEROctetString(digest));
-
-
-            //
-            // Finally build the body out of all the components above
-            //
-            ASN1EncodableVector body = new ASN1EncodableVector();
-            body.add(new DERInteger(version));
-            body.add(algos);
-            body.add(contentinfo);
-            body.add(new DERTaggedObject(false, 0, dercertificates));
-
-            if (crls.size()>0) {
-                v = new ASN1EncodableVector();
-                for (Iterator i = crls.iterator();i.hasNext();) {
-                    DERInputStream t = new DERInputStream(new ByteArrayInputStream((((X509CRL)i.next()).getEncoded())));
-                    v.add(t.readObject());
-                }
-                DERSet dercrls = new DERSet(v);
-                body.add(new DERTaggedObject(false, 1, dercrls));
-            }
-
-            // Only allow one signerInfo
-            //
-            body.add(new DERSet(new DERSequence(signerinfo)));
-
-            // Now we have the body, wrap it in it's PKCS7Signed shell
-            // and return it
-            //
-            ASN1EncodableVector whole = new ASN1EncodableVector();
-            whole.add(new DERObjectIdentifier(ID_PKCS7_SIGNED_DATA));
-            whole.add(new DERTaggedObject(0, new DERSequence(body)));
-
-            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-
-            DEROutputStream dout = new DEROutputStream(bOut);
-            dout.writeObject(new DERSequence(whole));
-            dout.close();
-
-            return bOut.toByteArray();
-        }
-        catch (Exception e)
-        {
-            throw new RuntimeException(e.toString());
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/PrincipalUtil.java b/azureus2/src/org/bouncycastle/jce/PrincipalUtil.java
deleted file mode 100644
index 0ccaf2c..0000000
--- a/azureus2/src/org/bouncycastle/jce/PrincipalUtil.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package org.bouncycastle.jce;
-
-import java.io.*;
-import java.security.cert.*;
-
-import org.bouncycastle.asn1.*;
-import org.bouncycastle.asn1.x509.*;
-
-/**
- * a utility class that will extract X509Principal objects from X.509 certificates.
- */
-public class PrincipalUtil
-{
-    /**
-     * return the issuer of the given cert as an X509PrincipalObject.
-     */
-    public static X509Principal getIssuerX509Principal(
-        X509Certificate cert)
-        throws CertificateEncodingException
-    {
-        try
-        {
-            ByteArrayInputStream    bIn = new ByteArrayInputStream(
-                cert.getTBSCertificate());
-            ASN1InputStream         aIn = new ASN1InputStream(bIn);
-            TBSCertificateStructure tbsCert = new TBSCertificateStructure(
-                                            (ASN1Sequence)aIn.readObject());
-
-            return new X509Principal(tbsCert.getIssuer());
-        }
-        catch (IOException e)
-        {
-            throw new CertificateEncodingException(e.toString());
-        }
-    }
-
-    /**
-     * return the subject of the given cert as an X509PrincipalObject.
-     */
-    public static X509Principal getSubjectX509Principal(
-        X509Certificate cert)
-        throws CertificateEncodingException
-    {
-        try
-        {
-            ByteArrayInputStream    bIn = new ByteArrayInputStream(
-                cert.getTBSCertificate());
-            ASN1InputStream         aIn = new ASN1InputStream(bIn);
-            TBSCertificateStructure tbsCert = new TBSCertificateStructure(
-                                            (ASN1Sequence)aIn.readObject());
-
-            return new X509Principal(tbsCert.getSubject());
-        }
-        catch (IOException e)
-        {
-            throw new CertificateEncodingException(e.toString());
-        }
-    }
-    
-	/**
-	 * return the issuer of the given CRL as an X509PrincipalObject.
-	 */
-	public static X509Principal getIssuerX509Principal(
-		X509CRL crl)
-		throws CRLException
-	{
-		try
-		{
-			ByteArrayInputStream    bIn = new ByteArrayInputStream(
-				crl.getTBSCertList());
-			ASN1InputStream         aIn = new ASN1InputStream(bIn);
-			TBSCertList tbsCertList = new TBSCertList(
-											(ASN1Sequence)aIn.readObject());
-
-			return new X509Principal(tbsCertList.getIssuer());
-		}
-		catch (IOException e)
-		{
-			throw new CRLException(e.toString());
-		}
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/jce/X509KeyUsage.java b/azureus2/src/org/bouncycastle/jce/X509KeyUsage.java
deleted file mode 100644
index 11a7f64..0000000
--- a/azureus2/src/org/bouncycastle/jce/X509KeyUsage.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.bouncycastle.jce;
-
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.x509.KeyUsage;
-
-/**
- * A holding class for constructing an X509 Key Usage extension.
- *
- * <pre>
- *    id-ce-keyUsage OBJECT IDENTIFIER ::=  { id-ce 15 }
- *
- *    KeyUsage ::= BIT STRING {
- *         digitalSignature        (0),
- *         nonRepudiation          (1),
- *         keyEncipherment         (2),
- *         dataEncipherment        (3),
- *         keyAgreement            (4),
- *         keyCertSign             (5),
- *         cRLSign                 (6),
- *         encipherOnly            (7),
- *         decipherOnly            (8) }
- * </pre>
- */
-public class X509KeyUsage
-    implements DEREncodable
-{
-    public static final int        digitalSignature = (1 << 7); 
-    public static final int        nonRepudiation   = (1 << 6);
-    public static final int        keyEncipherment  = (1 << 5);
-    public static final int        dataEncipherment = (1 << 4);
-    public static final int        keyAgreement     = (1 << 3);
-    public static final int        keyCertSign      = (1 << 2);
-    public static final int        cRLSign          = (1 << 1);
-    public static final int        encipherOnly     = (1 << 0);
-    public static final int        decipherOnly     = (1 << 15);
-
-    private int usage = 0;
-
-    /**
-     * Basic constructor.
-     * 
-     * @param usage - the bitwise OR of the Key Usage flags giving the
-     * allowed uses for the key.
-     * e.g. (X509KeyUsage.keyEncipherment | X509KeyUsage.dataEncipherment)
-     */
-    public X509KeyUsage(
-        int usage)
-    {
-        this.usage = usage;
-    }
-
-    public DERObject getDERObject()
-    {
-        return new KeyUsage(usage);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/X509Principal.java b/azureus2/src/org/bouncycastle/jce/X509Principal.java
deleted file mode 100644
index 3cdd548..0000000
--- a/azureus2/src/org/bouncycastle/jce/X509Principal.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package org.bouncycastle.jce;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.security.Principal;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import org.bouncycastle.asn1.ASN1InputStream;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DEROutputStream;
-import org.bouncycastle.asn1.x509.X509Name;
-
-public class X509Principal
-    extends X509Name
-    implements Principal
-{
-    /**
-     * Constructor from an encoded byte array.
-     */
-    public X509Principal(
-        byte[]  bytes)
-        throws IOException
-    {
-        super((ASN1Sequence)(new ASN1InputStream(new ByteArrayInputStream(bytes)).readObject()));
-    }
-
-    /**
-     * Constructor from an X509Name object.
-     */
-    public X509Principal(
-        X509Name  name)
-    {
-        super((ASN1Sequence)name.getDERObject());
-    }
-
-    /**
-     * constructor from a table of attributes.
-     * <p>
-     * it's is assumed the table contains OID/String pairs.
-     */
-    public X509Principal(
-        Hashtable  attributes)
-    {
-        super(attributes);
-    }
-
-    /**
-     * constructor from a table of attributes and a vector giving the
-     * specific ordering required for encoding or conversion to a string.
-     * <p>
-     * it's is assumed the table contains OID/String pairs.
-     */
-    public X509Principal(
-        Vector      ordering,
-        Hashtable   attributes)
-    {
-        super(ordering, attributes);
-    }
-
-    /**
-     * constructor from a vector of attribute values and a vector of OIDs.
-     */
-    public X509Principal(
-        Vector      oids,
-        Vector      values)
-    {
-        super(oids, values);
-    }
-
-    /**
-     * takes an X509 dir name as a string of the format "C=AU,ST=Victoria", or
-     * some such, converting it into an ordered set of name attributes.
-     */
-    public X509Principal(
-        String  dirName)
-    {
-        super(dirName);
-    }
-
-    /**
-     * Takes an X509 dir name as a string of the format "C=AU,ST=Victoria", or
-     * some such, converting it into an ordered set of name attributes. If reverse
-     * is false the dir name will be encoded in the order of the (name, value) pairs 
-     * presented, otherwise the encoding will start with the last (name, value) pair
-     * and work back.
-     */
-    public X509Principal(
-        boolean reverse,
-        String  dirName)
-    {
-        super(reverse, dirName);
-    }
-
-    /**
-     * Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or
-     * some such, converting it into an ordered set of name attributes. lookUp 
-     * should provide a table of lookups, indexed by lowercase only strings and
-     * yielding a DERObjectIdentifier, other than that OID. and numeric oids
-     * will be processed automatically.
-     * <p>
-     * If reverse is true, create the encoded version of the sequence starting
-     * from the last element in the string.
-     */
-    public X509Principal(
-        boolean     reverse,
-        Hashtable   lookUp,
-        String      dirName)
-    {
-        super(reverse, lookUp, dirName);
-    }
-
-    public String getName()
-    {
-        return this.toString();
-    }
-
-    /**
-     * return a DER encoded byte array representing this object
-     */
-    public byte[] getEncoded()
-    {
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-        DEROutputStream         dOut = new DEROutputStream(bOut);
-
-        try
-        {
-            dOut.writeObject(this);
-        }
-        catch (IOException e)
-        {
-            throw new RuntimeException(e.toString());
-        }
-
-        return bOut.toByteArray();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/X509V1CertificateGenerator.java b/azureus2/src/org/bouncycastle/jce/X509V1CertificateGenerator.java
deleted file mode 100644
index 6060cc7..0000000
--- a/azureus2/src/org/bouncycastle/jce/X509V1CertificateGenerator.java
+++ /dev/null
@@ -1,261 +0,0 @@
-package org.bouncycastle.jce;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.math.BigInteger;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.SecureRandom;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.cert.X509Certificate;
-import java.util.Date;
-import java.util.Hashtable;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DERInputStream;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERNull;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DEROutputStream;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
-import org.bouncycastle.asn1.x509.TBSCertificateStructure;
-import org.bouncycastle.asn1.x509.Time;
-import org.bouncycastle.asn1.x509.V1TBSCertificateGenerator;
-import org.bouncycastle.asn1.x509.X509CertificateStructure;
-import org.bouncycastle.asn1.x509.X509Name;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.bouncycastle.jce.provider.X509CertificateObject;
-
-/**
- * class to produce an X.509 Version 1 certificate.
- */
-public class X509V1CertificateGenerator
-{
-    private V1TBSCertificateGenerator   tbsGen;
-    private DERObjectIdentifier         sigOID;
-    private AlgorithmIdentifier         sigAlgId;
-    private String                      signatureAlgorithm;
-
-    private static Hashtable            algorithms = new Hashtable();
-
-    static
-    {
-		algorithms.put("MD2WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.2"));
-		algorithms.put("MD2WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.2"));
-		algorithms.put("MD5WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.4"));
-		algorithms.put("MD5WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.4"));
-		algorithms.put("SHA1WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.5"));
-		algorithms.put("SHA1WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.5"));
-		algorithms.put("RIPEMD160WITHRSAENCRYPTION", new DERObjectIdentifier("1.3.36.3.3.1.2"));
-		algorithms.put("RIPEMD160WITHRSA", new DERObjectIdentifier("1.3.36.3.3.1.2"));
-		algorithms.put("SHA1WITHDSA", new DERObjectIdentifier("1.2.840.10040.4.3"));
-		algorithms.put("DSAWITHSHA1", new DERObjectIdentifier("1.2.840.10040.4.3"));
-		algorithms.put("SHA1WITHECDSA", new DERObjectIdentifier("1.2.840.10045.4.1"));
-		algorithms.put("ECDSAWITHSHA1", new DERObjectIdentifier("1.2.840.10045.4.1"));
-    }
-
-    public X509V1CertificateGenerator()
-    {
-        tbsGen = new V1TBSCertificateGenerator();
-    }
-
-    /**
-     * reset the generator
-     */
-    public void reset()
-    {
-        tbsGen = new V1TBSCertificateGenerator();
-    }
-
-    /**
-     * set the serial number for the certificate.
-     */
-    public void setSerialNumber(
-        BigInteger      serialNumber)
-    {
-        tbsGen.setSerialNumber(new DERInteger(serialNumber));
-    }
-
-    /**
-     * Set the issuer distinguished name - the issuer is the entity whose private key is used to sign the
-     * certificate.
-     */
-    public void setIssuerDN(
-        X509Name   issuer)
-    {
-        tbsGen.setIssuer(issuer);
-    }
-
-    public void setNotBefore(
-        Date    date)
-    {
-        tbsGen.setStartDate(new Time(date));
-    }
-
-    public void setNotAfter(
-        Date    date)
-    {
-        tbsGen.setEndDate(new Time(date));
-    }
-
-    /**
-     * Set the subject distinguished name. The subject describes the entity associated with the public key.
-     */
-    public void setSubjectDN(
-        X509Name   subject)
-    {
-        tbsGen.setSubject(subject);
-    }
-
-    public void setPublicKey(
-        PublicKey       key)
-    {
-        try
-        {
-            tbsGen.setSubjectPublicKeyInfo(new SubjectPublicKeyInfo((ASN1Sequence)new DERInputStream(
-                                new ByteArrayInputStream(key.getEncoded())).readObject()));
-        }
-        catch (Exception e)
-        {
-            throw new IllegalArgumentException("unable to process key - " + e.toString());
-        }
-    }
-
-    public void setSignatureAlgorithm(
-        String  signatureAlgorithm)
-    {
-        this.signatureAlgorithm = signatureAlgorithm;
-
-        sigOID = (DERObjectIdentifier)algorithms.get(signatureAlgorithm.toUpperCase());
-
-        if (sigOID == null)
-        {
-            throw new IllegalArgumentException("Unknown signature type requested");
-        }
-
-        sigAlgId = new AlgorithmIdentifier(this.sigOID, new DERNull());
-
-        tbsGen.setSignature(sigAlgId);
-    }
-
-    /**
-     * generate an X509 certificate, based on the current issuer and subject
-     * using the default provider "BC".
-     */
-    public X509Certificate generateX509Certificate(
-        PrivateKey      key)
-        throws SecurityException, SignatureException, InvalidKeyException
-    {
-        try
-        {
-            return generateX509Certificate(key, BouncyCastleProvider.PROVIDER_NAME, null);
-        }
-        catch (NoSuchProviderException e)
-        {
-            throw new SecurityException("BC provider not installed!");
-        }
-    }
-
-    /**
-     * generate an X509 certificate, based on the current issuer and subject
-     * using the default provider "BC" and the passed in source of randomness
-     */
-    public X509Certificate generateX509Certificate(
-        PrivateKey      key,
-        SecureRandom    random)
-        throws SecurityException, SignatureException, InvalidKeyException
-    {
-        try
-        {
-            return generateX509Certificate(key, BouncyCastleProvider.PROVIDER_NAME, random);
-        }
-        catch (NoSuchProviderException e)
-        {
-            throw new SecurityException("BC provider not installed!");
-        }
-    }
-
-    /**
-     * generate an X509 certificate, based on the current issuer and subject,
-     * using the passed in provider for the signing, and the passed in source
-     * of randomness (if required).
-     */
-    public X509Certificate generateX509Certificate(
-        PrivateKey      key,
-        String          provider)
-        throws NoSuchProviderException, SecurityException, SignatureException, InvalidKeyException
-    {
-        return generateX509Certificate(key, provider, null);
-    }
-
-    /**
-     * generate an X509 certificate, based on the current issuer and subject,
-     * using the passed in provider for the signing, and the passed in source
-     * of randomness (if required).
-     */
-    public X509Certificate generateX509Certificate(
-        PrivateKey      key,
-        String          provider,
-        SecureRandom    random)
-        throws NoSuchProviderException, SecurityException, SignatureException, InvalidKeyException
-    {
-        Signature sig = null;
-
-        try
-        {
-            sig = Signature.getInstance(sigOID.getId(), provider);
-        }
-        catch (NoSuchAlgorithmException ex)
-        {
-            try
-            {
-                sig = Signature.getInstance(signatureAlgorithm, provider);
-            }
-            catch (NoSuchAlgorithmException e)
-            {
-                throw new SecurityException("exception creating signature: " + e.toString());
-            }
-        }
-
-        if (random != null)
-        {
-            sig.initSign(key, random);
-        }
-        else
-        {
-            sig.initSign(key);
-        }
-
-        TBSCertificateStructure tbsCert = tbsGen.generateTBSCertificate();
-
-        try
-        {
-            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-            DEROutputStream         dOut = new DEROutputStream(bOut);
-
-            dOut.writeObject(tbsCert);
-
-            sig.update(bOut.toByteArray());
-        }
-        catch (Exception e)
-        {
-            throw new SecurityException("exception encoding TBS cert - " + e);
-        }
-
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(tbsCert);
-        v.add(sigAlgId);
-        v.add(new DERBitString(sig.sign()));
-
-        return new X509CertificateObject(new X509CertificateStructure(new DERSequence(v)));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/X509V2CRLGenerator.java b/azureus2/src/org/bouncycastle/jce/X509V2CRLGenerator.java
deleted file mode 100644
index 3e48ae7..0000000
--- a/azureus2/src/org/bouncycastle/jce/X509V2CRLGenerator.java
+++ /dev/null
@@ -1,323 +0,0 @@
-package org.bouncycastle.jce;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.PrivateKey;
-import java.security.SecureRandom;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.cert.X509CRL;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Hashtable;
-import java.util.SimpleTimeZone;
-import java.util.Vector;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.DEROutputStream;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.DERUTCTime;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-import org.bouncycastle.asn1.x509.CertificateList;
-import org.bouncycastle.asn1.x509.TBSCertList;
-import org.bouncycastle.asn1.x509.V2TBSCertListGenerator;
-import org.bouncycastle.asn1.x509.X509Extension;
-import org.bouncycastle.asn1.x509.X509Extensions;
-import org.bouncycastle.asn1.x509.X509Name;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.bouncycastle.jce.provider.X509CRLObject;
-
-/**
- * class to produce an X.509 Version 2 CRL.
- * <p>
- * <b>Note:</b> This class may be subject to change.
- */
-public class X509V2CRLGenerator
-{
-    private SimpleDateFormat            dateF = new SimpleDateFormat("yyMMddHHmmss");
-    private SimpleTimeZone              tz = new SimpleTimeZone(0, "Z");
-    private V2TBSCertListGenerator      tbsGen;
-    private DERObjectIdentifier         sigOID;
-    private AlgorithmIdentifier         sigAlgId;
-    private String                      signatureAlgorithm;
-    private Hashtable                   extensions = null;
-    private Vector                      extOrdering = null;
-
-    private static Hashtable            algorithms = new Hashtable();
-
-    static
-    {
-        algorithms.put("MD2WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.2"));
-        algorithms.put("MD2WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.2"));
-        algorithms.put("MD5WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.4"));
-        algorithms.put("MD5WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.4"));
-        algorithms.put("SHA1WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.5"));
-        algorithms.put("SHA1WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.5"));
-        algorithms.put("RIPEMD160WITHRSAENCRYPTION", new DERObjectIdentifier("1.3.36.3.3.1.2"));
-        algorithms.put("RIPEMD160WITHRSA", new DERObjectIdentifier("1.3.36.3.3.1.2"));
-        algorithms.put("SHA1WITHDSA", new DERObjectIdentifier("1.2.840.10040.4.3"));
-        algorithms.put("DSAWITHSHA1", new DERObjectIdentifier("1.2.840.10040.4.3"));
-        algorithms.put("SHA1WITHECDSA", new DERObjectIdentifier("1.2.840.10045.4.1"));
-        algorithms.put("ECDSAWITHSHA1", new DERObjectIdentifier("1.2.840.10045.4.1"));
-    }
-
-    public X509V2CRLGenerator()
-    {
-        dateF.setTimeZone(tz);
-
-        tbsGen = new V2TBSCertListGenerator();
-    }
-
-    /**
-     * reset the generator
-     */
-    public void reset()
-    {
-        tbsGen = new V2TBSCertListGenerator();
-    }
-
-
-    /**
-     * Set the issuer distinguished name - the issuer is the entity whose private key is used to sign the
-     * certificate.
-     */
-    public void setIssuerDN(
-        X509Name   issuer)
-    {
-        tbsGen.setIssuer(issuer);
-    }
-
-    public void setThisUpdate(
-        Date    date)
-    {
-        tbsGen.setThisUpdate(new DERUTCTime(dateF.format(date) + "Z"));
-    }
-
-    public void setNextUpdate(
-        Date    date)
-    {
-        tbsGen.setNextUpdate(new DERUTCTime(dateF.format(date) + "Z"));
-    }
-
-    /**
-     * Reason being as indicated by ReasonFlags, i.e. ReasonFlags.KEY_COMPROMISE
-     * or 0 if ReasonFlags are not to be used
-     **/
-    public void addCRLEntry(BigInteger userCertificate, Date revocationDate, int reason)
-    {
-        tbsGen.addCRLEntry(new DERInteger(userCertificate), new DERUTCTime(dateF.format(revocationDate) + "Z"), reason);
-    }
-
-    public void setSignatureAlgorithm(
-        String  signatureAlgorithm)
-    {
-        this.signatureAlgorithm = signatureAlgorithm;
-
-        sigOID = (DERObjectIdentifier)algorithms.get(signatureAlgorithm.toUpperCase());
-
-        if (sigOID == null)
-        {
-            throw new IllegalArgumentException("Unknown signature type requested");
-        }
-
-        sigAlgId = new AlgorithmIdentifier(this.sigOID, null);
-
-        tbsGen.setSignature(sigAlgId);
-    }
-
-    /**
-     * add a given extension field for the standard extensions tag (tag 3)
-     */
-    public void addExtension(
-        String          OID,
-        boolean         critical,
-        DEREncodable    value)
-    {
-        this.addExtension(new DERObjectIdentifier(OID), critical, value);
-    }
-
-    /**
-     * add a given extension field for the standard extensions tag (tag 0)
-     */
-    public void addExtension(
-        DERObjectIdentifier OID,
-        boolean             critical,
-        DEREncodable        value)
-    {
-        if (extensions == null)
-        {
-            extensions = new Hashtable();
-            extOrdering = new Vector();
-        }
-
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-        DEROutputStream         dOut = new DEROutputStream(bOut);
-
-        try
-        {
-            dOut.writeObject(value);
-        }
-        catch (IOException e)
-        {
-            throw new IllegalArgumentException("error encoding value: " + e);
-        }
-
-        this.addExtension(OID, critical, bOut.toByteArray());
-    }
-
-    /**
-     * add a given extension field for the standard extensions tag (tag 0)
-     */
-    public void addExtension(
-        String          OID,
-        boolean         critical,
-        byte[]          value)
-    {
-        this.addExtension(new DERObjectIdentifier(OID), critical, value);
-    }
-
-    /**
-     * add a given extension field for the standard extensions tag (tag 0)
-     */
-    public void addExtension(
-        DERObjectIdentifier OID,
-        boolean             critical,
-        byte[]              value)
-    {
-        if (extensions == null)
-        {
-            extensions = new Hashtable();
-            extOrdering = new Vector();
-        }
-
-        extensions.put(OID, new X509Extension(critical, new DEROctetString(value)));
-        extOrdering.addElement(OID);
-    }
-
-    /**
-     * generate an X509 CRL, based on the current issuer and subject
-     * using the default provider "BC".
-     */
-    public X509CRL generateX509CRL(
-        PrivateKey      key)
-        throws SecurityException, SignatureException, InvalidKeyException
-    {
-        try
-        {
-            return generateX509CRL(key, BouncyCastleProvider.PROVIDER_NAME, null);
-        }
-        catch (NoSuchProviderException e)
-        {
-            throw new SecurityException("BC provider not installed!");
-        }
-    }
-
-    /**
-     * generate an X509 CRL, based on the current issuer and subject
-     * using the default provider "BC" and an user defined SecureRandom object as
-     * source of randomness.
-     */
-    public X509CRL generateX509CRL(
-        PrivateKey      key,
-        SecureRandom    random)
-        throws SecurityException, SignatureException, InvalidKeyException
-    {
-        try
-        {
-            return generateX509CRL(key, BouncyCastleProvider.PROVIDER_NAME, random);
-        }
-        catch (NoSuchProviderException e)
-        {
-            throw new SecurityException("BC provider not installed!");
-        }
-    }
-
-    /**
-     * generate an X509 certificate, based on the current issuer and subject
-     * using the passed in provider for the signing.
-     */
-    public X509CRL generateX509CRL(
-        PrivateKey      key,
-        String          provider)
-        throws NoSuchProviderException, SecurityException, SignatureException, InvalidKeyException
-    {
-        return generateX509CRL(key, provider, null);
-    }
-
-    /**
-     * generate an X509 CRL, based on the current issuer and subject,
-     * using the passed in provider for the signing.
-     */
-    public X509CRL generateX509CRL(
-        PrivateKey      key,
-        String          provider,
-        SecureRandom    random)
-        throws NoSuchProviderException, SecurityException, SignatureException, InvalidKeyException
-    {
-        Signature sig = null;
-
-        try
-        {
-            sig = Signature.getInstance(sigOID.getId(), provider);
-        }
-        catch (NoSuchAlgorithmException ex)
-        {
-            try
-            {
-                sig = Signature.getInstance(signatureAlgorithm, provider);
-            }
-            catch (NoSuchAlgorithmException e)
-            {
-                throw new SecurityException("exception creating signature: " + e.toString());
-            }
-        }
-
-        if (random != null)
-        {
-            sig.initSign(key, random);
-        }
-        else
-        {
-            sig.initSign(key);
-        }
-
-        if (extensions != null)
-        {
-            tbsGen.setExtensions(new X509Extensions(extOrdering, extensions));
-        }
-
-        TBSCertList tbsCrl = tbsGen.generateTBSCertList();
-
-        try
-        {
-            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-            DEROutputStream         dOut = new DEROutputStream(bOut);
-
-            dOut.writeObject(tbsCrl);
-
-            sig.update(bOut.toByteArray());
-        }
-        catch (Exception e)
-        {
-            throw new SecurityException("exception encoding TBS cert - " + e);
-        }
-
-        // Construct the CRL
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(tbsCrl);
-        v.add(sigAlgId);
-        v.add(new DERBitString(sig.sign()));
-
-        return new X509CRLObject(new CertificateList(new DERSequence(v)));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/X509V3CertificateGenerator.java b/azureus2/src/org/bouncycastle/jce/X509V3CertificateGenerator.java
deleted file mode 100644
index 2a18079..0000000
--- a/azureus2/src/org/bouncycastle/jce/X509V3CertificateGenerator.java
+++ /dev/null
@@ -1,342 +0,0 @@
-package org.bouncycastle.jce;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.SecureRandom;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.cert.X509Certificate;
-import java.util.Date;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import org.bouncycastle.asn1.*;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
-import org.bouncycastle.asn1.x509.TBSCertificateStructure;
-import org.bouncycastle.asn1.x509.Time;
-import org.bouncycastle.asn1.x509.V3TBSCertificateGenerator;
-import org.bouncycastle.asn1.x509.X509CertificateStructure;
-import org.bouncycastle.asn1.x509.X509Extension;
-import org.bouncycastle.asn1.x509.X509Extensions;
-import org.bouncycastle.asn1.x509.X509Name;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.bouncycastle.jce.provider.X509CertificateObject;
-
-/**
- * class to produce an X.509 Version 3 certificate.
- */
-public class X509V3CertificateGenerator
-{
-    private V3TBSCertificateGenerator   tbsGen;
-    private DERObjectIdentifier         sigOID;
-    private AlgorithmIdentifier         sigAlgId;
-    private String                      signatureAlgorithm;
-    private Hashtable                   extensions = null;
-    private Vector                      extOrdering = null;
-
-    private static Hashtable            algorithms = new Hashtable();
-
-    static
-    {
-		algorithms.put("MD2WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.2"));
-		algorithms.put("MD2WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.2"));
-		algorithms.put("MD5WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.4"));
-		algorithms.put("MD5WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.4"));
-		algorithms.put("SHA1WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.5"));
-		algorithms.put("SHA1WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.5"));
-		algorithms.put("RIPEMD160WITHRSAENCRYPTION", new DERObjectIdentifier("1.3.36.3.3.1.2"));
-		algorithms.put("RIPEMD160WITHRSA", new DERObjectIdentifier("1.3.36.3.3.1.2"));
-		algorithms.put("SHA1WITHDSA", new DERObjectIdentifier("1.2.840.10040.4.3"));
-		algorithms.put("DSAWITHSHA1", new DERObjectIdentifier("1.2.840.10040.4.3"));
-		algorithms.put("SHA1WITHECDSA", new DERObjectIdentifier("1.2.840.10045.4.1"));
-		algorithms.put("ECDSAWITHSHA1", new DERObjectIdentifier("1.2.840.10045.4.1"));
-    }
-
-    public X509V3CertificateGenerator()
-    {
-        tbsGen = new V3TBSCertificateGenerator();
-    }
-
-    /**
-     * reset the generator
-     */
-    public void reset()
-    {
-        tbsGen = new V3TBSCertificateGenerator();
-        extensions = null;
-        extOrdering = null;
-    }
-
-    /**
-     * set the serial number for the certificate.
-     */
-    public void setSerialNumber(
-        BigInteger      serialNumber)
-    {
-        tbsGen.setSerialNumber(new DERInteger(serialNumber));
-    }
-
-    /**
-     * Set the issuer distinguished name - the issuer is the entity whose private key is used to sign the
-     * certificate.
-     */
-    public void setIssuerDN(
-        X509Name   issuer)
-    {
-        tbsGen.setIssuer(issuer);
-    }
-
-    public void setNotBefore(
-        Date    date)
-    {
-        tbsGen.setStartDate(new Time(date));
-    }
-
-    public void setNotAfter(
-        Date    date)
-    {
-        tbsGen.setEndDate(new Time(date));
-    }
-
-    /**
-     * Set the subject distinguished name. The subject describes the entity associated with the public key.
-     */
-    public void setSubjectDN(
-        X509Name   subject)
-    {
-        tbsGen.setSubject(subject);
-    }
-
-    public void setPublicKey(
-        PublicKey       key)
-    {
-        try
-        {
-            tbsGen.setSubjectPublicKeyInfo(new SubjectPublicKeyInfo((ASN1Sequence)new DERInputStream(
-                                new ByteArrayInputStream(key.getEncoded())).readObject()));
-        }
-        catch (Exception e)
-        {
-            throw new IllegalArgumentException("unable to process key - " + e.toString());
-        }
-    }
-
-    public void setSignatureAlgorithm(
-        String  signatureAlgorithm)
-    {
-        this.signatureAlgorithm = signatureAlgorithm;
-
-        sigOID = (DERObjectIdentifier)algorithms.get(signatureAlgorithm.toUpperCase());
-
-        if (sigOID == null)
-        {
-            throw new IllegalArgumentException("Unknown signature type requested");
-        }
-
-        sigAlgId = new AlgorithmIdentifier(this.sigOID, new DERNull());
-
-        tbsGen.setSignature(sigAlgId);
-    }
-
-    /**
-     * add a given extension field for the standard extensions tag (tag 3)
-     */
-    public void addExtension(
-        String          OID,
-        boolean         critical,
-        DEREncodable    value)
-    {
-        this.addExtension(new DERObjectIdentifier(OID), critical, value);
-    }
-
-    /**
-     * add a given extension field for the standard extensions tag (tag 3)
-     */
-    public void addExtension(
-        DERObjectIdentifier OID,
-        boolean             critical,
-        DEREncodable        value)
-    {
-        if (extensions == null)
-        {
-            extensions = new Hashtable();
-            extOrdering = new Vector();
-        }
-
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-        DEROutputStream         dOut = new DEROutputStream(bOut);
-
-        try
-        {
-            dOut.writeObject(value);
-        }
-        catch (IOException e)
-        {
-            throw new IllegalArgumentException("error encoding value: " + e);
-        }
-
-        this.addExtension(OID, critical, bOut.toByteArray());
-    }
-
-    /**
-     * add a given extension field for the standard extensions tag (tag 3)
-     * The value parameter becomes the contents of the octet string associated
-     * with the extension.
-     */
-    public void addExtension(
-        String          OID,
-        boolean         critical,
-        byte[]          value)
-    {
-        this.addExtension(new DERObjectIdentifier(OID), critical, value);
-    }
-
-    /**
-     * add a given extension field for the standard extensions tag (tag 3)
-     */
-    public void addExtension(
-        DERObjectIdentifier OID,
-        boolean             critical,
-        byte[]              value)
-    {
-        if (extensions == null)
-        {
-            extensions = new Hashtable();
-            extOrdering = new Vector();
-        }
-
-        extensions.put(OID, new X509Extension(critical, new DEROctetString(value)));
-        extOrdering.addElement(OID);
-    }
-
-    /**
-     * generate an X509 certificate, based on the current issuer and subject
-     * using the default provider "BC".
-     */
-    public X509Certificate generateX509Certificate(
-        PrivateKey      key)
-        throws SecurityException, SignatureException, InvalidKeyException
-    {
-        try
-        {
-            return generateX509Certificate(key, BouncyCastleProvider.PROVIDER_NAME, null);
-        }
-        catch (NoSuchProviderException e)
-        {
-            throw new SecurityException("BC provider not installed!");
-        }
-    }
-
-    /**
-     * generate an X509 certificate, based on the current issuer and subject
-     * using the default provider "BC", and the passed in source of randomness
-     * (if required).
-     */
-    public X509Certificate generateX509Certificate(
-        PrivateKey      key,
-        SecureRandom    random)
-        throws SecurityException, SignatureException, InvalidKeyException
-    {
-        try
-        {
-            return generateX509Certificate(key, BouncyCastleProvider.PROVIDER_NAME, random);
-        }
-        catch (NoSuchProviderException e)
-        {
-            throw new SecurityException("BC provider not installed!");
-        }
-    }
-
-    /**
-     * generate an X509 certificate, based on the current issuer and subject,
-     * using the passed in provider for the signing.
-     */
-    public X509Certificate generateX509Certificate(
-        PrivateKey      key,
-        String          provider)
-        throws NoSuchProviderException, SecurityException, SignatureException, InvalidKeyException
-    {
-        return generateX509Certificate(key, provider, null);
-    }
-
-    /**
-     * generate an X509 certificate, based on the current issuer and subject,
-     * using the passed in provider for the signing and the supplied source
-     * of randomness, if required.
-     */
-    public X509Certificate generateX509Certificate(
-        PrivateKey      key,
-        String          provider,
-        SecureRandom    random)
-        throws NoSuchProviderException, SecurityException, SignatureException, InvalidKeyException
-    {
-        Signature sig = null;
-
-        if (sigOID == null)
-        {
-            throw new IllegalStateException("no signature algorithm specified");
-        }
-
-        try
-        {
-            sig = Signature.getInstance(sigOID.getId(), provider);
-        }
-        catch (NoSuchAlgorithmException ex)
-        {
-            try
-            {
-                sig = Signature.getInstance(signatureAlgorithm, provider);
-            }
-            catch (NoSuchAlgorithmException e)
-            {
-                throw new SecurityException("exception creating signature: " + e.toString());
-            }
-        }
-
-        if (random != null)
-        {
-            sig.initSign(key, random);
-        }
-        else
-        {
-            sig.initSign(key);
-        }
-
-        if (extensions != null)
-        {
-            tbsGen.setExtensions(new X509Extensions(extOrdering, extensions));
-        }
-
-        TBSCertificateStructure tbsCert = tbsGen.generateTBSCertificate();
-
-        try
-        {
-            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-            DEROutputStream         dOut = new DEROutputStream(bOut);
-
-            dOut.writeObject(tbsCert);
-
-            sig.update(bOut.toByteArray());
-        }
-        catch (Exception e)
-        {
-            throw new SecurityException("exception encoding TBS cert - " + e);
-        }
-
-        ASN1EncodableVector  v = new ASN1EncodableVector();
-
-        v.add(tbsCert);
-        v.add(sigAlgId);
-        v.add(new DERBitString(sig.sign()));
-
-        return new X509CertificateObject(new X509CertificateStructure(new DERSequence(v)));
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/interfaces/BCKeyStore.java b/azureus2/src/org/bouncycastle/jce/interfaces/BCKeyStore.java
deleted file mode 100644
index a36abbb..0000000
--- a/azureus2/src/org/bouncycastle/jce/interfaces/BCKeyStore.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.bouncycastle.jce.interfaces;
-
-import java.security.SecureRandom;
-
-/**
- * all BC provider keystores implement this interface.
- */
-public interface BCKeyStore
-{
-    /**
-     * set the random source for the key store
-     */
-    public void setRandom(SecureRandom random);
-}
diff --git a/azureus2/src/org/bouncycastle/jce/interfaces/ECKey.java b/azureus2/src/org/bouncycastle/jce/interfaces/ECKey.java
deleted file mode 100644
index 1c02816..0000000
--- a/azureus2/src/org/bouncycastle/jce/interfaces/ECKey.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.bouncycastle.jce.interfaces;
-
-import org.bouncycastle.jce.spec.ECParameterSpec;
-
-/**
- * generic interface for an Elliptic Curve Key.
- */
-public interface ECKey
-{
-    /**
-     * return a parameter specification representing the EC domain parameters
-     * for the key.
-     */
-	public ECParameterSpec getParams();
-}
diff --git a/azureus2/src/org/bouncycastle/jce/interfaces/ECPrivateKey.java b/azureus2/src/org/bouncycastle/jce/interfaces/ECPrivateKey.java
deleted file mode 100644
index 39d80c3..0000000
--- a/azureus2/src/org/bouncycastle/jce/interfaces/ECPrivateKey.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.bouncycastle.jce.interfaces;
-
-import java.math.BigInteger;
-import java.security.PrivateKey;
-
-/**
- * interface for Elliptic Curve Private keys.
- */
-public interface ECPrivateKey
-    extends ECKey, PrivateKey
-{
-    /**
-     * return the private value D.
-     */
-    public BigInteger getD();
-}
diff --git a/azureus2/src/org/bouncycastle/jce/interfaces/ECPublicKey.java b/azureus2/src/org/bouncycastle/jce/interfaces/ECPublicKey.java
deleted file mode 100644
index db2ecdc..0000000
--- a/azureus2/src/org/bouncycastle/jce/interfaces/ECPublicKey.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.bouncycastle.jce.interfaces;
-
-import java.security.PublicKey;
-
-import org.bouncycastle.math.ec.ECPoint;
-
-/**
- * interface for elliptic curve public keys.
- */
-public interface ECPublicKey
-    extends ECKey, PublicKey
-{
-    /**
-     * return the public point Q
-     */
-    public ECPoint getQ();
-}
diff --git a/azureus2/src/org/bouncycastle/jce/interfaces/ElGamalKey.java b/azureus2/src/org/bouncycastle/jce/interfaces/ElGamalKey.java
deleted file mode 100644
index 2f17804..0000000
--- a/azureus2/src/org/bouncycastle/jce/interfaces/ElGamalKey.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.bouncycastle.jce.interfaces;
-
-import org.bouncycastle.jce.spec.ElGamalParameterSpec;
-
-public interface ElGamalKey
-{
-    public ElGamalParameterSpec getParams();
-}
diff --git a/azureus2/src/org/bouncycastle/jce/interfaces/ElGamalPrivateKey.java b/azureus2/src/org/bouncycastle/jce/interfaces/ElGamalPrivateKey.java
deleted file mode 100644
index 609a2a8..0000000
--- a/azureus2/src/org/bouncycastle/jce/interfaces/ElGamalPrivateKey.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.bouncycastle.jce.interfaces;
-
-import java.math.BigInteger;
-import java.security.PrivateKey;
-
-public interface ElGamalPrivateKey
-    extends ElGamalKey, PrivateKey
-{
-    public BigInteger getX();
-}
diff --git a/azureus2/src/org/bouncycastle/jce/interfaces/ElGamalPublicKey.java b/azureus2/src/org/bouncycastle/jce/interfaces/ElGamalPublicKey.java
deleted file mode 100644
index c9fe35e..0000000
--- a/azureus2/src/org/bouncycastle/jce/interfaces/ElGamalPublicKey.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.bouncycastle.jce.interfaces;
-
-import java.math.BigInteger;
-import java.security.PublicKey;
-
-public interface ElGamalPublicKey
-    extends ElGamalKey, PublicKey
-{
-    public BigInteger getY();
-}
diff --git a/azureus2/src/org/bouncycastle/jce/interfaces/IESKey.java b/azureus2/src/org/bouncycastle/jce/interfaces/IESKey.java
deleted file mode 100644
index f1d7901..0000000
--- a/azureus2/src/org/bouncycastle/jce/interfaces/IESKey.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.bouncycastle.jce.interfaces;
-
-import java.security.Key;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-
-/**
- * key pair for use with an integrated encryptor
- */
-public interface IESKey
-    extends Key
-{
-    /**
-     * return the intended recipient's/sender's public key.
-     */
-    public PublicKey getPublic();
-
-    /**
-     * return the local private key.
-     */
-    public PrivateKey getPrivate();
-}
diff --git a/azureus2/src/org/bouncycastle/jce/interfaces/PKCS12BagAttributeCarrier.java b/azureus2/src/org/bouncycastle/jce/interfaces/PKCS12BagAttributeCarrier.java
deleted file mode 100644
index c5dd664..0000000
--- a/azureus2/src/org/bouncycastle/jce/interfaces/PKCS12BagAttributeCarrier.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.bouncycastle.jce.interfaces;
-
-import java.util.Enumeration;
-
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-
-/**
- * allow us to set attributes on objects that can go into a PKCS12 store.
- */
-public interface PKCS12BagAttributeCarrier
-{
-    public void setBagAttribute(
-        DERObjectIdentifier oid,
-        DEREncodable        attribute);
-
-    public DEREncodable getBagAttribute(
-        DERObjectIdentifier oid);
-
-    public Enumeration getBagAttributeKeys();
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/BouncyCastleProvider.java b/azureus2/src/org/bouncycastle/jce/provider/BouncyCastleProvider.java
deleted file mode 100644
index 2686f36..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/BouncyCastleProvider.java
+++ /dev/null
@@ -1,588 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.security.Provider;
-
-/**
- * To add the provider at runtime use:
- * <pre>
- * import java.security.Security;
- * import org.bouncycastle.jce.provider.BouncyCastleProvider;
- *
- * Security.addProvider(new BouncyCastleProvider());
- * </pre>
- * The provider can also be configured as part of your environment via
- * static registration by adding an entry to the java.security properties
- * file (found in $JAVA_HOME/jre/lib/security/java.security, where
- * $JAVA_HOME is the location of your JDK/JRE distribution). You'll find
- * detailed instructions in the file but basically it comes down to adding
- * a line:
- * <pre>
- * <code>
- *    security.provider.<n>=org.bouncycastle.jce.provider.BouncyCastleProvider
- * </code>
- * </pre>
- * Where <n> is the preference you want the provider at (1 being the
- * most prefered).
- * <p>Note: JCE algorithm names should be uppercase only so the case insensitive
- * test for getInstance works.
- */
-public final class BouncyCastleProvider extends Provider
-{
-	private static String info = "BouncyCastle Security Provider v1.23";
-
-    public static String PROVIDER_NAME = "BC_VUZE";
-
-	/**
-	 * Construct a new provider.  This should only be required when
-	 * using runtime registration of the provider using the
-	 * <code>Security.addProvider()</code> mechanism.
-	 */
-	public BouncyCastleProvider()
-	{
-		super(PROVIDER_NAME, 1.23, info);
-
-        //
-        // KeyStore
-        //
-        put("KeyStore.BKS", "org.bouncycastle.jce.provider.JDKKeyStore");
-        put("KeyStore.BouncyCastle", "org.bouncycastle.jce.provider.JDKKeyStore$BouncyCastleStore");
-        put("KeyStore.PKCS12", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$BCPKCS12KeyStore");
-		put("KeyStore.BCPKCS12", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$BCPKCS12KeyStore");
-        put("KeyStore.PKCS12-DEF", "org.bouncycastle.jce.provider.JDKPKCS12KeyStore$DefPKCS12KeyStore");
-        put("Alg.Alias.KeyStore.UBER", "BouncyCastle");
-        put("Alg.Alias.KeyStore.BOUNCYCASTLE", "BouncyCastle");
-        put("Alg.Alias.KeyStore.bouncycastle", "BouncyCastle");
-
-        //
-        // certificate factories.
-        //
-        put("CertificateFactory.X.509", "org.bouncycastle.jce.provider.JDKX509CertificateFactory");
-		put("Alg.Alias.CertificateFactory.X509", "X.509");
-
-        //
-        // algorithm parameter generators
-        //
-        put("AlgorithmParameterGenerator.DH", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DH");
-        put("AlgorithmParameterGenerator.DSA", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DSA");
-        put("AlgorithmParameterGenerator.ELGAMAL", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$ElGamal");
-        put("AlgorithmParameterGenerator.DES", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DES");
-        put("AlgorithmParameterGenerator.DESEDE", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DES");
-        put("AlgorithmParameterGenerator.1.2.840.113549.3.7", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DES");
-        put("AlgorithmParameterGenerator.1.3.14.3.2.7", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$DES");
-        put("AlgorithmParameterGenerator.IDEA", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$IDEA");
-        put("AlgorithmParameterGenerator.1.3.6.1.4.1.188.7.1.1.2", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$IDEA");
-        put("AlgorithmParameterGenerator.RC2", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$RC2");
-        put("AlgorithmParameterGenerator.1.2.840.113549.3.2", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$RC2");
-        put("AlgorithmParameterGenerator.CAST5", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$CAST5");
-        put("AlgorithmParameterGenerator.1.2.840.113533.7.66.10", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$CAST5");
-        put("AlgorithmParameterGenerator.AES", "org.bouncycastle.jce.provider.JDKAlgorithmParameterGenerator$AES");
-        put("Alg.Alias.AlgorithmParameterGenerator.2.16.840.1.101.3.4.2", "AES");  // these first 3 are wrong, but seem to have got around
-        put("Alg.Alias.AlgorithmParameterGenerator.2.16.840.1.101.3.4.22", "AES");
-        put("Alg.Alias.AlgorithmParameterGenerator.2.16.840.1.101.3.4.42", "AES");
-		put("Alg.Alias.AlgorithmParameterGenerator.2.16.840.1.101.3.4.1.2", "AES");
-		put("Alg.Alias.AlgorithmParameterGenerator.2.16.840.1.101.3.4.1.22", "AES");
-		put("Alg.Alias.AlgorithmParameterGenerator.2.16.840.1.101.3.4.1.42", "AES");
-        //
-        // algorithm parameters
-        //
-        put("AlgorithmParameters.DH", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$DH");
-        put("AlgorithmParameters.DSA", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$DSA");
-        put("AlgorithmParameters.ELGAMAL", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$ElGamal");
-        put("AlgorithmParameters.IES", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IES");
-        put("AlgorithmParameters.PKCS12PBE", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$PKCS12PBE");
-        put("AlgorithmParameters.1.2.840.113549.3.7", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IVAlgorithmParameters");
-        put("AlgorithmParameters.IDEA", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IDEAAlgorithmParameters");
-        put("AlgorithmParameters.1.3.6.1.4.1.188.7.1.1.2", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IDEAAlgorithmParameters");
-        put("AlgorithmParameters.CAST5", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$CAST5AlgorithmParameters");
-        put("AlgorithmParameters.1.2.840.113533.7.66.10", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$CAST5AlgorithmParameters");
-        put("Alg.Alias.AlgorithmParameters.PBEWITHSHA1ANDRC2", "PKCS12PBE");
-        put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND3-KEYTRIPLEDES", "PKCS12PBE");
-        put("Alg.Alias.AlgorithmParameters.PBEWITHSHAAND2-KEYTRIPLEDES", "PKCS12PBE");
-        put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDRC2", "PKCS12PBE");
-        put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDRC4", "PKCS12PBE");
-        put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDTWOFISH", "PKCS12PBE");
-        put("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDIDEA", "PKCS12PBE");
-        put("Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.1", "PKCS12PBE");
-        put("Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.2", "PKCS12PBE");
-        put("Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.3", "PKCS12PBE");
-        put("Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.4", "PKCS12PBE");
-        put("Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.5", "PKCS12PBE");
-        put("Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.6", "PKCS12PBE");
-
-        //
-        // key agreement
-        //
-        put("KeyAgreement.DH", "org.bouncycastle.jce.provider.JCEDHKeyAgreement");
-        put("KeyAgreement.ECDH", "org.bouncycastle.jce.provider.JCEECDHKeyAgreement$DH");
-        put("KeyAgreement.ECDHC", "org.bouncycastle.jce.provider.JCEECDHKeyAgreement$DHC");
-
-		//
-		// cipher engines
-		//
-		put("Cipher.DES", "org.bouncycastle.jce.provider.JCEBlockCipher$DES");
-		put("Cipher.DESEDE", "org.bouncycastle.jce.provider.JCEBlockCipher$DESede");
-		put("Cipher.1.2.840.113549.3.7", "org.bouncycastle.jce.provider.JCEBlockCipher$DESedeCBC");
-		put("Cipher.1.3.14.3.2.7", "org.bouncycastle.jce.provider.JCEBlockCipher$DESCBC");
-        put("Cipher.DESEDEWRAP", "org.bouncycastle.jce.provider.WrapCipherSpi$DESEDEWrap");
-        put("Cipher.1.2.840.113549.1.9.16.3.6", "org.bouncycastle.jce.provider.WrapCipherSpi$DESEDEWrap");
-		put("Cipher.SKIPJACK", "org.bouncycastle.jce.provider.JCEBlockCipher$Skipjack");
-		put("Cipher.BLOWFISH", "org.bouncycastle.jce.provider.JCEBlockCipher$Blowfish");
-		put("Cipher.TWOFISH", "org.bouncycastle.jce.provider.JCEBlockCipher$Twofish");
-		put("Cipher.RC2", "org.bouncycastle.jce.provider.JCEBlockCipher$RC2");
-        put("Cipher.RC2WRAP", "org.bouncycastle.jce.provider.WrapCipherSpi$RC2Wrap");
-        put("Cipher.1.2.840.113549.1.9.16.3.7", "org.bouncycastle.jce.provider.WrapCipherSpi$RC2Wrap");
-        put("Cipher.ARC4", "org.bouncycastle.jce.provider.JCEStreamCipher$RC4");
-        put("Cipher.RC4", "org.bouncycastle.jce.provider.JCEStreamCipher$RC4");
-		put("Alg.Alias.Cipher.1.2.840.113549.3.4", "RC4");
-		put("Cipher.RC5", "org.bouncycastle.jce.provider.JCEBlockCipher$RC5");
-		put("Cipher.1.2.840.113549.3.2", "org.bouncycastle.jce.provider.JCEBlockCipher$RC2CBC");
-		put("Alg.Alias.Cipher.RC5-32", "RC5");
-		put("Cipher.RC5-64", "org.bouncycastle.jce.provider.JCEBlockCipher$RC564");
-		put("Cipher.RC6", "org.bouncycastle.jce.provider.JCEBlockCipher$RC6");
-		put("Cipher.RIJNDAEL", "org.bouncycastle.jce.provider.JCEBlockCipher$Rijndael");
-		put("Cipher.AES", "org.bouncycastle.jce.provider.JCEBlockCipher$AES");
-		put("Alg.Alias.Cipher.2.16.840.1.101.3.4.2", "AES");
-		put("Alg.Alias.Cipher.2.16.840.1.101.3.4.22", "AES");
-		put("Alg.Alias.Cipher.2.16.840.1.101.3.4.42", "AES");
-		put("Cipher.2.16.840.1.101.3.4.1.2", "org.bouncycastle.jce.provider.JCEBlockCipher$AESCBC");
-		put("Cipher.2.16.840.1.101.3.4.1.22", "org.bouncycastle.jce.provider.JCEBlockCipher$AESCBC");
-		put("Cipher.2.16.840.1.101.3.4.1.42", "org.bouncycastle.jce.provider.JCEBlockCipher$AESCBC");
-		put("Cipher.AESWRAP", "org.bouncycastle.jce.provider.WrapCipherSpi$AESWrap");
-		put("Cipher.SERPENT", "org.bouncycastle.jce.provider.JCEBlockCipher$Serpent");
-		put("Cipher.CAST5", "org.bouncycastle.jce.provider.JCEBlockCipher$CAST5");
-		put("Cipher.1.2.840.113533.7.66.10", "org.bouncycastle.jce.provider.JCEBlockCipher$CAST5CBC");
-		put("Cipher.CAST6", "org.bouncycastle.jce.provider.JCEBlockCipher$CAST6");
-		put("Cipher.IDEA", "org.bouncycastle.jce.provider.JCEBlockCipher$IDEA");
-		put("Cipher.1.3.6.1.4.1.188.7.1.1.2", "org.bouncycastle.jce.provider.JCEBlockCipher$IDEACBC");
-
-/*
-		put("Cipher.DES/CFB8", "org.bouncycastle.jce.provider.JCEStreamCipher$DES_CFB8");
-		put("Cipher.DESEDE/CFB8", "org.bouncycastle.jce.provider.JCEStreamCipher$DESede_CFB8");
-		put("Cipher.SKIPJACK/CFB8", "org.bouncycastle.jce.provider.JCEStreamCipher$Skipjack_CFB8");
-		put("Cipher.BLOWFISH/CFB8", "org.bouncycastle.jce.provider.JCEStreamCipher$Blowfish_CFB8");
-		put("Cipher.TWOFISH/CFB8", "org.bouncycastle.jce.provider.JCEStreamCipher$Twofish_CFB8");
-		put("Cipher.IDEA/CFB8", "org.bouncycastle.jce.provider.JCEStreamCipher$IDEA_CFB8");
-
-		put("Alg.Alias.Cipher.DES/CFB8/NOPADDING", "DES/CFB8");
-		put("Alg.Alias.Cipher.DESEDE/CFB8/NOPADDING", "DESEDE/CFB8");
-		put("Alg.Alias.Cipher.SKIPJACK/CFB8/NOPADDING", "SKIPJACK/CFB8");
-		put("Alg.Alias.Cipher.BLOWFISH/CFB8/NOPADDING", "Blowfish/CFB8");
-		put("Alg.Alias.Cipher.TWOFISH/CFB8/NOPADDING", "Twofish/CFB8");
-		put("Alg.Alias.Cipher.IDEA/CFB8/NOPADDING", "IDEA/CFB8");
-
-		put("Cipher.DES/OFB8", "org.bouncycastle.jce.provider.JCEStreamCipher$DES_OFB8");
-		put("Cipher.DESEDE/OFB8", "org.bouncycastle.jce.provider.JCEStreamCipher$DESede_OFB8");
-		put("Cipher.SKIPJACK/OFB8", "org.bouncycastle.jce.provider.JCEStreamCipher$Skipjack_OFB8");
-		put("Cipher.BLOWFISH/OFB8", "org.bouncycastle.jce.provider.JCEStreamCipher$Blowfish_OFB8");
-		put("Cipher.TWOFISH/OFB8", "org.bouncycastle.jce.provider.JCEStreamCipher$Twofish_OFB8");
-		put("Cipher.IDEA/OFB8", "org.bouncycastle.jce.provider.JCEStreamCipher$IDEA_OFB8");
-
-		put("Alg.Alias.Cipher.DES/OFB8/NOPADDING", "DES/OFB8");
-		put("Alg.Alias.Cipher.DESEDE/OFB8/NOPADDING", "DESEDE/OFB8");
-		put("Alg.Alias.Cipher.SKIPJACK/OFB8/NOPADDING", "SKIPJACK/OFB8");
-		put("Alg.Alias.Cipher.BLOWFISH/OFB8/NOPADDING", "BLOWFISH/OFB8");
-		put("Alg.Alias.Cipher.TWOFISH/OFB8/NOPADDING", "TWOFISH/OFB8");
-		put("Alg.Alias.Cipher.IDEA/OFB8/NOPADDING", "IDEA/OFB8");
-*/
-
-		put("Cipher.RSA", "org.bouncycastle.jce.provider.JCERSACipher$NoPadding");
-		put("Cipher.RSA/RAW", "org.bouncycastle.jce.provider.JCERSACipher$NoPadding");
-		put("Cipher.RSA/PKCS1", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding");
-		put("Cipher.1.2.840.113549.1.1.1", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding");
-		put("Cipher.2.5.8.1.1", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding");
-		put("Cipher.RSA/1", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding_PrivateOnly");
-		put("Cipher.RSA/2", "org.bouncycastle.jce.provider.JCERSACipher$PKCS1v1_5Padding_PublicOnly");
-		put("Cipher.RSA/OAEP", "org.bouncycastle.jce.provider.JCERSACipher$OAEPPadding");
-		put("Cipher.1.2.840.113549.1.1.7", "org.bouncycastle.jce.provider.JCERSACipher$OAEPPadding");
-		put("Cipher.RSA/ISO9796-1", "org.bouncycastle.jce.provider.JCERSACipher$ISO9796d1Padding");
-
-		put("Cipher.ECIES", "org.bouncycastle.jce.provider.JCEIESCipher$ECIES");
-		put("Cipher.ELGAMAL", "org.bouncycastle.jce.provider.JCEElGamalCipher$NoPadding");
-		put("Cipher.ELGAMAL/PKCS1", "org.bouncycastle.jce.provider.JCEElGamalCipher$PKCS1v1_5Padding");
-
-		put("Alg.Alias.Cipher.RSA//RAW", "RSA");
-		put("Alg.Alias.Cipher.RSA//NOPADDING", "RSA");
-		put("Alg.Alias.Cipher.RSA//PKCS1PADDING", "RSA/PKCS1");
-		put("Alg.Alias.Cipher.RSA//OAEPPADDING", "RSA/OAEP");
-		put("Alg.Alias.Cipher.RSA//ISO9796-1PADDING", "RSA/ISO9796-1");
-		put("Alg.Alias.Cipher.RSA/ECB/NOPADDING", "RSA");
-		put("Alg.Alias.Cipher.RSA/ECB/PKCS1PADDING", "RSA/PKCS1");
-		put("Alg.Alias.Cipher.RSA/ECB/OAEPPADDING", "RSA/OAEP");
-		put("Alg.Alias.Cipher.RSA/ECB/ISO9796-1PADDING", "RSA/ISO9796-1");
-		put("Alg.Alias.Cipher.RSA/NONE/NOPADDING", "RSA");
-		put("Alg.Alias.Cipher.RSA/NONE/PKCS1PADDING", "RSA/PKCS1");
-		put("Alg.Alias.Cipher.RSA/NONE/OAEPPADDING", "RSA/OAEP");
-		put("Alg.Alias.Cipher.RSA/NONE/ISO9796-1PADDING", "RSA/ISO9796-1");
-		put("Alg.Alias.Cipher.RSA/1/PCKS1PADDING", "RSA/1");
-		put("Alg.Alias.Cipher.RSA/2/PCKS1PADDING", "RSA/2");
-		
-		put("Alg.Alias.Cipher.ELGAMAL/ECB/PKCS1PADDING", "ELGAMAL/PKCS1");
-		put("Alg.Alias.Cipher.ELGAMAL/NONE/PKCS1PADDING", "ELGAMAL/PKCS1");
-
-        put("Cipher.PBEWITHMD5ANDDES", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithMD5AndDES");
-        put("Cipher.BROKENPBEWITHMD5ANDDES", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithMD5AndDES");
-        put("Cipher.PBEWITHMD5ANDRC2", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithMD5AndRC2");
-        put("Cipher.PBEWITHSHA1ANDDES", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHA1AndDES");
-        put("Cipher.BROKENPBEWITHSHA1ANDDES", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithSHA1AndDES");
-        put("Cipher.PBEWITHSHA1ANDRC2", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHA1AndRC2");
-        put("Cipher.PBEWITHSHAAND3-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHAAndDES3Key");
-        put("Cipher.BROKENPBEWITHSHAAND3-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithSHAAndDES3Key");
-        put("Cipher.OLDPBEWITHSHAAND3-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$OldPBEWithSHAAndDES3Key");
-        put("Cipher.PBEWITHSHAAND2-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHAAndDES2Key");
-        put("Cipher.BROKENPBEWITHSHAAND2-KEYTRIPLEDES-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$BrokePBEWithSHAAndDES2Key");
-        put("Cipher.PBEWITHSHAAND128BITRC2-CBC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHAAnd128BitRC2");
-        put("Cipher.PBEWITHSHAAND40BITRC2-CBC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHAAnd40BitRC2");
-        put("Cipher.PBEWITHSHAAND128BITRC4", "org.bouncycastle.jce.provider.JCEStreamCipher$PBEWithSHAAnd128BitRC4");
-        put("Cipher.PBEWITHSHAAND40BITRC4", "org.bouncycastle.jce.provider.JCEStreamCipher$PBEWithSHAAnd40BitRC4");
-
-        put("Cipher.PBEWITHSHAANDTWOFISH-CBC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHAAndTwofish");
-        put("Cipher.OLDPBEWITHSHAANDTWOFISH-CBC", "org.bouncycastle.jce.provider.BrokenJCEBlockCipher$OldPBEWithSHAAndTwofish");
-        put("Cipher.PBEWITHSHAANDIDEA-CBC", "org.bouncycastle.jce.provider.JCEBlockCipher$PBEWithSHAAndIDEA");
-
-        put("Alg.Alias.Cipher.1.2.840.113549.1.12.1.1", "PBEWITHSHAAND128BITRC4");
-        put("Alg.Alias.Cipher.1.2.840.113549.1.12.1.2", "PBEWITHSHAAND40BITRC4");
-        put("Alg.Alias.Cipher.1.2.840.113549.1.12.1.3", "PBEWITHSHAAND3-KEYTRIPLEDES-CBC");
-        put("Alg.Alias.Cipher.1.2.840.113549.1.12.1.4", "PBEWITHSHAAND2-KEYTRIPLEDES-CBC");
-        put("Alg.Alias.Cipher.1.2.840.113549.1.12.1.5", "PBEWITHSHAAND128BITRC2-CBC");
-        put("Alg.Alias.Cipher.1.2.840.113549.1.12.1.6", "PBEWITHSHAAND40BITRC2-CBC");
-
-        //
-        // key generators.
-        //
-        put("KeyGenerator.DES", "org.bouncycastle.jce.provider.JCEKeyGenerator$DES");
-        put("Alg.Alias.KeyGenerator.1.3.14.3.2.7", "DES");
-        put("KeyGenerator.DESEDE", "org.bouncycastle.jce.provider.JCEKeyGenerator$DESede");
-        put("KeyGenerator.1.2.840.113549.3.7", "org.bouncycastle.jce.provider.JCEKeyGenerator$DESede3");
-        put("KeyGenerator.DESEDEWRAP", "org.bouncycastle.jce.provider.JCEKeyGenerator$DESede");
-        put("KeyGenerator.SKIPJACK", "org.bouncycastle.jce.provider.JCEKeyGenerator$Skipjack");
-        put("KeyGenerator.BLOWFISH", "org.bouncycastle.jce.provider.JCEKeyGenerator$Blowfish");
-        put("KeyGenerator.TWOFISH", "org.bouncycastle.jce.provider.JCEKeyGenerator$Twofish");
-        put("KeyGenerator.RC2", "org.bouncycastle.jce.provider.JCEKeyGenerator$RC2");
-        put("KeyGenerator.1.2.840.113549.3.2", "org.bouncycastle.jce.provider.JCEKeyGenerator$RC2");
-        put("KeyGenerator.RC4", "org.bouncycastle.jce.provider.JCEKeyGenerator$RC4");
-        put("Alg.Alias.KeyGenerator.ARC4", "RC4");
-        put("Alg.Alias.KeyGenerator.1.2.840.113549.3.4", "RC4");
-        put("KeyGenerator.RC5", "org.bouncycastle.jce.provider.JCEKeyGenerator$RC5");
-        put("Alg.Alias.KeyGenerator.RC5-32", "RC5");
-        put("KeyGenerator.RC5-64", "org.bouncycastle.jce.provider.JCEKeyGenerator$RC564");
-        put("KeyGenerator.RC6", "org.bouncycastle.jce.provider.JCEKeyGenerator$RC6");
-        put("KeyGenerator.RIJNDAEL", "org.bouncycastle.jce.provider.JCEKeyGenerator$Rijndael");
-        put("KeyGenerator.AES", "org.bouncycastle.jce.provider.JCEKeyGenerator$AES");
-        put("KeyGenerator.2.16.840.1.101.3.4.2", "org.bouncycastle.jce.provider.JCEKeyGenerator$AES128");
-        put("KeyGenerator.2.16.840.1.101.3.4.22", "org.bouncycastle.jce.provider.JCEKeyGenerator$AES192");
-        put("KeyGenerator.2.16.840.1.101.3.4.42", "org.bouncycastle.jce.provider.JCEKeyGenerator$AES256");
-		put("KeyGenerator.2.16.840.1.101.3.4.1.2", "org.bouncycastle.jce.provider.JCEKeyGenerator$AES128");
-		put("KeyGenerator.2.16.840.1.101.3.4.1.22", "org.bouncycastle.jce.provider.JCEKeyGenerator$AES192");
-		put("KeyGenerator.2.16.840.1.101.3.4.1.42", "org.bouncycastle.jce.provider.JCEKeyGenerator$AES256");
-        put("KeyGenerator.AESWRAP", "org.bouncycastle.jce.provider.JCEKeyGenerator$AES");
-        put("KeyGenerator.SERPENT", "org.bouncycastle.jce.provider.JCEKeyGenerator$Serpent");
-        put("KeyGenerator.CAST5", "org.bouncycastle.jce.provider.JCEKeyGenerator$CAST5");
-        put("KeyGenerator.1.2.840.113533.7.66.10", "org.bouncycastle.jce.provider.JCEKeyGenerator$CAST5");
-        put("KeyGenerator.CAST6", "org.bouncycastle.jce.provider.JCEKeyGenerator$CAST6");
-        put("KeyGenerator.IDEA", "org.bouncycastle.jce.provider.JCEKeyGenerator$IDEA");
-        put("KeyGenerator.1.3.6.1.4.1.188.7.1.1.2", "org.bouncycastle.jce.provider.JCEKeyGenerator$IDEA");
-        put("KeyGenerator.HMACMD2", "org.bouncycastle.jce.provider.JCEKeyGenerator$MD2HMAC");
-        put("KeyGenerator.HMACMD4", "org.bouncycastle.jce.provider.JCEKeyGenerator$MD4HMAC");
-        put("KeyGenerator.HMACMD5", "org.bouncycastle.jce.provider.JCEKeyGenerator$MD5HMAC");
-        put("KeyGenerator.HMACRIPEMD128", "org.bouncycastle.jce.provider.JCEKeyGenerator$RIPEMD128HMAC");
-        put("KeyGenerator.HMACRIPEMD160", "org.bouncycastle.jce.provider.JCEKeyGenerator$RIPEMD160HMAC");
-        put("KeyGenerator.HMACSHA1", "org.bouncycastle.jce.provider.JCEKeyGenerator$HMACSHA1");
-        put("KeyGenerator.HMACTIGER", "org.bouncycastle.jce.provider.JCEKeyGenerator$HMACTIGER");
-
-        //
-        // key pair generators.
-        //
-        put("KeyPairGenerator.RSA", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$RSA");
-        put("KeyPairGenerator.DH", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$DH");
-        put("KeyPairGenerator.DSA", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$DSA");
-        put("KeyPairGenerator.ELGAMAL", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$ElGamal");
-        put("KeyPairGenerator.ECDSA", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$ECDSA");
-        put("KeyPairGenerator.ECDH", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$ECDH");
-        put("KeyPairGenerator.ECDHC", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$ECDHC");
-        put("KeyPairGenerator.ECIES", "org.bouncycastle.jce.provider.JDKKeyPairGenerator$ECDH");
-
-        put("Alg.Alias.KeyPairGenerator.1.2.840.113549.1.1.1", "RSA");
-
-        //
-        // key factories
-        //
-        put("KeyFactory.RSA", "org.bouncycastle.jce.provider.JDKKeyFactory$RSA");
-        put("KeyFactory.DH", "org.bouncycastle.jce.provider.JDKKeyFactory$DH");
-        put("KeyFactory.DSA", "org.bouncycastle.jce.provider.JDKKeyFactory$DSA");
-        put("KeyFactory.ELGAMAL", "org.bouncycastle.jce.provider.JDKKeyFactory$ElGamal");
-        put("KeyFactory.ElGamal", "org.bouncycastle.jce.provider.JDKKeyFactory$ElGamal");
-        put("KeyFactory.EC", "org.bouncycastle.jce.provider.JDKKeyFactory$EC");
-        put("KeyFactory.ECDSA", "org.bouncycastle.jce.provider.JDKKeyFactory$ECDSA");
-        put("KeyFactory.ECDH", "org.bouncycastle.jce.provider.JDKKeyFactory$ECDH");
-        put("KeyFactory.ECDHC", "org.bouncycastle.jce.provider.JDKKeyFactory$ECDHC");
-
-        put("Alg.Alias.KeyFactory.1.2.840.113549.1.1.1", "RSA");
-        put("Alg.Alias.KeyFactory.1.2.840.10040.4.1", "DSA");
-
-        //
-        // Algorithm parameters
-        //
-        put("AlgorithmParameters.DES", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IVAlgorithmParameters");
-        put("Alg.Alias.AlgorithmParameters.1.3.14.3.2.7", "DES");
-        put("AlgorithmParameters.DESEDE", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IVAlgorithmParameters");
-        put("AlgorithmParameters.1.2.840.113549.3.7", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IVAlgorithmParameters");
-        put("AlgorithmParameters.RC2", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$RC2AlgorithmParameters");
-        put("AlgorithmParameters.1.2.840.113549.3.2", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$RC2AlgorithmParameters");
-        put("AlgorithmParameters.RC5", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IVAlgorithmParameters");
-        put("AlgorithmParameters.RC6", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IVAlgorithmParameters");
-        put("AlgorithmParameters.IDEA", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IDEAAlgorithmParameters");
-        put("AlgorithmParameters.BLOWFISH", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IVAlgorithmParameters");
-        put("AlgorithmParameters.TWOFISH", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IVAlgorithmParameters");
-        put("AlgorithmParameters.SKIPJACK", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IVAlgorithmParameters");
-        put("AlgorithmParameters.RIJNDAEL", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IVAlgorithmParameters");
-        put("AlgorithmParameters.AES", "org.bouncycastle.jce.provider.JDKAlgorithmParameters$IVAlgorithmParameters");
-        put("Alg.Alias.AlgorithmParameters.2.16.840.1.101.3.4.2", "AES");
-        put("Alg.Alias.AlgorithmParameters.2.16.840.1.101.3.4.22", "AES");
-        put("Alg.Alias.AlgorithmParameters.2.16.840.1.101.3.4.42", "AES");
-		put("Alg.Alias.AlgorithmParameters.2.16.840.1.101.3.4.1.2", "AES");
-		put("Alg.Alias.AlgorithmParameters.2.16.840.1.101.3.4.1.22", "AES");
-		put("Alg.Alias.AlgorithmParameters.2.16.840.1.101.3.4.1.42", "AES");
-		
-        //
-        // secret key factories.
-        //
-        put("SecretKeyFactory.PBE/PKCS5", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBE_PKCS5");
-        put("SecretKeyFactory.PBE/PKCS12", "org.bouncycastle.jce.provider.JCESecretKeyFactory$PBE_PKCS12");
-        put("SecretKeyFactory.DES", "org.bouncycastle.jce.provider.JCESecretKeyFactory$DES");
-        put("SecretKeyFactory.DESEDE", "org.bouncycastle.jce.provider.JCESecretKeyFactory$DESede");
-        put("SecretKeyFactory.DESEDE", "org.bouncycastle.jce.provider.JCESecretKeyFactory$DESede");
-
-        put("Alg.Alias.SecretKeyFactory.PBE", "PBE/PKCS5");
-        put("Alg.Alias.SecretKeyFactory.PBEWITHMD5ANDDES", "PBE/PKCS5");
-        put("Alg.Alias.SecretKeyFactory.BROKENPBEWITHMD5ANDDES", "PBE/PKCS5");
-        put("Alg.Alias.SecretKeyFactory.PBEWITHMD5ANDRC2", "PBE/PKCS5");
-        put("Alg.Alias.SecretKeyFactory.PBEWITHSHA1ANDDES", "PBE/PKCS5");
-        put("Alg.Alias.SecretKeyFactory.BROKENPBEWITHSHA1ANDDES", "PBE/PKCS5");
-        put("Alg.Alias.SecretKeyFactory.PBEWITHSHA1ANDRC2", "PBE/PKCS5");
-        put("Alg.Alias.SecretKeyFactory.PBEWITHSHAAND3-KEYTRIPLEDES-CBC", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.OLDPBEWITHSHAAND3-KEYTRIPLEDES-CBC", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.BROKENPBEWITHSHAAND3-KEYTRIPLEDES-CBC", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.PBEWITHSHAAND2-KEYTRIPLEDES-CBC", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.BROKENPBEWITHSHAAND2-KEYTRIPLEDES-CBC", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.PBEWITHSHAAND128BITRC4", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.PBEWITHSHAAND40BITRC4", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.PBEWITHSHAAND128BITRC2-CBC", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.PBEWITHSHAAND40BITRC2-CBC", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.PBEWITHSHAANDTWOFISH-CBC", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.OLDPBEWITHSHAANDTWOFISH-CBC", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.PBEWITHSHAANDIDEA-CBC", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.PBEWITHHMACSHA", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.PBEWITHHMACRIPEMD160", "PBE/PKCS12");
-
-        put("Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.1", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.2", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.3", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.4", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.5", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.6", "PBE/PKCS12");
-        put("Alg.Alias.SecretKeyFactory.1.3.14.3.2.26", "PBE/PKCS12");
-
-        //
-        // MAC's
-        //
-        put("Mac.DESMAC", "org.bouncycastle.jce.provider.JCEMac$DES");
-        put("Alg.Alias.Mac.DES", "DESMAC");
-        put("Mac.DESMAC/CFB8", "org.bouncycastle.jce.provider.JCEMac$DESCFB8");
-        put("Alg.Alias.Mac.DES/CFB8", "DESMAC/CFB8");
-
-        put("Mac.DESEDEMAC", "org.bouncycastle.jce.provider.JCEMac$DESede");
-        put("Alg.Alias.Mac.DESEDE", "DESEDEMAC");
-        put("Mac.DESEDEMAC/CFB8", "org.bouncycastle.jce.provider.JCEMac$DESedeCFB8");
-        put("Alg.Alias.Mac.DESEDE/CFB8", "DESEDEMAC/CFB8");
-
-        put("Mac.SKIPJACKMAC", "org.bouncycastle.jce.provider.JCEMac$Skipjack");
-        put("Alg.Alias.Mac.SKIPJACK", "SKIPJACKMAC");
-        put("Mac.SKIPJACKMAC/CFB8", "org.bouncycastle.jce.provider.JCEMac$SkipjackCFB8");
-        put("Alg.Alias.Mac.SKIPJACK/CFB8", "SKIPJACKMAC/CFB8");
-
-        put("Mac.IDEAMAC", "org.bouncycastle.jce.provider.JCEMac$IDEA");
-        put("Alg.Alias.Mac.IDEA", "IDEAMAC");
-        put("Mac.IDEAMAC/CFB8", "org.bouncycastle.jce.provider.JCEMac$IDEACFB8");
-        put("Alg.Alias.Mac.IDEA/CFB8", "IDEAMAC/CFB8");
-
-        put("Mac.RC2MAC", "org.bouncycastle.jce.provider.JCEMac$RC2");
-        put("Alg.Alias.Mac.RC2", "RC2MAC");
-        put("Mac.RC2MAC/CFB8", "org.bouncycastle.jce.provider.JCEMac$RC2CFB8");
-        put("Alg.Alias.Mac.RC2/CFB8", "RC2MAC/CFB8");
-
-        put("Mac.RC5MAC", "org.bouncycastle.jce.provider.JCEMac$RC5");
-        put("Alg.Alias.Mac.RC5", "RC5MAC");
-        put("Mac.RC5MAC/CFB8", "org.bouncycastle.jce.provider.JCEMac$RC5CFB8");
-        put("Alg.Alias.Mac.RC5/CFB8", "RC5MAC/CFB8");
-
-        put("Mac.HMACMD2", "org.bouncycastle.jce.provider.JCEMac$MD2");
-        put("Alg.Alias.Mac.HMAC-MD2", "HMACMD2");
-        put("Alg.Alias.Mac.HMAC/MD2", "HMACMD2");
-
-        put("Mac.HMACMD4", "org.bouncycastle.jce.provider.JCEMac$MD4");
-        put("Alg.Alias.Mac.HMAC-MD4", "HMACMD4");
-        put("Alg.Alias.Mac.HMAC/MD4", "HMACMD4");
-
-        put("Mac.HMACMD5", "org.bouncycastle.jce.provider.JCEMac$MD5");
-        put("Alg.Alias.Mac.HMAC-MD5", "HMACMD5");
-        put("Alg.Alias.Mac.HMAC/MD5", "HMACMD5");
-
-        put("Mac.HMACRIPEMD128", "org.bouncycastle.jce.provider.JCEMac$RIPEMD128");
-        put("Alg.Alias.Mac.HMAC-RIPEMD128", "HMACRIPEMD128");
-        put("Alg.Alias.Mac.HMAC/RIPEMD128", "HMACRIPEMD128");
-
-        put("Mac.HMACRIPEMD160", "org.bouncycastle.jce.provider.JCEMac$RIPEMD160");
-        put("Alg.Alias.Mac.HMAC-RIPEMD160", "HMACRIPEMD160");
-        put("Alg.Alias.Mac.HMAC/RIPEMD160", "HMACRIPEMD160");
-
-        put("Mac.HMACSHA1", "org.bouncycastle.jce.provider.JCEMac$SHA1");
-        put("Alg.Alias.Mac.HMAC-SHA1", "HMACSHA1");
-        put("Alg.Alias.Mac.HMAC/SHA1", "HMACSHA1");
-
-        put("Mac.HMACSHA256", "org.bouncycastle.jce.provider.JCEMac$SHA256");
-        put("Alg.Alias.Mac.HMAC-SHA256", "HMACSHA256");
-        put("Alg.Alias.Mac.HMAC/SHA256", "HMACSHA256");
-
-        put("Mac.HMACSHA384", "org.bouncycastle.jce.provider.JCEMac$SHA384");
-        put("Alg.Alias.Mac.HMAC-SHA384", "HMACSHA384");
-        put("Alg.Alias.Mac.HMAC/SHA384", "HMACSHA384");
-
-        put("Mac.HMACSHA512", "org.bouncycastle.jce.provider.JCEMac$SHA512");
-        put("Alg.Alias.Mac.HMAC-SHA512", "HMACSHA512");
-        put("Alg.Alias.Mac.HMAC/SHA512", "HMACSHA512");
-
-        put("Mac.HMACTiger", "org.bouncycastle.jce.provider.JCEMac$Tiger");
-        put("Alg.Alias.Mac.HMAC-Tiger", "HMACTiger");
-        put("Alg.Alias.Mac.HMAC/Tiger", "HMACTiger");
-
-        put("Mac.PBEWITHHMACSHA", "org.bouncycastle.jce.provider.JCEMac$PBEWithSHA");
-        put("Mac.PBEWITHHMACRIPEMD160", "org.bouncycastle.jce.provider.JCEMac$PBEWithRIPEMD160");
-        put("Alg.Alias.Mac.1.3.14.3.2.26", "PBEWITHHMACSHA");
-
-        //
-        // MessageDigests
-        //
-        put("MessageDigest.SHA-1", "org.bouncycastle.jce.provider.JDKMessageDigest$SHA1");
-        put("Alg.Alias.MessageDigest.SHA1", "SHA-1");
-        put("Alg.Alias.MessageDigest.SHA", "SHA-1");
-        put("Alg.Alias.MessageDigest.1.3.14.3.2.26", "SHA-1");
-        put("MessageDigest.SHA-256", "org.bouncycastle.jce.provider.JDKMessageDigest$SHA256");
-        put("MessageDigest.SHA-384", "org.bouncycastle.jce.provider.JDKMessageDigest$SHA384");
-        put("MessageDigest.SHA-512", "org.bouncycastle.jce.provider.JDKMessageDigest$SHA512");
-        put("MessageDigest.MD2", "org.bouncycastle.jce.provider.JDKMessageDigest$MD2");
-        put("MessageDigest.MD4", "org.bouncycastle.jce.provider.JDKMessageDigest$MD4");
-        put("MessageDigest.MD5", "org.bouncycastle.jce.provider.JDKMessageDigest$MD5");
-        put("MessageDigest.1.2.840.113549.2.5", "org.bouncycastle.jce.provider.JDKMessageDigest$MD5");
-        put("MessageDigest.RIPEMD128", "org.bouncycastle.jce.provider.JDKMessageDigest$RIPEMD128");
-        put("MessageDigest.RIPEMD160", "org.bouncycastle.jce.provider.JDKMessageDigest$RIPEMD160");
-		put("MessageDigest.RIPEMD256", "org.bouncycastle.jce.provider.JDKMessageDigest$RIPEMD256");
-		put("MessageDigest.RIPEMD320", "org.bouncycastle.jce.provider.JDKMessageDigest$RIPEMD320");
-        put("MessageDigest.Tiger", "org.bouncycastle.jce.provider.JDKMessageDigest$Tiger");
-
-        //
-        // signature algorithms.
-        //
-        put("Signature.MD2WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$MD2WithRSAEncryption");
-        put("Signature.MD5WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$MD5WithRSAEncryption");
-        put("Signature.SHA1WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$SHA1WithRSAEncryption");
-        put("Signature.RIPEMD160WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$RIPEMD160WithRSAEncryption");
-		put("Signature.RIPEMD128WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$RIPEMD128WithRSAEncryption");
-		put("Signature.RIPEMD256WithRSAEncryption", "org.bouncycastle.jce.provider.JDKDigestSignature$RIPEMD256WithRSAEncryption");
-        put("Signature.DSA", "org.bouncycastle.jce.provider.JDKDSASigner$stdDSA");
-        put("Signature.ECDSA", "org.bouncycastle.jce.provider.JDKDSASigner$ecDSA");
-        put("Signature.SHA1withRSA/ISO9796-2", "org.bouncycastle.jce.provider.JDKISOSignature$SHA1WithRSAEncryption");
-        put("Signature.MD5withRSA/ISO9796-2", "org.bouncycastle.jce.provider.JDKISOSignature$MD5WithRSAEncryption");
-        put("Signature.RIPEMD160withRSA/ISO9796-2", "org.bouncycastle.jce.provider.JDKISOSignature$RIPEMD160WithRSAEncryption");
-
-		put("Signature.SHA1withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA1withRSA");
-		put("Signature.SHA256withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA256withRSA");
-		put("Signature.SHA384withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA384withRSA");
-		put("Signature.SHA512withRSA/PSS", "org.bouncycastle.jce.provider.JDKPSSSigner$SHA512withRSA");
-
-		put("Alg.Alias.Signature.MD2withRSAEncryption", "MD2WithRSAEncryption");
-		put("Alg.Alias.Signature.MD5withRSAEncryption", "MD5WithRSAEncryption");
-		put("Alg.Alias.Signature.SHA1withRSAEncryption", "SHA1WithRSAEncryption");
-
-		put("Alg.Alias.Signature.SHA256withRSAEncryption", "SHA256withRSA/PSS");
-		put("Alg.Alias.Signature.SHA384withRSAEncryption", "SHA384withRSA/PSS");
-		put("Alg.Alias.Signature.SHA512withRSAEncryption", "SHA512withRSA/PSS");
-
-		put("Alg.Alias.Signature.SHA256WithRSAEncryption", "SHA256withRSA/PSS");
-		put("Alg.Alias.Signature.SHA384WithRSAEncryption", "SHA384withRSA/PSS");
-		put("Alg.Alias.Signature.SHA512WithRSAEncryption", "SHA512withRSA/PSS");
-
-		put("Alg.Alias.Signature.SHA256WITHRSAENCRYPTION", "SHA256withRSA/PSS");
-		put("Alg.Alias.Signature.SHA384WITHRSAENCRYPTION", "SHA384withRSA/PSS");
-		put("Alg.Alias.Signature.SHA512WITHRSAENCRYPTION", "SHA512withRSA/PSS");
-
-		put("Alg.Alias.Signature.RIPEMD160withRSAEncryption", "RIPEMD160WithRSAEncryption");
-
-		put("Alg.Alias.Signature.1.2.840.113549.1.1.2", "MD2WithRSAEncryption");
-		put("Alg.Alias.Signature.MD2WithRSA", "MD2WithRSAEncryption");
-		put("Alg.Alias.Signature.MD2withRSA", "MD2WithRSAEncryption");
-		put("Alg.Alias.Signature.MD2/RSA", "MD2WithRSAEncryption");
-		put("Alg.Alias.Signature.MD5WithRSA", "MD5WithRSAEncryption");
-		put("Alg.Alias.Signature.MD5withRSA", "MD5WithRSAEncryption");
-		put("Alg.Alias.Signature.MD5/RSA", "MD5WithRSAEncryption");
-		put("Alg.Alias.Signature.1.2.840.113549.1.1.4", "MD5WithRSAEncryption");
-		put("Alg.Alias.Signature.SHA1WithRSA", "SHA1WithRSAEncryption");
-		put("Alg.Alias.Signature.SHA1withRSA", "SHA1WithRSAEncryption");
-		put("Alg.Alias.Signature.SHA1/RSA", "SHA1WithRSAEncryption");
-		put("Alg.Alias.Signature.SHA-1/RSA", "SHA1WithRSAEncryption");
-		put("Alg.Alias.Signature.1.2.840.113549.1.1.5", "SHA1WithRSAEncryption");
-		put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.113549.1.1.1", "SHA1WithRSAEncryption");
-		put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.113549.1.1.5", "SHA1WithRSAEncryption");
-		put("Alg.Alias.Signature.1.2.840.113549.2.5with1.2.840.113549.1.1.1", "MD5WithRSAEncryption");
-		put("Alg.Alias.Signature.RIPEMD160WithRSA", "RIPEMD160WithRSAEncryption");
-		put("Alg.Alias.Signature.RIPEMD160withRSA", "RIPEMD160WithRSAEncryption");
-		put("Alg.Alias.Signature.RIPEMD128WithRSA", "RIPEMD128WithRSAEncryption");
-		put("Alg.Alias.Signature.RIPEMD128withRSA", "RIPEMD128WithRSAEncryption");
-		put("Alg.Alias.Signature.RIPEMD256WithRSA", "RIPEMD256WithRSAEncryption");
-		put("Alg.Alias.Signature.RIPEMD256withRSA", "RIPEMD256WithRSAEncryption");
-		put("Alg.Alias.Signature.RIPEMD-160/RSA", "RIPEMD160WithRSAEncryption");
-		put("Alg.Alias.Signature.RMD160withRSA", "RIPEMD160WithRSAEncryption");
-		put("Alg.Alias.Signature.RMD160/RSA", "RIPEMD160WithRSAEncryption");
-		put("Alg.Alias.Signature.1.3.36.3.3.1.2", "RIPEMD160WithRSAEncryption");
-		put("Alg.Alias.Signature.1.3.36.3.3.1.3", "RIPEMD128WithRSAEncryption");
-		put("Alg.Alias.Signature.1.3.36.3.3.1.4", "RIPEMD256WithRSAEncryption");
-		
-		put("Alg.Alias.Signature.MD2WITHRSAENCRYPTION", "MD2WithRSAEncryption");
-		put("Alg.Alias.Signature.MD5WITHRSAENCRYPTION", "MD5WithRSAEncryption");
-		put("Alg.Alias.Signature.SHA1WITHRSAENCRYPTION", "SHA1WithRSAEncryption");
-		put("Alg.Alias.Signature.RIPEMD160WITHRSAENCRYPTION", "RIPEMD160WithRSAEncryption");
-
-		put("Alg.Alias.Signature.MD5WITHRSA", "MD5WithRSAEncryption");
-		put("Alg.Alias.Signature.SHA1WITHRSA", "SHA1WithRSAEncryption");
-		put("Alg.Alias.Signature.RIPEMD160WITHRSA", "RIPEMD160WithRSAEncryption");
-		put("Alg.Alias.Signature.RMD160WITHRSA", "RIPEMD160WithRSAEncryption");
-		put("Alg.Alias.Signature.RIPEMD160WITHRSA", "RIPEMD160WithRSAEncryption");
-
-		put("Alg.Alias.Signature.SHA1withECDSA", "ECDSA");
-		put("Alg.Alias.Signature.ECDSAwithSHA1", "ECDSA");
-		put("Alg.Alias.Signature.SHA1WITHECDSA", "ECDSA");
-		put("Alg.Alias.Signature.ECDSAWITHSHA1", "ECDSA");
-		put("Alg.Alias.Signature.SHA1WithECDSA", "ECDSA");
-		put("Alg.Alias.Signature.ECDSAWithSHA1", "ECDSA");
-        put("Alg.Alias.Signature.1.2.840.10045.4.1", "ECDSA");
-		put("Alg.Alias.Signature.SHA/DSA", "DSA");
-		put("Alg.Alias.Signature.SHA1withDSA", "DSA");
-		put("Alg.Alias.Signature.SHA1WITHDSA", "DSA");
-		put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.1", "DSA");
-		put("Alg.Alias.Signature.1.3.14.3.2.26with1.2.840.10040.4.3", "DSA");
-		put("Alg.Alias.Signature.DSAwithSHA1", "DSA");
-		put("Alg.Alias.Signature.DSAWITHSHA1", "DSA");
-		put("Alg.Alias.Signature.SHA1WithDSA", "DSA");
-		put("Alg.Alias.Signature.DSAWithSHA1", "DSA");
-        put("Alg.Alias.Signature.1.2.840.10040.4.3", "DSA");
-        put("Alg.Alias.Signature.MD5WithRSA/ISO9796-2", "MD5withRSA/ISO9796-2");
-        put("Alg.Alias.Signature.SHA1WithRSA/ISO9796-2", "SHA1withRSA/ISO9796-2");
-        put("Alg.Alias.Signature.RIPEMD160WithRSA/ISO9796-2", "RIPEMD160withRSA/ISO9796-2");
-
-	// Certification Path API
-	put("CertPathValidator.PKIX", "org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi" );
-	put("CertPathValidator.PKIX ValidationAlgorithm", "RFC2459");
-	put("CertPathBuilder.PKIX", "org.bouncycastle.jce.provider.PKIXCertPathBuilderSpi" );
-	put("CertPathBuilder.PKIX ValidationAlgorithm", "RFC2459");
-	put("CertStore.Collection", "org.bouncycastle.jce.provider.CertStoreCollectionSpi" );
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/CertStoreCollectionSpi.java b/azureus2/src/org/bouncycastle/jce/provider/CertStoreCollectionSpi.java
deleted file mode 100644
index 7549955..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/CertStoreCollectionSpi.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.security.InvalidAlgorithmParameterException;
-import java.security.cert.CRL;
-import java.security.cert.CRLSelector;
-import java.security.cert.CertSelector;
-import java.security.cert.CertStoreException;
-import java.security.cert.CertStoreParameters;
-import java.security.cert.CertStoreSpi;
-import java.security.cert.Certificate;
-import java.security.cert.CollectionCertStoreParameters;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-public class CertStoreCollectionSpi extends CertStoreSpi
-{
-    private CollectionCertStoreParameters params;
-
-    public CertStoreCollectionSpi(CertStoreParameters params)
-        throws InvalidAlgorithmParameterException
-	{
-	    super(params);
-
-	    if (!(params instanceof CollectionCertStoreParameters))
-        {
-            throw new InvalidAlgorithmParameterException( "org.bouncycastle.jce.provider.CertStoreCollectionSpi: parameter must be a CollectionCertStoreParameters object\n" +  params.toString() );
-        }
-
-	    this.params = (CollectionCertStoreParameters)params;
-	}
-
-    public Collection engineGetCertificates(
-        CertSelector selector)
-        throws CertStoreException 
-	{
-	    Set         col = new HashSet();
-	    Iterator    iter = params.getCollection().iterator();
-
-        if (selector == null)
-        {
-            while (iter.hasNext())
-            {
-                Object obj = iter.next();
-
-                if (obj instanceof Certificate)
-                {
-                    col.add(obj);
-                }
-            }
-        }
-        else
-        {
-            while (iter.hasNext())
-            {
-                Object obj = iter.next();
-
-                if ((obj instanceof Certificate) && selector.match((Certificate)obj))
-                {
-                    col.add(obj);
-                }
-            }
-        }
-	    
-	    return col;
-	}
-    
-
-    public Collection engineGetCRLs(
-        CRLSelector selector)
-        throws CertStoreException 
-	{
-	    Set         col = new HashSet();
-	    Iterator    iter = params.getCollection().iterator();
-
-        if (selector == null)
-        {
-            while (iter.hasNext())
-            {
-                Object obj = iter.next();
-
-                if (obj instanceof CRL)
-                {
-                    col.add(obj);
-                }
-            }
-        }
-        else
-        {
-            while (iter.hasNext())
-            {
-                Object obj = iter.next();
-
-                if ((obj instanceof CRL) && selector.match((CRL)obj))
-                {
-                    col.add(obj);
-                }
-            }
-        }
-	    
-	    return col;
-	}    
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/DHUtil.java b/azureus2/src/org/bouncycastle/jce/provider/DHUtil.java
deleted file mode 100644
index 2470af9..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/DHUtil.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.security.InvalidKeyException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-
-import javax.crypto.interfaces.DHPrivateKey;
-import javax.crypto.interfaces.DHPublicKey;
-
-import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
-import org.bouncycastle.crypto.params.DHParameters;
-import org.bouncycastle.crypto.params.DHPrivateKeyParameters;
-import org.bouncycastle.crypto.params.DHPublicKeyParameters;
-
-/**
- * utility class for converting jce/jca DH objects
- * objects into their org.bouncycastle.crypto counterparts.
- */
-public class DHUtil
-{
-    static public AsymmetricKeyParameter generatePublicKeyParameter(
-        PublicKey    key)
-        throws InvalidKeyException
-    {
-        if (key instanceof DHPublicKey)
-        {
-            DHPublicKey    k = (DHPublicKey)key;
-
-            return new DHPublicKeyParameters(k.getY(),
-                new DHParameters(k.getParams().getP(), k.getParams().getG(), null, k.getParams().getL()));
-        }
-
-        throw new InvalidKeyException("can't identify DH public key.");
-    }
-
-    static public AsymmetricKeyParameter generatePrivateKeyParameter(
-        PrivateKey    key)
-        throws InvalidKeyException
-    {
-        if (key instanceof DHPrivateKey)
-        {
-            DHPrivateKey    k = (DHPrivateKey)key;
-
-            return new DHPrivateKeyParameters(k.getX(),
-                new DHParameters(k.getParams().getP(), k.getParams().getG(), null, k.getParams().getL()));
-        }
-                        
-        throw new InvalidKeyException("can't identify DH private key.");
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/DSAUtil.java b/azureus2/src/org/bouncycastle/jce/provider/DSAUtil.java
deleted file mode 100644
index 5cf3c22..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/DSAUtil.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.security.InvalidKeyException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.interfaces.DSAPrivateKey;
-import java.security.interfaces.DSAPublicKey;
-
-import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
-import org.bouncycastle.crypto.params.DSAParameters;
-import org.bouncycastle.crypto.params.DSAPrivateKeyParameters;
-import org.bouncycastle.crypto.params.DSAPublicKeyParameters;
-
-/**
- * utility class for converting jce/jca DSA objects
- * objects into their org.bouncycastle.crypto counterparts.
- */
-public class DSAUtil
-{
-    static public AsymmetricKeyParameter generatePublicKeyParameter(
-        PublicKey    key)
-        throws InvalidKeyException
-    {
-        if (key instanceof DSAPublicKey)
-        {
-            DSAPublicKey    k = (DSAPublicKey)key;
-
-            return new DSAPublicKeyParameters(k.getY(),
-                new DSAParameters(k.getParams().getP(), k.getParams().getQ(), k.getParams().getG()));
-        }
-
-        throw new InvalidKeyException("can't identify DSA public key: " + key.getClass().getName());
-    }
-
-    static public AsymmetricKeyParameter generatePrivateKeyParameter(
-        PrivateKey    key)
-        throws InvalidKeyException
-    {
-        if (key instanceof DSAPrivateKey)
-        {
-            DSAPrivateKey    k = (DSAPrivateKey)key;
-
-            return new DSAPrivateKeyParameters(k.getX(),
-                new DSAParameters(k.getParams().getP(), k.getParams().getQ(), k.getParams().getG()));
-        }
-                        
-        throw new InvalidKeyException("can't identify DSA private key.");
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/ECUtil.java b/azureus2/src/org/bouncycastle/jce/provider/ECUtil.java
deleted file mode 100644
index 849db16..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/ECUtil.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.security.InvalidKeyException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-
-import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
-import org.bouncycastle.crypto.params.ECDomainParameters;
-import org.bouncycastle.crypto.params.ECPrivateKeyParameters;
-import org.bouncycastle.crypto.params.ECPublicKeyParameters;
-import org.bouncycastle.jce.interfaces.ECPrivateKey;
-import org.bouncycastle.jce.interfaces.ECPublicKey;
-import org.bouncycastle.jce.spec.ECParameterSpec;
-
-/**
- * utility class for converting jce/jca ECDSA, ECDH, and ECDHC
- * objects into their org.bouncycastle.crypto counterparts.
- */
-public class ECUtil
-{
-    static public AsymmetricKeyParameter generatePublicKeyParameter(
-        PublicKey    key)
-        throws InvalidKeyException
-    {
-        if (key instanceof ECPublicKey)
-        {
-            ECPublicKey    k = (ECPublicKey)key;
-            ECParameterSpec s = k.getParams();
-
-            return new ECPublicKeyParameters(
-                            k.getQ(),
-                            new ECDomainParameters(s.getCurve(), s.getG(), s.getN()));
-        }
-
-        throw new InvalidKeyException("can't identify EC public key.");
-    }
-
-    static public AsymmetricKeyParameter generatePrivateKeyParameter(
-        PrivateKey    key)
-        throws InvalidKeyException
-    {
-        if (key instanceof ECPrivateKey)
-        {
-            ECPrivateKey    k = (ECPrivateKey)key;
-            ECParameterSpec s = k.getParams();
-
-            return new ECPrivateKeyParameters(
-                            k.getD(),
-                            new ECDomainParameters(s.getCurve(), s.getG(), s.getN()));
-        }
-                        
-        throw new InvalidKeyException("can't identify EC private key.");
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/ElGamalUtil.java b/azureus2/src/org/bouncycastle/jce/provider/ElGamalUtil.java
deleted file mode 100644
index f89c656..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/ElGamalUtil.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.security.InvalidKeyException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-
-import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
-import org.bouncycastle.crypto.params.ElGamalParameters;
-import org.bouncycastle.crypto.params.ElGamalPrivateKeyParameters;
-import org.bouncycastle.crypto.params.ElGamalPublicKeyParameters;
-import org.bouncycastle.jce.interfaces.ElGamalPrivateKey;
-import org.bouncycastle.jce.interfaces.ElGamalPublicKey;
-
-/**
- * utility class for converting jce/jca ElGamal objects
- * objects into their org.bouncycastle.crypto counterparts.
- */
-public class ElGamalUtil
-{
-    static public AsymmetricKeyParameter generatePublicKeyParameter(
-        PublicKey    key)
-        throws InvalidKeyException
-    {
-        if (key instanceof ElGamalPublicKey)
-        {
-            ElGamalPublicKey    k = (ElGamalPublicKey)key;
-
-            return new ElGamalPublicKeyParameters(k.getY(),
-                new ElGamalParameters(k.getParams().getP(), k.getParams().getG()));
-        }
-
-        throw new InvalidKeyException("can't identify ElGamal public key.");
-    }
-
-    static public AsymmetricKeyParameter generatePrivateKeyParameter(
-        PrivateKey    key)
-        throws InvalidKeyException
-    {
-        if (key instanceof ElGamalPrivateKey)
-        {
-            ElGamalPrivateKey    k = (ElGamalPrivateKey)key;
-
-            return new ElGamalPrivateKeyParameters(k.getX(),
-                new ElGamalParameters(k.getParams().getP(), k.getParams().getG()));
-        }
-                        
-        throw new InvalidKeyException("can't identify ElGamal private key.");
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/JCEECDHKeyAgreement.java b/azureus2/src/org/bouncycastle/jce/provider/JCEECDHKeyAgreement.java
deleted file mode 100644
index 174c0e4..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/JCEECDHKeyAgreement.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.math.BigInteger;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.security.Key;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.SecureRandom;
-import java.security.spec.AlgorithmParameterSpec;
-
-import javax.crypto.KeyAgreementSpi;
-import javax.crypto.SecretKey;
-import javax.crypto.ShortBufferException;
-import javax.crypto.spec.SecretKeySpec;
-
-import org.bouncycastle.crypto.BasicAgreement;
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.agreement.ECDHBasicAgreement;
-//import org.bouncycastle.crypto.agreement.ECDHCBasicAgreement;
-import org.bouncycastle.jce.interfaces.ECPrivateKey;
-import org.bouncycastle.jce.interfaces.ECPublicKey;
-
-/**
- * Diffie-Hellman key agreement using elliptic curve keys, ala IEEE P1363
- * both the simple one, and the simple one with cofactors are supported.
- */
-public class JCEECDHKeyAgreement
-    extends KeyAgreementSpi
-{
-    private BigInteger          result;
-    private CipherParameters    privKey;
-    private BasicAgreement      agreement;
-
-    protected JCEECDHKeyAgreement(
-        BasicAgreement  agreement)
-    {
-        this.agreement = agreement;
-    }
-
-    public Key
-    doPhase(
-    	Key		key,
-    	boolean	lastPhase )
-    
-    	throws InvalidKeyException, IllegalStateException
-    {
-    	return( engineDoPhase( key, lastPhase ));
-    }
-    
-    protected Key engineDoPhase(
-        Key     key,
-        boolean lastPhase) 
-        throws InvalidKeyException, IllegalStateException
-    {
-        if (privKey == null)
-        {
-            throw new IllegalStateException("EC Diffie-Hellman not initialised.");
-        }
-
-        if (!lastPhase)
-        {
-            throw new IllegalStateException("EC Diffie-Hellman can only be between two parties.");
-        }
-
-        if (!(key instanceof ECPublicKey))
-        {
-            throw new InvalidKeyException("EC Key Agreement doPhase requires ECPublicKey");
-        }
-
-        CipherParameters pubKey = ECUtil.generatePublicKeyParameter((PublicKey)key);
-
-        result = agreement.calculateAgreement(pubKey);
-
-        return null;
-    }
-
-    public byte[] 
-    generateSecret() 
-    	throws IllegalStateException
-    {
-    	return( engineGenerateSecret());
-    }
-    
-    protected byte[] engineGenerateSecret() 
-        throws IllegalStateException
-    {
-        return result.toByteArray();
-    }
-
-    protected int engineGenerateSecret(
-        byte[]  sharedSecret,
-        int     offset) 
-        throws IllegalStateException, ShortBufferException
-    {
-        byte[]  secret = result.toByteArray();
-
-        if (sharedSecret.length - offset < secret.length)
-        {
-            throw new ShortBufferException("ECKeyAgreement - buffer too short");
-        }
-
-        System.arraycopy(secret, 0, sharedSecret, offset, secret.length);
-
-        return secret.length;
-    }
-
-    protected SecretKey engineGenerateSecret(
-        String algorithm) 
-    {
-        return new SecretKeySpec(result.toByteArray(), algorithm);
-    }
-
-    public void
-    init(
-    	Key		key )
-    
-    	throws InvalidKeyException, InvalidAlgorithmParameterException
-    {
-    	engineInit( key, null );
-    }
-    
-    protected void engineInit(
-        Key                     key,
-        AlgorithmParameterSpec  params,
-        SecureRandom            random) 
-        throws InvalidKeyException, InvalidAlgorithmParameterException
-    {
-        if (!(key instanceof ECPrivateKey))
-        {
-            throw new InvalidKeyException("ECKeyAgreement requires ECPrivateKey for initialisation");
-        }
-
-        privKey = ECUtil.generatePrivateKeyParameter((PrivateKey)key);
-
-        agreement.init(privKey);
-    }
-
-    protected void engineInit(
-        Key             key,
-        SecureRandom    random) 
-        throws InvalidKeyException
-    {
-        if (!(key instanceof ECPrivateKey))
-        {
-            throw new InvalidKeyException("ECKeyAgreement requires ECPrivateKey");
-        }
-
-        privKey = ECUtil.generatePrivateKeyParameter((PrivateKey)key);
-
-        agreement.init(privKey);
-    }
-
-    public static class DH
-        extends JCEECDHKeyAgreement
-    {
-        public DH()
-        {
-            super(new ECDHBasicAgreement());
-        }
-    }
-
-    /*
-    public static class DHC
-        extends JCEECDHKeyAgreement
-    {
-        public DHC()
-        {
-            super(new ECDHCBasicAgreement());
-        }
-    }
-    */
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/JCEECPrivateKey.java b/azureus2/src/org/bouncycastle/jce/provider/JCEECPrivateKey.java
deleted file mode 100644
index 3109be5..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/JCEECPrivateKey.java
+++ /dev/null
@@ -1,270 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DEROutputStream;
-import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
-import org.bouncycastle.asn1.sec.ECPrivateKeyStructure;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-import org.bouncycastle.asn1.x9.X962NamedCurves;
-import org.bouncycastle.asn1.x9.X962Parameters;
-import org.bouncycastle.asn1.x9.X9ECParameters;
-import org.bouncycastle.asn1.x9.X9ObjectIdentifiers;
-import org.bouncycastle.crypto.params.ECDomainParameters;
-import org.bouncycastle.crypto.params.ECPrivateKeyParameters;
-import org.bouncycastle.jce.interfaces.ECPrivateKey;
-import org.bouncycastle.jce.interfaces.PKCS12BagAttributeCarrier;
-import org.bouncycastle.jce.spec.ECNamedCurveParameterSpec;
-import org.bouncycastle.jce.spec.ECParameterSpec;
-import org.bouncycastle.jce.spec.ECPrivateKeySpec;
-
-public class JCEECPrivateKey
-    implements ECPrivateKey, PKCS12BagAttributeCarrier
-{
-    private String          algorithm = "EC";
-    private BigInteger      d;
-    private ECParameterSpec ecSpec;
-
-    private Hashtable   pkcs12Attributes = new Hashtable();
-    private Vector      pkcs12Ordering = new Vector();
-
-    protected JCEECPrivateKey()
-    {
-    }
-
-    JCEECPrivateKey(
-        ECPrivateKey    key)
-    {
-        this.d = key.getD();
-        this.algorithm = key.getAlgorithm();
-        this.ecSpec = key.getParams();
-    }
-
-    JCEECPrivateKey(
-        String              algorithm,
-        ECPrivateKeySpec    spec)
-    {
-        this.algorithm = algorithm;
-        this.d = spec.getD();
-        this.ecSpec = spec.getParams();
-    }
-
-    JCEECPrivateKey(
-        String                  algorithm,
-        ECPrivateKeyParameters  params,
-        ECParameterSpec         spec)
-    {
-        ECDomainParameters      dp = params.getParameters();
-
-        this.algorithm = algorithm;
-        this.d = params.getD();
-
-        if (spec == null)
-        {
-            this.ecSpec = new ECParameterSpec(
-                            dp.getCurve(),
-                            dp.getG(),
-                            dp.getN(),
-                            dp.getH(),
-                            dp.getSeed());
-        }
-        else
-        {
-            this.ecSpec = spec;
-        }
-    }
-
-    JCEECPrivateKey(
-        PrivateKeyInfo      info)
-    {
-        X962Parameters      params = new X962Parameters((DERObject)info.getAlgorithmId().getParameters());
-
-        if (params.isNamedCurve())
-        {
-            DERObjectIdentifier oid = (DERObjectIdentifier)params.getParameters();
-            X9ECParameters      ecP = X962NamedCurves.getByOID(oid);
-
-            ecSpec = new ECNamedCurveParameterSpec(
-                                        X962NamedCurves.getName(oid),
-                                        ecP.getCurve(),
-                                        ecP.getG(),
-                                        ecP.getN(),
-                                        ecP.getH(),
-                                        ecP.getSeed());
-        }
-        else
-        {
-            X9ECParameters          ecP = new X9ECParameters((ASN1Sequence)params.getParameters());
-            ecSpec = new ECParameterSpec(ecP.getCurve(),
-                                            ecP.getG(),
-                                            ecP.getN(),
-                                            ecP.getH(),
-                                            ecP.getSeed());
-        }
-
-        if (info.getPrivateKey() instanceof DERInteger)
-        {
-            DERInteger          derD = (DERInteger)info.getPrivateKey();
-
-            this.d = derD.getValue();
-        }
-        else
-        {
-            ECPrivateKeyStructure   ec = new ECPrivateKeyStructure((ASN1Sequence)info.getPrivateKey());
-
-            this.d = ec.getKey();
-        }
-    }
-
-    public String getAlgorithm()
-    {
-        return algorithm;
-    }
-
-    /**
-     * return the encoding format we produce in getEncoded().
-     *
-     * @return the string "PKCS#8"
-     */
-    public String getFormat()
-    {
-        return "PKCS#8";
-    }
-
-    /**
-     * Return a PKCS8 representation of the key. The sequence returned
-     * represents a full PrivateKeyInfo object.
-     *
-     * @return a PKCS8 representation of the key.
-     */
-    public byte[] getEncoded()
-    {
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-        DEROutputStream         dOut = new DEROutputStream(bOut);
-        X962Parameters          params = null;
-
-        if (ecSpec instanceof ECNamedCurveParameterSpec)
-        {
-            params = new X962Parameters(X962NamedCurves.getOID(((ECNamedCurveParameterSpec)ecSpec).getName()));
-        }
-        else
-        {
-            X9ECParameters          ecP = new X9ECParameters(
-                                            ecSpec.getCurve(),
-                                            ecSpec.getG(),
-                                            ecSpec.getN(),
-                                            ecSpec.getH(),
-                                            ecSpec.getSeed());
-            params = new X962Parameters(ecP);
-        }
-
-        PrivateKeyInfo          info = new PrivateKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_ecPublicKey, params.getDERObject()), new ECPrivateKeyStructure(this.getD()).getDERObject());
-
-        try
-        {
-            dOut.writeObject(info);
-            dOut.close();
-        }
-        catch (IOException e)
-        {
-            throw new RuntimeException("Error encoding EC private key");
-        }
-
-        return bOut.toByteArray();
-    }
-
-    public ECParameterSpec getParams()
-    {
-        return ecSpec;
-    }
-
-    public BigInteger getD()
-    {
-        return d;
-    }
-
-/*
-    private void readObject(
-        ObjectInputStream   in)
-        throws IOException, ClassNotFoundException
-    {
-        in.defaultReadObject();
-
-        boolean named = in.readBoolean();
-
-        if (named)
-        {
-            ecSpec = new ECNamedCurveParameterSpec(
-                        in.readUTF(),
-                        (ECCurve)in.readObject(),
-                        (ECPoint)in.readObject(),
-                        (BigInteger)in.readObject(),
-                        (BigInteger)in.readObject(),
-                        (byte[])in.readObject());
-        }
-        else
-        {
-            ecSpec = new ECParameterSpec(
-                        (ECCurve)in.readObject(),
-                        (ECPoint)in.readObject(),
-                        (BigInteger)in.readObject(),
-                        (BigInteger)in.readObject(),
-                        (byte[])in.readObject());
-        }
-    }
-
-    private void writeObject(
-        ObjectOutputStream  out)
-        throws IOException
-    {
-        out.defaultWriteObject();
-
-        if (this.ecSpec instanceof ECNamedCurveParameterSpec)
-        {
-            ECNamedCurveParameterSpec   namedSpec = (ECNamedCurveParameterSpec)ecSpec;
-
-            out.writeBoolean(true);
-            out.writeUTF(namedSpec.getName());
-        }
-        else
-        {
-            out.writeBoolean(false);
-        }
-
-        out.writeObject(ecSpec.getCurve());
-        out.writeObject(ecSpec.getG());
-        out.writeObject(ecSpec.getN());
-        out.writeObject(ecSpec.getH());
-        out.writeObject(ecSpec.getSeed());
-    }
-*/
-
-    public void setBagAttribute(
-        DERObjectIdentifier oid,
-        DEREncodable        attribute)
-    {
-        pkcs12Attributes.put(oid, attribute);
-        pkcs12Ordering.addElement(oid);
-    }
-
-    public DEREncodable getBagAttribute(
-        DERObjectIdentifier oid)
-    {
-        return (DEREncodable)pkcs12Attributes.get(oid);
-    }
-
-    public Enumeration getBagAttributeKeys()
-    {
-        return pkcs12Ordering.elements();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/JCEECPublicKey.java b/azureus2/src/org/bouncycastle/jce/provider/JCEECPublicKey.java
deleted file mode 100644
index de35093..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/JCEECPublicKey.java
+++ /dev/null
@@ -1,273 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import org.bouncycastle.asn1.ASN1OctetString;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DERInputStream;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DEROctetString;
-import org.bouncycastle.asn1.DEROutputStream;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
-import org.bouncycastle.asn1.x9.X962NamedCurves;
-import org.bouncycastle.asn1.x9.X962Parameters;
-import org.bouncycastle.asn1.x9.X9ECParameters;
-import org.bouncycastle.asn1.x9.X9ECPoint;
-import org.bouncycastle.asn1.x9.X9ObjectIdentifiers;
-import org.bouncycastle.crypto.params.ECDomainParameters;
-import org.bouncycastle.crypto.params.ECPublicKeyParameters;
-import org.bouncycastle.jce.interfaces.ECPublicKey;
-import org.bouncycastle.jce.spec.ECNamedCurveParameterSpec;
-import org.bouncycastle.jce.spec.ECParameterSpec;
-import org.bouncycastle.jce.spec.ECPublicKeySpec;
-import org.bouncycastle.math.ec.ECPoint;
-
-public class JCEECPublicKey
-    implements ECPublicKey
-{
-    private String                  algorithm = "EC";
-    private ECPoint                 q;
-    private ECParameterSpec         ecSpec;
-
-    JCEECPublicKey(
-        String              algorithm,
-        ECPublicKeySpec     spec)
-    {
-        this.algorithm = algorithm;
-        this.q = spec.getQ();
-        this.ecSpec = spec.getParams();
-    }
-
-    JCEECPublicKey(
-        String                  algorithm,
-        ECPublicKeyParameters   params,
-        ECParameterSpec         spec)
-    {
-        ECDomainParameters      dp = params.getParameters();
-
-        this.algorithm = algorithm;
-        this.q = params.getQ();
-
-        if (spec == null)
-        {
-            this.ecSpec = new ECParameterSpec(
-                            dp.getCurve(),
-                            dp.getG(),
-                            dp.getN(),
-                            dp.getH(),
-                            dp.getSeed());
-        }
-        else
-        {
-            this.ecSpec = spec;
-        }
-    }
-
-    JCEECPublicKey(
-        String          algorithm,
-        ECPublicKey     key)
-    {
-        this.q = key.getQ();
-        this.algorithm = key.getAlgorithm();
-        this.ecSpec = key.getParams();
-    }
-
-    JCEECPublicKey(
-        String            algorithm,
-        ECPoint           q,
-        ECParameterSpec   ecSpec)
-    {
-        this.algorithm = algorithm;
-        this.q = q;
-        this.ecSpec = ecSpec;
-    }
-
-    JCEECPublicKey(
-        SubjectPublicKeyInfo    info)
-    {
-        X962Parameters          params = new X962Parameters((DERObject)info.getAlgorithmId().getParameters());
-
-        if (params.isNamedCurve())
-        {
-            DERObjectIdentifier oid = (DERObjectIdentifier)params.getParameters();
-            X9ECParameters      ecP = X962NamedCurves.getByOID(oid);
-
-            ecSpec = new ECNamedCurveParameterSpec(
-                                        X962NamedCurves.getName(oid),
-                                        ecP.getCurve(),
-                                        ecP.getG(),
-                                        ecP.getN(),
-                                        ecP.getH(),
-                                        ecP.getSeed());
-        }
-        else
-        {
-            X9ECParameters ecP = new X9ECParameters(
-                        (ASN1Sequence)params.getParameters());
-            ecSpec = new ECParameterSpec(
-                                        ecP.getCurve(),
-                                        ecP.getG(),
-                                        ecP.getN(),
-                                        ecP.getH(),
-                                        ecP.getSeed());
-        }
-
-        DERBitString    bits = info.getPublicKeyData();
-        byte[]          data = bits.getBytes();
-		ASN1OctetString	key = new DEROctetString(data);
-
-        //
-        // extra octet string - one of our old certs...
-        //
-        if (data[0] == 0x04 && data[1] == data.length - 2 
-            && (data[2] == 0x02 || data[2] == 0x03))
-        {
-            try
-            {
-                ByteArrayInputStream    bIn = new ByteArrayInputStream(data);
-                DERInputStream          dIn = new DERInputStream(bIn);
-
-                key = (ASN1OctetString)dIn.readObject();
-            }
-            catch (IOException ex)
-            {
-                throw new IllegalArgumentException("error recovering public key");
-            }
-        }
-
-        X9ECPoint       derQ = new X9ECPoint(ecSpec.getCurve(), key);
-
-        this.q = derQ.getPoint();
-    }
-
-    public String getAlgorithm()
-    {
-        return algorithm;
-    }
-
-    public String getFormat()
-    {
-        return "X.509";
-    }
-
-    public byte[] getEncoded()
-    {
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-        DEROutputStream         dOut = new DEROutputStream(bOut);
-        X962Parameters          params = null;
-
-        if (ecSpec instanceof ECNamedCurveParameterSpec)
-        {
-            params = new X962Parameters(X962NamedCurves.getOID(((ECNamedCurveParameterSpec)ecSpec).getName()));
-        }
-        else
-        {
-            X9ECParameters          ecP = new X9ECParameters(
-                                            ecSpec.getCurve(),
-                                            ecSpec.getG(),
-                                            ecSpec.getN(),
-                                            ecSpec.getH(),
-                                            ecSpec.getSeed());
-            params = new X962Parameters(ecP);
-        }
-
-        ASN1OctetString    p = (ASN1OctetString)(new X9ECPoint(this.getQ()).getDERObject());
-
-        SubjectPublicKeyInfo info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_ecPublicKey, params.getDERObject()), p.getOctets());
-
-        try
-        {
-            dOut.writeObject(info);
-            dOut.close();
-        }
-        catch (IOException e)
-        {
-            throw new RuntimeException("Error encoding EC public key");
-        }
-
-        return bOut.toByteArray();
-    }
-
-    public ECParameterSpec getParams()
-    {
-        return ecSpec;
-    }
-
-    public ECPoint getQ()
-    {
-        return q;
-    }
-
-    public String toString()
-    {
-        StringBuffer    buf = new StringBuffer();
-        String          nl = System.getProperty("line.separator");
-
-        buf.append("EC Public Key" + nl);
-        buf.append("            X: " + this.getQ().getX().toBigInteger().toString(16) + nl);
-        buf.append("            Y: " + this.getQ().getY().toBigInteger().toString(16) + nl);
-
-        return buf.toString();
-
-    }
-/*
-    private void readObject(
-        ObjectInputStream   in)
-        throws IOException, ClassNotFoundException
-    {
-        in.defaultReadObject();
-
-        boolean named = in.readBoolean();
-
-        if (named)
-        {
-            ecSpec = new ECNamedCurveParameterSpec(
-                        in.readUTF(),
-                        (ECCurve)in.readObject(),
-                        (ECPoint)in.readObject(),
-                        (BigInteger)in.readObject(),
-                        (BigInteger)in.readObject(),
-                        (byte[])in.readObject());
-        }
-        else
-        {
-            ecSpec = new ECParameterSpec(
-                        (ECCurve)in.readObject(),
-                        (ECPoint)in.readObject(),
-                        (BigInteger)in.readObject(),
-                        (BigInteger)in.readObject(),
-                        (byte[])in.readObject());
-        }
-    }
-
-    private void writeObject(
-        ObjectOutputStream  out)
-        throws IOException
-    {
-        out.defaultWriteObject();
-
-        if (this.ecSpec instanceof ECNamedCurveParameterSpec)
-        {
-            ECNamedCurveParameterSpec   namedSpec = (ECNamedCurveParameterSpec)ecSpec;
-
-            out.writeBoolean(true);
-            out.writeUTF(namedSpec.getName());
-        }
-        else
-        {
-            out.writeBoolean(false);
-        }
-
-        out.writeObject(ecSpec.getCurve());
-        out.writeObject(ecSpec.getG());
-        out.writeObject(ecSpec.getN());
-        out.writeObject(ecSpec.getH());
-        out.writeObject(ecSpec.getSeed());
-    }
-*/
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/JCEIESCipher.java b/azureus2/src/org/bouncycastle/jce/provider/JCEIESCipher.java
deleted file mode 100644
index 3908d87..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/JCEIESCipher.java
+++ /dev/null
@@ -1,371 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.io.ByteArrayOutputStream;
-import java.security.AlgorithmParameters;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.security.Key;
-import java.security.SecureRandom;
-import java.security.spec.AlgorithmParameterSpec;
-
-import javax.crypto.BadPaddingException;
-import javax.crypto.Cipher;
-import javax.crypto.IllegalBlockSizeException;
-import javax.crypto.NoSuchPaddingException;
-import javax.crypto.interfaces.DHPrivateKey;
-
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.InvalidCipherTextException;
-//import org.bouncycastle.crypto.agreement.DHBasicAgreement;
-import org.bouncycastle.crypto.agreement.ECDHBasicAgreement;
-import org.bouncycastle.crypto.digests.SHA1Digest;
-import org.bouncycastle.crypto.engines.IESEngine;
-import org.bouncycastle.crypto.generators.KDF2BytesGenerator;
-import org.bouncycastle.crypto.macs.HMac;
-import org.bouncycastle.crypto.params.IESParameters;
-import org.bouncycastle.jce.interfaces.ECPrivateKey;
-import org.bouncycastle.jce.interfaces.IESKey;
-import org.bouncycastle.jce.spec.IESParameterSpec;
-
-public class JCEIESCipher //extends WrapCipherSpi
-{
-    private IESEngine               cipher;
-    private int                     state = -1;
-    private ByteArrayOutputStream   buffer = new ByteArrayOutputStream();
-    private AlgorithmParameters     engineParam = null;
-    private IESParameterSpec        engineParams = null;
-
-    //
-    // specs we can handle.
-    //
-    private Class[]                 availableSpecs =
-                                    {
-                                        IESParameterSpec.class
-                                    };
-
-    public JCEIESCipher(
-        IESEngine   engine)
-    {
-        cipher = engine;
-    }
-
-    protected int engineGetBlockSize() 
-    {
-        return 0;
-    }
-
-    protected byte[] engineGetIV() 
-    {
-        return null;
-    }
-
-    protected int engineGetKeySize(
-        Key     key) 
-    {
-        IESKey   ieKey = (IESKey)key;
-
-        if (ieKey.getPrivate() instanceof DHPrivateKey)
-        {
-            DHPrivateKey   k = (DHPrivateKey)ieKey.getPrivate();
-
-            return k.getX().bitLength();
-        }
-        else if (ieKey.getPrivate() instanceof ECPrivateKey)
-        {
-            ECPrivateKey   k = (ECPrivateKey)ieKey.getPrivate();
-
-            return k.getD().bitLength();
-        }
-
-        throw new IllegalArgumentException("not an IE key!");
-    }
-
-    protected int engineGetOutputSize(
-        int     inputLen) 
-    {
-        if (state == Cipher.ENCRYPT_MODE || state == Cipher.WRAP_MODE)
-        {
-            return buffer.size() + inputLen + 20; /* SHA1 MAC size */
-        }
-        else if (state == Cipher.DECRYPT_MODE || state == Cipher.UNWRAP_MODE)
-        {
-            return buffer.size() + inputLen - 20;
-        }
-        else
-        {
-            throw new IllegalStateException("cipher not initialised");
-        }
-    }
-
-    protected AlgorithmParameters engineGetParameters() 
-    {
-        if (engineParam == null)
-        {
-            if (engineParams != null)
-            {
-                String  name = "IES";
-
-                try
-                {
-                    engineParam = AlgorithmParameters.getInstance(name, BouncyCastleProvider.PROVIDER_NAME);
-                    engineParam.init(engineParams);
-                }
-                catch (Exception e)
-                {
-                    throw new RuntimeException(e.toString());
-                }
-            }
-        }
-
-        return engineParam;
-    }
-
-    protected void engineSetMode(
-        String  mode) 
-    {
-        throw new IllegalArgumentException("can't support mode " + mode);
-    }
-
-    protected void engineSetPadding(
-        String  padding) 
-        throws NoSuchPaddingException
-    {
-        throw new NoSuchPaddingException(padding + " unavailable with RSA.");
-    }
-
-    public void engineInit(
-        int                     opmode,
-        Key                     key,
-        AlgorithmParameterSpec  params,
-        SecureRandom            random) 
-    throws InvalidKeyException, InvalidAlgorithmParameterException
-    {
-        if (!(key instanceof IESKey))
-        {
-            throw new InvalidKeyException("must be passed IE key");
-        }
-
-        if (params == null && (opmode == Cipher.ENCRYPT_MODE || opmode == Cipher.WRAP_MODE))
-        {
-            //
-            // if nothing is specified we set up for a 128 bit mac, with
-            // 128 bit derivation vectors.
-            //
-            byte[]  d = new byte[16];
-            byte[]  e = new byte[16];
-
-            if (random == null)
-            {
-                random = new SecureRandom();
-            }
-
-            random.nextBytes(d);
-            random.nextBytes(e);
-
-            params = new IESParameterSpec(d, e, 128);
-        }
-        else if (!(params instanceof IESParameterSpec))
-        {
-            throw new InvalidAlgorithmParameterException("must be passed IES parameters");
-        }
-
-        IESKey       ieKey = (IESKey)key;
-
-        CipherParameters pubKey;
-        CipherParameters privKey;
-
-        if (ieKey.getPublic() instanceof JCEECPublicKey)
-        {
-            pubKey = ECUtil.generatePublicKeyParameter(ieKey.getPublic());
-            privKey = ECUtil.generatePrivateKeyParameter(ieKey.getPrivate());
-        }
-        else
-        {
-            pubKey = DHUtil.generatePublicKeyParameter(ieKey.getPublic());
-            privKey = DHUtil.generatePrivateKeyParameter(ieKey.getPrivate());
-        }
-
-        this.engineParams = (IESParameterSpec)params;
-
-        IESParameters       p = new IESParameters(engineParams.getDerivationV(), engineParams.getEncodingV(), engineParams.getMacKeySize());
-
-        this.state = opmode;
-
-        buffer.reset();
-
-        switch (opmode)
-        {
-        case Cipher.ENCRYPT_MODE:
-		case Cipher.WRAP_MODE:
-            cipher.init(true, privKey, pubKey, p);
-            break;
-        case Cipher.DECRYPT_MODE:
-		case Cipher.UNWRAP_MODE:
-            cipher.init(false, privKey, pubKey, p);
-            break;
-        default:
-            System.out.println("eeek!");
-        }
-    }
-
-    protected void engineInit(
-        int                 opmode,
-        Key                 key,
-        AlgorithmParameters params,
-        SecureRandom        random) 
-    throws InvalidKeyException, InvalidAlgorithmParameterException
-    {
-        AlgorithmParameterSpec  paramSpec = null;
-
-        if (params != null)
-        {
-            for (int i = 0; i != availableSpecs.length; i++)
-            {
-                try
-                {
-                    paramSpec = params.getParameterSpec(availableSpecs[i]);
-                    break;
-                }
-                catch (Exception e)
-                {
-                    continue;
-                }
-            }
-
-            if (paramSpec == null)
-            {
-                throw new InvalidAlgorithmParameterException("can't handle parameter " + params.toString());
-            }
-        }
-
-        engineParam = params;
-        engineInit(opmode, key, paramSpec, random);
-    }
-
-    protected void engineInit(
-        int                 opmode,
-        Key                 key,
-        SecureRandom        random) 
-    throws InvalidKeyException
-    {
-        if (opmode == Cipher.ENCRYPT_MODE || opmode == Cipher.WRAP_MODE)
-        {
-            try
-            {
-                engineInit(opmode, key, (AlgorithmParameterSpec)null, random);
-                return;
-            }
-            catch (InvalidAlgorithmParameterException e)
-            {
-                // fall through...
-            }
-        }
-
-        throw new IllegalArgumentException("can't handle null parameter spec in IES");
-    }
-
-    public byte[] engineUpdate(
-        byte[]  input,
-        int     inputOffset,
-        int     inputLen) 
-    {
-        buffer.write(input, inputOffset, inputLen);
-        return null;
-    }
-
-    public int engineUpdate(
-        byte[]  input,
-        int     inputOffset,
-        int     inputLen,
-        byte[]  output,
-        int     outputOffset) 
-    {
-        buffer.write(input, inputOffset, inputLen);
-        return 0;
-    }
-
-    public byte[] engineDoFinal(
-        byte[]  input,
-        int     inputOffset,
-        int     inputLen) 
-        throws IllegalBlockSizeException, BadPaddingException
-    {
-        if (inputLen != 0)
-        {
-            buffer.write(input, inputOffset, inputLen);
-        }
-
-        try
-        {
-            byte[]  buf = buffer.toByteArray();
-
-            buffer.reset();
-
-            return cipher.processBlock(buf, 0, buf.length);
-        }
-        catch (InvalidCipherTextException e)
-        {
-            throw new BadPaddingException(e.getMessage());
-        }
-    }
-
-    public int engineDoFinal(
-        byte[]  input,
-        int     inputOffset,
-        int     inputLen,
-        byte[]  output,
-        int     outputOffset) 
-        throws IllegalBlockSizeException, BadPaddingException
-    {
-        if (inputLen != 0)
-        {
-            buffer.write(input, inputOffset, inputLen);
-        }
-
-        try
-        {
-            byte[]  buf = buffer.toByteArray();
-
-            buffer.reset();
-
-            buf = cipher.processBlock(buf, 0, buf.length);
-
-            System.arraycopy(buf, 0, output, outputOffset, buf.length);
-
-            return buf.length;
-        }
-        catch (InvalidCipherTextException e)
-        {
-            throw new BadPaddingException(e.getMessage());
-        }
-    }
-
-    /**
-     * classes that inherit from us.
-     */
-    static public class ECIES
-        extends JCEIESCipher
-    {
-        public ECIES()
-        {
-            super(new IESEngine(
-                   new ECDHBasicAgreement(),
-                   new KDF2BytesGenerator(new SHA1Digest()),
-                   new HMac(new SHA1Digest())));
-        }
-    }
-
-    /*
-    static public class IES
-        extends JCEIESCipher
-    {
-        public IES()
-        {
-            super(new IESEngine(
-                   new DHBasicAgreement(),
-                   new KDF2BytesGenerator(new SHA1Digest()),
-                   new HMac(new SHA1Digest())));
-        }
-    }
-    */
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/JCERSAPublicKey.java b/azureus2/src/org/bouncycastle/jce/provider/JCERSAPublicKey.java
deleted file mode 100644
index 79cf8ab..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/JCERSAPublicKey.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.interfaces.RSAPublicKey;
-import java.security.spec.RSAPublicKeySpec;
-
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERNull;
-import org.bouncycastle.asn1.DEROutputStream;
-import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-import org.bouncycastle.asn1.x509.RSAPublicKeyStructure;
-import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
-import org.bouncycastle.crypto.params.RSAKeyParameters;
-
-public class JCERSAPublicKey
-    implements RSAPublicKey
-{
-    private BigInteger modulus;
-    private BigInteger publicExponent;
-
-    JCERSAPublicKey(
-        RSAKeyParameters key)
-    {
-        this.modulus = key.getModulus();
-        this.publicExponent = key.getExponent();
-    }
-
-    JCERSAPublicKey(
-        RSAPublicKeySpec spec)
-    {
-        this.modulus = spec.getModulus();
-        this.publicExponent = spec.getPublicExponent();
-    }
-
-    JCERSAPublicKey(
-        RSAPublicKey key)
-    {
-        this.modulus = key.getModulus();
-        this.publicExponent = key.getPublicExponent();
-    }
-
-    JCERSAPublicKey(
-        SubjectPublicKeyInfo    info)
-    {
-        try
-        {
-            RSAPublicKeyStructure   pubKey = new RSAPublicKeyStructure((ASN1Sequence)info.getPublicKey());
-
-            this.modulus = pubKey.getModulus();
-            this.publicExponent = pubKey.getPublicExponent();
-		}
-        catch (IOException e)
-        {
-			throw new IllegalArgumentException("invalid info structure in RSA public key");
-        }
-    }
-
-    /**
-     * return the modulus.
-     *
-     * @return the modulus.
-     */
-    public BigInteger getModulus()
-    {
-        return modulus;
-    }
-
-    /**
-     * return the public exponent.
-     *
-     * @return the public exponent.
-     */
-    public BigInteger getPublicExponent()
-    {
-        return publicExponent;
-    }
-
-    public String getAlgorithm()
-    {
-        return "RSA";
-    }
-
-    public String getFormat()
-    {
-        return "X.509";
-    }
-
-    public byte[] getEncoded()
-    {
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-        DEROutputStream         dOut = new DEROutputStream(bOut);
-        SubjectPublicKeyInfo    info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, new DERNull()), new RSAPublicKeyStructure(getModulus(), getPublicExponent()).getDERObject());
-
-        try
-        {
-            dOut.writeObject(info);
-            dOut.close();
-        }
-        catch (IOException e)
-        {
-            throw new RuntimeException("Error encoding RSA public key");
-        }
-
-        return bOut.toByteArray();
-
-    }
-
-	public boolean equals(Object o)
-	{
-		if ( !(o instanceof RSAPublicKey) )
-		{
-			return false;
-		}
-
-		if ( o == this )
-		{
-			return true;
-		}
-
-		RSAPublicKey key = (RSAPublicKey)o;
-
-		return getModulus().equals(key.getModulus())
-			&& getPublicExponent().equals(key.getPublicExponent());
-	}
-
-    public String toString()
-    {
-        StringBuffer    buf = new StringBuffer();
-        String          nl = System.getProperty("line.separator");
-
-        buf.append("RSA Public Key" + nl);
-        buf.append("            modulus: " + this.getModulus().toString(16) + nl);
-        buf.append("    public exponent: " + this.getPublicExponent().toString(16) + nl);
-
-        return buf.toString();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/JDKAlgorithmParameterGenerator.java b/azureus2/src/org/bouncycastle/jce/provider/JDKAlgorithmParameterGenerator.java
deleted file mode 100644
index 403d824..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/JDKAlgorithmParameterGenerator.java
+++ /dev/null
@@ -1,385 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.security.AlgorithmParameterGeneratorSpi;
-import java.security.AlgorithmParameters;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.SecureRandom;
-import java.security.spec.AlgorithmParameterSpec;
-import java.security.spec.DSAParameterSpec;
-
-import javax.crypto.spec.DHGenParameterSpec;
-import javax.crypto.spec.DHParameterSpec;
-import javax.crypto.spec.IvParameterSpec;
-import javax.crypto.spec.RC2ParameterSpec;
-
-import org.bouncycastle.crypto.generators.DHParametersGenerator;
-import org.bouncycastle.crypto.generators.DSAParametersGenerator;
-import org.bouncycastle.crypto.generators.ElGamalParametersGenerator;
-import org.bouncycastle.crypto.params.DHParameters;
-import org.bouncycastle.crypto.params.DSAParameters;
-import org.bouncycastle.crypto.params.ElGamalParameters;
-import org.bouncycastle.jce.spec.ElGamalParameterSpec;
-
-public abstract class JDKAlgorithmParameterGenerator
-    extends AlgorithmParameterGeneratorSpi
-{
-    protected SecureRandom  random;
-    protected int           strength = 1024;
-
-    protected void engineInit(
-        int             strength,
-        SecureRandom    random)
-    {
-        this.strength = strength;
-        this.random = random;
-    }
-
-    public static class DH
-        extends JDKAlgorithmParameterGenerator
-    {
-        private int l = 0;
-
-        protected void engineInit(
-            AlgorithmParameterSpec  genParamSpec,
-            SecureRandom            random)
-            throws InvalidAlgorithmParameterException
-        {
-            if (!(genParamSpec instanceof DHGenParameterSpec))
-            {
-                throw new InvalidAlgorithmParameterException("DH parameter generator requires a DHGenParameterSpec for initialisation");
-            }
-            DHGenParameterSpec  spec = (DHGenParameterSpec)genParamSpec;
-
-            this.strength = spec.getPrimeSize();
-            this.l = spec.getExponentSize();
-            this.random = random;
-        }
-
-        protected AlgorithmParameters engineGenerateParameters()
-        {
-            DHParametersGenerator        pGen = new DHParametersGenerator();
-
-			if ( random != null )
-			{
-				pGen.init(strength, 20, random);
-			}
-			else
-			{
-				pGen.init(strength, 20, new SecureRandom());
-			}
-
-            DHParameters                p = pGen.generateParameters();
-
-            AlgorithmParameters params;
-
-            try
-            {
-                params = AlgorithmParameters.getInstance("DH", BouncyCastleProvider.PROVIDER_NAME);
-                params.init(new DHParameterSpec(p.getP(), p.getG(), l));
-            }
-            catch (Exception e)
-            {
-                throw new RuntimeException(e.getMessage());
-            }
-
-            return params;
-        }
-    }
-
-    public static class DSA
-        extends JDKAlgorithmParameterGenerator
-    {
-        protected void engineInit(
-            AlgorithmParameterSpec  genParamSpec,
-            SecureRandom            random)
-            throws InvalidAlgorithmParameterException
-        {
-            throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for DSA parameter generation.");
-        }
-
-        protected AlgorithmParameters engineGenerateParameters()
-        {
-            DSAParametersGenerator pGen = new DSAParametersGenerator();
-
-			if ( random != null )
-			{
-				pGen.init(strength, 20, random);
-			}
-			else
-			{
-				pGen.init(strength, 20, new SecureRandom());
-			}
-
-            DSAParameters p = pGen.generateParameters();
-
-            AlgorithmParameters params;
-
-            try
-            {
-                params = AlgorithmParameters.getInstance("DSA", BouncyCastleProvider.PROVIDER_NAME);
-                params.init(new DSAParameterSpec(p.getP(), p.getQ(), p.getG()));
-            }
-            catch (Exception e)
-            {
-                throw new RuntimeException(e.getMessage());
-            }
-
-            return params;
-        }
-    }
-
-    public static class ElGamal
-        extends JDKAlgorithmParameterGenerator
-    {
-        protected void engineInit(
-            AlgorithmParameterSpec  genParamSpec,
-            SecureRandom            random)
-            throws InvalidAlgorithmParameterException
-        {
-            throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for ElGamal parameter generation.");
-        }
-
-        protected AlgorithmParameters engineGenerateParameters()
-        {
-            ElGamalParametersGenerator pGen = new ElGamalParametersGenerator();
-
-			if ( random != null )
-			{
-				pGen.init(strength, 20, random);
-			}
-			else
-			{
-				pGen.init(strength, 20, new SecureRandom());
-			}
-
-            ElGamalParameters p = pGen.generateParameters();
-
-            AlgorithmParameters params;
-
-            try
-            {
-                params = AlgorithmParameters.getInstance("ElGamal", BouncyCastleProvider.PROVIDER_NAME);
-                params.init(new ElGamalParameterSpec(p.getP(), p.getG()));
-            }
-            catch (Exception e)
-            {
-                throw new RuntimeException(e.getMessage());
-            }
-
-            return params;
-        }
-    }
-
-    public static class DES
-        extends JDKAlgorithmParameterGenerator
-    {
-        protected void engineInit(
-            AlgorithmParameterSpec  genParamSpec,
-            SecureRandom            random)
-            throws InvalidAlgorithmParameterException
-        {
-            throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for DES parameter generation.");
-        }
-
-        protected AlgorithmParameters engineGenerateParameters()
-        {
-            byte[]  iv = new byte[8];
-
-			if (random == null)
-			{
-                random = new SecureRandom();
-			}
-
-            random.nextBytes(iv);
-
-            AlgorithmParameters params;
-
-            try
-            {
-                params = AlgorithmParameters.getInstance("DES", BouncyCastleProvider.PROVIDER_NAME);
-                params.init(new IvParameterSpec(iv));
-            }
-            catch (Exception e)
-            {
-                throw new RuntimeException(e.getMessage());
-            }
-
-            return params;
-        }
-    }
-
-    public static class RC2
-        extends JDKAlgorithmParameterGenerator
-    {
-        RC2ParameterSpec    spec = null;
-
-        protected void engineInit(
-            AlgorithmParameterSpec  genParamSpec,
-            SecureRandom            random)
-            throws InvalidAlgorithmParameterException
-        {
-            if (genParamSpec instanceof RC2ParameterSpec)
-            {
-                spec = (RC2ParameterSpec)genParamSpec;
-                return;
-            }
-
-            throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for RC2 parameter generation.");
-        }
-
-        protected AlgorithmParameters engineGenerateParameters()
-        {
-            AlgorithmParameters params;
-
-            if (spec == null)
-            {
-                byte[]  iv = new byte[8];
-
-                if (random == null)
-                {
-                    random = new SecureRandom();
-                }
-
-                random.nextBytes(iv);
-
-                try
-                {
-                    params = AlgorithmParameters.getInstance("RC2", BouncyCastleProvider.PROVIDER_NAME);
-                    params.init(new IvParameterSpec(iv));
-                }
-                catch (Exception e)
-                {
-                    throw new RuntimeException(e.getMessage());
-                }
-            }
-            else
-            {
-                try
-                {
-                    params = AlgorithmParameters.getInstance("RC2", BouncyCastleProvider.PROVIDER_NAME);
-                    params.init(spec);
-                }
-                catch (Exception e)
-                {
-                    throw new RuntimeException(e.getMessage());
-                }
-            }
-
-            return params;
-        }
-    }
-
-    public static class AES
-        extends JDKAlgorithmParameterGenerator
-    {
-        protected void engineInit(
-            AlgorithmParameterSpec  genParamSpec,
-            SecureRandom            random)
-            throws InvalidAlgorithmParameterException
-        {
-            throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for AES parameter generation.");
-        }
-
-        protected AlgorithmParameters engineGenerateParameters()
-        {
-            byte[]  iv = new byte[16];
-
-			if (random == null)
-			{
-                random = new SecureRandom();
-			}
-
-            random.nextBytes(iv);
-
-            AlgorithmParameters params;
-
-            try
-            {
-                params = AlgorithmParameters.getInstance("AES", BouncyCastleProvider.PROVIDER_NAME);
-                params.init(new IvParameterSpec(iv));
-            }
-            catch (Exception e)
-            {
-                throw new RuntimeException(e.getMessage());
-            }
-
-            return params;
-        }
-    }
-
-    public static class IDEA
-        extends JDKAlgorithmParameterGenerator
-    {
-        protected void engineInit(
-            AlgorithmParameterSpec  genParamSpec,
-            SecureRandom            random)
-            throws InvalidAlgorithmParameterException
-        {
-            throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for IDEA parameter generation.");
-        }
-
-        protected AlgorithmParameters engineGenerateParameters()
-        {
-            byte[]  iv = new byte[8];
-
-			if (random == null)
-			{
-                random = new SecureRandom();
-			}
-
-            random.nextBytes(iv);
-
-            AlgorithmParameters params;
-
-            try
-            {
-                params = AlgorithmParameters.getInstance("IDEA", BouncyCastleProvider.PROVIDER_NAME);
-                params.init(new IvParameterSpec(iv));
-            }
-            catch (Exception e)
-            {
-                throw new RuntimeException(e.getMessage());
-            }
-
-            return params;
-        }
-    }
-
-    public static class CAST5
-        extends JDKAlgorithmParameterGenerator
-    {
-        protected void engineInit(
-            AlgorithmParameterSpec  genParamSpec,
-            SecureRandom            random)
-            throws InvalidAlgorithmParameterException
-        {
-            throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for CAST5 parameter generation.");
-        }
-
-        protected AlgorithmParameters engineGenerateParameters()
-        {
-            byte[]  iv = new byte[8];
-
-			if (random == null)
-			{
-                random = new SecureRandom();
-			}
-
-            random.nextBytes(iv);
-
-            AlgorithmParameters params;
-
-            try
-            {
-                params = AlgorithmParameters.getInstance("CAST5", BouncyCastleProvider.PROVIDER_NAME);
-                params.init(new IvParameterSpec(iv));
-            }
-            catch (Exception e)
-            {
-                throw new RuntimeException(e.getMessage());
-            }
-
-            return params;
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/JDKDSASigner.java b/azureus2/src/org/bouncycastle/jce/provider/JDKDSASigner.java
deleted file mode 100644
index a27ceb4..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/JDKDSASigner.java
+++ /dev/null
@@ -1,269 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.InvalidKeyException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.SecureRandom;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.interfaces.DSAKey;
-import java.security.spec.AlgorithmParameterSpec;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERInputStream;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DEROutputStream;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-import org.bouncycastle.asn1.x509.X509ObjectIdentifiers;
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.DSA;
-import org.bouncycastle.crypto.Digest;
-import org.bouncycastle.crypto.digests.SHA1Digest;
-import org.bouncycastle.crypto.params.ParametersWithRandom;
-//import org.bouncycastle.crypto.signers.DSASigner;
-import org.bouncycastle.crypto.signers.ECDSASigner;
-import org.bouncycastle.jce.interfaces.ECKey;
-
-public class JDKDSASigner
-    extends Signature implements PKCSObjectIdentifiers, X509ObjectIdentifiers
-{
-    private Digest                  digest;
-    private DSA                     signer;
-    private SecureRandom            random;
-
-    protected JDKDSASigner(
-        String                  name,
-        Digest                  digest,
-        DSA                     signer)
-    {
-        super(name);
-
-        this.digest = digest;
-        this.signer = signer;
-    }
-
-    protected void engineInitVerify(
-        PublicKey   publicKey)
-        throws InvalidKeyException
-    {
-        CipherParameters    param = null;
-
-        if (publicKey instanceof ECKey)
-        {
-            param = ECUtil.generatePublicKeyParameter(publicKey);
-        }
-        else if (publicKey instanceof DSAKey)
-        {
-            param = DSAUtil.generatePublicKeyParameter(publicKey);
-        }
-        else
-        {
-            try
-            {
-            	/*
-                byte[]  bytes = publicKey.getEncoded();
-
-                publicKey = JDKKeyFactory.createPublicKeyFromDERStream(
-                                        new ByteArrayInputStream(bytes));
-
-                if (publicKey instanceof ECKey)
-                {
-                    param = ECUtil.generatePublicKeyParameter(publicKey);
-                }
-                else if (publicKey instanceof DSAKey)
-                {
-                    param = DSAUtil.generatePublicKeyParameter(publicKey);
-                }
-                else
-                {
-                */
-                    throw new InvalidKeyException("can't recognise key type in DSA based signer");
-                //}
-            }
-            catch (Exception e)
-            {
-                throw new InvalidKeyException("can't recognise key type in DSA based signer");
-            }
-        }
-
-        digest.reset();
-        signer.init(false, param);
-    }
-
-    protected void engineInitSign(
-        PrivateKey      privateKey,
-        SecureRandom    random)
-        throws InvalidKeyException
-    {
-        this.random = random;
-        engineInitSign(privateKey);
-    }
-
-    protected void engineInitSign(
-        PrivateKey  privateKey)
-        throws InvalidKeyException
-    {
-        CipherParameters    param = null;
-
-        if (privateKey instanceof ECKey)
-        {
-            param = ECUtil.generatePrivateKeyParameter(privateKey);
-        }
-        else
-        {
-            param = DSAUtil.generatePrivateKeyParameter(privateKey);
-        }
-
-        digest.reset();
-
-        if (random != null)
-        {
-            signer.init(true, new ParametersWithRandom(param, random));
-        }
-        else
-        {
-            signer.init(true, param);
-        }
-    }
-
-    protected void engineUpdate(
-        byte    b)
-        throws SignatureException
-    {
-        digest.update(b);
-    }
-
-    protected void engineUpdate(
-        byte[]  b,
-        int     off,
-        int     len) 
-        throws SignatureException
-    {
-        digest.update(b, off, len);
-    }
-
-    protected byte[] engineSign()
-        throws SignatureException
-    {
-        byte[]  hash = new byte[digest.getDigestSize()];
-
-        digest.doFinal(hash, 0);
-
-        try
-        {
-            BigInteger[]    sig = signer.generateSignature(hash);
-
-            return derEncode(sig[0], sig[1]);
-        }
-        catch (Exception e)
-        {
-            throw new SignatureException(e.toString());
-        }
-    }
-
-    protected boolean engineVerify(
-        byte[]  sigBytes) 
-        throws SignatureException
-    {
-        byte[]  hash = new byte[digest.getDigestSize()];
-
-        digest.doFinal(hash, 0);
-
-        BigInteger[]    sig;
-
-        try
-        {
-            sig = derDecode(sigBytes);
-        }
-        catch (Exception e)
-        {
-            throw new SignatureException("error decoding signature bytes.");
-        }
-
-        return signer.verifySignature(hash, sig[0], sig[1]);
-    }
-
-    protected void engineSetParameter(
-        AlgorithmParameterSpec params)
-    {
-        throw new UnsupportedOperationException("engineSetParameter unsupported");
-    }
-
-    /**
-     * @deprecated replaced with <a href = "#engineSetParameter(java.security.spec.AlgorithmParameterSpec)">
-     */
-    protected void engineSetParameter(
-        String  param,
-        Object  value)
-    {
-        throw new UnsupportedOperationException("engineSetParameter unsupported");
-    }
-
-    /**
-     * @deprecated
-     */
-    protected Object engineGetParameter(
-        String      param)
-    {
-        throw new UnsupportedOperationException("engineSetParameter unsupported");
-    }
-
-    private byte[] derEncode(
-        BigInteger  r,
-        BigInteger  s)
-        throws IOException
-    {
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-        DEROutputStream         dOut = new DEROutputStream(bOut);
-        ASN1EncodableVector     v = new ASN1EncodableVector();
-
-        v.add(new DERInteger(r));
-        v.add(new DERInteger(s));
-
-        dOut.writeObject(new DERSequence(v));
-
-        return bOut.toByteArray();
-    }
-
-    private BigInteger[] derDecode(
-        byte[]  encoding)
-        throws IOException
-    {
-        ByteArrayInputStream    bIn = new ByteArrayInputStream(encoding);
-        DERInputStream          dIn = new DERInputStream(bIn);
-        ASN1Sequence            s = (ASN1Sequence)dIn.readObject();
-
-        BigInteger[]            sig = new BigInteger[2];
-
-        sig[0] = ((DERInteger)s.getObjectAt(0)).getValue();
-        sig[1] = ((DERInteger)s.getObjectAt(1)).getValue();
-
-        return sig;
-    }
-
-    /*
-    static public class stdDSA
-        extends JDKDSASigner
-    {
-        public stdDSA()
-        {
-            super("SHA1withDSA", new SHA1Digest(), new DSASigner());
-        }
-    }
-	*/
-    
-    static public class ecDSA
-        extends JDKDSASigner
-    {
-        public ecDSA()
-        {
-            super("SHA1withECDSA", new SHA1Digest(), new ECDSASigner());
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/JDKDigestSignature.java b/azureus2/src/org/bouncycastle/jce/provider/JDKDigestSignature.java
deleted file mode 100644
index da0e9ee..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/JDKDigestSignature.java
+++ /dev/null
@@ -1,271 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.security.InvalidKeyException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.interfaces.RSAPrivateKey;
-import java.security.interfaces.RSAPublicKey;
-import java.security.spec.AlgorithmParameterSpec;
-
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERInputStream;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DEROutputStream;
-import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-import org.bouncycastle.asn1.x509.DigestInfo;
-import org.bouncycastle.asn1.x509.X509ObjectIdentifiers;
-import org.bouncycastle.crypto.AsymmetricBlockCipher;
-import org.bouncycastle.crypto.CipherParameters;
-import org.bouncycastle.crypto.Digest;
-import org.bouncycastle.crypto.digests.MD2Digest;
-import org.bouncycastle.crypto.digests.MD5Digest;
-import org.bouncycastle.crypto.digests.RIPEMD128Digest;
-import org.bouncycastle.crypto.digests.RIPEMD160Digest;
-import org.bouncycastle.crypto.digests.RIPEMD256Digest;
-import org.bouncycastle.crypto.digests.SHA1Digest;
-import org.bouncycastle.crypto.encodings.PKCS1Encoding;
-import org.bouncycastle.crypto.engines.RSAEngine;
-
-public class JDKDigestSignature
-    extends Signature implements PKCSObjectIdentifiers, X509ObjectIdentifiers
-{
-    private Digest                  digest;
-    private AsymmetricBlockCipher   cipher;
-    private AlgorithmIdentifier     algId;
-
-    protected JDKDigestSignature(
-        String                  name,
-        DERObjectIdentifier     objId,
-        Digest                  digest,
-        AsymmetricBlockCipher   cipher)
-    {
-        super(name);
-
-        this.digest = digest;
-        this.cipher = cipher;
-        this.algId = new AlgorithmIdentifier(objId, null);
-    }
-
-    protected void engineInitVerify(
-        PublicKey   publicKey)
-        throws InvalidKeyException
-    {
-		if ( !(publicKey instanceof RSAPublicKey) )
-		{
-			throw new InvalidKeyException("Supplied key is not a RSAPublicKey instance");
-		}
-
-        CipherParameters    param = RSAUtil.generatePublicKeyParameter((RSAPublicKey)publicKey);
-
-        digest.reset();
-        cipher.init(false, param);
-    }
-
-    protected void engineInitSign(
-        PrivateKey  privateKey)
-        throws InvalidKeyException
-    {
-		if ( !(privateKey instanceof RSAPrivateKey) )
-		{
-			throw new InvalidKeyException("Supplied key is not a RSAPrivateKey instance");
-		}
-
-        CipherParameters    param = RSAUtil.generatePrivateKeyParameter((RSAPrivateKey)privateKey);
-
-        digest.reset();
-
-        cipher.init(true, param);
-    }
-
-    protected void engineUpdate(
-        byte    b)
-        throws SignatureException
-    {
-        digest.update(b);
-    }
-
-    protected void engineUpdate(
-        byte[]  b,
-        int     off,
-        int     len) 
-        throws SignatureException
-    {
-        digest.update(b, off, len);
-    }
-
-    protected byte[] engineSign()
-        throws SignatureException
-    {
-        byte[]  hash = new byte[digest.getDigestSize()];
-
-        digest.doFinal(hash, 0);
-
-        try
-        {
-            byte[]  bytes = derEncode(hash);
-
-            return cipher.processBlock(bytes, 0, bytes.length);
-        }
-        catch (ArrayIndexOutOfBoundsException e)
-        {
-            throw new SignatureException("key too small for signature type");
-        }
-        catch (Exception e)
-        {
-            throw new SignatureException(e.toString());
-        }
-    }
-
-    protected boolean engineVerify(
-        byte[]  sigBytes) 
-        throws SignatureException
-    {
-        byte[]  hash = new byte[digest.getDigestSize()];
-
-        digest.doFinal(hash, 0);
-
-        DigestInfo  digInfo;
-        byte[]      sig;
-
-        try
-        {
-            sig = cipher.processBlock(sigBytes, 0, sigBytes.length);
-            digInfo = derDecode(sig);
-        }
-        catch (Exception e)
-        {
-            return false;
-        }
-
-        if (!digInfo.getAlgorithmId().equals(algId))
-        {
-            return false;
-        }
-
-        byte[]  sigHash = digInfo.getDigest();
-
-        if (hash.length != sigHash.length)
-        {
-            return false;
-        }
-
-        for (int i = 0; i < hash.length; i++)
-        {
-            if (sigHash[i] != hash[i])
-            {
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    protected void engineSetParameter(
-        AlgorithmParameterSpec params)
-    {
-        throw new UnsupportedOperationException("engineSetParameter unsupported");
-    }
-
-    /**
-     * @deprecated replaced with <a href = "#engineSetParameter(java.security.spec.AlgorithmParameterSpec)">
-     */
-    protected void engineSetParameter(
-        String  param,
-        Object  value)
-    {
-        throw new UnsupportedOperationException("engineSetParameter unsupported");
-    }
-
-    /**
-     * @deprecated
-     */
-    protected Object engineGetParameter(
-        String      param)
-    {
-        throw new UnsupportedOperationException("engineSetParameter unsupported");
-    }
-
-    private byte[] derEncode(
-        byte[]  hash)
-        throws IOException
-    {
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-        DEROutputStream         dOut = new DEROutputStream(bOut);
-        DigestInfo              dInfo = new DigestInfo(algId, hash);
-
-        dOut.writeObject(dInfo);
-
-        return bOut.toByteArray();
-    }
-
-    private DigestInfo derDecode(
-        byte[]  encoding)
-        throws IOException
-    {
-        ByteArrayInputStream    bIn = new ByteArrayInputStream(encoding);
-        DERInputStream          dIn = new DERInputStream(bIn);
-
-        return new DigestInfo((ASN1Sequence)dIn.readObject());
-    }
-
-    static public class SHA1WithRSAEncryption
-        extends JDKDigestSignature
-    {
-        public SHA1WithRSAEncryption()
-        {
-            super("SHA1withRSA", id_SHA1, new SHA1Digest(), new PKCS1Encoding(new RSAEngine()));
-        }
-    }
-
-    static public class MD2WithRSAEncryption
-        extends JDKDigestSignature
-    {
-        public MD2WithRSAEncryption()
-        {
-            super("MD2withRSA", md2, new MD2Digest(), new PKCS1Encoding(new RSAEngine()));
-        }
-    }
-
-    static public class MD5WithRSAEncryption
-        extends JDKDigestSignature
-    {
-        public MD5WithRSAEncryption()
-        {
-            super("MD5withRSA", md5, new MD5Digest(), new PKCS1Encoding(new RSAEngine()));
-        }
-    }
-
-    static public class RIPEMD160WithRSAEncryption
-        extends JDKDigestSignature
-    {
-        public RIPEMD160WithRSAEncryption()
-        {
-            super("RIPEMD160withRSA", TeleTrusTObjectIdentifiers.ripemd160, new RIPEMD160Digest(), new PKCS1Encoding(new RSAEngine()));
-        }
-    }
-    
-	static public class RIPEMD128WithRSAEncryption
-		extends JDKDigestSignature
-	{
-		public RIPEMD128WithRSAEncryption()
-		{
-			super("RIPEMD128withRSA", TeleTrusTObjectIdentifiers.ripemd128, new RIPEMD128Digest(), new PKCS1Encoding(new RSAEngine()));
-		}
-	}
-	
-	static public class RIPEMD256WithRSAEncryption
-		extends JDKDigestSignature
-	{
-		public RIPEMD256WithRSAEncryption()
-		{
-			super("RIPEMD256withRSA", TeleTrusTObjectIdentifiers.ripemd256, new RIPEMD256Digest(), new PKCS1Encoding(new RSAEngine()));
-		}
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/JDKKeyFactory.java b/azureus2/src/org/bouncycastle/jce/provider/JDKKeyFactory.java
deleted file mode 100644
index 3f3a905..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/JDKKeyFactory.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * Created on 08-Jun-2004
- * Created by Paul Gardner
- * Copyright (C) 2004, 2005, 2006 Aelitis, All Rights Reserved.
- *
- * This program 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
- * of the License, or (at your option) any later version.
- * This program 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 this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- * 
- * AELITIS, SAS au capital de 46,603.30 euros
- * 8 Allee Lenotre, La Grille Royale, 78600 Le Mesnil le Roi, France.
- *
- */
-
-package org.bouncycastle.jce.provider;
-
-/**
- * @author parg
- *
- */
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.InvalidKeyException;
-import java.security.Key;
-import java.security.KeyFactorySpi;
-import java.security.NoSuchAlgorithmException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.interfaces.DSAPrivateKey;
-import java.security.interfaces.DSAPublicKey;
-import java.security.interfaces.RSAPrivateCrtKey;
-import java.security.interfaces.RSAPrivateKey;
-import java.security.interfaces.RSAPublicKey;
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.KeySpec;
-import java.security.spec.PKCS8EncodedKeySpec;
-import java.security.spec.RSAPrivateCrtKeySpec;
-import java.security.spec.RSAPrivateKeySpec;
-import java.security.spec.RSAPublicKeySpec;
-import java.security.spec.X509EncodedKeySpec;
-
-import javax.crypto.interfaces.DHPrivateKey;
-import javax.crypto.interfaces.DHPublicKey;
-
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERInputStream;
-import org.bouncycastle.asn1.x509.*;
-import org.bouncycastle.asn1.x9.X9ObjectIdentifiers;
-import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
-import org.bouncycastle.jce.interfaces.ElGamalPrivateKey;
-import org.bouncycastle.jce.interfaces.ElGamalPublicKey;
-import org.bouncycastle.jce.spec.ECPrivateKeySpec;
-import org.bouncycastle.jce.spec.ECPublicKeySpec;
-import org.gudy.azureus2.core3.util.Debug;
-
-public abstract class 
-JDKKeyFactory 
-	extends KeyFactorySpi
-{
-    protected KeySpec engineGetKeySpec(
-            Key    key,
-            Class    spec)
-        throws InvalidKeySpecException
-        {
-           if (spec.isAssignableFrom(PKCS8EncodedKeySpec.class) && key.getFormat().equals("PKCS#8"))
-           {
-                   return new PKCS8EncodedKeySpec(key.getEncoded());
-           }
-           else if (spec.isAssignableFrom(X509EncodedKeySpec.class) && key.getFormat().equals("X.509"))
-           {
-                   return new X509EncodedKeySpec(key.getEncoded());
-           }
-           else if (spec.isAssignableFrom(RSAPublicKeySpec.class) && key instanceof RSAPublicKey)
-           {
-                RSAPublicKey    k = (RSAPublicKey)key;
-
-                return new RSAPublicKeySpec(k.getModulus(), k.getPublicExponent());
-           }
-           else if (spec.isAssignableFrom(RSAPrivateKeySpec.class) && key instanceof RSAPrivateKey)
-           {
-                RSAPrivateKey    k = (RSAPrivateKey)key;
-
-                return new RSAPrivateKeySpec(k.getModulus(), k.getPrivateExponent());
-           }
-           else if (spec.isAssignableFrom(RSAPrivateCrtKeySpec.class) && key instanceof RSAPrivateCrtKey)
-           {
-                RSAPrivateCrtKey    k = (RSAPrivateCrtKey)key;
-
-                return new RSAPrivateCrtKeySpec(
-                                k.getModulus(), k.getPublicExponent(),
-                                k.getPrivateExponent(),
-                                k.getPrimeP(), k.getPrimeQ(),
-                                k.getPrimeExponentP(), k.getPrimeExponentQ(),
-                                k.getCrtCoefficient());
-           }
-
-
-            throw new RuntimeException("not implemented yet " + key + " " + spec);
-        }
-
-        protected Key engineTranslateKey(
-            Key    key)
-            throws InvalidKeyException
-        {
-            if (key instanceof RSAPublicKey)
-            {
-                return new JCERSAPublicKey((RSAPublicKey)key);
-            }
-            else if (key instanceof RSAPrivateCrtKey)
-            {
-                //return new JCERSAPrivateCrtKey((RSAPrivateCrtKey)key);
-            }
-            else if (key instanceof RSAPrivateKey)
-            {
-                //return new JCERSAPrivateKey((RSAPrivateKey)key);
-            }
-            else if (key instanceof DHPublicKey)
-            {
-                //return new JCEDHPublicKey((DHPublicKey)key);
-            }
-            else if (key instanceof DHPrivateKey)
-            {
-                //return new JCEDHPrivateKey((DHPrivateKey)key);
-            }
-            else if (key instanceof DSAPublicKey)
-            {
-                //return new JDKDSAPublicKey((DSAPublicKey)key);
-            }
-            else if (key instanceof DSAPrivateKey)
-            {
-                //return new JDKDSAPrivateKey((DSAPrivateKey)key);
-            }
-            else if (key instanceof ElGamalPublicKey)
-            {
-                //return new JCEElGamalPublicKey((ElGamalPublicKey)key);
-            }
-            else if (key instanceof ElGamalPrivateKey)
-            {
-                //return new JCEElGamalPrivateKey((ElGamalPrivateKey)key);
-            }
-
-            throw new InvalidKeyException("key type unknown");
-        }
-	
-	
-	   static PublicKey createPublicKeyFromDERStream(
-		        InputStream         in)
-		        throws IOException
-		    {
-		        return createPublicKeyFromPublicKeyInfo(
-		                new SubjectPublicKeyInfo((ASN1Sequence)(new DERInputStream(in).readObject())));
-		    }
-	   
-    static PublicKey createPublicKeyFromPublicKeyInfo(
-        SubjectPublicKeyInfo         info)
-    {
-        AlgorithmIdentifier     algId = info.getAlgorithmId();
-        
-        if (algId.getObjectId().equals(PKCSObjectIdentifiers.rsaEncryption)
-        	|| algId.getObjectId().equals(X509ObjectIdentifiers.id_ea_rsa))
-        {
-              return new JCERSAPublicKey(info);
-        }
-        else if (algId.getObjectId().equals(X9ObjectIdentifiers.id_ecPublicKey))
-        {
-              return new JCEECPublicKey(info);
-        }
-        else
-        {
-            throw new RuntimeException("algorithm identifier in key not recognised");
-        }
-    }
-    
-    static PrivateKey createPrivateKeyFromDERStream(
-            InputStream         in)
-            throws IOException
-        {
-            return createPrivateKeyFromPrivateKeyInfo(
-                    new PrivateKeyInfo((ASN1Sequence)(new DERInputStream(in).readObject())));
-        }
-
-        /**
-         * create a private key from the given public key info object.
-         */ 
-        static PrivateKey createPrivateKeyFromPrivateKeyInfo(
-            PrivateKeyInfo      info)
-        {
-            AlgorithmIdentifier     algId = info.getAlgorithmId();
-            
-            /*
-            if (algId.getObjectId().equals(PKCSObjectIdentifiers.rsaEncryption))
-            {
-                  return new JCERSAPrivateCrtKey(info);
-            }
-            else if (algId.getObjectId().equals(PKCSObjectIdentifiers.dhKeyAgreement))
-            {
-                  return new JCEDHPrivateKey(info);
-            }
-            else if (algId.getObjectId().equals(OIWObjectIdentifiers.elGamalAlgorithm))
-            {
-                  return new JCEElGamalPrivateKey(info);
-            }
-            else if (algId.getObjectId().equals(X9ObjectIdentifiers.id_dsa))
-            {
-                  return new JDKDSAPrivateKey(info);
-            }
-            else */
-            if (algId.getObjectId().equals(X9ObjectIdentifiers.id_ecPublicKey))
-            {
-                  return new JCEECPrivateKey(info);
-            }
-            else
-            {
-                throw new RuntimeException("algorithm identifier in key not recognised");
-            }
-        }
-    
-    public static class EC
-    extends JDKKeyFactory
-	{
-	    String  algorithm;
-	
-	    public EC()
-	    
-	    	throws NoSuchAlgorithmException
-	    {
-	        this("EC");
-	        
-	        	// PARG - bail if we're constructing an X509 cert for SSL as the BC SSL impl is old and doesn't have recent named curves
-	        	// If we allow this to continue it borks constructing the EC public key and takes the whole SSL process down with
-	        	// utimately a 
-	        	// Caused by: java.io.IOException: subject key, java.lang.NullPointerException
-	        	// at sun.security.x509.X509Key.parse(X509Key.java:157)
-	    		// at sun.security.x509.CertificateX509Key.<init>(CertificateX509Key.java:58)
-	    		// at sun.security.x509.X509CertInfo.parse(X509CertInfo.java:688)
-	    		// at sun.security.x509.X509CertInfo.<init>(X509CertInfo.java:152)
-	        
-	        try{
-	        	StackTraceElement[] elements = new Exception().getStackTrace();
-	        
-	        	boolean	ssl 	= false;
-	        	boolean	x509	= false;
-	        	
-	        	for ( StackTraceElement elt: elements ){
-	        	
-	        		String name = elt.getClassName() + "." + elt.getMethodName();
-	        		
-	        		if ( name.contains( "SSLSocketFactory" ) || name.contains( "KeyStore.load" )){
-	        			
-	        			ssl = true;
-	        		}else if ( name.contains( "X509" )){
-	        			
-	        			
-	        			x509 = true;
-	        		}
-	        	}
-	        	
-	        	if( ssl && x509 ){
-	        		
-	        		//Debug.out( "Hacking SSL EC" );
-	        		
-	        		throw( new NoSuchAlgorithmException());
-	        	}
-	        }catch( NoSuchAlgorithmException e ){
-	        	
-	        	throw( e );
-	        	
-	        }catch( Throwable e ){
-	        	
-	        	Debug.out( e );
-	        }
-	    }
-	
-	    public EC(
-	        String  algorithm)
-	    {
-	        this.algorithm = algorithm;
-	    }
-	
-	    protected PrivateKey engineGeneratePrivate(
-	        KeySpec    keySpec)
-	        throws InvalidKeySpecException
-	    {
-	        if (keySpec instanceof PKCS8EncodedKeySpec)
-	        {
-	            try
-	            {
-	                return JDKKeyFactory.createPrivateKeyFromDERStream(
-	                            new ByteArrayInputStream(((PKCS8EncodedKeySpec)keySpec).getEncoded()));
-	            }
-	            catch (Exception e)
-	            {
-	                throw new InvalidKeySpecException(e.toString());
-	            }
-	        }
-	        else if (keySpec instanceof ECPrivateKeySpec)
-	        {
-	            return new JCEECPrivateKey(algorithm, (ECPrivateKeySpec)keySpec);
-	        }
-	
-	        throw new InvalidKeySpecException("Unknown KeySpec type.");
-	    }
-	
-	    protected PublicKey engineGeneratePublic(
-	        KeySpec    keySpec)
-	        throws InvalidKeySpecException
-	    {
-	        if (keySpec instanceof X509EncodedKeySpec)
-	        {
-	            try
-	            {
-	                return JDKKeyFactory.createPublicKeyFromDERStream(
-	                            new ByteArrayInputStream(((X509EncodedKeySpec)keySpec).getEncoded()));
-	            }
-	            catch (Exception e)
-	            {
-	                throw new InvalidKeySpecException(e.toString());
-	            }
-	        }
-	        else if (keySpec instanceof ECPublicKeySpec)
-	        {
-	            return new JCEECPublicKey(algorithm, (ECPublicKeySpec)keySpec);
-	        }
-	
-	        throw new InvalidKeySpecException("Unknown KeySpec type.");
-	    }
-	}
-    
-    public static class ECDSA
-    extends EC
-    {
-	    public ECDSA()
-	    {
-	        super("ECDSA");
-	    }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/JDKKeyPairGenerator.java b/azureus2/src/org/bouncycastle/jce/provider/JDKKeyPairGenerator.java
deleted file mode 100644
index 21c55e1..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/JDKKeyPairGenerator.java
+++ /dev/null
@@ -1,381 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.security.InvalidAlgorithmParameterException;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.SecureRandom;
-import java.security.spec.AlgorithmParameterSpec;
-import java.util.Hashtable;
-
-import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
-import org.bouncycastle.crypto.generators.ECKeyPairGenerator;
-import org.bouncycastle.crypto.params.*;
-import org.bouncycastle.jce.ECNamedCurveTable;
-import org.bouncycastle.jce.spec.ECParameterSpec;
-
-public abstract class JDKKeyPairGenerator
-    extends KeyPairGenerator
-{
-    public JDKKeyPairGenerator(
-        String              algorithmName)
-    {
-        super(algorithmName);
-    }
-
-    public abstract void initialize(int strength, SecureRandom random);
-
-    public abstract KeyPair generateKeyPair();
-
-    /* PARG removed
-    public static class RSA
-        extends JDKKeyPairGenerator
-    {
-		final static BigInteger defaultPublicExponent = BigInteger.valueOf(0x10001);
-		final static int defaultTests = 8;
-
-        RSAKeyGenerationParameters  param;
-        RSAKeyPairGenerator         engine;
-
-        public RSA()
-        {
-            super("RSA");
-
-            engine = new RSAKeyPairGenerator();
-            param = new RSAKeyGenerationParameters(defaultPublicExponent,
-                            new SecureRandom(), 2048, defaultTests);
-            engine.init(param);
-        }
-
-        public void initialize(
-            int             strength,
-            SecureRandom    random)
-        {
-            param = new RSAKeyGenerationParameters(defaultPublicExponent,
-                            random, strength, defaultTests);
-
-            engine.init(param);
-        }
-
-        public void initialize(
-            AlgorithmParameterSpec  params,
-            SecureRandom            random)
-            throws InvalidAlgorithmParameterException
-        {
-            if (!(params instanceof RSAKeyGenParameterSpec))
-            {
-                throw new InvalidAlgorithmParameterException("parameter object not a RSAKeyGenParameterSpec");
-            }
-            RSAKeyGenParameterSpec     rsaParams = (RSAKeyGenParameterSpec)params;
-
-            param = new RSAKeyGenerationParameters(
-                            rsaParams.getPublicExponent(),
-                            random, rsaParams.getKeysize(), defaultTests);
-
-            engine.init(param);
-        }
-
-        public KeyPair generateKeyPair()
-        {
-            AsymmetricCipherKeyPair     pair = engine.generateKeyPair();
-            RSAKeyParameters            pub = (RSAKeyParameters)pair.getPublic();
-            RSAPrivateCrtKeyParameters  priv = (RSAPrivateCrtKeyParameters)pair.getPrivate();
-
-            return new KeyPair(new JCERSAPublicKey(pub),
-                               new JCERSAPrivateCrtKey(priv));
-        }
-    }
-
-    public static class DH
-        extends JDKKeyPairGenerator
-    {
-        DHKeyGenerationParameters  param;
-        DHBasicKeyPairGenerator    engine = new DHBasicKeyPairGenerator();
-        int                        strength = 1024;
-        int                        certainty = 20;
-        SecureRandom               random = new SecureRandom();
-        boolean                    initialised = false;
-
-        public DH()
-        {
-            super("DH");
-        }
-
-        public void initialize(
-            int             strength,
-            SecureRandom    random)
-        {
-            this.strength = strength;
-            this.random = random;
-        }
-
-        public void initialize(
-            AlgorithmParameterSpec  params,
-            SecureRandom            random)
-            throws InvalidAlgorithmParameterException
-        {
-            if (!(params instanceof DHParameterSpec))
-            {
-                throw new InvalidAlgorithmParameterException("parameter object not a DHParameterSpec");
-            }
-            DHParameterSpec     dhParams = (DHParameterSpec)params;
-
-            param = new DHKeyGenerationParameters(random, new DHParameters(dhParams.getP(), dhParams.getG()));
-
-            engine.init(param);
-            initialised = true;
-        }
-
-        public KeyPair generateKeyPair()
-        {
-            if (!initialised)
-            {
-                DHParametersGenerator   pGen = new DHParametersGenerator();
-
-                pGen.init(strength, certainty, random);
-                param = new DHKeyGenerationParameters(random, pGen.generateParameters());
-                engine.init(param);
-                initialised = true;
-            }
-
-            AsymmetricCipherKeyPair   pair = engine.generateKeyPair();
-            DHPublicKeyParameters     pub = (DHPublicKeyParameters)pair.getPublic();
-            DHPrivateKeyParameters priv = (DHPrivateKeyParameters)pair.getPrivate();
-
-            return new KeyPair(new JCEDHPublicKey(pub),
-                               new JCEDHPrivateKey(priv));
-        }
-    }
-
-    public static class DSA
-        extends JDKKeyPairGenerator
-    {
-        DSAKeyGenerationParameters param;
-        DSAKeyPairGenerator        engine = new DSAKeyPairGenerator();
-        int                        strength = 1024;
-        int                        certainty = 20;
-        SecureRandom               random = new SecureRandom();
-        boolean                    initialised = false;
-
-        public DSA()
-        {
-            super("DSA");
-        }
-
-        public void initialize(
-            int             strength,
-            SecureRandom    random)
-        {
-            this.strength = strength;
-            this.random = random;
-        }
-
-        public void initialize(
-            AlgorithmParameterSpec  params,
-            SecureRandom            random)
-            throws InvalidAlgorithmParameterException
-        {
-            if (!(params instanceof DSAParameterSpec))
-            {
-                throw new InvalidAlgorithmParameterException("parameter object not a DSAParameterSpec");
-            }
-            DSAParameterSpec     dsaParams = (DSAParameterSpec)params;
-
-            param = new DSAKeyGenerationParameters(random, new DSAParameters(dsaParams.getP(), dsaParams.getQ(), dsaParams.getG()));
-
-            engine.init(param);
-            initialised = true;
-        }
-
-        public KeyPair generateKeyPair()
-        {
-            if (!initialised)
-            {
-                DSAParametersGenerator   pGen = new DSAParametersGenerator();
-
-                pGen.init(strength, certainty, random);
-                param = new DSAKeyGenerationParameters(random, pGen.generateParameters());
-                engine.init(param);
-                initialised = true;
-            }
-
-            AsymmetricCipherKeyPair   pair = engine.generateKeyPair();
-            DSAPublicKeyParameters     pub = (DSAPublicKeyParameters)pair.getPublic();
-            DSAPrivateKeyParameters priv = (DSAPrivateKeyParameters)pair.getPrivate();
-
-            return new KeyPair(new JDKDSAPublicKey(pub),
-                               new JDKDSAPrivateKey(priv));
-        }
-    }
-
-    public static class ElGamal
-        extends JDKKeyPairGenerator
-    {
-        ElGamalKeyGenerationParameters  param;
-        ElGamalKeyPairGenerator         engine = new ElGamalKeyPairGenerator();
-        int                             strength = 1024;
-        int                             certainty = 20;
-        SecureRandom                    random = new SecureRandom();
-        boolean                         initialised = false;
-
-        public ElGamal()
-        {
-            super("ElGamal");
-        }
-
-        public void initialize(
-            int             strength,
-            SecureRandom    random)
-        {
-            this.strength = strength;
-            this.random = random;
-        }
-
-        public void initialize(
-            AlgorithmParameterSpec  params,
-            SecureRandom            random)
-            throws InvalidAlgorithmParameterException
-        {
-            if (!(params instanceof ElGamalParameterSpec))
-            {
-                throw new InvalidAlgorithmParameterException("parameter object not a ElGamalParameterSpec");
-            }
-            ElGamalParameterSpec     elParams = (ElGamalParameterSpec)params;
-
-            param = new ElGamalKeyGenerationParameters(random, new ElGamalParameters(elParams.getP(), elParams.getG()));
-
-            engine.init(param);
-            initialised = true;
-        }
-
-        public KeyPair generateKeyPair()
-        {
-            if (!initialised)
-            {
-                ElGamalParametersGenerator   pGen = new ElGamalParametersGenerator();
-
-                pGen.init(strength, certainty, random);
-                param = new ElGamalKeyGenerationParameters(random, pGen.generateParameters());
-                engine.init(param);
-                initialised = true;
-            }
-
-            AsymmetricCipherKeyPair         pair = engine.generateKeyPair();
-            ElGamalPublicKeyParameters      pub = (ElGamalPublicKeyParameters)pair.getPublic();
-            ElGamalPrivateKeyParameters     priv = (ElGamalPrivateKeyParameters)pair.getPrivate();
-
-            return new KeyPair(new JCEElGamalPublicKey(pub),
-                               new JCEElGamalPrivateKey(priv));
-        }
-    }
-	*/
-    public static class EC
-        extends JDKKeyPairGenerator
-    {
-        ECKeyGenerationParameters   param;
-        ECKeyPairGenerator          engine = new ECKeyPairGenerator();
-        ECParameterSpec             ecParams = null;
-        int                         strength = 239;
-        int                         certainty = 50;
-        SecureRandom                random = new SecureRandom();
-        boolean                     initialised = false;
-        String                      algorithm;
-
-        static private Hashtable    ecParameters;
-
-        static {
-            ecParameters = new Hashtable();
-
-            ecParameters.put(new Integer(192), 
-                    ECNamedCurveTable.getParameterSpec("prime192v1"));
-            ecParameters.put(new Integer(239), 
-                    ECNamedCurveTable.getParameterSpec("prime239v1"));
-            ecParameters.put(new Integer(256), 
-                    ECNamedCurveTable.getParameterSpec("prime256v1"));
-        }
-
-
-        public EC(
-            String  algorithm)
-        {
-            super(algorithm);
-            this.algorithm = algorithm;
-        }
-
-        public void initialize(
-            int             strength,
-            SecureRandom    random)
-        {
-            this.strength = strength;
-            this.random = random;
-            this.ecParams = (ECParameterSpec)ecParameters.get(new Integer(strength));
-
-            if (ecParams != null)
-            {
-                param = new ECKeyGenerationParameters(new ECDomainParameters(ecParams.getCurve(), ecParams.getG(), ecParams.getN()), random);
-
-                engine.init(param);
-                initialised = true;
-            }
-        }
-
-        public void initialize(
-            AlgorithmParameterSpec  params,
-            SecureRandom            random)
-            throws InvalidAlgorithmParameterException
-        {
-            if (!(params instanceof ECParameterSpec))
-            {
-                throw new InvalidAlgorithmParameterException("parameter object not a ECParameterSpec");
-            }
-
-            this.ecParams = (ECParameterSpec)params;
-
-            param = new ECKeyGenerationParameters(new ECDomainParameters(ecParams.getCurve(), ecParams.getG(), ecParams.getN()), random);
-
-            engine.init(param);
-            initialised = true;
-        }
-
-        public KeyPair generateKeyPair()
-        {
-            if (!initialised)
-            {
-                throw new IllegalStateException("EC Key Pair Generator not initialised");
-            }
-
-            AsymmetricCipherKeyPair     pair = engine.generateKeyPair();
-            ECPublicKeyParameters       pub = (ECPublicKeyParameters)pair.getPublic();
-            ECPrivateKeyParameters      priv = (ECPrivateKeyParameters)pair.getPrivate();
-
-            return new KeyPair(new JCEECPublicKey(algorithm, pub, ecParams),
-                               new JCEECPrivateKey(algorithm, priv, ecParams));
-        }
-    }
-
-    public static class ECDSA
-        extends EC
-    {
-        public ECDSA()
-        {
-            super("ECDSA");
-        }
-    }
-
-    public static class ECDH
-        extends EC
-    {
-        public ECDH()
-        {
-            super("ECDH");
-        }
-    }
-
-    public static class ECDHC
-        extends EC
-    {
-        public ECDHC()
-        {
-            super("ECDHC");
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/JDKMessageDigest.java b/azureus2/src/org/bouncycastle/jce/provider/JDKMessageDigest.java
deleted file mode 100644
index 9e18d25..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/JDKMessageDigest.java
+++ /dev/null
@@ -1,279 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.security.MessageDigest;
-
-import org.bouncycastle.crypto.Digest;
-import org.bouncycastle.crypto.digests.*;
-
-public class JDKMessageDigest
-    extends MessageDigest
-{
-    Digest  digest;
-
-    protected JDKMessageDigest(
-        Digest  digest)
-    {
-        super(digest.getAlgorithmName());
-
-        this.digest = digest;
-    }
-
-    public void engineReset() 
-    {
-        digest.reset();
-    }
-
-    public void engineUpdate(
-        byte    input) 
-    {
-        digest.update(input);
-    }
-
-    public void engineUpdate(
-        byte[]  input,
-        int     offset,
-        int     len) 
-    {
-        digest.update(input, offset, len);
-    }
-
-    public byte[] engineDigest() 
-    {
-        byte[]  digestBytes = new byte[digest.getDigestSize()];
-
-        digest.doFinal(digestBytes, 0);
-
-        return digestBytes;
-    }
-
-    /**
-     * classes that extend directly off us.
-     */
-    static public class SHA1
-        extends JDKMessageDigest
-		implements Cloneable
-    {
-        public SHA1()
-        {
-            super(new SHA1Digest());
-        }
-
-		public Object clone()
-		throws CloneNotSupportedException
-		{
-			SHA1 d = (SHA1)super.clone();
-			d.digest = new SHA1Digest((SHA1Digest)digest);
-
-			return d;
-		}
-    }
-
-    static public class SHA256
-        extends JDKMessageDigest
-		implements Cloneable
-    {
-        public SHA256()
-        {
-            super(new SHA256Digest());
-        }
-
-		public Object clone()
-		throws CloneNotSupportedException
-		{
-			SHA256 d = (SHA256)super.clone();
-			d.digest = new SHA256Digest((SHA256Digest)digest);
-
-			return d;
-		}
-    }
-
-    static public class SHA384
-        extends JDKMessageDigest
-		implements Cloneable
-    {
-        public SHA384()
-        {
-            super(new SHA384Digest());
-        }
-
-		public Object clone()
-		throws CloneNotSupportedException
-		{
-			SHA384 d = (SHA384)super.clone();
-			d.digest = new SHA384Digest((SHA384Digest)digest);
-
-			return d;
-		}
-    }
-
-    static public class SHA512
-        extends JDKMessageDigest
-		implements Cloneable
-    {
-        public SHA512()
-        {
-            super(new SHA512Digest());
-        }
-
-		public Object clone()
-		throws CloneNotSupportedException
-		{
-			SHA512 d = (SHA512)super.clone();
-			d.digest = new SHA512Digest((SHA512Digest)digest);
-
-			return d;
-		}
-    }
-
-    static public class MD2
-        extends JDKMessageDigest
-		implements Cloneable
-    {
-        public MD2()
-        {
-            super(new MD2Digest());
-        }
-
-		public Object clone()
-		throws CloneNotSupportedException
-		{
-			MD2 d = (MD2)super.clone();
-			d.digest = new MD2Digest((MD2Digest)digest);
-
-			return d;
-		}
-    }
-
-    static public class MD4
-        extends JDKMessageDigest
-		implements Cloneable
-    {
-        public MD4()
-        {
-            super(new MD4Digest());
-        }
-
-		public Object clone()
-		throws CloneNotSupportedException
-		{
-			MD4 d = (MD4)super.clone();
-			d.digest = new MD4Digest((MD4Digest)digest);
-
-			return d;
-		}
-    }
-
-    static public class MD5
-        extends JDKMessageDigest
-		implements Cloneable
-    {
-        public MD5()
-        {
-            super(new MD5Digest());
-        }
-
-		public Object clone()
-		throws CloneNotSupportedException
-		{
-			MD5 d = (MD5)super.clone();
-			d.digest = new MD5Digest((MD5Digest)digest);
-
-			return d;
-		}
-    }
-
-    static public class RIPEMD128
-        extends JDKMessageDigest
-		implements Cloneable
-    {
-        public RIPEMD128()
-        {
-            super(new RIPEMD128Digest());
-        }
-
-		public Object clone()
-		throws CloneNotSupportedException
-		{
-			RIPEMD128 d = (RIPEMD128)super.clone();
-			d.digest = new RIPEMD128Digest((RIPEMD128Digest)digest);
-
-			return d;
-		}
-    }
-
-    static public class RIPEMD160
-        extends JDKMessageDigest
-		implements Cloneable
-    {
-        public RIPEMD160()
-        {
-            super(new RIPEMD160Digest());
-        }
-
-		public Object clone()
-		throws CloneNotSupportedException
-		{
-			RIPEMD160 d = (RIPEMD160)super.clone();
-			d.digest = new RIPEMD160Digest((RIPEMD160Digest)digest);
-
-			return d;
-		}
-    }
-    
-	static public class RIPEMD256
-		extends JDKMessageDigest
-		implements Cloneable
-	{
-		public RIPEMD256()
-		{
-			super(new RIPEMD256Digest());
-		}
-
-		public Object clone()
-		throws CloneNotSupportedException
-		{
-			RIPEMD256 d = (RIPEMD256)super.clone();
-			d.digest = new RIPEMD256Digest((RIPEMD256Digest)digest);
-
-			return d;
-		}
-	}
-	
-	static public class RIPEMD320
-		extends JDKMessageDigest
-		implements Cloneable
-	{
-		public RIPEMD320()
-		{
-			super(new RIPEMD320Digest());
-		}
-
-		public Object clone()
-		throws CloneNotSupportedException
-		{
-			RIPEMD320 d = (RIPEMD320)super.clone();
-			d.digest = new RIPEMD320Digest((RIPEMD320Digest)digest);
-
-			return d;
-		}
-	}
-	
-    static public class Tiger
-        extends JDKMessageDigest
-		implements Cloneable
-    {
-        public Tiger()
-        {
-            super(new TigerDigest());
-        }
-
-		public Object clone()
-		throws CloneNotSupportedException
-		{
-			Tiger d = (Tiger)super.clone();
-			d.digest = new TigerDigest((TigerDigest)digest);
-
-			return d;
-		}
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/JDKX509CertificateFactory.java b/azureus2/src/org/bouncycastle/jce/provider/JDKX509CertificateFactory.java
deleted file mode 100644
index 2da33d4..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/JDKX509CertificateFactory.java
+++ /dev/null
@@ -1,360 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.cert.CRL;
-import java.security.cert.CRLException;
-import java.security.cert.CertPath;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactorySpi;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.ASN1TaggedObject;
-import org.bouncycastle.asn1.BERInputStream;
-import org.bouncycastle.asn1.DERInputStream;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-import org.bouncycastle.asn1.pkcs.SignedData;
-import org.bouncycastle.asn1.x509.CertificateList;
-import org.bouncycastle.asn1.x509.X509CertificateStructure;
-import org.bouncycastle.util.encoders.Base64;
-
-/**
- * class for dealing with X509 certificates.
- * <p>
- * At the moment this will deal with "-----BEGIN CERTIFICATE-----" to "-----END CERTIFICATE-----"
- * base 64 encoded certs, as well as the BER binaries of certificates and some classes of PKCS#7
- * objects.
- */
-public class JDKX509CertificateFactory
-    extends CertificateFactorySpi
-{
-	private SignedData	sData = null;
-	private int				sDataObjectCount = 0;
-	
-    private String readLine(
-        InputStream in)
-        throws IOException
-    {
-        int             c;
-        StringBuffer    l = new StringBuffer();
-
-        while (((c = in.read()) != '\n') && (c >= 0))
-        {
-            if (c == '\r')
-            {
-                continue;
-            }
-
-            l.append((char)c);
-        }
-
-        if (c < 0)
-        {
-            return null;
-        }
-
-        return l.toString();
-    }
-
-    private Certificate readDERCertificate(
-        InputStream in)
-        throws IOException
-    {
-        DERInputStream  dIn = new DERInputStream(in);
-        ASN1Sequence    seq = (ASN1Sequence)dIn.readObject();
-
-        if (seq.size() > 1
-                && seq.getObjectAt(0) instanceof DERObjectIdentifier)
-        {
-            if (seq.getObjectAt(0).equals(PKCSObjectIdentifiers.signedData))
-            {
-                sData = new SignedData(ASN1Sequence.getInstance(
-                                (ASN1TaggedObject)seq.getObjectAt(1), true));
-
-                return new X509CertificateObject(
-                            X509CertificateStructure.getInstance(
-                                    sData.getCertificates().getObjectAt(sDataObjectCount++)));
-            }
-        }
-
-        return new X509CertificateObject(
-                            X509CertificateStructure.getInstance(seq));
-    }
-
-    /**
-     * read in a BER encoded PKCS7 certificate.
-     */
-    private Certificate readPKCS7Certificate(
-        InputStream  in)
-        throws IOException
-    {
-        BERInputStream  dIn = new BERInputStream(in);
-        ASN1Sequence seq = (ASN1Sequence)dIn.readObject();
-
-		if (seq.size() > 1
-				&& seq.getObjectAt(0) instanceof DERObjectIdentifier)
-		{
-	        if (seq.getObjectAt(0).equals(PKCSObjectIdentifiers.signedData))
-	        {
-				sData = new SignedData(ASN1Sequence.getInstance(
-								(ASN1TaggedObject)seq.getObjectAt(1), true));
-	
-				return new X509CertificateObject(
-							X509CertificateStructure.getInstance(
-									sData.getCertificates().getObjectAt(sDataObjectCount++)));
-	        }
-		}
-
-		return new X509CertificateObject(
-					 X509CertificateStructure.getInstance(seq));
-    }
-
-    private Certificate readPEMCertificate(
-        InputStream  in)
-        throws IOException
-    {
-        String          line;
-        StringBuffer    pemBuf = new StringBuffer();
-
-        while ((line = readLine(in)) != null)
-        {
-            if (line.equals("-----BEGIN CERTIFICATE-----")
-                || line.equals("-----BEGIN X509 CERTIFICATE-----"))
-            {
-                break;
-            }
-        }
-
-        while ((line = readLine(in)) != null)
-        {
-            if (line.equals("-----END CERTIFICATE-----")
-                || line.equals("-----END X509 CERTIFICATE-----"))
-            {
-                break;
-            }
-
-            pemBuf.append(line);
-        }
-
-        if (pemBuf.length() != 0)
-        {
-            ByteArrayInputStream bIn = new ByteArrayInputStream(Base64.decode(pemBuf.toString()));
-            return readDERCertificate(bIn);
-        }
-
-        return null;
-    }
-
-    private CRL readDERCRL(
-        InputStream in)
-        throws IOException
-    {
-        DERInputStream  dIn = new DERInputStream(in);
-
-        return new X509CRLObject(new CertificateList((ASN1Sequence)dIn.readObject()));
-    }
-
-    private CRL readPEMCRL(
-        InputStream  in)
-        throws IOException
-    {
-        String          line;
-        StringBuffer    pemBuf = new StringBuffer();
-
-        while ((line = readLine(in)) != null)
-        {
-            if (line.equals("-----BEGIN CRL-----")
-                || line.equals("-----BEGIN X509 CRL-----"))
-            {
-                break;
-            }
-        }
-
-        while ((line = readLine(in)) != null)
-        {
-            if (line.equals("-----END CRL-----")
-                || line.equals("-----END X509 CRL-----"))
-            {
-                break;
-            }
-
-            pemBuf.append(line);
-        }
-
-        if (pemBuf.length() != 0)
-        {
-            ByteArrayInputStream bIn = new ByteArrayInputStream(Base64.decode(pemBuf.toString()));
-            return readDERCRL(bIn);
-        }
-
-        return null;
-    }
-
-    /**
-     * Generates a certificate object and initializes it with the data
-     * read from the input stream inStream.
-     */
-    public Certificate engineGenerateCertificate(
-        InputStream in) 
-        throws CertificateException
-    {
-    	if (sData != null && sDataObjectCount != sData.getCertificates().size())
-    	{
-			return new X509CertificateObject(
-						X509CertificateStructure.getInstance(
-								sData.getCertificates().getObjectAt(sDataObjectCount++)));
-    	}
-    	
-        if (!in.markSupported())
-        {
-            in = new BufferedInputStream(in);
-        }
-
-        try
-        {
-            in.mark(10);
-            int	tag = in.read();
-            
-            if (tag == -1)
-            {
-            	return null;
-            }
-            
-            if (tag != 0x30)  // assume ascii PEM encoded.
-            {
-                in.reset();
-                return readPEMCertificate(in);
-            }
-            else if (in.read() == 0x80)    // assume BER encoded.
-            {
-                in.reset();
-                return readPKCS7Certificate(in);
-            }
-            else
-            {
-                in.reset();
-                return readDERCertificate(in);
-            }
-        }
-        catch (IOException e)
-        {
-            throw new CertificateException(e.toString());
-        }
-    }
-
-    /**
-     * Returns a (possibly empty) collection view of the certificates
-     * read from the given input stream inStream.
-     */
-    public Collection engineGenerateCertificates(
-        InputStream inStream) 
-        throws CertificateException
-    {
-        Certificate     cert;
-        ArrayList       certs = new ArrayList();
-
-        while ((cert = engineGenerateCertificate(inStream)) != null)
-        {
-            certs.add(cert);
-        }
-
-        return certs;
-    }
-
-    /**
-     * Generates a certificate revocation list (CRL) object and initializes
-     * it with the data read from the input stream inStream.
-     */
-    public CRL engineGenerateCRL(
-        InputStream inStream) 
-		throws CRLException
-    {
-        if (!inStream.markSupported())
-        {
-            inStream = new BufferedInputStream(inStream);
-        }
-
-        try
-        {
-            inStream.mark(10);
-            if (inStream.read() != 0x30)  // assume ascii PEM encoded.
-            {
-                inStream.reset();
-                return readPEMCRL(inStream);
-            }
-            else
-            {
-                inStream.reset();
-                return readDERCRL(inStream);
-            }
-        }
-        catch (IOException e)
-        {
-            throw new CRLException(e.toString());
-        }
-    }
-
-    /**
-     * Returns a (possibly empty) collection view of the CRLs read from
-     * the given input stream inStream.
-	 *
-	 * The inStream may contain a sequence of DER-encoded CRLs, or
-	 * a PKCS#7 CRL set.  This is a PKCS#7 SignedData object, with the
-	 * only signficant field being crls.  In particular the signature
-	 * and the contents are ignored.
-     */
-    public Collection engineGenerateCRLs(
-        InputStream inStream) 
-		throws CRLException
-    {
-        return null;
-    }
-
-    public Iterator engineGetCertPathEncodings()
-    {
-	return PKIXCertPath.certPathEncodings.iterator();
-    }
-
-    public CertPath engineGenerateCertPath(
-        InputStream inStream)
-	throws CertificateException
-    {
-        return engineGenerateCertPath( inStream, "PkiPath" );
-    }
-
-    public CertPath engineGenerateCertPath(
-        InputStream inStream,
-		String encoding)
-	throws CertificateException
-    {
-        return new PKIXCertPath( inStream, encoding );
-    }
-
-    public CertPath engineGenerateCertPath(
-        List certificates)
-	throws CertificateException
-    {
-        Iterator iter = certificates.iterator();
-        Object obj;
-        while ( iter.hasNext() )
-        {
-            obj = iter.next();
-            if ( obj != null ) {
-                if ( ! ( obj instanceof X509Certificate ) )
-                {
-                    throw new CertificateException( "list contains none X509Certificate object while creating CertPath\n" + obj.toString() );
-                }
-            }
-        }
-        return new PKIXCertPath( certificates );
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/PKIXCertPath.java b/azureus2/src/org/bouncycastle/jce/provider/PKIXCertPath.java
deleted file mode 100644
index d105a00..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/PKIXCertPath.java
+++ /dev/null
@@ -1,222 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.NoSuchProviderException;
-import java.security.cert.CertPath;
-import java.security.cert.CertificateEncodingException;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERInputStream;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DEROutputStream;
-import org.bouncycastle.asn1.DERSequence;
-
-/**
- * CertPath implementation for X.509 certificates.
- * <br />
- * <b>TODO: add PKCS #7 encoding support</b>
- **/
-public  class PKIXCertPath
-	extends CertPath
-{
-    static final List certPathEncodings;
-
-    static
-    {
-	List encodings = new ArrayList();
-	encodings.add("PkiPath");
-	certPathEncodings = Collections.unmodifiableList( encodings );
-    }
-
-    private List certificates;
-
-	/**
-	 * Creates a CertPath of the specified type.
-	 * This constructor is protected because most users should use
-	 * a CertificateFactory to create CertPaths.
-	 * @param type the standard name of the type of Certificatesin this path
-	 **/
-    PKIXCertPath( List certificates )
-    {
-	super("X.509");
-	this.certificates = new ArrayList( certificates );
-    }
-
-	/**
-	 * Creates a CertPath of the specified type.
-	 * This constructor is protected because most users should use
-	 * a CertificateFactory to create CertPaths.
-	 *
-	 * <b>TODO: implement PKCS7 decoding</b>
-	 *
-	 * @param type the standard name of the type of Certificatesin this path
-	 **/
-    PKIXCertPath( InputStream inStream, String encoding)
-	throws CertificateException
-    {
-	super("X.509");
-	try {
-	    if ( encoding.equals( "PkiPath" ) )
-	    {
-		DERInputStream derInStream = new DERInputStream(inStream);
-		DERObject derObject = derInStream.readObject();
-		if ( derObject == null || ! ( derObject instanceof ASN1Sequence ) )
-		{
-		    throw new CertificateException("input stream does not contain a ASN1 SEQUENCE while reading PkiPath encoded data to load CertPath" );
-		}
-		Enumeration enumx = ((ASN1Sequence)derObject).getObjects();
-		InputStream certInStream;
-		ByteArrayOutputStream outStream;
-		DEROutputStream derOutStream;
-		certificates = new ArrayList();
-		CertificateFactory certFactory= CertificateFactory.getInstance( "X.509", BouncyCastleProvider.PROVIDER_NAME );
-		while ( enumx.hasMoreElements() ) {
-		    outStream = new ByteArrayOutputStream();
-		    derOutStream = new DEROutputStream(outStream);
-    
-        	    derOutStream.writeObject(enumx.nextElement());
-        	    derOutStream.close();
-
-		    certInStream = new ByteArrayInputStream(outStream.toByteArray());
-		    certificates.add(0,certFactory.generateCertificate(certInStream));
-		}
-	    }
-	    else
-	    {
-		throw new CertificateException( "unsupported encoding" );
-	    }
-	} catch ( IOException ex ) {
-	    throw new CertificateException( "IOException throw while decoding CertPath:\n" + ex.toString() ); 
-	} catch ( NoSuchProviderException ex ) {
-	    throw new CertificateException( "BouncyCastle provider not found while trying to get a CertificateFactory:\n" + ex.toString() ); 
-	}
-    }
-    
-	/**
-	 * Returns an iteration of the encodings supported by this
-	 * certification path, with the default encoding
-	 * first. Attempts to modify the returned Iterator via its
-	 * remove method result in an UnsupportedOperationException.
-	 *
-	 * @return an Iterator over the names of the supported encodings (as Strings)
-	 **/
-    public Iterator getEncodings()
-    {
-	return certPathEncodings.iterator();
-    }
-
-	/**
-	 * Returns the encoded form of this certification path, using
-	 * the default encoding.
-	 *
-	 * @return the encoded bytes
-	 * @exception CertificateEncodingException if an encoding error occurs
-	 **/
-    public byte[] getEncoded()
-	throws CertificateEncodingException
-    {
-	Iterator iter = getEncodings();
-	if ( iter.hasNext() )
-	{
-	    Object enc = iter.next();
-	    if ( enc instanceof String )
-	    {
-		return getEncoded((String)enc);
-	    }
-	}
-	return null;
-    }
-
-	/**
-	 * Returns the encoded form of this certification path, using
-	 * the specified encoding.
-	 *
-	 * <b>TODO: implement PKCS7 decoding</b>
-	 *
-	 * @param encoding the name of the encoding to use
-	 * @return the encoded bytes
-	 * @exception CertificateEncodingException if an encoding error
-	 * occurs or the encoding requested is not supported
-	 *
-	 **/
-    public byte[] getEncoded(String encoding)
-	throws CertificateEncodingException
-    {
-	DERObject encoded = null;
-	if ( encoding.equals("PkiPath") )
-	{
-        ASN1EncodableVector v = new ASN1EncodableVector();
-
-		// TODO check ListIterator  implementation for JDK 1.1
-	    ListIterator iter = certificates.listIterator(certificates.size());
-	    while ( iter.hasPrevious() )
-	    {
-		    v.add(getEncodedX509Certificate((X509Certificate)iter.previous()));
-	    }
-
-        encoded = new DERSequence(v);
-	}
-	else
-	    throw new CertificateEncodingException( "unsupported encoding" );
-
-	if ( encoded == null )
-	    return null;
-
-	ByteArrayOutputStream outStream = new ByteArrayOutputStream();
-        DEROutputStream derOutStream = new DEROutputStream(outStream);
-
-	try {
-	    derOutStream.writeObject( encoded );
-	    derOutStream.close();
-	} catch ( IOException ex ) {
-	    throw new CertificateEncodingException( "IOExeption thrown: " + ex.toString() );
-	}
-
-        return outStream.toByteArray();
-    }
-
-	/**
-	 * Returns the list of certificates in this certification
-	 * path. The List returned must be immutable and thread-safe. 
-	 *
-	 * <b>TODO: return immutable List</b>
-	 *
-	 * @return an immutable List of Certificates (may be empty, but not null)
-	 **/
-    public List getCertificates()
-    {
-	return new ArrayList( certificates );
-    }
-
-	/**
-	 * Return a DERObject containing the encoded certificate.
-	 *
-	 * @param cert the X509Certificate object to be encoded
-	 *
-	 * @return the DERObject
-	 **/
-    private DERObject getEncodedX509Certificate( X509Certificate cert )
-	throws CertificateEncodingException
-    {
-	try {
-	    ByteArrayInputStream inStream = new ByteArrayInputStream( cert.getEncoded() );
-	    DERInputStream derInStream = new DERInputStream( inStream );
-	    return derInStream.readObject();
-	} catch ( IOException ex ) {
-	    throw new CertificateEncodingException( "IOException caught while encoding certificate\n" + ex.toString() );
-	}
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/PKIXPolicyNode.java b/azureus2/src/org/bouncycastle/jce/provider/PKIXPolicyNode.java
deleted file mode 100644
index 4e33bb8..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/PKIXPolicyNode.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.security.cert.PolicyNode;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-public class PKIXPolicyNode
-    implements PolicyNode
-{
-	protected List       children;
-	protected int        depth;
-	protected Set        expectedPolicies;
-	protected PolicyNode parent;
-	protected Set        policyQualifiers;
-	protected String     validPolicy;
-	protected boolean    critical;
-	
-	/*  
-	 *  
-	 *  CONSTRUCTORS
-	 *  
-	 */ 
-	
-	public PKIXPolicyNode(
-        List       _children,
-        int        _depth,
-        Set        _expectedPolicies,
-        PolicyNode _parent,
-        Set        _policyQualifiers,
-        String     _validPolicy,
-        boolean    _critical)
-    {
-		children         = _children;
-		depth            = _depth;
-		expectedPolicies = _expectedPolicies;
-		parent           = _parent;
-		policyQualifiers = _policyQualifiers;
-		validPolicy      = _validPolicy;
-		critical         = _critical;
-	}
-	
-	public void addChild(
-        PKIXPolicyNode _child)
-    {
-		children.add(_child);
-		_child.setParent(this);
-	}
-	
-	public Iterator getChildren()
-    {
-		return children.iterator();
-	}
-	
-	public int getDepth()
-    {
-		return depth;
-	}
-	
-	public Set getExpectedPolicies()
-    {
-		return expectedPolicies;
-	}
-	
-	public PolicyNode getParent()
-    {
-		return parent;
-	}
-	
-	public Set getPolicyQualifiers()
-    {
-		return policyQualifiers;
-	}
-	
-	public String getValidPolicy()
-    {
-		return validPolicy;
-	}
-	
-	public boolean hasChildren()
-    {
-		return !children.isEmpty();
-	}
-	
-	public boolean isCritical()
-    {
-		return critical;
-	}
-	
-	public void removeChild(PKIXPolicyNode _child)
-    {
-		children.remove(_child);
-	}
-	
-	public void setCritical(boolean _critical)
-    {
-		critical = _critical;
-	}
-	
-	public void setParent(PKIXPolicyNode _parent)
-    {
-		parent = _parent;
-	}
-	
-	public String toString()
-    {
-		return toString("");
-	}
-	
-	public String toString(String _indent)
-    {
-		StringBuffer _buf = new StringBuffer();
-		_buf.append(_indent);
-		_buf.append(validPolicy);
-		_buf.append(" {\n");
-		
-		for(int i = 0; i < children.size(); i++) {
-			_buf.append(((PKIXPolicyNode)children.get(i)).toString(_indent + "    "));
-		}
-		
-		_buf.append(_indent);
-		_buf.append("}\n");
-		return _buf.toString();
-	}
-	
-	public Object clone()
-    {
-		return copy();
-	}
-	
-	public PKIXPolicyNode copy()
-    {
-		HashSet _expectedPolicies = new HashSet();
-		Iterator _iter = expectedPolicies.iterator();
-		while (_iter.hasNext())
-        {
-			_expectedPolicies.add(new String((String)_iter.next()));
-		}
-		
-		HashSet _policyQualifiers = new HashSet();
-		_iter = policyQualifiers.iterator();
-		while (_iter.hasNext())
-        {
-			_policyQualifiers.add(new String((String)_iter.next()));
-		}
-		
-		PKIXPolicyNode _node = new PKIXPolicyNode(new ArrayList(),
-		                                          depth,
-		                                          _expectedPolicies,
-		                                          null,
-		                                          _policyQualifiers,
-		                                          new String(validPolicy),
-		                                          critical);
-		
-		_iter = children.iterator();
-		while (_iter.hasNext())
-        {
-			PKIXPolicyNode _child = ((PKIXPolicyNode)_iter.next()).copy();
-			_child.setParent(_node);
-			_node.addChild(_child);
-		}
-		
-		return _node;
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/RSAUtil.java b/azureus2/src/org/bouncycastle/jce/provider/RSAUtil.java
deleted file mode 100644
index f7f0411..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/RSAUtil.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.security.interfaces.RSAPrivateCrtKey;
-import java.security.interfaces.RSAPrivateKey;
-import java.security.interfaces.RSAPublicKey;
-
-import org.bouncycastle.crypto.params.RSAKeyParameters;
-import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters;
-
-/**
- * utility class for converting java.security RSA objects into their
- * org.bouncycastle.crypto counterparts.
- */
-public class RSAUtil
-{
-    static public RSAKeyParameters generatePublicKeyParameter(
-        RSAPublicKey    key)
-    {
-        return new RSAKeyParameters(false, key.getModulus(), key.getPublicExponent());
-
-    }
-
-    static public RSAKeyParameters generatePrivateKeyParameter(
-        RSAPrivateKey    key)
-    {
-        if (key instanceof RSAPrivateCrtKey)
-        {
-            RSAPrivateCrtKey    k = (RSAPrivateCrtKey)key;
-
-            return new RSAPrivateCrtKeyParameters(k.getModulus(),
-                k.getPublicExponent(), k.getPrivateExponent(),
-                k.getPrimeP(), k.getPrimeQ(), k.getPrimeExponentP(),                            k.getPrimeExponentQ(), k.getCrtCoefficient());
-        }
-        else
-        {
-            RSAPrivateKey    k = key;
-
-            return new RSAKeyParameters(true, k.getModulus(), k.getPrivateExponent());
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/X509CRLEntryObject.java b/azureus2/src/org/bouncycastle/jce/provider/X509CRLEntryObject.java
deleted file mode 100644
index f6b5573..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/X509CRLEntryObject.java
+++ /dev/null
@@ -1,168 +0,0 @@
-
-package org.bouncycastle.jce.provider;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.cert.CRLException;
-import java.security.cert.X509CRLEntry;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DEROutputStream;
-import org.bouncycastle.asn1.x509.TBSCertList;
-import org.bouncycastle.asn1.x509.X509Extension;
-import org.bouncycastle.asn1.x509.X509Extensions;
-
-/**
- * The following extensions are listed in RFC 2459 as relevant to CRL Entries
- *
- * ReasonCode
- * Hode Instruction Code
- * Invalidity Date
- * Certificate Issuer (critical)
- */
-public class X509CRLEntryObject extends X509CRLEntry
-{
-	private TBSCertList.CRLEntry c;
-
-	public X509CRLEntryObject(
-		TBSCertList.CRLEntry c)
-	{
-		this.c = c;
-	}
-
-	/**
-	 * Will return true if any extensions are present and marked
-	 * as critical as we currently dont handle any extensions!
-	 */
-    public boolean hasUnsupportedCriticalExtension()
-	{
-		Set extns = getCriticalExtensionOIDs();
-		if ( extns != null && !extns.isEmpty() )
-		{
-			return true;
-		}
-
-		return false;
-	}
-
-	private Set getExtensionOIDs(boolean critical)
-	{
-		X509Extensions extensions = c.getExtensions();
-
-		if ( extensions != null )
-		{
-			HashSet			set = new HashSet();
-			Enumeration		e = extensions.oids();
-
-			while (e.hasMoreElements())
-			{
-				DERObjectIdentifier	oid = (DERObjectIdentifier)e.nextElement();
-				X509Extension		ext = extensions.getExtension(oid);
-
-				if (critical == ext.isCritical())
-				{
-					set.add(oid.getId());
-				}
-			}
-
-			return set;
-		}
-
-		return null;
-	}
-
-    public Set getCriticalExtensionOIDs()
-	{
-		return getExtensionOIDs(true);
-	}
-
-    public Set getNonCriticalExtensionOIDs()
-	{
-		return getExtensionOIDs(false);
-	}
-
-    public byte[] getExtensionValue(String oid)
-	{
-		X509Extensions exts = c.getExtensions();
-
-		if (exts != null)
-		{
-			X509Extension ext = exts.getExtension(new DERObjectIdentifier(oid));
-
-			if (ext != null)
-			{
-				return ext.getValue().getOctets();
-			}
-		}
-
-		return null;
-	}
-
-    public byte[] getEncoded()
-		throws CRLException
-	{
-		ByteArrayOutputStream	bOut = new ByteArrayOutputStream();
-		DEROutputStream			dOut = new DEROutputStream(bOut);
-
-		try
-		{
-			dOut.writeObject(c);
-
-			return bOut.toByteArray();
-		}
-		catch (IOException e)
-		{
-			throw new CRLException(e.toString());
-		}
-	}
-
-    public BigInteger getSerialNumber()
-	{
-		return c.getUserCertificate().getValue();
-	}
-
-    public Date getRevocationDate()
-	{
-		return c.getRevocationDate().getDate();
-	}
-
-    public boolean hasExtensions()
-	{
-		return c.getExtensions() != null;
-	}
-
-    public String toString()
-	{
-		StringBuffer buf = new StringBuffer();
-		String nl = System.getProperty("line.separator");
-
-		buf.append("      userCertificate: " + this.getSerialNumber() + nl);
-		buf.append("       revocationDate: " + this.getRevocationDate() + nl);
-
-
-		X509Extensions extensions = c.getExtensions();
-
-		if ( extensions != null )
-		{
-			Enumeration e = extensions.oids();
-			if ( e.hasMoreElements() )
-			{
-				buf.append("   crlEntryExtensions:" + nl);
-
-				while ( e.hasMoreElements() )
-				{
-					DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement();
-					X509Extension ext = extensions.getExtension(oid);
-					buf.append(ext);
-				}
-			}
-		}
-
-		return buf.toString();
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/jce/provider/X509CRLObject.java b/azureus2/src/org/bouncycastle/jce/provider/X509CRLObject.java
deleted file mode 100644
index 51071fc..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/X509CRLObject.java
+++ /dev/null
@@ -1,379 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Principal;
-import java.security.Provider;
-import java.security.PublicKey;
-import java.security.Security;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.cert.CRLException;
-import java.security.cert.Certificate;
-import java.security.cert.X509CRL;
-import java.security.cert.X509CRLEntry;
-import java.security.cert.X509Certificate;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.security.auth.x500.X500Principal;
-
-import org.bouncycastle.asn1.ASN1OutputStream;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DEROutputStream;
-import org.bouncycastle.asn1.x509.CertificateList;
-import org.bouncycastle.asn1.x509.TBSCertList;
-import org.bouncycastle.asn1.x509.X509Extension;
-import org.bouncycastle.asn1.x509.X509Extensions;
-import org.bouncycastle.jce.X509Principal;
-
-/**
- * The following extensions are listed in RFC 2459 as relevant to CRLs
- *
- * Authority Key Identifier
- * Issuer Alternative Name
- * CRL Number
- * Delta CRL Indicator (critical)
- * Issuing Distribution Point (critical)
- */
-public class X509CRLObject
-    extends X509CRL
-{
-    private CertificateList c;
-
-    public X509CRLObject(
-        CertificateList c)
-    {
-        this.c = c;
-    }
-
-	/**
-	 * Will return true if any extensions are present and marked
-	 * as critical as we currently dont handle any extensions!
-	 */
-    public boolean hasUnsupportedCriticalExtension()
-	{
-		Set extns = getCriticalExtensionOIDs();
-		if ( extns != null && !extns.isEmpty() )
-		{
-			return true;
-		}
-
-		return false;
-	}
-
-	private Set getExtensionOIDs(boolean critical)
-	{
-		if (this.getVersion() == 2)
-		{
-			HashSet         set = new HashSet();
-			X509Extensions  extensions = c.getTBSCertList().getExtensions();
-			Enumeration     e = extensions.oids();
-
-			while (e.hasMoreElements())
-			{
-				DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement();
-				X509Extension       ext = extensions.getExtension(oid);
-
-				if (critical == ext.isCritical())
-				{
-					set.add(oid.getId());
-				}
-			}
-
-			return set;
-		}
-
-		return null;
-	}
-
-    public Set getCriticalExtensionOIDs()
-	{
-		return getExtensionOIDs(true);
-	}
-
-    public Set getNonCriticalExtensionOIDs()
-	{
-		return getExtensionOIDs(false);
-	}
-
-    public byte[] getExtensionValue(String oid)
-	{
-		X509Extensions exts = c.getTBSCertList().getExtensions();
-
-		if (exts != null)
-		{
-			X509Extension   ext = exts.getExtension(new DERObjectIdentifier(oid));
-
-			if (ext != null)
-			{
-                ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-                DEROutputStream dOut = new DEROutputStream(bOut);
-
-                try
-                {
-                    dOut.writeObject(ext.getValue());
-
-                    return bOut.toByteArray();
-                }
-                catch (Exception e)
-                {
-                    throw new RuntimeException("error encoding " + e.toString());
-                }
-			}
-		}
-
-		return null;
-	}
-
-    public byte[] getEncoded()
-        throws CRLException
-	{
-		ByteArrayOutputStream	bOut = new ByteArrayOutputStream();
-		DEROutputStream			dOut = new DEROutputStream(bOut);
-
-		try
-		{
-			dOut.writeObject(c);
-
-			return bOut.toByteArray();
-		}
-		catch (IOException e)
-		{
-			throw new CRLException(e.toString());
-		}
-	}
-
-    public void verify(PublicKey key)
-        throws CRLException,  NoSuchAlgorithmException,
-        InvalidKeyException, NoSuchProviderException,
-        SignatureException
-	{
-		verify(key, BouncyCastleProvider.PROVIDER_NAME);
-	}
-
-    public void verify(PublicKey key, String sigProvider)
-        throws CRLException, NoSuchAlgorithmException,
-        InvalidKeyException, NoSuchProviderException,
-        SignatureException
-	{
-		if ( !c.getSignatureAlgorithm().equals(c.getTBSCertList().getSignature()) )
-		{
-			throw new CRLException("Signature algorithm on CertifcateList does not match TBSCertList.");
-		}
-
-		Signature sig = Signature.getInstance(getSigAlgName(), sigProvider);
-
-		sig.initVerify(key);
-		sig.update(this.getTBSCertList());
-		if ( !sig.verify(this.getSignature()) )
-		{
-			throw new SignatureException("CRL does not verify with supplied public key.");
-		}
-	}
-
-    public int getVersion()
-	{
-		return c.getVersion();
-	}
-
-    public Principal getIssuerDN()
-	{
-		return new X509Principal(c.getIssuer());
-	}
-
-    public X500Principal getIssuerX500Principal()
-    {
-        try
-        {
-            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-            ASN1OutputStream        aOut = new ASN1OutputStream(bOut);
-
-            aOut.writeObject(c.getIssuer());
-
-            return new X500Principal(bOut.toByteArray());
-        }
-        catch (IOException e)
-        {
-            throw new IllegalStateException("can't encode issuer DN");
-        }
-    }
-
-    public Date getThisUpdate()
-	{
-		return c.getThisUpdate().getDate();
-	}
-
-    public Date getNextUpdate()
-	{
-		if (c.getNextUpdate() != null)
-		{
-			return c.getNextUpdate().getDate();
-		}
-
-		return null;
-	}
-
-    public X509CRLEntry getRevokedCertificate(BigInteger serialNumber)
-	{
-		TBSCertList.CRLEntry[] certs = c.getRevokedCertificates();
-
-		if ( certs != null )
-		{
-			for ( int i = 0; i < certs.length; i++ )
-			{
-				if ( certs[i].getUserCertificate().getValue().equals(serialNumber) ) {
-					return new X509CRLEntryObject(certs[i]);
-				}
-			}
-		}
-
-		return null;
-	}
-  
-    public Set getRevokedCertificates()
-	{
-		TBSCertList.CRLEntry[] certs = c.getRevokedCertificates();
-
-		if ( certs != null )
-		{
-			HashSet set = new HashSet();
-			for ( int i = 0; i < certs.length; i++ )
-			{
-				set.add(new X509CRLEntryObject(certs[i]));
-
-			}
-
-			return set;
-		}
-
-		return null;
-	}
-  
-    public byte[] getTBSCertList()
-		throws CRLException
-	{
-		ByteArrayOutputStream	bOut = new ByteArrayOutputStream();
-		DEROutputStream			dOut = new DEROutputStream(bOut);
-
-		try
-		{
-			dOut.writeObject(c.getTBSCertList());
-
-			return bOut.toByteArray();
-		}
-		catch (IOException e)
-		{
-			throw new CRLException(e.toString());
-		}
-	}
-
-    public byte[] getSignature()
-	{
-		return c.getSignature().getBytes();
-	}
-
-    public String getSigAlgName()
-	{
-		Provider	prov = Security.getProvider(BouncyCastleProvider.PROVIDER_NAME);
-		String		algName = prov.getProperty("Alg.Alias.Signature." + this.getSigAlgOID());
-
-		if ( algName != null )
-		{
-			return algName;
-		}
-
-		Provider[] provs = Security.getProviders();
-
-		//
-		// search every provider looking for a real algorithm
-		//
-		for (int i = 0; i != provs.length; i++)
-		{
-			algName = provs[i].getProperty("Alg.Alias.Signature." + this.getSigAlgOID());
-			if ( algName != null )
-			{
-				return algName;
-			}
-		}
-
-		return this.getSigAlgOID();
-	}
-
-    public String getSigAlgOID()
-	{
-		return c.getSignatureAlgorithm().getObjectId().getId();
-	}
-
-    public byte[] getSigAlgParams()
-	{
-		ByteArrayOutputStream	bOut = new ByteArrayOutputStream();
-
-		if ( c.getSignatureAlgorithm().getParameters() != null )
-		{
-			try
-			{
-				DEROutputStream	dOut = new DEROutputStream(bOut);
-
-				dOut.writeObject(c.getSignatureAlgorithm().getParameters());
-			}
-			catch (Exception e)
-			{
-				throw new RuntimeException("exception getting sig parameters " + e);
-			}
-
-			return bOut.toByteArray();
-		}
-
-		return null;
-	}
-
-    /**
-     * Returns a string representation of this CRL.
-     *
-     * @return a string representation of this CRL.
-     */
-    public String toString()
-	{
-		return "X.509 CRL";
-	}
-
-    /**
-     * Checks whether the given certificate is on this CRL.
-     *
-     * @param cert the certificate to check for.
-     * @return true if the given certificate is on this CRL,
-     * false otherwise.
-     */
-    public boolean isRevoked(Certificate cert)
-	{
-		if ( !cert.getType().equals("X.509") )
-		{
-			throw new RuntimeException("X.509 CRL used with non X.509 Cert");
-		}
-
-		TBSCertList.CRLEntry[] certs = c.getRevokedCertificates();
-
-		if ( certs != null )
-		{
-			BigInteger serial = ((X509Certificate)cert).getSerialNumber();
-
-			for ( int i = 0; i < certs.length; i++ )
-			{
-				if ( certs[i].getUserCertificate().getValue().equals(serial) )
-				{
-					return true;
-				}
-			}
-		}
-
-		return false;
-	}
-}
-
diff --git a/azureus2/src/org/bouncycastle/jce/provider/X509CertificateObject.java b/azureus2/src/org/bouncycastle/jce/provider/X509CertificateObject.java
deleted file mode 100644
index 4bb593b..0000000
--- a/azureus2/src/org/bouncycastle/jce/provider/X509CertificateObject.java
+++ /dev/null
@@ -1,679 +0,0 @@
-package org.bouncycastle.jce.provider;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Principal;
-import java.security.Provider;
-import java.security.PublicKey;
-import java.security.Security;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.cert.CertificateEncodingException;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateExpiredException;
-import java.security.cert.CertificateNotYetValidException;
-import java.security.cert.X509Certificate;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.security.auth.x500.X500Principal;
-
-import org.bouncycastle.asn1.*;
-import org.bouncycastle.asn1.misc.MiscObjectIdentifiers;
-import org.bouncycastle.asn1.misc.NetscapeCertType;
-import org.bouncycastle.asn1.misc.NetscapeRevocationURL;
-import org.bouncycastle.asn1.misc.VerisignCzagExtension;
-import org.bouncycastle.asn1.util.ASN1Dump;
-import org.bouncycastle.asn1.x509.BasicConstraints;
-import org.bouncycastle.asn1.x509.KeyUsage;
-import org.bouncycastle.asn1.x509.X509CertificateStructure;
-import org.bouncycastle.asn1.x509.X509Extension;
-import org.bouncycastle.asn1.x509.X509Extensions;
-import org.bouncycastle.jce.X509Principal;
-import org.bouncycastle.jce.interfaces.PKCS12BagAttributeCarrier;
-import org.bouncycastle.util.encoders.Hex;
-
-public class X509CertificateObject
-    extends X509Certificate
-    implements PKCS12BagAttributeCarrier
-{
-    private X509CertificateStructure    c;
-    private Hashtable                   pkcs12Attributes = new Hashtable();
-    private Vector                      pkcs12Ordering = new Vector();
-
-    public X509CertificateObject(
-        X509CertificateStructure    c)
-    {
-        this.c = c;
-    }
-
-    public void checkValidity()
-        throws CertificateExpiredException, CertificateNotYetValidException
-    {
-        this.checkValidity(new Date());
-    }
-
-    public void checkValidity(
-        Date    date)
-        throws CertificateExpiredException, CertificateNotYetValidException
-    {
-        if (date.after(this.getNotAfter()))
-        {
-            throw new CertificateExpiredException("certificate expired on " + c.getEndDate().getTime());
-        }
-
-        if (date.before(this.getNotBefore()))
-        {
-            throw new CertificateNotYetValidException("certificate not valid till " + c.getStartDate().getTime());
-        }
-    }
-
-    public int getVersion()
-    {
-        return c.getVersion();
-    }
-
-    public BigInteger getSerialNumber()
-    {
-        return c.getSerialNumber().getValue();
-    }
-
-    public Principal getIssuerDN()
-    {
-        return new X509Principal(c.getIssuer());
-    }
-
-    public X500Principal getIssuerX500Principal()
-    {
-        try
-        {
-            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-            ASN1OutputStream        aOut = new ASN1OutputStream(bOut);
-
-            aOut.writeObject(c.getIssuer());
-
-            return new X500Principal(bOut.toByteArray());
-        }
-        catch (IOException e)
-        {
-            throw new IllegalStateException("can't encode issuer DN");
-        }
-    }
-
-    public Principal getSubjectDN()
-    {
-        return new X509Principal(c.getSubject());
-    }
-
-    public X500Principal getSubjectX500Principal()
-    {
-        try
-        {
-            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-            ASN1OutputStream        aOut = new ASN1OutputStream(bOut);
-
-            aOut.writeObject(c.getSubject());
-
-            return new X500Principal(bOut.toByteArray());
-        }
-        catch (IOException e)
-        {
-            throw new IllegalStateException("can't encode issuer DN");
-        }
-    }
-
-    public Date getNotBefore()
-    {
-        return c.getStartDate().getDate();
-    }
-
-    public Date getNotAfter()
-    {
-        return c.getEndDate().getDate();
-    }
-
-    public byte[] getTBSCertificate()
-        throws CertificateEncodingException
-    {
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-        DEROutputStream         dOut = new DEROutputStream(bOut);
-
-        try
-        {
-            dOut.writeObject(c.getTBSCertificate());
-
-            return bOut.toByteArray();
-        }
-        catch (IOException e)
-        {
-            throw new CertificateEncodingException(e.toString());
-        }
-    }
-
-    public byte[] getSignature()
-    {
-        return c.getSignature().getBytes();
-    }
-
-    /**
-     * return a more "meaningful" representation for the signature algorithm used in
-     * the certficate.
-     */
-    public String getSigAlgName()
-    {
-        Provider    prov = Security.getProvider(BouncyCastleProvider.PROVIDER_NAME);
-        String      algName = prov.getProperty("Alg.Alias.Signature." + this.getSigAlgOID());
-
-        if (algName != null)
-        {
-            return algName;
-        }
-
-        Provider[] provs = Security.getProviders();
-
-        //
-        // search every provider looking for a real algorithm
-        //
-        for (int i = 0; i != provs.length; i++)
-        {
-            algName = provs[i].getProperty("Alg.Alias.Signature." + this.getSigAlgOID());
-            if (algName != null)
-            {
-                return algName;
-            }
-        }
-
-        return this.getSigAlgOID();
-    }
-
-    /**
-     * return the object identifier for the signature.
-     */
-    public String getSigAlgOID()
-    {
-        return c.getSignatureAlgorithm().getObjectId().getId();
-    }
-
-    /**
-     * return the signature parameters, or null if there aren't any.
-     */
-    public byte[] getSigAlgParams()
-    {
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-
-        if (c.getSignatureAlgorithm().getParameters() != null)
-        {
-            try
-            {
-                DEROutputStream         dOut = new DEROutputStream(bOut);
-
-                dOut.writeObject(c.getSignatureAlgorithm().getParameters());
-            }
-            catch (Exception e)
-            {
-                throw new RuntimeException("exception getting sig parameters " + e);
-            }
-
-            return bOut.toByteArray();
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-    public boolean[] getIssuerUniqueID()
-    {
-        DERBitString    id = c.getTBSCertificate().getIssuerUniqueId();
-
-        if (id != null)
-        {
-            byte[]          bytes = id.getBytes();
-            boolean[]       boolId = new boolean[bytes.length * 8 - id.getPadBits()];
-
-            for (int i = 0; i != boolId.length; i++)
-            {
-                boolId[i] = (bytes[i / 8] & (0x80 >>> (i % 8))) != 0;
-            }
-
-            return boolId;
-        }
-            
-        return null;
-    }
-
-    public boolean[] getSubjectUniqueID()
-    {
-        DERBitString    id = c.getTBSCertificate().getSubjectUniqueId();
-
-        if (id != null)
-        {
-            byte[]          bytes = id.getBytes();
-            boolean[]       boolId = new boolean[bytes.length * 8 - id.getPadBits()];
-
-            for (int i = 0; i != boolId.length; i++)
-            {
-                boolId[i] = (bytes[i / 8] & (0x80 >>> (i % 8))) != 0;
-            }
-
-            return boolId;
-        }
-            
-        return null;
-    }
-
-    public boolean[] getKeyUsage()
-    {
-        byte[]  bytes = this.getExtensionBytes("2.5.29.15");
-        int     length = 0;
-
-        if (bytes != null)
-        {
-            try
-            {
-                DERInputStream  dIn = new DERInputStream(new ByteArrayInputStream(bytes));
-                DERBitString    bits = (DERBitString)dIn.readObject();
-
-                bytes = bits.getBytes();
-                length = (bytes.length * 8) - bits.getPadBits();
-            }
-            catch (Exception e)
-            {
-                throw new RuntimeException("error processing key usage extension");
-            }
-
-            boolean[]       keyUsage = new boolean[(length < 9) ? 9 : length];
-
-            for (int i = 0; i != length; i++)
-            {
-                keyUsage[i] = (bytes[i / 8] & (0x80 >>> (i % 8))) != 0;
-            }
-
-            return keyUsage;
-        }
-
-        return null;
-    }
-
-    public int getBasicConstraints()
-    {
-        byte[]  bytes = this.getExtensionBytes("2.5.29.19");
-
-        if (bytes != null)
-        {
-            try
-            {
-                DERInputStream  dIn = new DERInputStream(new ByteArrayInputStream(bytes));
-                ASN1Sequence    seq = (ASN1Sequence)dIn.readObject();
-
-                if (seq.size() == 2)
-                {
-                    if (((DERBoolean)seq.getObjectAt(0)).isTrue())
-                    {
-                        return ((DERInteger)seq.getObjectAt(1)).getValue().intValue();
-                    }
-                    else
-                    {
-                        return -1;
-                    }
-                }
-                else if (seq.size() == 1)
-                {
-                    if (seq.getObjectAt(0) instanceof DERBoolean)
-                    {
-                        if (((DERBoolean)seq.getObjectAt(0)).isTrue())
-                        {
-                            return Integer.MAX_VALUE;
-                        }
-                        else
-                        {
-                            return -1;
-                        }
-                    }
-                    else
-                    {
-                        return -1;
-                    }
-                }
-            }
-            catch (Exception e)
-            {
-                throw new RuntimeException("error processing key usage extension");
-            }
-        }
-
-        return -1;
-    }
-
-    public Set getCriticalExtensionOIDs() 
-    {
-        if (this.getVersion() == 3)
-        {
-            HashSet         set = new HashSet();
-            X509Extensions  extensions = c.getTBSCertificate().getExtensions();
-
-            if (extensions != null)
-            {
-                Enumeration     e = extensions.oids();
-
-                while (e.hasMoreElements())
-                {
-                    DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement();
-                    X509Extension       ext = extensions.getExtension(oid);
-
-                    if (ext.isCritical())
-                    {
-                        set.add(oid.getId());
-                    }
-                }
-
-                return set;
-            }
-        }
-
-        return null;
-    }
-
-    private byte[] getExtensionBytes(String oid)
-    {
-        X509Extensions exts = c.getTBSCertificate().getExtensions();
-
-        if (exts != null)
-        {
-            X509Extension   ext = exts.getExtension(new DERObjectIdentifier(oid));
-            if (ext != null)
-            {
-                return ext.getValue().getOctets();
-            }
-        }
-
-        return null;
-    }
-
-    public byte[] getExtensionValue(String oid) 
-    {
-        X509Extensions exts = c.getTBSCertificate().getExtensions();
-
-        if (exts != null)
-        {
-            X509Extension   ext = exts.getExtension(new DERObjectIdentifier(oid));
-
-            if (ext != null)
-            {
-                ByteArrayOutputStream    bOut = new ByteArrayOutputStream();
-                DEROutputStream            dOut = new DEROutputStream(bOut);
-                
-                try
-                {
-                    dOut.writeObject(ext.getValue());
-
-                    return bOut.toByteArray();
-                }
-                catch (Exception e)
-                {
-                    throw new RuntimeException("error encoding " + e.toString());
-                }
-            }
-        }
-
-        return null;
-    }
-
-    public Set getNonCriticalExtensionOIDs() 
-    {
-        if (this.getVersion() == 3)
-        {
-            HashSet         set = new HashSet();
-            X509Extensions  extensions = c.getTBSCertificate().getExtensions();
-
-            if (extensions != null)
-            {
-                Enumeration     e = extensions.oids();
-
-                while (e.hasMoreElements())
-                {
-                    DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement();
-                    X509Extension       ext = extensions.getExtension(oid);
-
-                    if (!ext.isCritical())
-                    {
-                        set.add(oid.getId());
-                    }
-                }
-
-                return set;
-            }
-        }
-
-        return null;
-    }
-
-    public boolean hasUnsupportedCriticalExtension()
-    {
-        if (this.getVersion() == 3)
-        {
-            X509Extensions  extensions = c.getTBSCertificate().getExtensions();
-
-            if (extensions != null)
-            {
-                Enumeration     e = extensions.oids();
-
-                while (e.hasMoreElements())
-                {
-                    DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement();
-                    if (oid.getId().equals("2.5.29.15")
-                       || oid.getId().equals("2.5.29.19"))
-                    {
-                        continue;
-                    }
-
-                    X509Extension       ext = extensions.getExtension(oid);
-
-                    if (ext.isCritical())
-                    {
-                        return true;
-                    }
-                }
-            }
-        }
-
-        return false;
-    }
-
-    public PublicKey getPublicKey()
-    {
-        return JDKKeyFactory.createPublicKeyFromPublicKeyInfo(c.getSubjectPublicKeyInfo());
-    }
-
-    public byte[] getEncoded()
-        throws CertificateEncodingException
-    {
-        ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-        DEROutputStream         dOut = new DEROutputStream(bOut);
-
-        try
-        {
-            dOut.writeObject(c);
-
-            return bOut.toByteArray();
-        }
-        catch (IOException e)
-        {
-            throw new CertificateEncodingException(e.toString());
-        }
-    }
-
-    public void setBagAttribute(
-        DERObjectIdentifier oid,
-        DEREncodable        attribute)
-    {
-        pkcs12Attributes.put(oid, attribute);
-        pkcs12Ordering.addElement(oid);
-    }
-
-    public DEREncodable getBagAttribute(
-        DERObjectIdentifier oid)
-    {
-        return (DEREncodable)pkcs12Attributes.get(oid);
-    }
-
-    public Enumeration getBagAttributeKeys()
-    {
-        return pkcs12Ordering.elements();
-    }
-
-    public String toString()
-    {
-        StringBuffer    buf = new StringBuffer();
-        String          nl = System.getProperty("line.separator");
-
-        buf.append("  [0]         Version: " + this.getVersion() + nl);
-        buf.append("         SerialNumber: " + this.getSerialNumber() + nl);
-        buf.append("             IssuerDN: " + this.getIssuerDN() + nl);
-        buf.append("           Start Date: " + this.getNotBefore() + nl);
-        buf.append("           Final Date: " + this.getNotAfter() + nl);
-        buf.append("            SubjectDN: " + this.getSubjectDN() + nl);
-        buf.append("           Public Key: " + this.getPublicKey() + nl);
-        buf.append("  Signature Algorithm: " + this.getSigAlgName() + nl);
-
-        byte[]  sig = this.getSignature();
-
-        buf.append("            Signature: " + new String(Hex.encode(sig, 0, 20)) + nl);
-        for (int i = 20; i < sig.length; i += 20)
-        {
-            if (i < sig.length - 20)
-            {
-                buf.append("                       " + new String(Hex.encode(sig, i, 20)) + nl);
-            }
-            else
-            {
-                buf.append("                       " + new String(Hex.encode(sig, i, sig.length - i)) + nl);
-            }
-        }
-
-        X509Extensions  extensions = c.getTBSCertificate().getExtensions();
-
-        if (extensions != null)
-        {
-            Enumeration     e = extensions.oids();
-
-            if (e.hasMoreElements())
-            {
-                buf.append("       Extensions: \n");
-            }
-
-            while (e.hasMoreElements())
-            {
-                DERObjectIdentifier     oid = (DERObjectIdentifier)e.nextElement();
-                X509Extension           ext = extensions.getExtension(oid);
-
-                if (ext.getValue() != null)
-                {
-                    byte[]                  octs = ext.getValue().getOctets();
-                    ByteArrayInputStream    bIn = new ByteArrayInputStream(octs);
-                    DERInputStream          dIn = new DERInputStream(bIn);
-                    buf.append("                       critical(" + ext.isCritical() + ") ");
-                    try
-                    {
-                        if (oid.equals(X509Extensions.BasicConstraints))
-                        {
-                            buf.append(new BasicConstraints((ASN1Sequence)dIn.readObject()) + nl);
-                        }
-                        else if (oid.equals(X509Extensions.KeyUsage))
-                        {
-                            buf.append(new KeyUsage((DERBitString)dIn.readObject()) + nl);
-                        }
-                        else if (oid.equals(MiscObjectIdentifiers.netscapeCertType))
-                        {
-                            buf.append(new NetscapeCertType((DERBitString)dIn.readObject()) + nl);
-                        }
-                        else if (oid.equals(MiscObjectIdentifiers.netscapeRevocationURL))
-                        {
-                            buf.append(new NetscapeRevocationURL((DERIA5String)dIn.readObject()) + nl);
-                        }
-                        else if (oid.equals(MiscObjectIdentifiers.verisignCzagExtension))
-                        {
-                            buf.append(new VerisignCzagExtension((DERIA5String)dIn.readObject()) + nl);
-                        }
-                        else 
-                        {
-                            buf.append(oid.getId());
-                            buf.append(" value = " + ASN1Dump.dumpAsString(dIn.readObject()) + nl);
-                            //buf.append(" value = " + "*****" + nl);
-                        }
-                    }
-                    catch (Exception ex)
-                    {
-                        buf.append(oid.getId());
-                   //     buf.append(" value = " + new String(Hex.encode(ext.getValue().getOctets())) + nl);
-                        buf.append(" value = " + "*****" + nl);
-                    }
-                }
-                else
-                {
-                    buf.append(nl);
-                }
-            }
-        }
-
-        return buf.toString();
-    }
-
-    public final void verify(
-        PublicKey   key)
-        throws CertificateException, NoSuchAlgorithmException,
-        InvalidKeyException, NoSuchProviderException, SignatureException
-    {
-        Signature   signature = null;
-
-        if (!c.getSignatureAlgorithm().equals(c.getTBSCertificate().getSignature()))
-        {
-            throw new CertificateException("signature algorithm in TBS cert not same as outer cert");
-        }
-
-        try
-        {
-            signature = Signature.getInstance(c.getSignatureAlgorithm().getObjectId().getId(), BouncyCastleProvider.PROVIDER_NAME);
-        }
-        catch (Exception e)
-        {
-            signature = Signature.getInstance(c.getSignatureAlgorithm().getObjectId().getId());
-        }
-
-        signature.initVerify(key);
-
-        signature.update(this.getTBSCertificate());
-
-        if (!signature.verify(this.getSignature()))
-        {
-            throw new InvalidKeyException("Public key presented not for certificate signature");
-        }
-    }
-
-    public final void verify(
-        PublicKey   key,
-        String      sigProvider)
-        throws CertificateException, NoSuchAlgorithmException,
-        InvalidKeyException, NoSuchProviderException, SignatureException
-    {
-        Signature signature = Signature.getInstance(c.getSignatureAlgorithm().getObjectId().getId(), sigProvider);
-
-        signature.initVerify(key);
-
-        signature.update(this.getTBSCertificate());
-
-        if (!signature.verify(this.getSignature()))
-        {
-            throw new InvalidKeyException("Public key presented not for certificate signature");
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/spec/ECKeySpec.java b/azureus2/src/org/bouncycastle/jce/spec/ECKeySpec.java
deleted file mode 100644
index 28ac5dd..0000000
--- a/azureus2/src/org/bouncycastle/jce/spec/ECKeySpec.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.bouncycastle.jce.spec;
-
-import java.security.spec.KeySpec;
-
-/**
- * base class for an Elliptic Curve Key Spec
- */
-public class ECKeySpec
-    implements KeySpec
-{
-	private ECParameterSpec     spec;
-
-	protected ECKeySpec(
-        ECParameterSpec spec)
-	{
-		this.spec = spec;
-	}
-
-    /**
-     * return the domain parameters for the curve
-     */
-    public ECParameterSpec getParams()
-    {
-        return spec;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/spec/ECNamedCurveParameterSpec.java b/azureus2/src/org/bouncycastle/jce/spec/ECNamedCurveParameterSpec.java
deleted file mode 100644
index 0e5148c..0000000
--- a/azureus2/src/org/bouncycastle/jce/spec/ECNamedCurveParameterSpec.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.bouncycastle.jce.spec;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.math.ec.ECCurve;
-import org.bouncycastle.math.ec.ECPoint;
-
-/**
- * specification signifying that the curve parameters can also be
- * refered to by name.
- */
-public class ECNamedCurveParameterSpec
-	extends ECParameterSpec
-{
-    private String  name;
-
-	public ECNamedCurveParameterSpec(
-        String      name,
-		ECCurve     curve,
-		ECPoint     G,
-		BigInteger  n)
-	{
-        super(curve, G, n);
-
-        this.name = name;
-	}
-
-	public ECNamedCurveParameterSpec(
-        String      name,
-		ECCurve     curve,
-		ECPoint     G,
-		BigInteger  n,
-        BigInteger  h)
-	{
-        super(curve, G, n, h);
-
-        this.name = name;
-	}
-
-	public ECNamedCurveParameterSpec(
-        String      name,
-		ECCurve     curve,
-		ECPoint     G,
-		BigInteger  n,
-        BigInteger  h,
-        byte[]      seed)
-	{
-        super(curve, G, n, h, seed);
-
-        this.name = name;
-	}
-
-    /**
-     * return the name of the curve the EC domain parameters belong to.
-     */
-	public String getName()
-	{
-		return name;
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/jce/spec/ECParameterSpec.java b/azureus2/src/org/bouncycastle/jce/spec/ECParameterSpec.java
deleted file mode 100644
index 1326793..0000000
--- a/azureus2/src/org/bouncycastle/jce/spec/ECParameterSpec.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.bouncycastle.jce.spec;
-
-import java.math.BigInteger;
-import java.security.spec.AlgorithmParameterSpec;
-
-import org.bouncycastle.math.ec.ECCurve;
-import org.bouncycastle.math.ec.ECPoint;
-
-/**
- * basic domain parameters for an Elliptic Curve public or private key.
- */
-public class ECParameterSpec
-	implements AlgorithmParameterSpec
-{
-	private ECCurve     curve;
-	private byte[]      seed;
-	private ECPoint     G;
-	private BigInteger  n;
-	private BigInteger  h;
-
-	public ECParameterSpec(
-		ECCurve     curve,
-		ECPoint     G,
-		BigInteger  n)
-	{
-		this.curve = curve;
-		this.G = G;
-		this.n = n;
-        this.h = BigInteger.valueOf(1);
-        this.seed = null;
-	}
-
-	public ECParameterSpec(
-		ECCurve     curve,
-		ECPoint     G,
-		BigInteger  n,
-        BigInteger  h)
-	{
-		this.curve = curve;
-		this.G = G;
-		this.n = n;
-		this.h = h;
-        this.seed = null;
-	}
-
-	public ECParameterSpec(
-		ECCurve     curve,
-		ECPoint     G,
-		BigInteger  n,
-        BigInteger  h,
-        byte[]      seed)
-	{
-		this.curve = curve;
-		this.G = G;
-		this.n = n;
-		this.h = h;
-		this.seed = seed;
-	}
-
-    /**
-     * return the curve along which the base point lies.
-     */
-    public ECCurve getCurve()
-    {
-        return curve;
-    }
-
-    /**
-     * return the base point we are using for these domain parameters.
-     */
-	public ECPoint getG()
-	{
-		return G;
-	}
-
-    /**
-     * return the order N of G
-     */
-	public BigInteger getN()
-	{
-		return n;
-	}
-
-    /**
-     * return the cofactor H to the order of G.
-     */
-	public BigInteger getH()
-	{
-		return h;
-	}
-
-    /**
-     * return the seed used to generate this curve (if available).
-     */
-	public byte[] getSeed()
-	{
-		return seed;
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/jce/spec/ECPrivateKeySpec.java b/azureus2/src/org/bouncycastle/jce/spec/ECPrivateKeySpec.java
deleted file mode 100644
index 8a44018..0000000
--- a/azureus2/src/org/bouncycastle/jce/spec/ECPrivateKeySpec.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.bouncycastle.jce.spec;
-
-import java.math.BigInteger;
-
-/**
- * Elliptic Curve private key specification.
- */
-public class ECPrivateKeySpec
-    extends ECKeySpec
-{
-    private BigInteger    d;
-
-    /**
-     * base constructor
-     *
-     * @param d the private number for the key.
-     * @param spec the domain parameters for the curve being used.
-     */
-	public ECPrivateKeySpec(
-        BigInteger      d,
-		ECParameterSpec spec)
-	{
-		super(spec);
-
-        this.d = d;
-	}
-
-    /**
-     * return the private number D
-     */
-    public BigInteger getD()
-    {
-        return d;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/spec/ECPublicKeySpec.java b/azureus2/src/org/bouncycastle/jce/spec/ECPublicKeySpec.java
deleted file mode 100644
index 532f065..0000000
--- a/azureus2/src/org/bouncycastle/jce/spec/ECPublicKeySpec.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.bouncycastle.jce.spec;
-
-import org.bouncycastle.math.ec.ECPoint;
-
-/**
- * Elliptic Curve public key specification
- */
-public class ECPublicKeySpec
-    extends ECKeySpec
-{
-    private ECPoint    q;
-
-    /**
-     * base constructor
-     *
-     * @param q the public point on the curve.
-     * @param spec the domain parameters for the curve.
-     */
-	public ECPublicKeySpec(
-        ECPoint         q,
-		ECParameterSpec spec)
-	{
-		super(spec);
-
-        this.q = q;
-	}
-
-    /**
-     * return the public point q
-     */
-    public ECPoint getQ()
-    {
-        return q;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/spec/ElGamalGenParameterSpec.java b/azureus2/src/org/bouncycastle/jce/spec/ElGamalGenParameterSpec.java
deleted file mode 100644
index 200d2b4..0000000
--- a/azureus2/src/org/bouncycastle/jce/spec/ElGamalGenParameterSpec.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.bouncycastle.jce.spec;
-
-import java.security.spec.AlgorithmParameterSpec;
-
-public class ElGamalGenParameterSpec
-    implements AlgorithmParameterSpec
-{
-    private int primeSize;
-
-    /*
-     * @param primeSize the size (in bits) of the prime modulus.
-     */
-    public ElGamalGenParameterSpec(
-        int     primeSize)
-    {
-        this.primeSize = primeSize;
-    }
-
-    /**
-     * Returns the size in bits of the prime modulus.
-     *
-     * @return the size in bits of the prime modulus
-     */
-    public int getPrimeSize()
-    {
-        return primeSize;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/spec/ElGamalKeySpec.java b/azureus2/src/org/bouncycastle/jce/spec/ElGamalKeySpec.java
deleted file mode 100644
index 5e3eb66..0000000
--- a/azureus2/src/org/bouncycastle/jce/spec/ElGamalKeySpec.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.bouncycastle.jce.spec;
-
-import java.security.spec.KeySpec;
-
-public class ElGamalKeySpec
-    implements KeySpec
-{
-    private ElGamalParameterSpec  spec;
-
-    public ElGamalKeySpec(
-        ElGamalParameterSpec  spec)
-    {
-        this.spec = spec;
-    }
-
-    public ElGamalParameterSpec getParams()
-    {
-        return spec;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/spec/ElGamalParameterSpec.java b/azureus2/src/org/bouncycastle/jce/spec/ElGamalParameterSpec.java
deleted file mode 100644
index 10ed1c5..0000000
--- a/azureus2/src/org/bouncycastle/jce/spec/ElGamalParameterSpec.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.bouncycastle.jce.spec;
-
-import java.math.BigInteger;
-import java.security.spec.AlgorithmParameterSpec;
-
-public class ElGamalParameterSpec
-    implements AlgorithmParameterSpec
-{
-    private BigInteger  p;
-    private BigInteger  g;
-
-    /**
-     * Constructs a parameter set for Diffie-Hellman, using a prime modulus
-     * <code>p</code> and a base generator <code>g</code>.
-     * 
-     * @param p the prime modulus
-     * @param g the base generator
-     */
-    public ElGamalParameterSpec(
-        BigInteger  p,
-        BigInteger  g)
-    {
-        this.p = p;
-        this.g = g;
-    }
-
-    /**
-     * Returns the prime modulus <code>p</code>.
-     *
-     * @return the prime modulus <code>p</code>
-     */
-    public BigInteger getP()
-    {
-        return p;
-    }
-
-    /**
-     * Returns the base generator <code>g</code>.
-     *
-     * @return the base generator <code>g</code>
-     */
-    public BigInteger getG()
-    {
-        return g;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/spec/ElGamalPrivateKeySpec.java b/azureus2/src/org/bouncycastle/jce/spec/ElGamalPrivateKeySpec.java
deleted file mode 100644
index 3a3c6e4..0000000
--- a/azureus2/src/org/bouncycastle/jce/spec/ElGamalPrivateKeySpec.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.bouncycastle.jce.spec;
-
-import java.math.BigInteger;
-
-/**
- * This class specifies an ElGamal private key with its associated parameters.
- *
- * @see ElGamalPublicKeySpec
- */
-public class ElGamalPrivateKeySpec
-    extends ElGamalKeySpec
-{
-    private BigInteger  x;
-
-    public ElGamalPrivateKeySpec(
-        BigInteger              x,
-        ElGamalParameterSpec    spec)
-    {
-        super(spec);
-
-        this.x = x;
-    }
-
-    /**
-     * Returns the private value <code>x</code>.
-     *
-     * @return the private value <code>x</code>
-     */
-    public BigInteger getX()
-    {
-        return x;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/spec/ElGamalPublicKeySpec.java b/azureus2/src/org/bouncycastle/jce/spec/ElGamalPublicKeySpec.java
deleted file mode 100644
index c0e6dba..0000000
--- a/azureus2/src/org/bouncycastle/jce/spec/ElGamalPublicKeySpec.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.bouncycastle.jce.spec;
-
-import java.math.BigInteger;
-
-/**
- * This class specifies an ElGamal public key with its associated parameters.
- *
- * @see ElGamalPrivateKeySpec
- */
-public class ElGamalPublicKeySpec
-    extends ElGamalKeySpec
-{
-    private BigInteger  y;
-
-    public ElGamalPublicKeySpec(
-        BigInteger              y,
-        ElGamalParameterSpec    spec)
-    {
-        super(spec);
-
-        this.y = y;
-    }
-
-    /**
-     * Returns the public value <code>y</code>.
-     *
-     * @return the public value <code>y</code>
-     */
-    public BigInteger getY()
-    {
-        return y;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/spec/IEKeySpec.java b/azureus2/src/org/bouncycastle/jce/spec/IEKeySpec.java
deleted file mode 100644
index 9859a22..0000000
--- a/azureus2/src/org/bouncycastle/jce/spec/IEKeySpec.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.bouncycastle.jce.spec;
-
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.spec.KeySpec;
-
-import org.bouncycastle.jce.interfaces.IESKey;
-
-/**
- * key pair for use with an integrated encryptor - together
- * they provide what's required to generate the message.
- */
-public class IEKeySpec
-    implements KeySpec, IESKey
-{
-    private PublicKey   pubKey;
-    private PrivateKey  privKey;
-
-    /**
-     * @param privKey our private key.
-     * @param pubKey the public key of the sender/recipient.
-     */
-    public IEKeySpec(
-        PrivateKey  privKey,
-        PublicKey   pubKey)
-    {
-        this.privKey = privKey;
-        this.pubKey = pubKey;
-    }
-
-    /**
-     * return the intended recipient's/sender's public key.
-     */
-    public PublicKey getPublic()
-    {
-        return pubKey;
-    }
-
-    /**
-     * return the local private key.
-     */
-    public PrivateKey getPrivate()
-    {
-        return privKey;
-    }
-
-    /**
-     * return "IES"
-     */
-    public String getAlgorithm()
-    {
-        return "IES";
-    }
-
-    /**
-     * return null
-     */
-    public String getFormat()
-    {
-        return null;
-    }
-
-    /**
-     * returns null
-     */
-    public byte[] getEncoded()
-    {
-        return null;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/jce/spec/IESParameterSpec.java b/azureus2/src/org/bouncycastle/jce/spec/IESParameterSpec.java
deleted file mode 100644
index 97c7d3a..0000000
--- a/azureus2/src/org/bouncycastle/jce/spec/IESParameterSpec.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.bouncycastle.jce.spec;
-
-import java.security.spec.AlgorithmParameterSpec;
-
-/**
- * Parameter spec for an integrated encryptor, as in IEEE P1363a
- */
-public class IESParameterSpec
-    implements AlgorithmParameterSpec
-{
-    private byte[]  derivation;
-    private byte[]  encoding;
-    private int     macKeySize;
-
-    public IESParameterSpec(
-        byte[]  derivation,
-        byte[]  encoding,
-        int     macKeySize)
-    {
-        this.derivation = new byte[derivation.length];
-        System.arraycopy(derivation, 0, this.derivation, 0, derivation.length);
-
-        this.encoding = new byte[encoding.length];
-        System.arraycopy(encoding, 0, this.encoding, 0, encoding.length);
-
-        this.macKeySize = macKeySize;           
-    }
-
-    /**
-     * return the derivation vector.
-     */
-    public byte[] getDerivationV()
-    {
-        return derivation;
-    }
-
-    /**
-     * return the encoding vector.
-     */
-    public byte[] getEncodingV()
-    {
-        return encoding;
-    }
-
-    /**
-     * return the key size in bits for the MAC used with the message
-     */
-    public int getMacKeySize()
-    {
-        return macKeySize;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/math/ec/ECConstants.java b/azureus2/src/org/bouncycastle/math/ec/ECConstants.java
deleted file mode 100644
index 864f746..0000000
--- a/azureus2/src/org/bouncycastle/math/ec/ECConstants.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.bouncycastle.math.ec;
-
-import java.math.BigInteger;
-
-public interface ECConstants
-{
-    public static final BigInteger ZERO = BigInteger.valueOf(0);
-    public static final BigInteger ONE = BigInteger.valueOf(1);
-    public static final BigInteger TWO = BigInteger.valueOf(2);
-    public static final BigInteger THREE = BigInteger.valueOf(3);
-    public static final BigInteger FOUR = BigInteger.valueOf(4);
-}
diff --git a/azureus2/src/org/bouncycastle/math/ec/ECCurve.java b/azureus2/src/org/bouncycastle/math/ec/ECCurve.java
deleted file mode 100644
index 4db07d5..0000000
--- a/azureus2/src/org/bouncycastle/math/ec/ECCurve.java
+++ /dev/null
@@ -1,660 +0,0 @@
-package org.bouncycastle.math.ec;
-
-import java.math.BigInteger;
-import java.util.Random;
-
-/**
- * base class for an elliptic curve
- */
-public abstract class ECCurve
-{
-    ECFieldElement a, b;
-
-    public abstract int getFieldSize();
-
-    public abstract ECFieldElement fromBigInteger(BigInteger x);
-
-    public abstract ECPoint createPoint(BigInteger x, BigInteger y, boolean withCompression);
-
-    public abstract ECPoint decodePoint(byte[] encoded);
-
-    public abstract ECPoint getInfinity();
-
-    public ECFieldElement getA()
-    {
-        return a;
-    }
-
-    public ECFieldElement getB()
-    {
-        return b;
-    }
-
-    /**
-     * Elliptic curve over Fp
-     */
-    public static class Fp extends ECCurve
-    {
-        BigInteger q;
-        ECPoint.Fp infinity;
-
-        public Fp(BigInteger q, BigInteger a, BigInteger b)
-        {
-            this.q = q;
-            this.a = fromBigInteger(a);
-            this.b = fromBigInteger(b);
-            this.infinity = new ECPoint.Fp(this, null, null);
-        }
-
-        public BigInteger getQ()
-        {
-            return q;
-        }
-
-        public int getFieldSize()
-        {
-            return q.bitLength();
-        }
-
-        public ECFieldElement fromBigInteger(BigInteger x)
-        {
-            return new ECFieldElement.Fp(this.q, x);
-        }
-
-        public ECPoint createPoint(BigInteger x, BigInteger y, boolean withCompression)
-        {
-            return new ECPoint.Fp(this, fromBigInteger(x), fromBigInteger(y), withCompression);
-        }
-
-        /**
-         * Decode a point on this curve from its ASN.1 encoding. The different
-         * encodings are taken account of, including point compression for
-         * <code>F<sub>p</sub></code> (X9.62 s 4.2.1 pg 17).
-         * @return The decoded point.
-         */
-        public ECPoint decodePoint(byte[] encoded)
-        {
-            ECPoint p = null;
-
-            switch (encoded[0])
-            {
-                // infinity
-            case 0x00:
-                p = getInfinity();
-                break;
-                // compressed
-            case 0x02:
-            case 0x03:
-                int ytilde = encoded[0] & 1;
-                byte[]  i = new byte[encoded.length - 1];
-
-                System.arraycopy(encoded, 1, i, 0, i.length);
-
-                ECFieldElement x = new ECFieldElement.Fp(this.q, new BigInteger(1, i));
-                ECFieldElement alpha = x.multiply(x.square().add(a)).add(b);
-                ECFieldElement beta = alpha.sqrt();
-
-                //
-                // if we can't find a sqrt we haven't got a point on the
-                // curve - run!
-                //
-                if (beta == null)
-                {
-                    throw new RuntimeException("Invalid point compression");
-                }
-
-                int bit0 = (beta.toBigInteger().testBit(0) ? 1 : 0);
-
-                if (bit0 == ytilde)
-                {
-                    p = new ECPoint.Fp(this, x, beta, true);
-                }
-                else
-                {
-                    p = new ECPoint.Fp(this, x,
-                        new ECFieldElement.Fp(this.q, q.subtract(beta.toBigInteger())), true);
-                }
-                break;
-                // uncompressed
-            case 0x04:
-                // hybrid
-            case 0x06:
-            case 0x07:
-                byte[]  xEnc = new byte[(encoded.length - 1) / 2];
-                byte[]  yEnc = new byte[(encoded.length - 1) / 2];
-
-                System.arraycopy(encoded, 1, xEnc, 0, xEnc.length);
-                System.arraycopy(encoded, xEnc.length + 1, yEnc, 0, yEnc.length);
-
-                p = new ECPoint.Fp(this,
-                        new ECFieldElement.Fp(this.q, new BigInteger(1, xEnc)),
-                        new ECFieldElement.Fp(this.q, new BigInteger(1, yEnc)));
-                break;
-            default:
-                throw new RuntimeException("Invalid point encoding 0x" + Integer.toString(encoded[0], 16));
-            }
-
-            return p;
-        }
-
-        public ECPoint getInfinity()
-        {
-            return infinity;
-        }
-
-        public boolean equals(
-            Object anObject) 
-        {
-            if (anObject == this) 
-            {
-                return true;
-            }
-
-            if (!(anObject instanceof ECCurve.Fp)) 
-            {
-                return false;
-            }
-
-            ECCurve.Fp other = (ECCurve.Fp) anObject;
-
-            return this.q.equals(other.q) 
-                    && a.equals(other.a) && b.equals(other.b);
-        }
-
-        public int hashCode() 
-        {
-            return a.hashCode() ^ b.hashCode() ^ q.hashCode();
-        }
-    }
-
-    /**
-     * Elliptic curves over F2m. The Weierstrass equation is given by
-     * <code>y<sup>2</sup> + xy = x<sup>3</sup> + ax<sup>2</sup> + b</code>.
-     */
-    public static class F2m extends ECCurve
-    {
-        /**
-         * The exponent <code>m</code> of <code>F<sub>2<sup>m</sup></sub></code>.
-         */
-        private int m;  // can't be final - JDK 1.1
-
-        /**
-         * TPB: The integer <code>k</code> where <code>x<sup>m</sup> +
-         * x<sup>k</sup> + 1</code> represents the reduction polynomial
-         * <code>f(z)</code>.<br>
-         * PPB: The integer <code>k1</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.<br>
-         */
-        private int k1;  // can't be final - JDK 1.1
-
-        /**
-         * TPB: Always set to <code>0</code><br>
-         * PPB: The integer <code>k2</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.<br>
-         */
-        private int k2;  // can't be final - JDK 1.1
-
-        /**
-         * TPB: Always set to <code>0</code><br>
-         * PPB: The integer <code>k3</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.<br>
-         */
-        private int k3;  // can't be final - JDK 1.1
-
-        /**
-         * The order of the base point of the curve.
-         */
-        private BigInteger n;  // can't be final - JDK 1.1
-
-        /**
-         * The cofactor of the curve.
-         */
-        private BigInteger h;  // can't be final - JDK 1.1
-        
-         /**
-         * The point at infinity on this curve.
-         */
-        private ECPoint.F2m infinity;  // can't be final - JDK 1.1
-
-        /**
-         * The parameter <code>μ</code> of the elliptic curve if this is
-         * a Koblitz curve.
-         */
-        private byte mu = 0;
-
-        /**
-         * The auxiliary values <code>s<sub>0</sub></code> and
-         * <code>s<sub>1</sub></code> used for partial modular reduction for
-         * Koblitz curves.
-         */
-        private BigInteger[] si = null;
-
-        /**
-         * Constructor for Trinomial Polynomial Basis (TPB).
-         * @param m  The exponent <code>m</code> of
-         * <code>F<sub>2<sup>m</sup></sub></code>.
-         * @param k The integer <code>k</code> where <code>x<sup>m</sup> +
-         * x<sup>k</sup> + 1</code> represents the reduction
-         * polynomial <code>f(z)</code>.
-         * @param a The coefficient <code>a</code> in the Weierstrass equation
-         * for non-supersingular elliptic curves over
-         * <code>F<sub>2<sup>m</sup></sub></code>.
-         * @param b The coefficient <code>b</code> in the Weierstrass equation
-         * for non-supersingular elliptic curves over
-         * <code>F<sub>2<sup>m</sup></sub></code>.
-         */
-        public F2m(
-            int m,
-            int k,
-            BigInteger a,
-            BigInteger b)
-        {
-            this(m, k, 0, 0, a, b, null, null);
-        }
-
-        /**
-         * Constructor for Trinomial Polynomial Basis (TPB).
-         * @param m  The exponent <code>m</code> of
-         * <code>F<sub>2<sup>m</sup></sub></code>.
-         * @param k The integer <code>k</code> where <code>x<sup>m</sup> +
-         * x<sup>k</sup> + 1</code> represents the reduction
-         * polynomial <code>f(z)</code>.
-         * @param a The coefficient <code>a</code> in the Weierstrass equation
-         * for non-supersingular elliptic curves over
-         * <code>F<sub>2<sup>m</sup></sub></code>.
-         * @param b The coefficient <code>b</code> in the Weierstrass equation
-         * for non-supersingular elliptic curves over
-         * <code>F<sub>2<sup>m</sup></sub></code>.
-         * @param n The order of the main subgroup of the elliptic curve.
-         * @param h The cofactor of the elliptic curve, i.e.
-         * <code>#E<sub>a</sub>(F<sub>2<sup>m</sup></sub>) = h * n</code>.
-         */
-        public F2m(
-            int m, 
-            int k, 
-            BigInteger a, 
-            BigInteger b,
-            BigInteger n,
-            BigInteger h)
-        {
-            this(m, k, 0, 0, a, b, n, h);
-        }
-
-        /**
-         * Constructor for Pentanomial Polynomial Basis (PPB).
-         * @param m  The exponent <code>m</code> of
-         * <code>F<sub>2<sup>m</sup></sub></code>.
-         * @param k1 The integer <code>k1</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.
-         * @param k2 The integer <code>k2</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.
-         * @param k3 The integer <code>k3</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.
-         * @param a The coefficient <code>a</code> in the Weierstrass equation
-         * for non-supersingular elliptic curves over
-         * <code>F<sub>2<sup>m</sup></sub></code>.
-         * @param b The coefficient <code>b</code> in the Weierstrass equation
-         * for non-supersingular elliptic curves over
-         * <code>F<sub>2<sup>m</sup></sub></code>.
-         */
-        public F2m(
-            int m,
-            int k1,
-            int k2,
-            int k3,
-            BigInteger a,
-            BigInteger b)
-        {
-            this(m, k1, k2, k3, a, b, null, null);
-        }
-
-        /**
-         * Constructor for Pentanomial Polynomial Basis (PPB).
-         * @param m  The exponent <code>m</code> of
-         * <code>F<sub>2<sup>m</sup></sub></code>.
-         * @param k1 The integer <code>k1</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.
-         * @param k2 The integer <code>k2</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.
-         * @param k3 The integer <code>k3</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.
-         * @param a The coefficient <code>a</code> in the Weierstrass equation
-         * for non-supersingular elliptic curves over
-         * <code>F<sub>2<sup>m</sup></sub></code>.
-         * @param b The coefficient <code>b</code> in the Weierstrass equation
-         * for non-supersingular elliptic curves over
-         * <code>F<sub>2<sup>m</sup></sub></code>.
-         * @param n The order of the main subgroup of the elliptic curve.
-         * @param h The cofactor of the elliptic curve, i.e.
-         * <code>#E<sub>a</sub>(F<sub>2<sup>m</sup></sub>) = h * n</code>.
-         */
-        public F2m(
-            int m, 
-            int k1, 
-            int k2, 
-            int k3,
-            BigInteger a, 
-            BigInteger b,
-            BigInteger n,
-            BigInteger h)
-        {
-            this.m = m;
-            this.k1 = k1;
-            this.k2 = k2;
-            this.k3 = k3;
-            this.n = n;
-            this.h = h;
-
-            if (k1 == 0)
-            {
-                throw new IllegalArgumentException("k1 must be > 0");
-            }
-
-            if (k2 == 0)
-            {
-                if (k3 != 0)
-                {
-                    throw new IllegalArgumentException("k3 must be 0 if k2 == 0");
-                }
-            }
-            else
-            {
-                if (k2 <= k1)
-                {
-                    throw new IllegalArgumentException("k2 must be > k1");
-                }
-
-                if (k3 <= k2)
-                {
-                    throw new IllegalArgumentException("k3 must be > k2");
-                }
-            }
-
-            this.a = fromBigInteger(a);
-            this.b = fromBigInteger(b);
-            this.infinity = new ECPoint.F2m(this, null, null);
-        }
-
-        public int getFieldSize()
-        {
-            return m;
-        }
-
-        public ECFieldElement fromBigInteger(BigInteger x)
-        {
-            return new ECFieldElement.F2m(this.m, this.k1, this.k2, this.k3, x);
-        }
-
-        public ECPoint createPoint(BigInteger x, BigInteger y, boolean withCompression)
-        {
-            return new ECPoint.F2m(this, fromBigInteger(x), fromBigInteger(y), withCompression);
-        }
-
-        /* (non-Javadoc)
-         * @see org.bouncycastle.math.ec.ECCurve#decodePoint(byte[])
-         */
-        public ECPoint decodePoint(byte[] encoded)
-        {
-            ECPoint p = null;
-
-            switch (encoded[0])
-            {
-                // infinity
-            case 0x00:
-                p = getInfinity();
-                break;
-                // compressed
-            case 0x02:
-            case 0x03:
-                byte[] enc = new byte[encoded.length - 1];
-                System.arraycopy(encoded, 1, enc, 0, enc.length);
-                if (encoded[0] == 0x02) 
-                {
-                        p = decompressPoint(enc, 0);
-                }
-                else 
-                {
-                        p = decompressPoint(enc, 1);
-                }
-                break;
-                // uncompressed
-            case 0x04:
-                // hybrid
-            case 0x06:
-            case 0x07:
-                byte[] xEnc = new byte[(encoded.length - 1) / 2];
-                byte[] yEnc = new byte[(encoded.length - 1) / 2];
-
-                System.arraycopy(encoded, 1, xEnc, 0, xEnc.length);
-                System.arraycopy(encoded, xEnc.length + 1, yEnc, 0, yEnc.length);
-
-                p = new ECPoint.F2m(this,
-                    new ECFieldElement.F2m(this.m, this.k1, this.k2, this.k3,
-                        new BigInteger(1, xEnc)),
-                    new ECFieldElement.F2m(this.m, this.k1, this.k2, this.k3,
-                        new BigInteger(1, yEnc)), false);
-                break;
-
-            default:
-                throw new RuntimeException("Invalid point encoding 0x" + Integer.toString(encoded[0], 16));
-            }
-
-            return p;
-        }
-
-        public ECPoint getInfinity()
-        {
-            return infinity;
-        }
-
-        /**
-         * Returns true if this is a Koblitz curve (ABC curve).
-         * @return true if this is a Koblitz curve (ABC curve), false otherwise
-         */
-        public boolean isKoblitz()
-        {
-            return ((n != null) && (h != null) &&
-                    ((a.toBigInteger().equals(ECConstants.ZERO)) ||
-                    (a.toBigInteger().equals(ECConstants.ONE))) &&
-                    (b.toBigInteger().equals(ECConstants.ONE)));
-        }
-
-        /**
-         * Returns the parameter <code>μ</code> of the elliptic curve.
-         * @return <code>μ</code> of the elliptic curve.
-         * @throws IllegalArgumentException if the given ECCurve is not a
-         * Koblitz curve.
-         */
-        synchronized byte getMu()
-        {
-            if (mu == 0)
-            {
-                mu = Tnaf.getMu(this);
-            }
-            return mu;
-        }
-
-        /**
-         * @return the auxiliary values <code>s<sub>0</sub></code> and
-         * <code>s<sub>1</sub></code> used for partial modular reduction for
-         * Koblitz curves.
-         */
-        synchronized BigInteger[] getSi()
-        {
-            if (si == null)
-            {
-                si = Tnaf.getSi(this);
-            }
-            return si;
-        }
-
-        /**
-         * Decompresses a compressed point P = (xp, yp) (X9.62 s 4.2.2).
-         * 
-         * @param xEnc
-         *            The encoding of field element xp.
-         * @param ypBit
-         *            ~yp, an indication bit for the decompression of yp.
-         * @return the decompressed point.
-         */
-        private ECPoint decompressPoint(
-            byte[] xEnc, 
-            int ypBit)
-        {
-            ECFieldElement xp = new ECFieldElement.F2m(
-                    this.m, this.k1, this.k2, this.k3, new BigInteger(1, xEnc));
-            ECFieldElement yp = null;
-            if (xp.toBigInteger().equals(ECConstants.ZERO))
-            {
-                yp = (ECFieldElement.F2m)b;
-                for (int i = 0; i < m - 1; i++)
-                {
-                    yp = yp.square();
-                }
-            }
-            else
-            {
-                ECFieldElement beta = xp.add(a).add(
-                        b.multiply(xp.square().invert()));
-                ECFieldElement z = solveQuadradicEquation(beta);
-                if (z == null)
-                {
-                    throw new RuntimeException("Invalid point compression");
-                }
-                int zBit = 0;
-                if (z.toBigInteger().testBit(0))
-                {
-                    zBit = 1;
-                }
-                if (zBit != ypBit)
-                {
-                    z = z.add(new ECFieldElement.F2m(this.m, this.k1, this.k2,
-                            this.k3, ECConstants.ONE));
-                }
-                yp = xp.multiply(z);
-            }
-            
-            return new ECPoint.F2m(this, xp, yp);
-        }
-        
-        /**
-         * Solves a quadratic equation <code>z<sup>2</sup> + z = beta</code>(X9.62
-         * D.1.6) The other solution is <code>z + 1</code>.
-         * 
-         * @param beta
-         *            The value to solve the qradratic equation for.
-         * @return the solution for <code>z<sup>2</sup> + z = beta</code> or
-         *         <code>null</code> if no solution exists.
-         */
-        private ECFieldElement solveQuadradicEquation(ECFieldElement beta)
-        {
-            ECFieldElement zeroElement = new ECFieldElement.F2m(
-                    this.m, this.k1, this.k2, this.k3, ECConstants.ZERO);
-
-            if (beta.toBigInteger().equals(ECConstants.ZERO))
-            {
-                return zeroElement;
-            }
-
-            ECFieldElement z = null;
-            ECFieldElement gamma = zeroElement;
-
-            Random rand = new Random();
-            do
-            {
-                ECFieldElement t = new ECFieldElement.F2m(this.m, this.k1,
-                        this.k2, this.k3, new BigInteger(m, rand));
-                z = zeroElement;
-                ECFieldElement w = beta;
-                for (int i = 1; i <= m - 1; i++)
-                {
-                    ECFieldElement w2 = w.square();
-                    z = z.square().add(w2.multiply(t));
-                    w = w2.add(beta);
-                }
-                if (!w.toBigInteger().equals(ECConstants.ZERO))
-                {
-                    return null;
-                }
-                gamma = z.square().add(z);
-            }
-            while (gamma.toBigInteger().equals(ECConstants.ZERO));
-
-            return z;
-        }
-        
-        public boolean equals(
-            Object anObject)
-        {
-            if (anObject == this) 
-            {
-                return true;
-            }
-
-            if (!(anObject instanceof ECCurve.F2m)) 
-            {
-                return false;
-            }
-
-            ECCurve.F2m other = (ECCurve.F2m)anObject;
-            
-            return (this.m == other.m) && (this.k1 == other.k1)
-                && (this.k2 == other.k2) && (this.k3 == other.k3)
-                && a.equals(other.a) && b.equals(other.b);
-        }
-
-        public int hashCode()
-        {
-            return this.a.hashCode() ^ this.b.hashCode() ^ m ^ k1 ^ k2 ^ k3;
-        }
-
-        public int getM()
-        {
-            return m;
-        }
-
-        /**
-         * Return true if curve uses a Trinomial basis.
-         * 
-         * @return true if curve Trinomial, false otherwise.
-         */
-        public boolean isTrinomial()
-        {
-            return k2 == 0 && k3 == 0;
-        }
-        
-        public int getK1()
-        {
-            return k1;
-        }
-
-        public int getK2()
-        {
-            return k2;
-        }
-
-        public int getK3()
-        {
-            return k3;
-        }
-
-        public BigInteger getN()
-        {
-            return n;
-        }
-
-        public BigInteger getH()
-        {
-            return h;
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/math/ec/ECFieldElement.java b/azureus2/src/org/bouncycastle/math/ec/ECFieldElement.java
deleted file mode 100644
index b4b9b0a..0000000
--- a/azureus2/src/org/bouncycastle/math/ec/ECFieldElement.java
+++ /dev/null
@@ -1,1194 +0,0 @@
-package org.bouncycastle.math.ec;
-
-import java.math.BigInteger;
-import java.util.Random;
-
-public abstract class ECFieldElement
-    implements ECConstants
-{
-
-    public abstract BigInteger     toBigInteger();
-    public abstract String         getFieldName();
-    public abstract int            getFieldSize();
-    public abstract ECFieldElement add(ECFieldElement b);
-    public abstract ECFieldElement subtract(ECFieldElement b);
-    public abstract ECFieldElement multiply(ECFieldElement b);
-    public abstract ECFieldElement divide(ECFieldElement b);
-    public abstract ECFieldElement negate();
-    public abstract ECFieldElement square();
-    public abstract ECFieldElement invert();
-    public abstract ECFieldElement sqrt();
-
-    public String toString()
-    {
-        return this.toBigInteger().toString(2);
-    }
-
-    public static class Fp extends ECFieldElement
-    {
-        BigInteger x;
-
-        BigInteger q;
-        
-        public Fp(BigInteger q, BigInteger x)
-        {
-            this.x = x;
-            
-            if (x.compareTo(q) >= 0)
-            {
-                throw new IllegalArgumentException("x value too large in field element");
-            }
-
-            this.q = q;
-        }
-
-        public BigInteger toBigInteger()
-        {
-            return x;
-        }
-
-        /**
-         * return the field name for this field.
-         *
-         * @return the string "Fp".
-         */
-        public String getFieldName()
-        {
-            return "Fp";
-        }
-
-        public int getFieldSize()
-        {
-            return q.bitLength();
-        }
-
-        public BigInteger getQ()
-        {
-            return q;
-        }
-        
-        public ECFieldElement add(ECFieldElement b)
-        {
-            return new Fp(q, x.add(b.toBigInteger()).mod(q));
-        }
-
-        public ECFieldElement subtract(ECFieldElement b)
-        {
-            return new Fp(q, x.subtract(b.toBigInteger()).mod(q));
-        }
-
-        public ECFieldElement multiply(ECFieldElement b)
-        {
-            return new Fp(q, x.multiply(b.toBigInteger()).mod(q));
-        }
-
-        public ECFieldElement divide(ECFieldElement b)
-        {
-            return new Fp(q, x.multiply(b.toBigInteger().modInverse(q)).mod(q));
-        }
-
-        public ECFieldElement negate()
-        {
-            return new Fp(q, x.negate().mod(q));
-        }
-
-        public ECFieldElement square()
-        {
-            return new Fp(q, x.multiply(x).mod(q));
-        }
-
-        public ECFieldElement invert()
-        {
-            return new Fp(q, x.modInverse(q));
-        }
-
-        // D.1.4 91
-        /**
-         * return a sqrt root - the routine verifies that the calculation
-         * returns the right value - if none exists it returns null.
-         */
-        public ECFieldElement sqrt()
-        {
-            if (!q.testBit(0))
-            {
-                throw new RuntimeException("not done yet");
-            }
-
-            // p mod 4 == 3
-            if (q.testBit(1))
-            {
-                // z = g^(u+1) + p, p = 4u + 3
-                ECFieldElement z = new Fp(q, x.modPow(q.shiftRight(2).add(ONE), q));
-
-                return z.square().equals(this) ? z : null;
-            }
-
-            // p mod 4 == 1
-            BigInteger qMinusOne = q.subtract(ECConstants.ONE);
-
-            BigInteger legendreExponent = qMinusOne.shiftRight(1);
-            if (!(x.modPow(legendreExponent, q).equals(ECConstants.ONE)))
-            {
-                return null;
-            }
-
-            BigInteger u = qMinusOne.shiftRight(2);
-            BigInteger k = u.shiftLeft(1).add(ECConstants.ONE);
-
-            BigInteger Q = this.x;
-            BigInteger fourQ = Q.shiftLeft(2).mod(q);
-
-            BigInteger U, V;
-            Random rand = new Random();
-            do
-            {
-                BigInteger P;
-                do
-                {
-                    P = new BigInteger(q.bitLength(), rand);
-                }
-                while (P.compareTo(q) >= 0
-                    || !(P.multiply(P).subtract(fourQ).modPow(legendreExponent, q).equals(qMinusOne)));
-
-                BigInteger[] result = lucasSequence(q, P, Q, k);
-                U = result[0];
-                V = result[1];
-
-                if (V.multiply(V).mod(q).equals(fourQ))
-                {
-                    // Integer division by 2, mod q
-                    if (V.testBit(0))
-                    {
-                        V = V.add(q);
-                    }
-
-                    V = V.shiftRight(1);
-
-                    //assert V.multiply(V).mod(q).equals(x);
-
-                    return new ECFieldElement.Fp(q, V);
-                }
-            }
-            while (U.equals(ECConstants.ONE) || U.equals(qMinusOne));
-
-            return null;
-
-//            BigInteger qMinusOne = q.subtract(ECConstants.ONE);
-//            BigInteger legendreExponent = qMinusOne.shiftRight(1); //divide(ECConstants.TWO);
-//            if (!(x.modPow(legendreExponent, q).equals(ECConstants.ONE)))
-//            {
-//                return null;
-//            }
-//
-//            Random rand = new Random();
-//            BigInteger fourX = x.shiftLeft(2);
-//
-//            BigInteger r;
-//            do
-//            {
-//                r = new BigInteger(q.bitLength(), rand);
-//            }
-//            while (r.compareTo(q) >= 0
-//                || !(r.multiply(r).subtract(fourX).modPow(legendreExponent, q).equals(qMinusOne)));
-//
-//            BigInteger n1 = qMinusOne.shiftRight(2); //.divide(ECConstants.FOUR);
-//            BigInteger n2 = n1.add(ECConstants.ONE); //q.add(ECConstants.THREE).divide(ECConstants.FOUR);
-//
-//            BigInteger wOne = WOne(r, x, q);
-//            BigInteger wSum = W(n1, wOne, q).add(W(n2, wOne, q)).mod(q);
-//            BigInteger twoR = r.shiftLeft(1); //ECConstants.TWO.multiply(r);
-//
-//            BigInteger root = twoR.modPow(q.subtract(ECConstants.TWO), q)
-//                .multiply(x).mod(q)
-//                .multiply(wSum).mod(q);
-//
-//            return new Fp(q, root);
-        }
-
-//        private static BigInteger W(BigInteger n, BigInteger wOne, BigInteger p)
-//        {
-//            if (n.equals(ECConstants.ONE))
-//            {
-//                return wOne;
-//            }
-//            boolean isEven = !n.testBit(0);
-//            n = n.shiftRight(1);//divide(ECConstants.TWO);
-//            if (isEven)
-//            {
-//                BigInteger w = W(n, wOne, p);
-//                return w.multiply(w).subtract(ECConstants.TWO).mod(p);
-//            }
-//            BigInteger w1 = W(n.add(ECConstants.ONE), wOne, p);
-//            BigInteger w2 = W(n, wOne, p);
-//            return w1.multiply(w2).subtract(wOne).mod(p);
-//        }
-//
-//        private BigInteger WOne(BigInteger r, BigInteger x, BigInteger p)
-//        {
-//            return r.multiply(r).multiply(x.modPow(q.subtract(ECConstants.TWO), q)).subtract(ECConstants.TWO).mod(p);
-//        }
-
-        private static BigInteger[] lucasSequence(
-            BigInteger  p,
-            BigInteger  P,
-            BigInteger  Q,
-            BigInteger  k)
-        {
-            int n = k.bitLength();
-            int s = k.getLowestSetBit();
-
-            BigInteger Uh = ECConstants.ONE;
-            BigInteger Vl = ECConstants.TWO;
-            BigInteger Vh = P;
-            BigInteger Ql = ECConstants.ONE;
-            BigInteger Qh = ECConstants.ONE;
-
-            for (int j = n - 1; j >= s + 1; --j)
-            {
-                Ql = Ql.multiply(Qh).mod(p);
-
-                if (k.testBit(j))
-                {
-                    Qh = Ql.multiply(Q).mod(p);
-                    Uh = Uh.multiply(Vh).mod(p);
-                    Vl = Vh.multiply(Vl).subtract(P.multiply(Ql)).mod(p);
-                    Vh = Vh.multiply(Vh).subtract(Qh.shiftLeft(1)).mod(p);
-                }
-                else
-                {
-                    Qh = Ql;
-                    Uh = Uh.multiply(Vl).subtract(Ql).mod(p);
-                    Vh = Vh.multiply(Vl).subtract(P.multiply(Ql)).mod(p);
-                    Vl = Vl.multiply(Vl).subtract(Ql.shiftLeft(1)).mod(p);
-                }
-            }
-
-            Ql = Ql.multiply(Qh).mod(p);
-            Qh = Ql.multiply(Q).mod(p);
-            Uh = Uh.multiply(Vl).subtract(Ql).mod(p);
-            Vl = Vh.multiply(Vl).subtract(P.multiply(Ql)).mod(p);
-            Ql = Ql.multiply(Qh).mod(p);
-
-            for (int j = 1; j <= s; ++j)
-            {
-                Uh = Uh.multiply(Vl).mod(p);
-                Vl = Vl.multiply(Vl).subtract(Ql.shiftLeft(1)).mod(p);
-                Ql = Ql.multiply(Ql).mod(p);
-            }
-
-            return new BigInteger[]{ Uh, Vl };
-        }
-        
-        public boolean equals(Object other)
-        {
-            if (other == this)
-            {
-                return true;
-            }
-
-            if (!(other instanceof ECFieldElement.Fp))
-            {
-                return false;
-            }
-            
-            ECFieldElement.Fp o = (ECFieldElement.Fp)other;
-            return q.equals(o.q) && x.equals(o.x);
-        }
-
-        public int hashCode()
-        {
-            return q.hashCode() ^ x.hashCode();
-        }
-    }
-
-//    /**
-//     * Class representing the Elements of the finite field
-//     * <code>F<sub>2<sup>m</sup></sub></code> in polynomial basis (PB)
-//     * representation. Both trinomial (TPB) and pentanomial (PPB) polynomial
-//     * basis representations are supported. Gaussian normal basis (GNB)
-//     * representation is not supported.
-//     */
-//    public static class F2m extends ECFieldElement
-//    {
-//        BigInteger x;
-//
-//        /**
-//         * Indicates gaussian normal basis representation (GNB). Number chosen
-//         * according to X9.62. GNB is not implemented at present.
-//         */
-//        public static final int GNB = 1;
-//
-//        /**
-//         * Indicates trinomial basis representation (TPB). Number chosen
-//         * according to X9.62.
-//         */
-//        public static final int TPB = 2;
-//
-//        /**
-//         * Indicates pentanomial basis representation (PPB). Number chosen
-//         * according to X9.62.
-//         */
-//        public static final int PPB = 3;
-//
-//        /**
-//         * TPB or PPB.
-//         */
-//        private int representation;
-//
-//        /**
-//         * The exponent <code>m</code> of <code>F<sub>2<sup>m</sup></sub></code>.
-//         */
-//        private int m;
-//
-//        /**
-//         * TPB: The integer <code>k</code> where <code>x<sup>m</sup> +
-//         * x<sup>k</sup> + 1</code> represents the reduction polynomial
-//         * <code>f(z)</code>.<br>
-//         * PPB: The integer <code>k1</code> where <code>x<sup>m</sup> +
-//         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-//         * represents the reduction polynomial <code>f(z)</code>.<br>
-//         */
-//        private int k1;
-//
-//        /**
-//         * TPB: Always set to <code>0</code><br>
-//         * PPB: The integer <code>k2</code> where <code>x<sup>m</sup> +
-//         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-//         * represents the reduction polynomial <code>f(z)</code>.<br>
-//         */
-//        private int k2;
-//
-//        /**
-//         * TPB: Always set to <code>0</code><br>
-//         * PPB: The integer <code>k3</code> where <code>x<sup>m</sup> +
-//         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-//         * represents the reduction polynomial <code>f(z)</code>.<br>
-//         */
-//        private int k3;
-//        
-//        /**
-//         * Constructor for PPB.
-//         * @param m  The exponent <code>m</code> of
-//         * <code>F<sub>2<sup>m</sup></sub></code>.
-//         * @param k1 The integer <code>k1</code> where <code>x<sup>m</sup> +
-//         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-//         * represents the reduction polynomial <code>f(z)</code>.
-//         * @param k2 The integer <code>k2</code> where <code>x<sup>m</sup> +
-//         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-//         * represents the reduction polynomial <code>f(z)</code>.
-//         * @param k3 The integer <code>k3</code> where <code>x<sup>m</sup> +
-//         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-//         * represents the reduction polynomial <code>f(z)</code>.
-//         * @param x The BigInteger representing the value of the field element.
-//         */
-//        public F2m(
-//            int m, 
-//            int k1, 
-//            int k2, 
-//            int k3,
-//            BigInteger x)
-//        {
-////            super(x);
-//            this.x = x;
-//
-//            if ((k2 == 0) && (k3 == 0))
-//            {
-//                this.representation = TPB;
-//            }
-//            else
-//            {
-//                if (k2 >= k3)
-//                {
-//                    throw new IllegalArgumentException(
-//                            "k2 must be smaller than k3");
-//                }
-//                if (k2 <= 0)
-//                {
-//                    throw new IllegalArgumentException(
-//                            "k2 must be larger than 0");
-//                }
-//                this.representation = PPB;
-//            }
-//
-//            if (x.signum() < 0)
-//            {
-//                throw new IllegalArgumentException("x value cannot be negative");
-//            }
-//
-//            this.m = m;
-//            this.k1 = k1;
-//            this.k2 = k2;
-//            this.k3 = k3;
-//        }
-//
-//        /**
-//         * Constructor for TPB.
-//         * @param m  The exponent <code>m</code> of
-//         * <code>F<sub>2<sup>m</sup></sub></code>.
-//         * @param k The integer <code>k</code> where <code>x<sup>m</sup> +
-//         * x<sup>k</sup> + 1</code> represents the reduction
-//         * polynomial <code>f(z)</code>.
-//         * @param x The BigInteger representing the value of the field element.
-//         */
-//        public F2m(int m, int k, BigInteger x)
-//        {
-//            // Set k1 to k, and set k2 and k3 to 0
-//            this(m, k, 0, 0, x);
-//        }
-//
-//        public BigInteger toBigInteger()
-//        {
-//            return x;
-//        }
-//
-//        public String getFieldName()
-//        {
-//            return "F2m";
-//        }
-//
-//        public int getFieldSize()
-//        {
-//            return m;
-//        }
-//
-//        /**
-//         * Checks, if the ECFieldElements <code>a</code> and <code>b</code>
-//         * are elements of the same field <code>F<sub>2<sup>m</sup></sub></code>
-//         * (having the same representation).
-//         * @param a field element.
-//         * @param b field element to be compared.
-//         * @throws IllegalArgumentException if <code>a</code> and <code>b</code>
-//         * are not elements of the same field
-//         * <code>F<sub>2<sup>m</sup></sub></code> (having the same
-//         * representation). 
-//         */
-//        public static void checkFieldElements(
-//            ECFieldElement a,
-//            ECFieldElement b)
-//        {
-//            if ((!(a instanceof F2m)) || (!(b instanceof F2m)))
-//            {
-//                throw new IllegalArgumentException("Field elements are not "
-//                        + "both instances of ECFieldElement.F2m");
-//            }
-//
-//            if ((a.toBigInteger().signum() < 0) || (b.toBigInteger().signum() < 0))
-//            {
-//                throw new IllegalArgumentException(
-//                        "x value may not be negative");
-//            }
-//
-//            ECFieldElement.F2m aF2m = (ECFieldElement.F2m)a;
-//            ECFieldElement.F2m bF2m = (ECFieldElement.F2m)b;
-//
-//            if ((aF2m.m != bF2m.m) || (aF2m.k1 != bF2m.k1)
-//                    || (aF2m.k2 != bF2m.k2) || (aF2m.k3 != bF2m.k3))
-//            {
-//                throw new IllegalArgumentException("Field elements are not "
-//                        + "elements of the same field F2m");
-//            }
-//
-//            if (aF2m.representation != bF2m.representation)
-//            {
-//                // Should never occur
-//                throw new IllegalArgumentException(
-//                        "One of the field "
-//                                + "elements are not elements has incorrect representation");
-//            }
-//        }
-//
-//        /**
-//         * Computes <code>z * a(z) mod f(z)</code>, where <code>f(z)</code> is
-//         * the reduction polynomial of <code>this</code>.
-//         * @param a The polynomial <code>a(z)</code> to be multiplied by
-//         * <code>z mod f(z)</code>.
-//         * @return <code>z * a(z) mod f(z)</code>
-//         */
-//        private BigInteger multZModF(final BigInteger a)
-//        {
-//            // Left-shift of a(z)
-//            BigInteger az = a.shiftLeft(1);
-//            if (az.testBit(this.m)) 
-//            {
-//                // If the coefficient of z^m in a(z) equals 1, reduction
-//                // modulo f(z) is performed: Add f(z) to to a(z):
-//                // Step 1: Unset mth coeffient of a(z)
-//                az = az.clearBit(this.m);
-//
-//                // Step 2: Add r(z) to a(z), where r(z) is defined as
-//                // f(z) = z^m + r(z), and k1, k2, k3 are the positions of
-//                // the non-zero coefficients in r(z)
-//                az = az.flipBit(0);
-//                az = az.flipBit(this.k1);
-//                if (this.representation == PPB) 
-//                {
-//                    az = az.flipBit(this.k2);
-//                    az = az.flipBit(this.k3);
-//                }
-//            }
-//            return az;
-//        }
-//
-//        public ECFieldElement add(final ECFieldElement b)
-//        {
-//            // No check performed here for performance reasons. Instead the
-//            // elements involved are checked in ECPoint.F2m
-//            // checkFieldElements(this, b);
-//            if (b.toBigInteger().signum() == 0)
-//            {
-//                return this;
-//            }
-//
-//            return new F2m(this.m, this.k1, this.k2, this.k3, this.x.xor(b.toBigInteger()));
-//        }
-//
-//        public ECFieldElement subtract(final ECFieldElement b)
-//        {
-//            // Addition and subtraction are the same in F2m
-//            return add(b);
-//        }
-//
-//
-//        public ECFieldElement multiply(final ECFieldElement b)
-//        {
-//            // Left-to-right shift-and-add field multiplication in F2m
-//            // Input: Binary polynomials a(z) and b(z) of degree at most m-1
-//            // Output: c(z) = a(z) * b(z) mod f(z)
-//
-//            // No check performed here for performance reasons. Instead the
-//            // elements involved are checked in ECPoint.F2m
-//            // checkFieldElements(this, b);
-//            final BigInteger az = this.x;
-//            BigInteger bz = b.toBigInteger();
-//            BigInteger cz;
-//
-//            // Compute c(z) = a(z) * b(z) mod f(z)
-//            if (az.testBit(0)) 
-//            {
-//                cz = bz;
-//            } 
-//            else 
-//            {
-//                cz = ECConstants.ZERO;
-//            }
-//
-//            for (int i = 1; i < this.m; i++) 
-//            {
-//                // b(z) := z * b(z) mod f(z)
-//                bz = multZModF(bz);
-//
-//                if (az.testBit(i)) 
-//                {
-//                    // If the coefficient of x^i in a(z) equals 1, b(z) is added
-//                    // to c(z)
-//                    cz = cz.xor(bz);
-//                }
-//            }
-//            return new ECFieldElement.F2m(m, this.k1, this.k2, this.k3, cz);
-//        }
-//
-//
-//        public ECFieldElement divide(final ECFieldElement b)
-//        {
-//            // There may be more efficient implementations
-//            ECFieldElement bInv = b.invert();
-//            return multiply(bInv);
-//        }
-//
-//        public ECFieldElement negate()
-//        {
-//            // -x == x holds for all x in F2m
-//            return this;
-//        }
-//
-//        public ECFieldElement square()
-//        {
-//            // Naive implementation, can probably be speeded up using modular
-//            // reduction
-//            return multiply(this);
-//        }
-//
-//        public ECFieldElement invert()
-//        {
-//            // Inversion in F2m using the extended Euclidean algorithm
-//            // Input: A nonzero polynomial a(z) of degree at most m-1
-//            // Output: a(z)^(-1) mod f(z)
-//
-//            // u(z) := a(z)
-//            BigInteger uz = this.x;
-//            if (uz.signum() <= 0) 
-//            {
-//                throw new ArithmeticException("x is zero or negative, " +
-//                        "inversion is impossible");
-//            }
-//
-//            // v(z) := f(z)
-//            BigInteger vz = ECConstants.ZERO.setBit(m);
-//            vz = vz.setBit(0);
-//            vz = vz.setBit(this.k1);
-//            if (this.representation == PPB) 
-//            {
-//                vz = vz.setBit(this.k2);
-//                vz = vz.setBit(this.k3);
-//            }
-//
-//            // g1(z) := 1, g2(z) := 0
-//            BigInteger g1z = ECConstants.ONE;
-//            BigInteger g2z = ECConstants.ZERO;
-//
-//            // while u != 1
-//            while (!(uz.equals(ECConstants.ZERO))) 
-//            {
-//                // j := deg(u(z)) - deg(v(z))
-//                int j = uz.bitLength() - vz.bitLength();
-//
-//                // If j < 0 then: u(z) <-> v(z), g1(z) <-> g2(z), j := -j
-//                if (j < 0) 
-//                {
-//                    final BigInteger uzCopy = uz;
-//                    uz = vz;
-//                    vz = uzCopy;
-//
-//                    final BigInteger g1zCopy = g1z;
-//                    g1z = g2z;
-//                    g2z = g1zCopy;
-//
-//                    j = -j;
-//                }
-//
-//                // u(z) := u(z) + z^j * v(z)
-//                // Note, that no reduction modulo f(z) is required, because
-//                // deg(u(z) + z^j * v(z)) <= max(deg(u(z)), j + deg(v(z)))
-//                // = max(deg(u(z)), deg(u(z)) - deg(v(z)) + deg(v(z))
-//                // = deg(u(z))
-//                uz = uz.xor(vz.shiftLeft(j));
-//
-//                // g1(z) := g1(z) + z^j * g2(z)
-//                g1z = g1z.xor(g2z.shiftLeft(j));
-////                if (g1z.bitLength() > this.m) {
-////                    throw new ArithmeticException(
-////                            "deg(g1z) >= m, g1z = " + g1z.toString(2));
-////                }
-//            }
-//            return new ECFieldElement.F2m(
-//                    this.m, this.k1, this.k2, this.k3, g2z);
-//        }
-//
-//        public ECFieldElement sqrt()
-//        {
-//            throw new RuntimeException("Not implemented");
-//        }
-//
-//        /**
-//         * @return the representation of the field
-//         * <code>F<sub>2<sup>m</sup></sub></code>, either of
-//         * TPB (trinomial
-//         * basis representation) or
-//         * PPB (pentanomial
-//         * basis representation).
-//         */
-//        public int getRepresentation()
-//        {
-//            return this.representation;
-//        }
-//
-//        /**
-//         * @return the degree <code>m</code> of the reduction polynomial
-//         * <code>f(z)</code>.
-//         */
-//        public int getM()
-//        {
-//            return this.m;
-//        }
-//
-//        /**
-//         * @return TPB: The integer <code>k</code> where <code>x<sup>m</sup> +
-//         * x<sup>k</sup> + 1</code> represents the reduction polynomial
-//         * <code>f(z)</code>.<br>
-//         * PPB: The integer <code>k1</code> where <code>x<sup>m</sup> +
-//         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-//         * represents the reduction polynomial <code>f(z)</code>.<br>
-//         */
-//        public int getK1()
-//        {
-//            return this.k1;
-//        }
-//
-//        /**
-//         * @return TPB: Always returns <code>0</code><br>
-//         * PPB: The integer <code>k2</code> where <code>x<sup>m</sup> +
-//         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-//         * represents the reduction polynomial <code>f(z)</code>.<br>
-//         */
-//        public int getK2()
-//        {
-//            return this.k2;
-//        }
-//
-//        /**
-//         * @return TPB: Always set to <code>0</code><br>
-//         * PPB: The integer <code>k3</code> where <code>x<sup>m</sup> +
-//         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-//         * represents the reduction polynomial <code>f(z)</code>.<br>
-//         */
-//        public int getK3()
-//        {
-//            return this.k3;
-//        }
-//
-//        public boolean equals(Object anObject)
-//        {
-//            if (anObject == this) 
-//            {
-//                return true;
-//            }
-//
-//            if (!(anObject instanceof ECFieldElement.F2m)) 
-//            {
-//                return false;
-//            }
-//
-//            ECFieldElement.F2m b = (ECFieldElement.F2m)anObject;
-//            
-//            return ((this.m == b.m) && (this.k1 == b.k1) && (this.k2 == b.k2)
-//                && (this.k3 == b.k3)
-//                && (this.representation == b.representation)
-//                && (this.x.equals(b.x)));
-//        }
-//
-//        public int hashCode()
-//        {
-//            return x.hashCode() ^ m ^ k1 ^ k2 ^ k3;
-//        }
-//    }
-
-    /**
-     * Class representing the Elements of the finite field
-     * <code>F<sub>2<sup>m</sup></sub></code> in polynomial basis (PB)
-     * representation. Both trinomial (TPB) and pentanomial (PPB) polynomial
-     * basis representations are supported. Gaussian normal basis (GNB)
-     * representation is not supported.
-     */
-    public static class F2m extends ECFieldElement
-    {
-        /**
-         * Indicates gaussian normal basis representation (GNB). Number chosen
-         * according to X9.62. GNB is not implemented at present.
-         */
-        public static final int GNB = 1;
-
-        /**
-         * Indicates trinomial basis representation (TPB). Number chosen
-         * according to X9.62.
-         */
-        public static final int TPB = 2;
-
-        /**
-         * Indicates pentanomial basis representation (PPB). Number chosen
-         * according to X9.62.
-         */
-        public static final int PPB = 3;
-
-        /**
-         * TPB or PPB.
-         */
-        private int representation;
-
-        /**
-         * The exponent <code>m</code> of <code>F<sub>2<sup>m</sup></sub></code>.
-         */
-        private int m;
-
-        /**
-         * TPB: The integer <code>k</code> where <code>x<sup>m</sup> +
-         * x<sup>k</sup> + 1</code> represents the reduction polynomial
-         * <code>f(z)</code>.<br>
-         * PPB: The integer <code>k1</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.<br>
-         */
-        private int k1;
-
-        /**
-         * TPB: Always set to <code>0</code><br>
-         * PPB: The integer <code>k2</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.<br>
-         */
-        private int k2;
-
-        /**
-         * TPB: Always set to <code>0</code><br>
-         * PPB: The integer <code>k3</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.<br>
-         */
-        private int k3;
-
-        /**
-         * The <code>IntArray</code> holding the bits.
-         */
-        private IntArray x;
-
-        /**
-         * The number of <code>int</code>s required to hold <code>m</code> bits.
-         */
-        private int t;
-
-        /**
-         * Constructor for PPB.
-         * @param m  The exponent <code>m</code> of
-         * <code>F<sub>2<sup>m</sup></sub></code>.
-         * @param k1 The integer <code>k1</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.
-         * @param k2 The integer <code>k2</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.
-         * @param k3 The integer <code>k3</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.
-         * @param x The BigInteger representing the value of the field element.
-         */
-        public F2m(
-            int m, 
-            int k1, 
-            int k2, 
-            int k3,
-            BigInteger x)
-        {
-            // t = m / 32 rounded up to the next integer
-            t = (m + 31) >> 5;
-            this.x = new IntArray(x, t);
-
-            if ((k2 == 0) && (k3 == 0))
-            {
-                this.representation = TPB;
-            }
-            else
-            {
-                if (k2 >= k3)
-                {
-                    throw new IllegalArgumentException(
-                            "k2 must be smaller than k3");
-                }
-                if (k2 <= 0)
-                {
-                    throw new IllegalArgumentException(
-                            "k2 must be larger than 0");
-                }
-                this.representation = PPB;
-            }
-
-            if (x.signum() < 0)
-            {
-                throw new IllegalArgumentException("x value cannot be negative");
-            }
-
-            this.m = m;
-            this.k1 = k1;
-            this.k2 = k2;
-            this.k3 = k3;
-        }
-
-        /**
-         * Constructor for TPB.
-         * @param m  The exponent <code>m</code> of
-         * <code>F<sub>2<sup>m</sup></sub></code>.
-         * @param k The integer <code>k</code> where <code>x<sup>m</sup> +
-         * x<sup>k</sup> + 1</code> represents the reduction
-         * polynomial <code>f(z)</code>.
-         * @param x The BigInteger representing the value of the field element.
-         */
-        public F2m(int m, int k, BigInteger x)
-        {
-            // Set k1 to k, and set k2 and k3 to 0
-            this(m, k, 0, 0, x);
-        }
-
-        private F2m(int m, int k1, int k2, int k3, IntArray x)
-        {
-            t = (m + 31) >> 5;
-            this.x = x;
-            this.m = m;
-            this.k1 = k1;
-            this.k2 = k2;
-            this.k3 = k3;
-
-            if ((k2 == 0) && (k3 == 0))
-            {
-                this.representation = TPB;
-            }
-            else
-            {
-                this.representation = PPB;
-            }
-
-        }
-
-        public BigInteger toBigInteger()
-        {
-            return x.toBigInteger();
-        }
-
-        public String getFieldName()
-        {
-            return "F2m";
-        }
-
-        public int getFieldSize()
-        {
-            return m;
-        }
-
-        /**
-         * Checks, if the ECFieldElements <code>a</code> and <code>b</code>
-         * are elements of the same field <code>F<sub>2<sup>m</sup></sub></code>
-         * (having the same representation).
-         * @param a field element.
-         * @param b field element to be compared.
-         * @throws IllegalArgumentException if <code>a</code> and <code>b</code>
-         * are not elements of the same field
-         * <code>F<sub>2<sup>m</sup></sub></code> (having the same
-         * representation). 
-         */
-        public static void checkFieldElements(
-            ECFieldElement a,
-            ECFieldElement b)
-        {
-            if ((!(a instanceof F2m)) || (!(b instanceof F2m)))
-            {
-                throw new IllegalArgumentException("Field elements are not "
-                        + "both instances of ECFieldElement.F2m");
-            }
-
-            ECFieldElement.F2m aF2m = (ECFieldElement.F2m)a;
-            ECFieldElement.F2m bF2m = (ECFieldElement.F2m)b;
-
-            if ((aF2m.m != bF2m.m) || (aF2m.k1 != bF2m.k1)
-                    || (aF2m.k2 != bF2m.k2) || (aF2m.k3 != bF2m.k3))
-            {
-                throw new IllegalArgumentException("Field elements are not "
-                        + "elements of the same field F2m");
-            }
-
-            if (aF2m.representation != bF2m.representation)
-            {
-                // Should never occur
-                throw new IllegalArgumentException(
-                        "One of the field "
-                                + "elements are not elements has incorrect representation");
-            }
-        }
-
-        public ECFieldElement add(final ECFieldElement b)
-        {
-            // No check performed here for performance reasons. Instead the
-            // elements involved are checked in ECPoint.F2m
-            // checkFieldElements(this, b);
-            IntArray iarrClone = (IntArray)this.x.clone();
-            F2m bF2m = (F2m)b;
-            iarrClone.addShifted(bF2m.x, 0);
-            return new F2m(m, k1, k2, k3, iarrClone);
-        }
-
-        public ECFieldElement subtract(final ECFieldElement b)
-        {
-            // Addition and subtraction are the same in F2m
-            return add(b);
-        }
-
-        public ECFieldElement multiply(final ECFieldElement b)
-        {
-            // Right-to-left comb multiplication in the IntArray
-            // Input: Binary polynomials a(z) and b(z) of degree at most m-1
-            // Output: c(z) = a(z) * b(z) mod f(z)
-
-            // No check performed here for performance reasons. Instead the
-            // elements involved are checked in ECPoint.F2m
-            // checkFieldElements(this, b);
-            F2m bF2m = (F2m)b;
-            IntArray mult = x.multiply(bF2m.x, m);
-            mult.reduce(m, new int[]{k1, k2, k3});
-            return new F2m(m, k1, k2, k3, mult);
-        }
-
-        public ECFieldElement divide(final ECFieldElement b)
-        {
-            // There may be more efficient implementations
-            ECFieldElement bInv = b.invert();
-            return multiply(bInv);
-        }
-
-        public ECFieldElement negate()
-        {
-            // -x == x holds for all x in F2m
-            return this;
-        }
-
-        public ECFieldElement square()
-        {
-            IntArray squared = x.square(m);
-            squared.reduce(m, new int[]{k1, k2, k3});
-            return new F2m(m, k1, k2, k3, squared);
-        }
-
-
-        public ECFieldElement invert()
-        {
-            // Inversion in F2m using the extended Euclidean algorithm
-            // Input: A nonzero polynomial a(z) of degree at most m-1
-            // Output: a(z)^(-1) mod f(z)
-
-            // u(z) := a(z)
-            IntArray uz = (IntArray)this.x.clone();
-
-            // v(z) := f(z)
-            IntArray vz = new IntArray(t);
-            vz.setBit(m);
-            vz.setBit(0);
-            vz.setBit(this.k1);
-            if (this.representation == PPB) 
-            {
-                vz.setBit(this.k2);
-                vz.setBit(this.k3);
-            }
-
-            // g1(z) := 1, g2(z) := 0
-            IntArray g1z = new IntArray(t);
-            g1z.setBit(0);
-            IntArray g2z = new IntArray(t);
-
-            // while u != 0
-            while (!uz.isZero())
-//            while (uz.getUsedLength() > 0)
-//            while (uz.bitLength() > 1)
-            {
-                // j := deg(u(z)) - deg(v(z))
-                int j = uz.bitLength() - vz.bitLength();
-
-                // If j < 0 then: u(z) <-> v(z), g1(z) <-> g2(z), j := -j
-                if (j < 0) 
-                {
-                    final IntArray uzCopy = uz;
-                    uz = vz;
-                    vz = uzCopy;
-
-                    final IntArray g1zCopy = g1z;
-                    g1z = g2z;
-                    g2z = g1zCopy;
-
-                    j = -j;
-                }
-
-                // u(z) := u(z) + z^j * v(z)
-                // Note, that no reduction modulo f(z) is required, because
-                // deg(u(z) + z^j * v(z)) <= max(deg(u(z)), j + deg(v(z)))
-                // = max(deg(u(z)), deg(u(z)) - deg(v(z)) + deg(v(z))
-                // = deg(u(z))
-                // uz = uz.xor(vz.shiftLeft(j));
-                // jInt = n / 32
-                int jInt = j >> 5;
-                // jInt = n % 32
-                int jBit = j & 0x1F;
-                IntArray vzShift = vz.shiftLeft(jBit);
-                uz.addShifted(vzShift, jInt);
-
-                // g1(z) := g1(z) + z^j * g2(z)
-//                g1z = g1z.xor(g2z.shiftLeft(j));
-                IntArray g2zShift = g2z.shiftLeft(jBit);
-                g1z.addShifted(g2zShift, jInt);
-                
-            }
-            return new ECFieldElement.F2m(
-                    this.m, this.k1, this.k2, this.k3, g2z);
-        }
-
-        public ECFieldElement sqrt()
-        {
-            throw new RuntimeException("Not implemented");
-        }
-
-        /**
-         * @return the representation of the field
-         * <code>F<sub>2<sup>m</sup></sub></code>, either of
-         * TPB (trinomial
-         * basis representation) or
-         * PPB (pentanomial
-         * basis representation).
-         */
-        public int getRepresentation()
-        {
-            return this.representation;
-        }
-
-        /**
-         * @return the degree <code>m</code> of the reduction polynomial
-         * <code>f(z)</code>.
-         */
-        public int getM()
-        {
-            return this.m;
-        }
-
-        /**
-         * @return TPB: The integer <code>k</code> where <code>x<sup>m</sup> +
-         * x<sup>k</sup> + 1</code> represents the reduction polynomial
-         * <code>f(z)</code>.<br>
-         * PPB: The integer <code>k1</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.<br>
-         */
-        public int getK1()
-        {
-            return this.k1;
-        }
-
-        /**
-         * @return TPB: Always returns <code>0</code><br>
-         * PPB: The integer <code>k2</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.<br>
-         */
-        public int getK2()
-        {
-            return this.k2;
-        }
-
-        /**
-         * @return TPB: Always set to <code>0</code><br>
-         * PPB: The integer <code>k3</code> where <code>x<sup>m</sup> +
-         * x<sup>k3</sup> + x<sup>k2</sup> + x<sup>k1</sup> + 1</code>
-         * represents the reduction polynomial <code>f(z)</code>.<br>
-         */
-        public int getK3()
-        {
-            return this.k3;
-        }
-
-        public boolean equals(Object anObject)
-        {
-            if (anObject == this) 
-            {
-                return true;
-            }
-
-            if (!(anObject instanceof ECFieldElement.F2m)) 
-            {
-                return false;
-            }
-
-            ECFieldElement.F2m b = (ECFieldElement.F2m)anObject;
-            
-            return ((this.m == b.m) && (this.k1 == b.k1) && (this.k2 == b.k2)
-                && (this.k3 == b.k3)
-                && (this.representation == b.representation)
-                && (this.x.equals(b.x)));
-        }
-
-        public int hashCode()
-        {
-            return x.hashCode() ^ m ^ k1 ^ k2 ^ k3;
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/math/ec/ECMultiplier.java b/azureus2/src/org/bouncycastle/math/ec/ECMultiplier.java
deleted file mode 100644
index 4d72e33..0000000
--- a/azureus2/src/org/bouncycastle/math/ec/ECMultiplier.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.bouncycastle.math.ec;
-
-import java.math.BigInteger;
-
-/**
- * Interface for classes encapsulating a point multiplication algorithm
- * for <code>ECPoint</code>s.
- */
-interface ECMultiplier
-{
-    /**
-     * Multiplies the <code>ECPoint p</code> by <code>k</code>, i.e.
-     * <code>p</code> is added <code>k</code> times to itself.
-     * @param p The <code>ECPoint</code> to be multiplied.
-     * @param k The factor by which <code>p</code> i multiplied.
-     * @return <code>p</code> multiplied by <code>k</code>.
-     */
-    ECPoint multiply(ECPoint p, BigInteger k, PreCompInfo preCompInfo);
-}
diff --git a/azureus2/src/org/bouncycastle/math/ec/ECPoint.java b/azureus2/src/org/bouncycastle/math/ec/ECPoint.java
deleted file mode 100644
index 2d38ee4..0000000
--- a/azureus2/src/org/bouncycastle/math/ec/ECPoint.java
+++ /dev/null
@@ -1,594 +0,0 @@
-package org.bouncycastle.math.ec;
-
-import java.math.BigInteger;
-
-import org.bouncycastle.asn1.x9.X9IntegerConverter;
-
-/**
- * base class for points on elliptic curves.
- */
-public abstract class ECPoint
-{
-    ECCurve        curve;
-    ECFieldElement x;
-    ECFieldElement y;
-
-    protected boolean withCompression;
-
-    protected ECMultiplier multiplier = null;
-
-    protected PreCompInfo preCompInfo = null;
-
-    private static X9IntegerConverter converter = new X9IntegerConverter();
-
-    protected ECPoint(ECCurve curve, ECFieldElement x, ECFieldElement y)
-    {
-        this.curve = curve;
-        this.x = x;
-        this.y = y;
-    }
-    
-    public ECCurve getCurve()
-    {
-        return curve;
-    }
-    
-    public ECFieldElement getX()
-    {
-        return x;
-    }
-
-    public ECFieldElement getY()
-    {
-        return y;
-    }
-
-    public boolean isInfinity()
-    {
-        return x == null && y == null;
-    }
-
-    public boolean isCompressed()
-    {
-        return withCompression;
-    }
-
-    public boolean equals(
-        Object  other)
-    {
-        if (other == this)
-        {
-            return true;
-        }
-
-        if (!(other instanceof ECPoint))
-        {
-            return false;
-        }
-
-        ECPoint o = (ECPoint)other;
-
-        if (this.isInfinity())
-        {
-            return o.isInfinity();
-        }
-
-        return x.equals(o.x) && y.equals(o.y);
-    }
-
-    public int hashCode()
-    {
-        if (this.isInfinity())
-        {
-            return 0;
-        }
-        
-        return x.hashCode() ^ y.hashCode();
-    }
-
-//    /**
-//     * Mainly for testing. Explicitly set the <code>ECMultiplier</code>.
-//     * @param multiplier The <code>ECMultiplier</code> to be used to multiply
-//     * this <code>ECPoint</code>.
-//     */
-//    public void setECMultiplier(ECMultiplier multiplier)
-//    {
-//        this.multiplier = multiplier;
-//    }
-
-    /**
-     * Sets the <code>PreCompInfo</code>. Used by <code>ECMultiplier</code>s
-     * to save the precomputation for this <code>ECPoint</code> to store the
-     * precomputation result for use by subsequent multiplication.
-     * @param preCompInfo The values precomputed by the
-     * <code>ECMultiplier</code>.
-     */
-    void setPreCompInfo(PreCompInfo preCompInfo)
-    {
-        this.preCompInfo = preCompInfo;
-    }
-
-    public abstract byte[] getEncoded();
-
-    public abstract ECPoint add(ECPoint b);
-    public abstract ECPoint subtract(ECPoint b);
-    public abstract ECPoint negate();
-    public abstract ECPoint twice();
-
-    /**
-     * Sets the default <code>ECMultiplier</code>, unless already set. 
-     */
-    synchronized void assertECMultiplier()
-    {
-        if (this.multiplier == null)
-        {
-            this.multiplier = new FpNafMultiplier();
-        }
-    }
-
-    /**
-     * Multiplies this <code>ECPoint</code> by the given number.
-     * @param k The multiplicator.
-     * @return <code>k * this</code>.
-     */
-    public ECPoint multiply(BigInteger k)
-    {
-        if (this.isInfinity())
-        {
-            return this;
-        }
-
-        if (k.signum() == 0)
-        {
-            return this.curve.getInfinity();
-        }
-
-        assertECMultiplier();
-        return this.multiplier.multiply(this, k, preCompInfo);
-    }
-
-    /**
-     * Elliptic curve points over Fp
-     */
-    public static class Fp extends ECPoint
-    {
-        
-        /**
-         * Create a point which encodes with point compression.
-         * 
-         * @param curve the curve to use
-         * @param x affine x co-ordinate
-         * @param y affine y co-ordinate
-         */
-        public Fp(ECCurve curve, ECFieldElement x, ECFieldElement y)
-        {
-            this(curve, x, y, false);
-        }
-
-        /**
-         * Create a point that encodes with or without point compresion.
-         * 
-         * @param curve the curve to use
-         * @param x affine x co-ordinate
-         * @param y affine y co-ordinate
-         * @param withCompression if true encode with point compression
-         */
-        public Fp(ECCurve curve, ECFieldElement x, ECFieldElement y, boolean withCompression)
-        {
-            super(curve, x, y);
-
-            if ((x != null && y == null) || (x == null && y != null))
-            {
-                throw new IllegalArgumentException("Exactly one of the field elements is null");
-            }
-
-            this.withCompression = withCompression;
-        }
-         
-        /**
-         * return the field element encoded with point compression. (S 4.3.6)
-         */
-        public byte[] getEncoded()
-        {
-            if (this.isInfinity()) 
-            {
-                return new byte[1];
-            }
-
-            int qLength = converter.getByteLength(x);
-            
-            if (withCompression)
-            {
-                byte    PC;
-    
-                if (this.getY().toBigInteger().testBit(0))
-                {
-                    PC = 0x03;
-                }
-                else
-                {
-                    PC = 0x02;
-                }
-    
-                byte[]  X = converter.integerToBytes(this.getX().toBigInteger(), qLength);
-                byte[]  PO = new byte[X.length + 1];
-    
-                PO[0] = PC;
-                System.arraycopy(X, 0, PO, 1, X.length);
-    
-                return PO;
-            }
-            else
-            {
-                byte[]  X = converter.integerToBytes(this.getX().toBigInteger(), qLength);
-                byte[]  Y = converter.integerToBytes(this.getY().toBigInteger(), qLength);
-                byte[]  PO = new byte[X.length + Y.length + 1];
-                
-                PO[0] = 0x04;
-                System.arraycopy(X, 0, PO, 1, X.length);
-                System.arraycopy(Y, 0, PO, X.length + 1, Y.length);
-
-                return PO;
-            }
-        }
-
-        // B.3 pg 62
-        public ECPoint add(ECPoint b)
-        {
-            if (this.isInfinity())
-            {
-                return b;
-            }
-
-            if (b.isInfinity())
-            {
-                return this;
-            }
-
-            // Check if b = this or b = -this
-            if (this.x.equals(b.x))
-            {
-                if (this.y.equals(b.y))
-                {
-                    // this = b, i.e. this must be doubled
-                    return this.twice();
-                }
-
-                // this = -b, i.e. the result is the point at infinity
-                return this.curve.getInfinity();
-            }
-
-            ECFieldElement gamma = b.y.subtract(this.y).divide(b.x.subtract(this.x));
-
-            ECFieldElement x3 = gamma.square().subtract(this.x).subtract(b.x);
-            ECFieldElement y3 = gamma.multiply(this.x.subtract(x3)).subtract(this.y);
-
-            return new ECPoint.Fp(curve, x3, y3);
-        }
-
-        // B.3 pg 62
-        public ECPoint twice()
-        {
-            if (this.isInfinity())
-            {
-                // Twice identity element (point at infinity) is identity
-                return this;
-            }
-
-            if (this.y.toBigInteger().signum() == 0) 
-            {
-                // if y1 == 0, then (x1, y1) == (x1, -y1)
-                // and hence this = -this and thus 2(x1, y1) == infinity
-                return this.curve.getInfinity();
-            }
-
-            ECFieldElement TWO = this.curve.fromBigInteger(BigInteger.valueOf(2));
-            ECFieldElement THREE = this.curve.fromBigInteger(BigInteger.valueOf(3));
-            ECFieldElement gamma = this.x.square().multiply(THREE).add(curve.a).divide(y.multiply(TWO));
-
-            ECFieldElement x3 = gamma.square().subtract(this.x.multiply(TWO));
-            ECFieldElement y3 = gamma.multiply(this.x.subtract(x3)).subtract(this.y);
-                
-            return new ECPoint.Fp(curve, x3, y3, this.withCompression);
-        }
-
-        // D.3.2 pg 102 (see Note:)
-        public ECPoint subtract(ECPoint b)
-        {
-            if (b.isInfinity())
-            {
-                return this;
-            }
-
-            // Add -b
-            return add(b.negate());
-        }
-
-        public ECPoint negate()
-        {
-            return new ECPoint.Fp(curve, this.x, this.y.negate(), this.withCompression);
-        }
-
-        // TODO Uncomment this to enable WNAF algorithm for Fp point multiplication
-//        /**
-//         * Sets the default <code>ECMultiplier</code>, unless already set. 
-//         */
-//        synchronized void assertECMultiplier()
-//        {
-//            if (this.multiplier == null)
-//            {
-//                this.multiplier = new WNafMultiplier();
-//            }
-//        }
-    }
-
-    /**
-     * Elliptic curve points over F2m
-     */
-    public static class F2m extends ECPoint
-    {
-        /**
-         * @param curve base curve
-         * @param x x point
-         * @param y y point
-         */
-        public F2m(ECCurve curve, ECFieldElement x, ECFieldElement y)
-        {
-            this(curve, x, y, false);
-        }
-        
-        /**
-         * @param curve base curve
-         * @param x x point
-         * @param y y point
-         * @param withCompression true if encode with point compression.
-         */
-        public F2m(ECCurve curve, ECFieldElement x, ECFieldElement y, boolean withCompression)
-        {
-            super(curve, x, y);
-
-            if ((x != null && y == null) || (x == null && y != null))
-            {
-                throw new IllegalArgumentException("Exactly one of the field elements is null");
-            }
-            
-            if (x != null)
-            {
-                // Check if x and y are elements of the same field
-                ECFieldElement.F2m.checkFieldElements(this.x, this.y);
-    
-                // Check if x and a are elements of the same field
-                if (curve != null)
-                {
-                    ECFieldElement.F2m.checkFieldElements(this.x, this.curve.getA());
-                }
-            }
-            
-            this.withCompression = withCompression;
-        }
-
-        /**
-         * @deprecated use ECCurve.getInfinity()
-         * Constructor for point at infinity
-         */
-        public F2m(ECCurve curve)
-        {
-            super(curve, null, null);
-        }
-
-        /* (non-Javadoc)
-         * @see org.bouncycastle.math.ec.ECPoint#getEncoded()
-         */
-        public byte[] getEncoded()
-        {
-            if (this.isInfinity()) 
-            {
-                return new byte[1];
-            }
-
-            int byteCount = converter.getByteLength(this.x);
-            byte[] X = converter.integerToBytes(this.getX().toBigInteger(), byteCount);
-            byte[] PO;
-
-            if (withCompression)
-            {
-                // See X9.62 4.3.6 and 4.2.2
-                PO = new byte[byteCount + 1];
-
-                PO[0] = 0x02;
-                // X9.62 4.2.2 and 4.3.6:
-                // if x = 0 then ypTilde := 0, else ypTilde is the rightmost
-                // bit of y * x^(-1)
-                // if ypTilde = 0, then PC := 02, else PC := 03
-                // Note: PC === PO[0]
-                if (!(this.getX().toBigInteger().equals(ECConstants.ZERO)))
-                {
-                    if (this.getY().multiply(this.getX().invert())
-                            .toBigInteger().testBit(0))
-                    {
-                        // ypTilde = 1, hence PC = 03
-                        PO[0] = 0x03;
-                    }
-                }
-
-                System.arraycopy(X, 0, PO, 1, byteCount);
-            }
-            else
-            {
-                byte[] Y = converter.integerToBytes(this.getY().toBigInteger(), byteCount);
-    
-                PO = new byte[byteCount + byteCount + 1];
-    
-                PO[0] = 0x04;
-                System.arraycopy(X, 0, PO, 1, byteCount);
-                System.arraycopy(Y, 0, PO, byteCount + 1, byteCount);    
-            }
-
-            return PO;
-        }
-
-        /**
-         * Check, if two <code>ECPoint</code>s can be added or subtracted.
-         * @param a The first <code>ECPoint</code> to check.
-         * @param b The second <code>ECPoint</code> to check.
-         * @throws IllegalArgumentException if <code>a</code> and <code>b</code>
-         * cannot be added.
-         */
-        private static void checkPoints(ECPoint a, ECPoint b)
-        {
-            // Check, if points are on the same curve
-            if (!(a.curve.equals(b.curve)))
-            {
-                throw new IllegalArgumentException("Only points on the same "
-                        + "curve can be added or subtracted");
-            }
-
-//            ECFieldElement.F2m.checkFieldElements(a.x, b.x);
-        }
-
-        /* (non-Javadoc)
-         * @see org.bouncycastle.math.ec.ECPoint#add(org.bouncycastle.math.ec.ECPoint)
-         */
-        public ECPoint add(ECPoint b)
-        {
-            checkPoints(this, b);
-            return addSimple((ECPoint.F2m)b);
-        }
-
-        /**
-         * Adds another <code>ECPoints.F2m</code> to <code>this</code> without
-         * checking if both points are on the same curve. Used by multiplication
-         * algorithms, because there all points are a multiple of the same point
-         * and hence the checks can be omitted.
-         * @param b The other <code>ECPoints.F2m</code> to add to
-         * <code>this</code>.
-         * @return <code>this + b</code>
-         */
-        public ECPoint.F2m addSimple(ECPoint.F2m b)
-        {
-            ECPoint.F2m other = b;
-            if (this.isInfinity())
-            {
-                return other;
-            }
-
-            if (other.isInfinity())
-            {
-                return this;
-            }
-
-            ECFieldElement.F2m x2 = (ECFieldElement.F2m)other.getX();
-            ECFieldElement.F2m y2 = (ECFieldElement.F2m)other.getY();
-
-            // Check if other = this or other = -this
-            if (this.x.equals(x2))
-            {
-                if (this.y.equals(y2))
-                {
-                    // this = other, i.e. this must be doubled
-                    return (ECPoint.F2m)this.twice();
-                }
-
-                // this = -other, i.e. the result is the point at infinity
-                return (ECPoint.F2m)this.curve.getInfinity();
-            }
-
-            ECFieldElement.F2m lambda
-                = (ECFieldElement.F2m)(this.y.add(y2)).divide(this.x.add(x2));
-
-            ECFieldElement.F2m x3
-                = (ECFieldElement.F2m)lambda.square().add(lambda).add(this.x).add(x2).add(this.curve.getA());
-
-            ECFieldElement.F2m y3
-                = (ECFieldElement.F2m)lambda.multiply(this.x.add(x3)).add(x3).add(this.y);
-
-            return new ECPoint.F2m(curve, x3, y3, withCompression);
-        }
-
-        /* (non-Javadoc)
-         * @see org.bouncycastle.math.ec.ECPoint#subtract(org.bouncycastle.math.ec.ECPoint)
-         */
-        public ECPoint subtract(ECPoint b)
-        {
-            checkPoints(this, b);
-            return subtractSimple((ECPoint.F2m)b);
-        }
-
-        /**
-         * Subtracts another <code>ECPoints.F2m</code> from <code>this</code>
-         * without checking if both points are on the same curve. Used by
-         * multiplication algorithms, because there all points are a multiple
-         * of the same point and hence the checks can be omitted.
-         * @param b The other <code>ECPoints.F2m</code> to subtract from
-         * <code>this</code>.
-         * @return <code>this - b</code>
-         */
-        public ECPoint.F2m subtractSimple(ECPoint.F2m b)
-        {
-            if (b.isInfinity())
-            {
-                return this;
-            }
-
-            // Add -b
-            return addSimple((ECPoint.F2m)b.negate());
-        }
-
-        /* (non-Javadoc)
-         * @see org.bouncycastle.math.ec.ECPoint#twice()
-         */
-        public ECPoint twice()
-        {
-            if (this.isInfinity()) 
-            {
-                // Twice identity element (point at infinity) is identity
-                return this;
-            }
-
-            if (this.x.toBigInteger().signum() == 0) 
-            {
-                // if x1 == 0, then (x1, y1) == (x1, x1 + y1)
-                // and hence this = -this and thus 2(x1, y1) == infinity
-                return this.curve.getInfinity();
-            }
-
-            ECFieldElement.F2m lambda
-                = (ECFieldElement.F2m)this.x.add(this.y.divide(this.x));
-
-            ECFieldElement.F2m x3
-                = (ECFieldElement.F2m)lambda.square().add(lambda).
-                    add(this.curve.getA());
-
-            ECFieldElement ONE = this.curve.fromBigInteger(ECConstants.ONE);
-            ECFieldElement.F2m y3
-                = (ECFieldElement.F2m)this.x.square().add(
-                    x3.multiply(lambda.add(ONE)));
-
-            return new ECPoint.F2m(this.curve, x3, y3, withCompression);
-        }
-
-        public ECPoint negate()
-        {
-            return new ECPoint.F2m(curve, this.getX(), this.getY().add(this.getX()), withCompression);
-        }
-
-        // TODO Uncomment this to enable WNAF/WTNAF F2m point multiplication
-//        /**
-//         * Sets the appropriate <code>ECMultiplier</code>, unless already set. 
-//         */
-//        synchronized void assertECMultiplier()
-//        {
-//            if (this.multiplier == null)
-//            {
-//                if (((ECCurve.F2m)(this.curve)).isKoblitz())
-//                {
-//                    this.multiplier = new WTauNafMultiplier();
-//                }
-//                else
-//                {
-//                    this.multiplier = new WNafMultiplier();
-//                }
-//            }
-//        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/math/ec/FpNafMultiplier.java b/azureus2/src/org/bouncycastle/math/ec/FpNafMultiplier.java
deleted file mode 100644
index 35e601d..0000000
--- a/azureus2/src/org/bouncycastle/math/ec/FpNafMultiplier.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.bouncycastle.math.ec;
-
-import java.math.BigInteger;
-
-/**
- * Class implementing the NAF (Non-Adjacent Form) multiplication algorithm.
- */
-class FpNafMultiplier implements ECMultiplier
-{
-    /**
-     * D.3.2 pg 101
-     * @see org.bouncycastle.math.ec.ECMultiplier#multiply(org.bouncycastle.math.ec.ECPoint, java.math.BigInteger)
-     */
-    public ECPoint multiply(ECPoint p, BigInteger k, PreCompInfo preCompInfo)
-    {
-        // TODO Probably should try to add this
-        // BigInteger e = k.mod(n); // n == order of p
-        BigInteger e = k;
-        BigInteger h = e.multiply(BigInteger.valueOf(3));
-
-        ECPoint neg = p.negate();
-        ECPoint R = p;
-
-        for (int i = h.bitLength() - 2; i > 0; --i)
-        {             
-            R = R.twice();
-
-            boolean hBit = h.testBit(i);
-            boolean eBit = e.testBit(i);
-
-            if (hBit != eBit)
-            {
-                R = R.add(hBit ? p : neg);
-            }
-        }
-
-        return R;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/math/ec/IntArray.java b/azureus2/src/org/bouncycastle/math/ec/IntArray.java
deleted file mode 100644
index 6cfc36c..0000000
--- a/azureus2/src/org/bouncycastle/math/ec/IntArray.java
+++ /dev/null
@@ -1,518 +0,0 @@
-package org.bouncycastle.math.ec;
-
-import org.bouncycastle.util.Arrays;
-
-import java.math.BigInteger;
-
-class IntArray
-{
-    // TODO make m fixed for the IntArray, and hence compute T once and for all
-
-    private int[] m_ints;
-
-    public IntArray(int intLen)
-    {
-        m_ints = new int[intLen];
-    }
-
-    public IntArray(int[] ints)
-    {
-        m_ints = ints;
-    }
-
-    public IntArray(BigInteger bigInt)
-    {
-        this(bigInt, 0);
-    }
-
-    public IntArray(BigInteger bigInt, int minIntLen)
-    {
-        if (bigInt.signum() == -1)
-        {
-            throw new IllegalArgumentException("Only positive Integers allowed");
-        }
-        if (bigInt.equals(ECConstants.ZERO))
-        {
-            m_ints = new int[] { 0 };
-            return;
-        }
-
-        byte[] barr = bigInt.toByteArray();
-        int barrLen = barr.length;
-        int barrStart = 0;
-        if (barr[0] == 0)
-        {
-            // First byte is 0 to enforce highest (=sign) bit is zero.
-            // In this case ignore barr[0].
-            barrLen--;
-            barrStart = 1;
-        }
-        int intLen = (barrLen + 3) / 4;
-        if (intLen < minIntLen)
-        {
-            m_ints = new int[minIntLen];
-        }
-        else
-        {
-            m_ints = new int[intLen];
-        }
-
-        int iarrJ = intLen - 1;
-        int rem = barrLen % 4 + barrStart;
-        int temp = 0;
-        int barrI = barrStart;
-        if (barrStart < rem)
-        {
-            for (; barrI < rem; barrI++)
-            {
-                temp <<= 8;
-                int barrBarrI = barr[barrI];
-                if (barrBarrI < 0)
-                {
-                    barrBarrI += 256;
-                }
-                temp |= barrBarrI;
-            }
-            m_ints[iarrJ--] = temp;
-        }
-
-        for (; iarrJ >= 0; iarrJ--)
-        {
-            temp = 0;
-            for (int i = 0; i < 4; i++)
-            {
-                temp <<= 8;
-                int barrBarrI = barr[barrI++];
-                if (barrBarrI < 0)
-                {
-                    barrBarrI += 256;
-                }
-                temp |= barrBarrI;
-            }
-            m_ints[iarrJ] = temp;
-        }
-    }
-
-    public boolean isZero()
-    {
-        return m_ints.length == 0
-            || (m_ints[0] == 0 && getUsedLength() == 0);
-    }
-
-    public int getUsedLength()
-    {
-        int highestIntPos = m_ints.length;
-
-        if (highestIntPos < 1)
-        {
-            return 0;
-        }
-
-        // Check if first element will act as sentinel
-        if (m_ints[0] != 0)
-        {
-            while (m_ints[--highestIntPos] == 0)
-            {
-            }
-            return highestIntPos + 1;
-        }
-
-        do
-        {
-            if (m_ints[--highestIntPos] != 0)
-            {
-                return highestIntPos + 1;
-            }
-        }
-        while (highestIntPos > 0);
-
-        return 0;
-    }
-
-    public int bitLength()
-    {
-        // JDK 1.5: see Integer.numberOfLeadingZeros()
-        int intLen = getUsedLength();
-        if (intLen == 0)
-        {
-            return 0;
-        }
-
-        int last = intLen - 1;
-        int highest = m_ints[last];
-        int bits = (last << 5) + 1;
-
-        // A couple of binary search steps
-        if ((highest & 0xffff0000) != 0)
-        {
-            if ((highest & 0xff000000) != 0)
-            {
-                bits += 24;
-                highest >>>= 24;
-            }
-            else
-            {
-                bits += 16;
-                highest >>>= 16;
-            }
-        }
-        else if (highest > 0x000000ff)
-        {
-            bits += 8;
-            highest >>>= 8;
-        }
-
-        while (highest != 1)
-        {
-            ++bits;
-            highest >>>= 1;
-        }
-
-        return bits;
-    }
-
-    private int[] resizedInts(int newLen)
-    {
-        int[] newInts = new int[newLen];
-        int oldLen = m_ints.length;
-        int copyLen = oldLen < newLen ? oldLen : newLen;
-        System.arraycopy(m_ints, 0, newInts, 0, copyLen);
-        return newInts;
-    }
-
-    public BigInteger toBigInteger()
-    {
-        int usedLen = getUsedLength();
-        if (usedLen == 0)
-        {
-            return ECConstants.ZERO;
-        }
-
-        int highestInt = m_ints[usedLen - 1];
-        byte[] temp = new byte[4];
-        int barrI = 0;
-        boolean trailingZeroBytesDone = false;
-        for (int j = 3; j >= 0; j--)
-        {
-            byte thisByte = (byte) (highestInt >>> (8 * j));
-            if (trailingZeroBytesDone || (thisByte != 0))
-            {
-                trailingZeroBytesDone = true;
-                temp[barrI++] = thisByte;
-            }
-        }
-
-        int barrLen = 4 * (usedLen - 1) + barrI;
-        byte[] barr = new byte[barrLen];
-        for (int j = 0; j < barrI; j++)
-        {
-            barr[j] = temp[j];
-        }
-        // Highest value int is done now
-
-        for (int iarrJ = usedLen - 2; iarrJ >= 0; iarrJ--)
-        {
-            for (int j = 3; j >= 0; j--)
-            {
-                barr[barrI++] = (byte) (m_ints[iarrJ] >>> (8 * j));
-            }
-        }
-        return new BigInteger(1, barr);
-    }
-
-    public void shiftLeft()
-    {
-        int usedLen = getUsedLength();
-        if (usedLen == 0)
-        {
-            return;
-        }
-        if (m_ints[usedLen - 1] < 0)
-        {
-            // highest bit of highest used byte is set, so shifting left will
-            // make the IntArray one byte longer
-            usedLen++;
-            if (usedLen > m_ints.length)
-            {
-                // make the m_ints one byte longer, because we need one more
-                // byte which is not available in m_ints
-                m_ints = resizedInts(m_ints.length + 1);
-            }
-        }
-
-        boolean carry = false;
-        for (int i = 0; i < usedLen; i++)
-        {
-            // nextCarry is true if highest bit is set
-            boolean nextCarry = m_ints[i] < 0;
-            m_ints[i] <<= 1;
-            if (carry)
-            {
-                // set lowest bit
-                m_ints[i] |= 1;
-            }
-            carry = nextCarry;
-        }
-    }
-
-    public IntArray shiftLeft(int n)
-    {
-        int usedLen = getUsedLength();
-        if (usedLen == 0)
-        {
-            return this;
-        }
-
-        if (n == 0)
-        {
-            return this;
-        }
-
-        if (n > 31)
-        {
-            throw new IllegalArgumentException("shiftLeft() for max 31 bits "
-                + ", " + n + "bit shift is not possible");
-        }
-
-        int[] newInts = new int[usedLen + 1];
-
-        int nm32 = 32 - n;
-        newInts[0] = m_ints[0] << n;
-        for (int i = 1; i < usedLen; i++)
-        {
-            newInts[i] = (m_ints[i] << n) | (m_ints[i - 1] >>> nm32);
-        }
-        newInts[usedLen] = m_ints[usedLen - 1] >>> nm32;
-
-        return new IntArray(newInts);
-    }
-
-    public void addShifted(IntArray other, int shift)
-    {
-        int usedLenOther = other.getUsedLength();
-        int newMinUsedLen = usedLenOther + shift;
-        if (newMinUsedLen > m_ints.length)
-        {
-            m_ints = resizedInts(newMinUsedLen);
-            //System.out.println("Resize required");
-        }
-
-        for (int i = 0; i < usedLenOther; i++)
-        {
-            m_ints[i + shift] ^= other.m_ints[i];
-        }
-    }
-
-    public int getLength()
-    {
-        return m_ints.length;
-    }
-
-    public boolean testBit(int n)
-    {
-        // theInt = n / 32
-        int theInt = n >> 5;
-        // theBit = n % 32
-        int theBit = n & 0x1F;
-        int tester = 1 << theBit;
-        return ((m_ints[theInt] & tester) != 0);
-    }
-
-    public void flipBit(int n)
-    {
-        // theInt = n / 32
-        int theInt = n >> 5;
-        // theBit = n % 32
-        int theBit = n & 0x1F;
-        int flipper = 1 << theBit;
-        m_ints[theInt] ^= flipper;
-    }
-
-    public void setBit(int n)
-    {
-        // theInt = n / 32
-        int theInt = n >> 5;
-        // theBit = n % 32
-        int theBit = n & 0x1F;
-        int setter = 1 << theBit;
-        m_ints[theInt] |= setter;
-    }
-
-    public IntArray multiply(IntArray other, int m)
-    {
-        // Lenght of c is 2m bits rounded up to the next int (32 bit)
-        int t = (m + 31) >> 5;
-        if (m_ints.length < t)
-        {
-            m_ints = resizedInts(t);
-        }
-
-        IntArray b = new IntArray(other.resizedInts(other.getLength() + 1));
-        IntArray c = new IntArray((m + m + 31) >> 5);
-        // IntArray c = new IntArray(t + t);
-        int testBit = 1;
-        for (int k = 0; k < 32; k++)
-        {
-            for (int j = 0; j < t; j++)
-            {
-                if ((m_ints[j] & testBit) != 0)
-                {
-                    // The kth bit of m_ints[j] is set
-                    c.addShifted(b, j);
-                }
-            }
-            testBit <<= 1;
-            b.shiftLeft();
-        }
-        return c;
-    }
-
-    // public IntArray multiplyLeftToRight(IntArray other, int m) {
-    // // Lenght of c is 2m bits rounded up to the next int (32 bit)
-    // int t = (m + 31) / 32;
-    // if (m_ints.length < t) {
-    // m_ints = resizedInts(t);
-    // }
-    //
-    // IntArray b = new IntArray(other.resizedInts(other.getLength() + 1));
-    // IntArray c = new IntArray((m + m + 31) / 32);
-    // // IntArray c = new IntArray(t + t);
-    // int testBit = 1 << 31;
-    // for (int k = 31; k >= 0; k--) {
-    // for (int j = 0; j < t; j++) {
-    // if ((m_ints[j] & testBit) != 0) {
-    // // The kth bit of m_ints[j] is set
-    // c.addShifted(b, j);
-    // }
-    // }
-    // testBit >>>= 1;
-    // if (k > 0) {
-    // c.shiftLeft();
-    // }
-    // }
-    // return c;
-    // }
-
-    // TODO note, redPol.length must be 3 for TPB and 5 for PPB
-    public void reduce(int m, int[] redPol)
-    {
-        for (int i = m + m - 2; i >= m; i--)
-        {
-            if (testBit(i))
-            {
-                int bit = i - m;
-                flipBit(bit);
-                flipBit(i);
-                int l = redPol.length;
-                while (--l >= 0)
-                {
-                    flipBit(redPol[l] + bit);
-                }
-            }
-        }
-        m_ints = resizedInts((m + 31) >> 5);
-    }
-
-    public IntArray square(int m)
-    {
-        // TODO make the table static final
-        final int[] table = { 0x0, 0x1, 0x4, 0x5, 0x10, 0x11, 0x14, 0x15, 0x40,
-            0x41, 0x44, 0x45, 0x50, 0x51, 0x54, 0x55 };
-
-        int t = (m + 31) >> 5;
-        if (m_ints.length < t)
-        {
-            m_ints = resizedInts(t);
-        }
-
-        IntArray c = new IntArray(t + t);
-
-        // TODO twice the same code, put in separate private method
-        for (int i = 0; i < t; i++)
-        {
-            int v0 = 0;
-            for (int j = 0; j < 4; j++)
-            {
-                v0 = v0 >>> 8;
-                int u = (m_ints[i] >>> (j * 4)) & 0xF;
-                int w = table[u] << 24;
-                v0 |= w;
-            }
-            c.m_ints[i + i] = v0;
-
-            v0 = 0;
-            int upper = m_ints[i] >>> 16;
-            for (int j = 0; j < 4; j++)
-            {
-                v0 = v0 >>> 8;
-                int u = (upper >>> (j * 4)) & 0xF;
-                int w = table[u] << 24;
-                v0 |= w;
-            }
-            c.m_ints[i + i + 1] = v0;
-        }
-        return c;
-    }
-
-    public boolean equals(Object o)
-    {
-        if (!(o instanceof IntArray))
-        {
-            return false;
-        }
-        IntArray other = (IntArray) o;
-        int usedLen = getUsedLength();
-        if (other.getUsedLength() != usedLen)
-        {
-            return false;
-        }
-        for (int i = 0; i < usedLen; i++)
-        {
-            if (m_ints[i] != other.m_ints[i])
-            {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    public int hashCode()
-    {
-        int usedLen = getUsedLength();
-        int hash = 0;
-        for (int i = 0; i < usedLen; i++)
-        {
-            hash ^= m_ints[i];
-        }
-        return hash;
-    }
-
-    public Object clone()
-    {
-        return new IntArray(Arrays.clone(m_ints));
-    }
-
-    public String toString()
-    {
-        int usedLen = getUsedLength();
-        if (usedLen == 0)
-        {
-            return "0";
-        }
-
-        StringBuffer sb = new StringBuffer(Integer
-            .toBinaryString(m_ints[usedLen - 1]));
-        for (int iarrJ = usedLen - 2; iarrJ >= 0; iarrJ--)
-        {
-            String hexString = Integer.toBinaryString(m_ints[iarrJ]);
-
-            // Add leading zeroes, except for highest significant int
-            for (int i = hexString.length(); i < 8; i++)
-            {
-                hexString = "0" + hexString;
-            }
-            sb.append(hexString);
-        }
-        return sb.toString();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/math/ec/PreCompInfo.java b/azureus2/src/org/bouncycastle/math/ec/PreCompInfo.java
deleted file mode 100644
index 804dcf7..0000000
--- a/azureus2/src/org/bouncycastle/math/ec/PreCompInfo.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.bouncycastle.math.ec;
-
-/**
- * Interface for classes storing precomputation data for multiplication
- * algorithms. Used as a Memento (see GOF patterns) for
- * <code>WNafMultiplier</code>.
- */
-interface PreCompInfo
-{
-}
diff --git a/azureus2/src/org/bouncycastle/math/ec/SimpleBigDecimal.java b/azureus2/src/org/bouncycastle/math/ec/SimpleBigDecimal.java
deleted file mode 100644
index 2aea166..0000000
--- a/azureus2/src/org/bouncycastle/math/ec/SimpleBigDecimal.java
+++ /dev/null
@@ -1,253 +0,0 @@
-package org.bouncycastle.math.ec;
-
-import java.math.BigInteger;
-
-/**
- * Class representing a simple version of a big decimal. A
- * <code>SimpleBigDecimal</code> is basically a
- * {@link java.math.BigInteger BigInteger} with a few digits on the right of
- * the decimal point. The number of (binary) digits on the right of the decimal
- * point is called the <code>scale</code> of the <code>SimpleBigDecimal</code>.
- * Unlike in {@link java.math.BigDecimal BigDecimal}, the scale is not adjusted
- * automatically, but must be set manually. All <code>SimpleBigDecimal</code>s
- * taking part in the same arithmetic operation must have equal scale. The
- * result of a multiplication of two <code>SimpleBigDecimal</code>s returns a
- * <code>SimpleBigDecimal</code> with double scale.
- */
-class SimpleBigDecimal
-    //extends Number   // not in J2ME - add compatibility class?
-{
-    private static final long serialVersionUID = 1L;
-
-    private final BigInteger bigInt;
-    private final int scale;
-
-    /**
-     * Returns a <code>SimpleBigDecimal</code> representing the same numerical
-     * value as <code>value</code>.
-     * @param value The value of the <code>SimpleBigDecimal</code> to be
-     * created. 
-     * @param scale The scale of the <code>SimpleBigDecimal</code> to be
-     * created. 
-     * @return The such created <code>SimpleBigDecimal</code>.
-     */
-    public static SimpleBigDecimal getInstance(BigInteger value, int scale)
-    {
-        return new SimpleBigDecimal(value.shiftLeft(scale), scale);
-    }
-
-    /**
-     * Constructor for <code>SimpleBigDecimal</code>. The value of the
-     * constructed <code>SimpleBigDecimal</code> equals <code>bigInt / 
-     * 2<sup>scale</sup></code>.
-     * @param bigInt The <code>bigInt</code> value parameter.
-     * @param scale The scale of the constructed <code>SimpleBigDecimal</code>.
-     */
-    public SimpleBigDecimal(BigInteger bigInt, int scale)
-    {
-        if (scale < 0)
-        {
-            throw new IllegalArgumentException("scale may not be negative");
-        }
-
-        this.bigInt = bigInt;
-        this.scale = scale;
-    }
-
-    private SimpleBigDecimal(SimpleBigDecimal limBigDec)
-    {
-        bigInt = limBigDec.bigInt;
-        scale = limBigDec.scale;
-    }
-
-    private void checkScale(SimpleBigDecimal b)
-    {
-        if (scale != b.scale)
-        {
-            throw new IllegalArgumentException("Only SimpleBigDecimal of " +
-                "same scale allowed in arithmetic operations");
-        }
-    }
-
-    public SimpleBigDecimal adjustScale(int newScale)
-    {
-        if (newScale < 0)
-        {
-            throw new IllegalArgumentException("scale may not be negative");
-        }
-
-        if (newScale == scale)
-        {
-            return new SimpleBigDecimal(this);
-        }
-
-        return new SimpleBigDecimal(bigInt.shiftLeft(newScale - scale),
-                newScale);
-    }
-
-    public SimpleBigDecimal add(SimpleBigDecimal b)
-    {
-        checkScale(b);
-        return new SimpleBigDecimal(bigInt.add(b.bigInt), scale);
-    }
-
-    public SimpleBigDecimal add(BigInteger b)
-    {
-        return new SimpleBigDecimal(bigInt.add(b.shiftLeft(scale)), scale);
-    }
-
-    public SimpleBigDecimal negate()
-    {
-        return new SimpleBigDecimal(bigInt.negate(), scale);
-    }
-
-    public SimpleBigDecimal subtract(SimpleBigDecimal b)
-    {
-        return add(b.negate());
-    }
-
-    public SimpleBigDecimal subtract(BigInteger b)
-    {
-        return new SimpleBigDecimal(bigInt.subtract(b.shiftLeft(scale)),
-                scale);
-    }
-
-    public SimpleBigDecimal multiply(SimpleBigDecimal b)
-    {
-        checkScale(b);
-        return new SimpleBigDecimal(bigInt.multiply(b.bigInt), scale + scale);
-    }
-
-    public SimpleBigDecimal multiply(BigInteger b)
-    {
-        return new SimpleBigDecimal(bigInt.multiply(b), scale);
-    }
-
-    public SimpleBigDecimal divide(SimpleBigDecimal b)
-    {
-        checkScale(b);
-        BigInteger dividend = bigInt.shiftLeft(scale);
-        return new SimpleBigDecimal(dividend.divide(b.bigInt), scale);
-    }
-
-    public SimpleBigDecimal divide(BigInteger b)
-    {
-        return new SimpleBigDecimal(bigInt.divide(b), scale);
-    }
-
-    public SimpleBigDecimal shiftLeft(int n)
-    {
-        return new SimpleBigDecimal(bigInt.shiftLeft(n), scale);
-    }
-
-    public int compareTo(SimpleBigDecimal val)
-    {
-        checkScale(val);
-        return bigInt.compareTo(val.bigInt);
-    }
-
-    public int compareTo(BigInteger val)
-    {
-        return bigInt.compareTo(val.shiftLeft(scale));
-    }
-
-    public BigInteger floor()
-    {
-        return bigInt.shiftRight(scale);
-    }
-
-    public BigInteger round()
-    {
-        SimpleBigDecimal oneHalf = new SimpleBigDecimal(ECConstants.ONE, 1);
-        return add(oneHalf.adjustScale(scale)).floor();
-    }
-
-    public int intValue()
-    {
-        return floor().intValue();
-    }
-    
-    public long longValue()
-    {
-        return floor().longValue();
-    }
-
-    public double doubleValue()
-    {
-        return Double.valueOf(toString()).doubleValue();
-    }
-
-    public float floatValue()
-    {
-        return Float.valueOf(toString()).floatValue();
-    }
-
-    public int getScale()
-    {
-        return scale;
-    }
-
-    public String toString()
-    {
-        if (scale == 0)
-        {
-            return bigInt.toString();
-        }
-
-        BigInteger floorBigInt = floor();
-        
-        BigInteger fract = bigInt.subtract(floorBigInt.shiftLeft(scale));
-        if (bigInt.signum() == -1)
-        {
-            fract = ECConstants.ONE.shiftLeft(scale).subtract(fract);
-        }
-
-        if ((floorBigInt.signum() == -1) && (!(fract.equals(ECConstants.ZERO))))
-        {
-            floorBigInt = floorBigInt.add(ECConstants.ONE);
-        }
-        String leftOfPoint = floorBigInt.toString();
-
-        char[] fractCharArr = new char[scale];
-        String fractStr = fract.toString(2);
-        int fractLen = fractStr.length();
-        int zeroes = scale - fractLen;
-        for (int i = 0; i < zeroes; i++)
-        {
-            fractCharArr[i] = '0';
-        }
-        for (int j = 0; j < fractLen; j++)
-        {
-            fractCharArr[zeroes + j] = fractStr.charAt(j);
-        }
-        String rightOfPoint = new String(fractCharArr);
-
-        StringBuffer sb = new StringBuffer(leftOfPoint);
-        sb.append(".");
-        sb.append(rightOfPoint);
-
-        return sb.toString();
-    }
-
-    public boolean equals(Object o)
-    {
-        if (this == o)
-        {
-            return true;
-        }
-
-        if (!(o instanceof SimpleBigDecimal))
-        {
-            return false;
-        }
-
-        SimpleBigDecimal other = (SimpleBigDecimal)o;
-        return ((bigInt.equals(other.bigInt)) && (scale == other.scale));
-    }
-
-    public int hashCode()
-    {
-        return bigInt.hashCode() ^ scale;
-    }
-
-}
diff --git a/azureus2/src/org/bouncycastle/math/ec/Tnaf.java b/azureus2/src/org/bouncycastle/math/ec/Tnaf.java
deleted file mode 100644
index af4355f..0000000
--- a/azureus2/src/org/bouncycastle/math/ec/Tnaf.java
+++ /dev/null
@@ -1,844 +0,0 @@
-package org.bouncycastle.math.ec;
-
-import java.math.BigInteger;
-
-/**
- * Class holding methods for point multiplication based on the window
- * τ-adic nonadjacent form (WTNAF). The algorithms are based on the
- * paper "Improved Algorithms for Arithmetic on Anomalous Binary Curves"
- * by Jerome A. Solinas. The paper first appeared in the Proceedings of
- * Crypto 1997.
- */
-class Tnaf
-{
-    private static final BigInteger MINUS_ONE = ECConstants.ONE.negate();
-    private static final BigInteger MINUS_TWO = ECConstants.TWO.negate();
-    private static final BigInteger MINUS_THREE = ECConstants.THREE.negate();
-
-    /**
-     * The window width of WTNAF. The standard value of 4 is slightly less
-     * than optimal for running time, but keeps space requirements for
-     * precomputation low. For typical curves, a value of 5 or 6 results in
-     * a better running time. When changing this value, the
-     * <code>α<sub>u</sub></code>'s must be computed differently, see
-     * e.g. "Guide to Elliptic Curve Cryptography", Darrel Hankerson,
-     * Alfred Menezes, Scott Vanstone, Springer-Verlag New York Inc., 2004,
-     * p. 121-122
-     */
-    public static final byte WIDTH = 4;
-
-    /**
-     * 2<sup>4</sup>
-     */
-    public static final byte POW_2_WIDTH = 16;
-
-    /**
-     * The <code>α<sub>u</sub></code>'s for <code>a=0</code> as an array
-     * of <code>ZTauElement</code>s.
-     */
-    public static final ZTauElement[] alpha0 = {
-        null,
-        new ZTauElement(ECConstants.ONE, ECConstants.ZERO), null,
-        new ZTauElement(MINUS_THREE, MINUS_ONE), null,
-        new ZTauElement(MINUS_ONE, MINUS_ONE), null,
-        new ZTauElement(ECConstants.ONE, MINUS_ONE), null
-    };
-
-    /**
-     * The <code>α<sub>u</sub></code>'s for <code>a=0</code> as an array
-     * of TNAFs.
-     */
-    public static final byte[][] alpha0Tnaf = {
-        null, {1}, null, {-1, 0, 1}, null, {1, 0, 1}, null, {-1, 0, 0, 1}
-    };
-
-    /**
-     * The <code>α<sub>u</sub></code>'s for <code>a=1</code> as an array
-     * of <code>ZTauElement</code>s.
-     */
-    public static final ZTauElement[] alpha1 = {null,
-        new ZTauElement(ECConstants.ONE, ECConstants.ZERO), null,
-        new ZTauElement(MINUS_THREE, ECConstants.ONE), null,
-        new ZTauElement(MINUS_ONE, ECConstants.ONE), null,
-        new ZTauElement(ECConstants.ONE, ECConstants.ONE), null
-    };
-
-    /**
-     * The <code>α<sub>u</sub></code>'s for <code>a=1</code> as an array
-     * of TNAFs.
-     */
-    public static final byte[][] alpha1Tnaf = {
-        null, {1}, null, {-1, 0, 1}, null, {1, 0, 1}, null, {-1, 0, 0, -1}
-    };
-
-    /**
-     * Computes the norm of an element <code>λ</code> of
-     * <code><b>Z</b>[τ]</code>.
-     * @param mu The parameter <code>μ</code> of the elliptic curve.
-     * @param lambda The element <code>λ</code> of
-     * <code><b>Z</b>[τ]</code>.
-     * @return The norm of <code>λ</code>.
-     */
-    public static BigInteger norm(final byte mu, ZTauElement lambda)
-    {
-        BigInteger norm;
-
-        // s1 = u^2
-        BigInteger s1 = lambda.u.multiply(lambda.u);
-
-        // s2 = u * v
-        BigInteger s2 = lambda.u.multiply(lambda.v);
-
-        // s3 = 2 * v^2
-        BigInteger s3 = lambda.v.multiply(lambda.v).shiftLeft(1);
-
-        if (mu == 1)
-        {
-            norm = s1.add(s2).add(s3);
-        }
-        else if (mu == -1)
-        {
-            norm = s1.subtract(s2).add(s3);
-        }
-        else
-        {
-            throw new IllegalArgumentException("mu must be 1 or -1");
-        }
-
-        return norm;
-    }
-
-    /**
-     * Computes the norm of an element <code>λ</code> of
-     * <code><b>R</b>[τ]</code>, where <code>λ = u + vτ</code>
-     * and <code>u</code> and <code>u</code> are real numbers (elements of
-     * <code><b>R</b></code>). 
-     * @param mu The parameter <code>μ</code> of the elliptic curve.
-     * @param u The real part of the element <code>λ</code> of
-     * <code><b>R</b>[τ]</code>.
-     * @param v The <code>τ</code>-adic part of the element
-     * <code>λ</code> of <code><b>R</b>[τ]</code>.
-     * @return The norm of <code>λ</code>.
-     */
-    public static SimpleBigDecimal norm(final byte mu, SimpleBigDecimal u,
-            SimpleBigDecimal v)
-    {
-        SimpleBigDecimal norm;
-
-        // s1 = u^2
-        SimpleBigDecimal s1 = u.multiply(u);
-
-        // s2 = u * v
-        SimpleBigDecimal s2 = u.multiply(v);
-
-        // s3 = 2 * v^2
-        SimpleBigDecimal s3 = v.multiply(v).shiftLeft(1);
-
-        if (mu == 1)
-        {
-            norm = s1.add(s2).add(s3);
-        }
-        else if (mu == -1)
-        {
-            norm = s1.subtract(s2).add(s3);
-        }
-        else
-        {
-            throw new IllegalArgumentException("mu must be 1 or -1");
-        }
-
-        return norm;
-    }
-
-    /**
-     * Rounds an element <code>λ</code> of <code><b>R</b>[τ]</code>
-     * to an element of <code><b>Z</b>[τ]</code>, such that their difference
-     * has minimal norm. <code>λ</code> is given as
-     * <code>λ = λ<sub>0</sub> + λ<sub>1</sub>τ</code>.
-     * @param lambda0 The component <code>λ<sub>0</sub></code>.
-     * @param lambda1 The component <code>λ<sub>1</sub></code>.
-     * @param mu The parameter <code>μ</code> of the elliptic curve. Must
-     * equal 1 or -1.
-     * @return The rounded element of <code><b>Z</b>[τ]</code>.
-     * @throws IllegalArgumentException if <code>lambda0</code> and
-     * <code>lambda1</code> do not have same scale.
-     */
-    public static ZTauElement round(SimpleBigDecimal lambda0,
-            SimpleBigDecimal lambda1, byte mu)
-    {
-        int scale = lambda0.getScale();
-        if (lambda1.getScale() != scale)
-        {
-            throw new IllegalArgumentException("lambda0 and lambda1 do not " +
-                    "have same scale");
-        }
-
-        if (!((mu == 1) || (mu == -1)))
-        {
-            throw new IllegalArgumentException("mu must be 1 or -1");
-        }
-
-        BigInteger f0 = lambda0.round();
-        BigInteger f1 = lambda1.round();
-
-        SimpleBigDecimal eta0 = lambda0.subtract(f0);
-        SimpleBigDecimal eta1 = lambda1.subtract(f1);
-
-        // eta = 2*eta0 + mu*eta1
-        SimpleBigDecimal eta = eta0.add(eta0);
-        if (mu == 1)
-        {
-            eta = eta.add(eta1);
-        }
-        else
-        {
-            // mu == -1
-            eta = eta.subtract(eta1);
-        }
-
-        // check1 = eta0 - 3*mu*eta1
-        // check2 = eta0 + 4*mu*eta1
-        SimpleBigDecimal threeEta1 = eta1.add(eta1).add(eta1);
-        SimpleBigDecimal fourEta1 = threeEta1.add(eta1);
-        SimpleBigDecimal check1;
-        SimpleBigDecimal check2;
-        if (mu == 1)
-        {
-            check1 = eta0.subtract(threeEta1);
-            check2 = eta0.add(fourEta1);
-        }
-        else
-        {
-            // mu == -1
-            check1 = eta0.add(threeEta1);
-            check2 = eta0.subtract(fourEta1);
-        }
-
-        byte h0 = 0;
-        byte h1 = 0;
-
-        // if eta >= 1
-        if (eta.compareTo(ECConstants.ONE) >= 0)
-        {
-            if (check1.compareTo(MINUS_ONE) < 0)
-            {
-                h1 = mu;
-            }
-            else
-            {
-                h0 = 1;
-            }
-        }
-        else
-        {
-            // eta < 1
-            if (check2.compareTo(ECConstants.TWO) >= 0)
-            {
-                h1 = mu;
-            }
-        }
-
-        // if eta < -1
-        if (eta.compareTo(MINUS_ONE) < 0)
-        {
-            if (check1.compareTo(ECConstants.ONE) >= 0)
-            {
-                h1 = (byte)-mu;
-            }
-            else
-            {
-                h0 = -1;
-            }
-        }
-        else
-        {
-            // eta >= -1
-            if (check2.compareTo(MINUS_TWO) < 0)
-            {
-                h1 = (byte)-mu;
-            }
-        }
-
-        BigInteger q0 = f0.add(BigInteger.valueOf(h0));
-        BigInteger q1 = f1.add(BigInteger.valueOf(h1));
-        return new ZTauElement(q0, q1);
-    }
-
-    /**
-     * Approximate division by <code>n</code>. For an integer
-     * <code>k</code>, the value <code>λ = s k / n</code> is
-     * computed to <code>c</code> bits of accuracy.
-     * @param k The parameter <code>k</code>.
-     * @param s The curve parameter <code>s<sub>0</sub></code> or
-     * <code>s<sub>1</sub></code>.
-     * @param vm The Lucas Sequence element <code>V<sub>m</sub></code>.
-     * @param a The parameter <code>a</code> of the elliptic curve.
-     * @param m The bit length of the finite field
-     * <code><b>F</b><sub>m</sub></code>.
-     * @param c The number of bits of accuracy, i.e. the scale of the returned
-     * <code>SimpleBigDecimal</code>.
-     * @return The value <code>λ = s k / n</code> computed to
-     * <code>c</code> bits of accuracy.
-     */
-    public static SimpleBigDecimal approximateDivisionByN(BigInteger k,
-            BigInteger s, BigInteger vm, byte a, int m, int c)
-    {
-        int _k = (m + 5)/2 + c;
-        BigInteger ns = k.shiftRight(m - _k - 2 + a);
-
-        BigInteger gs = s.multiply(ns);
-
-        BigInteger hs = gs.shiftRight(m);
-
-        BigInteger js = vm.multiply(hs);
-
-        BigInteger gsPlusJs = gs.add(js);
-        BigInteger ls = gsPlusJs.shiftRight(_k-c);
-        if (gsPlusJs.testBit(_k-c-1))
-        {
-            // round up
-            ls = ls.add(ECConstants.ONE);
-        }
-
-        return new SimpleBigDecimal(ls, c);
-    }
-
-    /**
-     * Computes the <code>τ</code>-adic NAF (non-adjacent form) of an
-     * element <code>λ</code> of <code><b>Z</b>[τ]</code>.
-     * @param mu The parameter <code>μ</code> of the elliptic curve.
-     * @param lambda The element <code>λ</code> of
-     * <code><b>Z</b>[τ]</code>.
-     * @return The <code>τ</code>-adic NAF of <code>λ</code>.
-     */
-    public static byte[] tauAdicNaf(byte mu, ZTauElement lambda)
-    {
-        if (!((mu == 1) || (mu == -1)))
-        {
-            throw new IllegalArgumentException("mu must be 1 or -1");
-        }
-        
-        BigInteger norm = norm(mu, lambda);
-
-        // Ceiling of log2 of the norm 
-        int log2Norm = norm.bitLength();
-
-        // If length(TNAF) > 30, then length(TNAF) < log2Norm + 3.52
-        int maxLength = log2Norm > 30 ? log2Norm + 4 : 34;
-
-        // The array holding the TNAF
-        byte[] u = new byte[maxLength];
-        int i = 0;
-
-        // The actual length of the TNAF
-        int length = 0;
-
-        BigInteger r0 = lambda.u;
-        BigInteger r1 = lambda.v;
-
-        while(!((r0.equals(ECConstants.ZERO)) && (r1.equals(ECConstants.ZERO))))
-        {
-            // If r0 is odd
-            if (r0.testBit(0))
-            {
-                u[i] = (byte) ECConstants.TWO.subtract((r0.subtract(r1.shiftLeft(1))).mod(ECConstants.FOUR)).intValue();
-
-                // r0 = r0 - u[i]
-                if (u[i] == 1)
-                {
-                    r0 = r0.clearBit(0);
-                }
-                else
-                {
-                    // u[i] == -1
-                    r0 = r0.add(ECConstants.ONE);
-                }
-                length = i;
-            }
-            else
-            {
-                u[i] = 0;
-            }
-
-            BigInteger t = r0;
-            BigInteger s = r0.shiftRight(1);
-            if (mu == 1)
-            {
-                r0 = r1.add(s);
-            }
-            else
-            {
-                // mu == -1
-                r0 = r1.subtract(s);
-            }
-
-            r1 = t.shiftRight(1).negate();
-            i++;
-        }
-
-        length++;
-
-        // Reduce the TNAF array to its actual length
-        byte[] tnaf = new byte[length];
-        System.arraycopy(u, 0, tnaf, 0, length);
-        return tnaf;
-    }
-
-    /**
-     * Applies the operation <code>τ()</code> to an
-     * <code>ECPoint.F2m</code>. 
-     * @param p The ECPoint.F2m to which <code>τ()</code> is applied.
-     * @return <code>τ(p)</code>
-     */
-    public static ECPoint.F2m tau(ECPoint.F2m p)
-    {
-        if (p.isInfinity())
-        {
-            return p;
-        }
-
-        ECFieldElement x = p.getX();
-        ECFieldElement y = p.getY();
-
-        return new ECPoint.F2m(p.getCurve(), x.square(), y.square(), p.isCompressed());
-    }
-
-    /**
-     * Returns the parameter <code>μ</code> of the elliptic curve.
-     * @param curve The elliptic curve from which to obtain <code>μ</code>.
-     * The curve must be a Koblitz curve, i.e. <code>a</code> equals
-     * <code>0</code> or <code>1</code> and <code>b</code> equals
-     * <code>1</code>. 
-     * @return <code>μ</code> of the elliptic curve.
-     * @throws IllegalArgumentException if the given ECCurve is not a Koblitz
-     * curve.
-     */
-    public static byte getMu(ECCurve.F2m curve)
-    {
-        BigInteger a = curve.getA().toBigInteger();
-        byte mu;
-
-        if (a.equals(ECConstants.ZERO))
-        {
-            mu = -1;
-        }
-        else if (a.equals(ECConstants.ONE))
-        {
-            mu = 1;
-        }
-        else
-        {
-            throw new IllegalArgumentException("No Koblitz curve (ABC), " +
-                    "TNAF multiplication not possible");
-        }
-        return mu;
-    }
-
-    /**
-     * Calculates the Lucas Sequence elements <code>U<sub>k-1</sub></code> and
-     * <code>U<sub>k</sub></code> or <code>V<sub>k-1</sub></code> and
-     * <code>V<sub>k</sub></code>.
-     * @param mu The parameter <code>μ</code> of the elliptic curve.
-     * @param k The index of the second element of the Lucas Sequence to be
-     * returned.
-     * @param doV If set to true, computes <code>V<sub>k-1</sub></code> and
-     * <code>V<sub>k</sub></code>, otherwise <code>U<sub>k-1</sub></code> and
-     * <code>U<sub>k</sub></code>.
-     * @return An array with 2 elements, containing <code>U<sub>k-1</sub></code>
-     * and <code>U<sub>k</sub></code> or <code>V<sub>k-1</sub></code>
-     * and <code>V<sub>k</sub></code>.
-     */
-    public static BigInteger[] getLucas(byte mu, int k, boolean doV)
-    {
-        if (!((mu == 1) || (mu == -1)))
-        {
-            throw new IllegalArgumentException("mu must be 1 or -1");
-        }
-
-        BigInteger u0;
-        BigInteger u1;
-        BigInteger u2;
-
-        if (doV)
-        {
-            u0 = ECConstants.TWO;
-            u1 = BigInteger.valueOf(mu);
-        }
-        else
-        {
-            u0 = ECConstants.ZERO;
-            u1 = ECConstants.ONE;
-        }
-
-        for (int i = 1; i < k; i++)
-        {
-            // u2 = mu*u1 - 2*u0;
-            BigInteger s = null;
-            if (mu == 1)
-            {
-                s = u1;
-            }
-            else
-            {
-                // mu == -1
-                s = u1.negate();
-            }
-            
-            u2 = s.subtract(u0.shiftLeft(1));
-            u0 = u1;
-            u1 = u2;
-//            System.out.println(i + ": " + u2);
-//            System.out.println();
-        }
-
-        BigInteger[] retVal = {u0, u1};
-        return retVal;
-    }
-
-    /**
-     * Computes the auxiliary value <code>t<sub>w</sub></code>. If the width is
-     * 4, then for <code>mu = 1</code>, <code>t<sub>w</sub> = 6</code> and for
-     * <code>mu = -1</code>, <code>t<sub>w</sub> = 10</code> 
-     * @param mu The parameter <code>μ</code> of the elliptic curve.
-     * @param w The window width of the WTNAF.
-     * @return the auxiliary value <code>t<sub>w</sub></code>
-     */
-    public static BigInteger getTw(byte mu, int w)
-    {
-        if (w == 4)
-        {
-            if (mu == 1)
-            {
-                return BigInteger.valueOf(6);
-            }
-            else
-            {
-                // mu == -1
-                return BigInteger.valueOf(10);
-            }
-        }
-        else
-        {
-            // For w <> 4, the values must be computed
-            BigInteger[] us = getLucas(mu, w, false);
-            BigInteger twoToW = ECConstants.ZERO.setBit(w);
-            BigInteger u1invert = us[1].modInverse(twoToW);
-            BigInteger tw;
-            tw = ECConstants.TWO.multiply(us[0]).multiply(u1invert).mod(twoToW);
-//            System.out.println("mu = " + mu);
-//            System.out.println("tw = " + tw);
-            return tw;
-        }
-    }
-
-    /**
-     * Computes the auxiliary values <code>s<sub>0</sub></code> and
-     * <code>s<sub>1</sub></code> used for partial modular reduction. 
-     * @param curve The elliptic curve for which to compute
-     * <code>s<sub>0</sub></code> and <code>s<sub>1</sub></code>.
-     * @throws IllegalArgumentException if <code>curve</code> is not a
-     * Koblitz curve (Anomalous Binary Curve, ABC).
-     */
-    public static BigInteger[] getSi(ECCurve.F2m curve)
-    {
-        if (!curve.isKoblitz())
-        {
-            throw new IllegalArgumentException("si is defined for Koblitz curves only");
-        }
-
-        int m = curve.getM();
-        int a = curve.getA().toBigInteger().intValue();
-        byte mu = curve.getMu();
-        int h = curve.getH().intValue();
-        int index = m + 3 - a;
-        BigInteger[] ui = getLucas(mu, index, false);
-
-        BigInteger dividend0;
-        BigInteger dividend1;
-        if (mu == 1)
-        {
-            dividend0 = ECConstants.ONE.subtract(ui[1]);
-            dividend1 = ECConstants.ONE.subtract(ui[0]);
-        }
-        else if (mu == -1)
-        {
-            dividend0 = ECConstants.ONE.add(ui[1]);
-            dividend1 = ECConstants.ONE.add(ui[0]);
-        }
-        else
-        {
-            throw new IllegalArgumentException("mu must be 1 or -1");
-        }
-
-        BigInteger[] si = new BigInteger[2];
-
-        if (h == 2)
-        {
-            si[0] = dividend0.shiftRight(1);
-            si[1] = dividend1.shiftRight(1).negate();
-        }
-        else if (h == 4)
-        {
-            si[0] = dividend0.shiftRight(2);
-            si[1] = dividend1.shiftRight(2).negate();
-        }
-        else
-        {
-            throw new IllegalArgumentException("h (Cofactor) must be 2 or 4");
-        }
-
-        return si;
-    }
-
-    /**
-     * Partial modular reduction modulo
-     * <code>(τ<sup>m</sup> - 1)/(τ - 1)</code>.
-     * @param k The integer to be reduced.
-     * @param m The bitlength of the underlying finite field.
-     * @param a The parameter <code>a</code> of the elliptic curve.
-     * @param s The auxiliary values <code>s<sub>0</sub></code> and
-     * <code>s<sub>1</sub></code>.
-     * @param mu The parameter μ of the elliptic curve.
-     * @param c The precision (number of bits of accuracy) of the partial
-     * modular reduction.
-     * @return <code>ρ := k partmod (τ<sup>m</sup> - 1)/(τ - 1)</code>
-     */
-    public static ZTauElement partModReduction(BigInteger k, int m, byte a,
-            BigInteger[] s, byte mu, byte c)
-    {
-        // d0 = s[0] + mu*s[1]; mu is either 1 or -1
-        BigInteger d0;
-        if (mu == 1)
-        {
-            d0 = s[0].add(s[1]);
-        }
-        else
-        {
-            d0 = s[0].subtract(s[1]);
-        }
-
-        BigInteger[] v = getLucas(mu, m, true);
-        BigInteger vm = v[1];
-
-        SimpleBigDecimal lambda0 = approximateDivisionByN(
-                k, s[0], vm, a, m, c);
-        
-        SimpleBigDecimal lambda1 = approximateDivisionByN(
-                k, s[1], vm, a, m, c);
-
-        ZTauElement q = round(lambda0, lambda1, mu);
-
-        // r0 = n - d0*q0 - 2*s1*q1
-        BigInteger r0 = k.subtract(d0.multiply(q.u)).subtract(
-                BigInteger.valueOf(2).multiply(s[1]).multiply(q.v));
-
-        // r1 = s1*q0 - s0*q1
-        BigInteger r1 = s[1].multiply(q.u).subtract(s[0].multiply(q.v));
-        
-        return new ZTauElement(r0, r1);
-    }
-
-    /**
-     * Multiplies a {@link org.bouncycastle.math.ec.ECPoint.F2m ECPoint.F2m}
-     * by a <code>BigInteger</code> using the reduced <code>τ</code>-adic
-     * NAF (RTNAF) method.
-     * @param p The ECPoint.F2m to multiply.
-     * @param k The <code>BigInteger</code> by which to multiply <code>p</code>.
-     * @return <code>k * p</code>
-     */
-    public static ECPoint.F2m multiplyRTnaf(ECPoint.F2m p, BigInteger k)
-    {
-        ECCurve.F2m curve = (ECCurve.F2m) p.getCurve();
-        int m = curve.getM();
-        byte a = (byte) curve.getA().toBigInteger().intValue();
-        byte mu = curve.getMu();
-        BigInteger[] s = curve.getSi();
-        ZTauElement rho = partModReduction(k, m, a, s, mu, (byte)10);
-
-        return multiplyTnaf(p, rho);
-    }
-
-    /**
-     * Multiplies a {@link org.bouncycastle.math.ec.ECPoint.F2m ECPoint.F2m}
-     * by an element <code>λ</code> of <code><b>Z</b>[τ]</code>
-     * using the <code>τ</code>-adic NAF (TNAF) method.
-     * @param p The ECPoint.F2m to multiply.
-     * @param lambda The element <code>λ</code> of
-     * <code><b>Z</b>[τ]</code>.
-     * @return <code>λ * p</code>
-     */
-    public static ECPoint.F2m multiplyTnaf(ECPoint.F2m p, ZTauElement lambda)
-    {
-        ECCurve.F2m curve = (ECCurve.F2m)p.getCurve();
-        byte mu = curve.getMu();
-        byte[] u = tauAdicNaf(mu, lambda);
-
-        ECPoint.F2m q = multiplyFromTnaf(p, u);
-
-        return q;
-    }
-
-    /**
-    * Multiplies a {@link org.bouncycastle.math.ec.ECPoint.F2m ECPoint.F2m}
-    * by an element <code>λ</code> of <code><b>Z</b>[τ]</code>
-    * using the <code>τ</code>-adic NAF (TNAF) method, given the TNAF
-    * of <code>λ</code>.
-    * @param p The ECPoint.F2m to multiply.
-    * @param u The the TNAF of <code>λ</code>..
-    * @return <code>λ * p</code>
-    */
-    public static ECPoint.F2m multiplyFromTnaf(ECPoint.F2m p, byte[] u)
-    {
-        ECCurve.F2m curve = (ECCurve.F2m)p.getCurve();
-        ECPoint.F2m q = (ECPoint.F2m) curve.getInfinity();
-        for (int i = u.length - 1; i >= 0; i--)
-        {
-            q = tau(q);
-            if (u[i] == 1)
-            {
-                q = (ECPoint.F2m)q.addSimple(p);
-            }
-            else if (u[i] == -1)
-            {
-                q = (ECPoint.F2m)q.subtractSimple(p);
-            }
-        }
-        return q;
-    }
-
-    /**
-     * Computes the <code>[τ]</code>-adic window NAF of an element
-     * <code>λ</code> of <code><b>Z</b>[τ]</code>.
-     * @param mu The parameter μ of the elliptic curve.
-     * @param lambda The element <code>λ</code> of
-     * <code><b>Z</b>[τ]</code> of which to compute the
-     * <code>[τ]</code>-adic NAF.
-     * @param width The window width of the resulting WNAF.
-     * @param pow2w 2<sup>width</sup>.
-     * @param tw The auxiliary value <code>t<sub>w</sub></code>.
-     * @param alpha The <code>α<sub>u</sub></code>'s for the window width.
-     * @return The <code>[τ]</code>-adic window NAF of
-     * <code>λ</code>.
-     */
-    public static byte[] tauAdicWNaf(byte mu, ZTauElement lambda,
-            byte width, BigInteger pow2w, BigInteger tw, ZTauElement[] alpha)
-    {
-        if (!((mu == 1) || (mu == -1)))
-        {
-            throw new IllegalArgumentException("mu must be 1 or -1");
-        }
-
-        BigInteger norm = norm(mu, lambda);
-
-        // Ceiling of log2 of the norm 
-        int log2Norm = norm.bitLength();
-
-        // If length(TNAF) > 30, then length(TNAF) < log2Norm + 3.52
-        int maxLength = log2Norm > 30 ? log2Norm + 4 + width : 34 + width;
-
-        // The array holding the TNAF
-        byte[] u = new byte[maxLength];
-
-        // 2^(width - 1)
-        BigInteger pow2wMin1 = pow2w.shiftRight(1);
-
-        // Split lambda into two BigIntegers to simplify calculations
-        BigInteger r0 = lambda.u;
-        BigInteger r1 = lambda.v;
-        int i = 0;
-
-        // while lambda <> (0, 0)
-        while (!((r0.equals(ECConstants.ZERO))&&(r1.equals(ECConstants.ZERO))))
-        {
-            // if r0 is odd
-            if (r0.testBit(0))
-            {
-                // uUnMod = r0 + r1*tw mod 2^width
-                BigInteger uUnMod
-                    = r0.add(r1.multiply(tw)).mod(pow2w);
-                
-                byte uLocal;
-                // if uUnMod >= 2^(width - 1)
-                if (uUnMod.compareTo(pow2wMin1) >= 0)
-                {
-                    uLocal = (byte) uUnMod.subtract(pow2w).intValue();
-                }
-                else
-                {
-                    uLocal = (byte) uUnMod.intValue();
-                }
-                // uLocal is now in [-2^(width-1), 2^(width-1)-1]
-
-                u[i] = uLocal;
-                boolean s = true;
-                if (uLocal < 0)
-                {
-                    s = false;
-                    uLocal = (byte)-uLocal;
-                }
-                // uLocal is now >= 0
-
-                if (s)
-                {
-                    r0 = r0.subtract(alpha[uLocal].u);
-                    r1 = r1.subtract(alpha[uLocal].v);
-                }
-                else
-                {
-                    r0 = r0.add(alpha[uLocal].u);
-                    r1 = r1.add(alpha[uLocal].v);
-                }
-            }
-            else
-            {
-                u[i] = 0;
-            }
-
-            BigInteger t = r0;
-
-            if (mu == 1)
-            {
-                r0 = r1.add(r0.shiftRight(1));
-            }
-            else
-            {
-                // mu == -1
-                r0 = r1.subtract(r0.shiftRight(1));
-            }
-            r1 = t.shiftRight(1).negate();
-            i++;
-        }
-        return u;
-    }
-
-    /**
-     * Does the precomputation for WTNAF multiplication.
-     * @param p The <code>ECPoint</code> for which to do the precomputation.
-     * @param a The parameter <code>a</code> of the elliptic curve.
-     * @return The precomputation array for <code>p</code>. 
-     */
-    public static ECPoint.F2m[] getPreComp(ECPoint.F2m p, byte a)
-    {
-        ECPoint.F2m[] pu;
-        pu = new ECPoint.F2m[16];
-        pu[1] = p;
-        byte[][] alphaTnaf;
-        if (a == 0)
-        {
-            alphaTnaf = Tnaf.alpha0Tnaf;
-        }
-        else
-        {
-            // a == 1
-            alphaTnaf = Tnaf.alpha1Tnaf;
-        }
-
-        int precompLen = alphaTnaf.length;
-        for (int i = 3; i < precompLen; i = i + 2)
-        {
-            pu[i] = Tnaf.multiplyFromTnaf(p, alphaTnaf[i]);
-        }
-        
-        return pu;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/math/ec/ZTauElement.java b/azureus2/src/org/bouncycastle/math/ec/ZTauElement.java
deleted file mode 100644
index 7402f22..0000000
--- a/azureus2/src/org/bouncycastle/math/ec/ZTauElement.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.bouncycastle.math.ec;
-
-import java.math.BigInteger;
-
-/**
- * Class representing an element of <code><b>Z</b>[τ]</code>. Let
- * <code>λ</code> be an element of <code><b>Z</b>[τ]</code>. Then
- * <code>λ</code> is given as <code>λ = u + vτ</code>. The
- * components <code>u</code> and <code>v</code> may be used directly, there
- * are no accessor methods.
- * Immutable class.
- */
-class ZTauElement
-{
-    /**
-     * The "real" part of <code>λ</code>.
-     */
-    public final BigInteger u;
-
-    /**
-     * The "<code>τ</code>-adic" part of <code>λ</code>.
-     */
-    public final BigInteger v;
-
-    /**
-     * Constructor for an element <code>λ</code> of
-     * <code><b>Z</b>[τ]</code>.
-     * @param u The "real" part of <code>λ</code>.
-     * @param v The "<code>τ</code>-adic" part of
-     * <code>λ</code>.
-     */
-    public ZTauElement(BigInteger u, BigInteger v)
-    {
-        this.u = u;
-        this.v = v;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/openssl/PEMReader.java b/azureus2/src/org/bouncycastle/openssl/PEMReader.java
deleted file mode 100644
index dbd15e2..0000000
--- a/azureus2/src/org/bouncycastle/openssl/PEMReader.java
+++ /dev/null
@@ -1,543 +0,0 @@
-package org.bouncycastle.openssl;
-
-import org.bouncycastle.asn1.ASN1InputStream;
-import org.bouncycastle.asn1.ASN1Object;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.cms.ContentInfo;
-import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
-import org.bouncycastle.asn1.sec.ECPrivateKeyStructure;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-import org.bouncycastle.asn1.x509.RSAPublicKeyStructure;
-import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
-import org.bouncycastle.asn1.x9.X9ObjectIdentifiers;
-import org.bouncycastle.jce.ECNamedCurveTable;
-import org.bouncycastle.jce.PKCS10CertificationRequest;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.bouncycastle.jce.spec.ECNamedCurveParameterSpec;
-import org.bouncycastle.util.encoders.Base64;
-import org.bouncycastle.util.encoders.Hex;
-import org.bouncycastle.x509.X509AttributeCertificate;
-import org.bouncycastle.x509.X509V2AttributeCertificate;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.Reader;
-import java.security.KeyFactory;
-import java.security.KeyPair;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.PublicKey;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509CRL;
-import java.security.cert.X509Certificate;
-import java.security.spec.DSAPrivateKeySpec;
-import java.security.spec.DSAPublicKeySpec;
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.KeySpec;
-import java.security.spec.PKCS8EncodedKeySpec;
-import java.security.spec.RSAPrivateCrtKeySpec;
-import java.security.spec.RSAPublicKeySpec;
-import java.security.spec.X509EncodedKeySpec;
-import java.util.StringTokenizer;
-
-/**
- * Class for reading OpenSSL PEM encoded streams containing 
- * X509 certificates, PKCS8 encoded keys and PKCS7 objects.
- * <p>
- * In the case of PKCS7 objects the reader will return a CMS ContentInfo object. Keys and
- * Certificates will be returned using the appropriate java.security type.
- */
-public class PEMReader extends BufferedReader
-{
-    private final PasswordFinder    pFinder;
-    private final String            provider;
-
-    /**
-     * Create a new PEMReader
-     *
-     * @param reader the Reader
-     */
-    public PEMReader(
-        Reader reader)
-    {
-        this(reader, null, BouncyCastleProvider.PROVIDER_NAME);
-    }
-
-    /**
-     * Create a new PEMReader with a password finder
-     *
-     * @param reader the Reader
-     * @param pFinder the password finder
-     */
-    public PEMReader(
-        Reader          reader,
-        PasswordFinder  pFinder)
-    {
-        this(reader, pFinder, BouncyCastleProvider.PROVIDER_NAME);
-    }
-
-    /**
-     * Create a new PEMReader with a password finder
-     *
-     * @param reader the Reader
-     * @param pFinder the password finder
-     * @param provider the cryptography provider to use
-     */
-    public PEMReader(
-        Reader          reader,
-        PasswordFinder  pFinder,
-        String          provider)
-    {
-        super(reader);
-
-        this.pFinder = pFinder;
-        this.provider = provider;
-    }
-
-    public Object readObject()
-        throws IOException
-    {
-        String  line;
-
-        while ((line = readLine()) != null)
-        {
-            if (line.indexOf("-----BEGIN PUBLIC KEY") != -1)
-            {
-                return readPublicKey("-----END PUBLIC KEY");
-            }
-            if (line.indexOf("-----BEGIN RSA PUBLIC KEY") != -1)
-            {
-                return readRSAPublicKey("-----END RSA PUBLIC KEY");
-            }
-            if (line.indexOf("-----BEGIN CERTIFICATE REQUEST") != -1)
-            {
-                return readCertificateRequest("-----END CERTIFICATE REQUEST");
-            }
-            if (line.indexOf("-----BEGIN NEW CERTIFICATE REQUEST") != -1)
-            {
-                return readCertificateRequest("-----END NEW CERTIFICATE REQUEST");
-            }
-            if (line.indexOf("-----BEGIN CERTIFICATE") != -1)
-            {
-                return readCertificate("-----END CERTIFICATE");
-            }
-            if (line.indexOf("-----BEGIN PKCS7") != -1)
-            {
-               return readPKCS7("-----END PKCS7");
-            } 
-            if (line.indexOf("-----BEGIN X509 CERTIFICATE") != -1)
-            {
-                return readCertificate("-----END X509 CERTIFICATE");
-            }
-            if (line.indexOf("-----BEGIN X509 CRL") != -1)
-            {
-                return readCRL("-----END X509 CRL");
-            }
-            if (line.indexOf("-----BEGIN ATTRIBUTE CERTIFICATE") != -1)
-            {
-                return readAttributeCertificate("-----END ATTRIBUTE CERTIFICATE");
-            }
-            if (line.indexOf("-----BEGIN RSA PRIVATE KEY") != -1)
-            {
-                try
-                {
-                    return readKeyPair("RSA", "-----END RSA PRIVATE KEY");
-                }
-                catch (Exception e)
-                {
-                    throw new IOException(
-                        "problem creating RSA private key: " + e.toString());
-                }
-            }
-            if (line.indexOf("-----BEGIN DSA PRIVATE KEY") != -1)
-            {
-                try
-                {
-                    return readKeyPair("DSA", "-----END DSA PRIVATE KEY");
-                }
-                catch (Exception e)
-                {
-                    throw new IOException(
-                        "problem creating DSA private key: " + e.toString());
-                }
-            }
-            if (line.indexOf("-----BEGIN EC PARAMETERS-----") != -1)
-            {
-                return readECParameters("-----END EC PARAMETERS-----");
-            }
-            if (line.indexOf("-----BEGIN EC PRIVATE KEY-----") != -1)
-            {
-                return readECPrivateKey("-----END EC PRIVATE KEY-----");
-            }
-        }
-
-        return null;
-    }
-
-    private byte[] readBytes(String endMarker)
-        throws IOException
-    {
-        String          line;
-        StringBuffer    buf = new StringBuffer();
-  
-        while ((line = readLine()) != null)
-        {
-            if (line.indexOf(endMarker) != -1)
-            {
-                break;
-            }
-            buf.append(line.trim());
-        }
-
-        if (line == null)
-        {
-            throw new IOException(endMarker + " not found");
-        }
-
-        return Base64.decode(buf.toString());
-    }
-
-    private PublicKey readRSAPublicKey(String endMarker) 
-        throws IOException 
-    {
-        ByteArrayInputStream bAIS = new ByteArrayInputStream(readBytes(endMarker));
-        ASN1InputStream ais = new ASN1InputStream(bAIS);
-        Object asnObject = ais.readObject();
-        ASN1Sequence sequence = (ASN1Sequence) asnObject;
-        RSAPublicKeyStructure rsaPubStructure = new RSAPublicKeyStructure(sequence);
-        RSAPublicKeySpec keySpec = new RSAPublicKeySpec(
-                    rsaPubStructure.getModulus(), 
-                    rsaPubStructure.getPublicExponent());
-
-        try 
-        {
-            KeyFactory keyFact = KeyFactory.getInstance("RSA", provider);
-
-            return keyFact.generatePublic(keySpec);
-        }
-        catch (NoSuchProviderException e)
-        {
-            throw new IOException("can't find provider " + provider);
-        }
-        catch (Exception e)
-        {
-            throw new IOException("problem extracting key: " + e.toString());
-        }
-    }
-
-    private PublicKey readPublicKey(String endMarker)
-        throws IOException
-    {
-        KeySpec keySpec = new X509EncodedKeySpec(readBytes(endMarker));
-        String[] algorithms = { "DSA", "RSA" };
-        for (int i = 0; i < algorithms.length; i++) 
-        {
-            try 
-            {
-                KeyFactory keyFact = KeyFactory.getInstance(algorithms[i],
-                                provider);
-                PublicKey pubKey = keyFact.generatePublic(keySpec);
-                
-                return pubKey;
-            }
-            catch (NoSuchAlgorithmException e) 
-            { 
-                // ignore
-            }
-            catch (InvalidKeySpecException e) 
-            { 
-                // ignore
-            }
-            catch (NoSuchProviderException e)
-            {
-                throw new RuntimeException("can't find provider " + provider);
-            }
-        }
-        
-        return null;
-    }
-
-    /**
-     * Reads in a X509Certificate.
-     *
-     * @return the X509Certificate
-     * @throws IOException if an I/O error occured
-     */
-    private X509Certificate readCertificate(
-        String  endMarker)
-        throws IOException
-    {
-        ByteArrayInputStream    bIn = new ByteArrayInputStream(readBytes(endMarker));
-
-        try
-        {
-            CertificateFactory certFact
-                    = CertificateFactory.getInstance("X.509", provider);
-
-            return (X509Certificate)certFact.generateCertificate(bIn);
-        }
-        catch (Exception e)
-        {
-            throw new IOException("problem parsing cert: " + e.toString());
-        }
-    }
-
-    /**
-     * Reads in a X509CRL.
-     *
-     * @return the X509Certificate
-     * @throws IOException if an I/O error occured
-     */
-    private X509CRL readCRL(
-        String  endMarker)
-        throws IOException
-    {
-        ByteArrayInputStream    bIn = new ByteArrayInputStream(readBytes(endMarker));
-
-        try
-        {
-            CertificateFactory certFact
-                    = CertificateFactory.getInstance("X.509", provider);
-
-            return (X509CRL)certFact.generateCRL(bIn);
-        }
-        catch (Exception e)
-        {
-            throw new IOException("problem parsing cert: " + e.toString());
-        }
-    }
-
-    /**
-     * Reads in a PKCS10 certification request.
-     *
-     * @return the certificate request.
-     * @throws IOException if an I/O error occured
-     */
-    private PKCS10CertificationRequest readCertificateRequest(
-        String  endMarker)
-        throws IOException
-    {
-        try
-        {
-            return new PKCS10CertificationRequest(readBytes(endMarker));
-        }
-        catch (Exception e)
-        {
-            throw new IOException("problem parsing cert: " + e.toString());
-        }
-    }
-
-    /**
-     * Reads in a X509 Attribute Certificate.
-     *
-     * @return the X509 Attribute Certificate
-     * @throws IOException if an I/O error occured
-     */
-    private X509AttributeCertificate readAttributeCertificate(
-        String  endMarker)
-        throws IOException
-    {
-        return new X509V2AttributeCertificate(readBytes(endMarker));
-    }
-    
-    /**
-     * Reads in a PKCS7 object. This returns a ContentInfo object suitable for use with the CMS
-     * API.
-     *
-     * @return the X509Certificate
-     * @throws IOException if an I/O error occured
-     */
-    private ContentInfo readPKCS7(
-        String  endMarker)
-        throws IOException
-    {
-        String                                  line;
-        StringBuffer                        buf = new StringBuffer();
-        ByteArrayOutputStream    bOut = new ByteArrayOutputStream();
-  
-        while ((line = readLine()) != null)
-        {
-            if (line.indexOf(endMarker) != -1)
-            {
-                break;
-            }
-            
-            line = line.trim();
-            
-            buf.append(line.trim());
-            
-            Base64.decode(buf.substring(0, (buf.length() / 4) * 4), bOut);
-
-            buf.delete(0, (buf.length() / 4) * 4);
-        }
-
-        if (buf.length() != 0)
-        {
-            throw new RuntimeException("base64 data appears to be truncated");
-        }
-        
-        if (line == null)
-        {
-            throw new IOException(endMarker + " not found");
-        }
-
-        ByteArrayInputStream    bIn = new ByteArrayInputStream(bOut.toByteArray());
-
-        try
-        {
-            ASN1InputStream aIn = new ASN1InputStream(bIn);
-
-            return ContentInfo.getInstance(aIn.readObject());
-        }
-        catch (Exception e)
-        {
-            throw new IOException("problem parsing PKCS7 object: " + e.toString());
-        }
-    }
-
-    /**
-     * Read a Key Pair
-     */
-    private KeyPair readKeyPair(
-        String  type,
-        String  endMarker)
-        throws Exception
-    {
-        boolean         isEncrypted = false;
-        String          line = null;
-        String          dekInfo = null;
-        StringBuffer    buf = new StringBuffer();
-
-        while ((line = readLine()) != null)
-        {
-            if (line.startsWith("Proc-Type: 4,ENCRYPTED"))
-            {
-                isEncrypted = true;
-            }
-            else if (line.startsWith("DEK-Info:"))
-            {
-                dekInfo = line.substring(10);
-            }
-            else if (line.indexOf(endMarker) != -1)
-            {
-                break;
-            }
-            else
-            {
-                buf.append(line.trim());
-            }
-        }
-
-        //
-        // extract the key
-        //
-        byte[] keyBytes = Base64.decode(buf.toString());
-
-        if (isEncrypted)
-        {
-            if (pFinder == null)
-            {
-                throw new IOException("No password finder specified, but a password is required");
-            }
-
-            char[] password = pFinder.getPassword();
-
-            if (password == null)
-            {
-                throw new IOException("Password is null, but a password is required");
-            }
-
-            StringTokenizer tknz = new StringTokenizer(dekInfo, ",");
-            String          dekAlgName = tknz.nextToken();
-            byte[]          iv = Hex.decode(tknz.nextToken());
-
-            keyBytes = PEMUtilities.crypt(false, provider, keyBytes, password, dekAlgName, iv);
-        }
-
-
-        KeySpec                 pubSpec, privSpec;
-        ByteArrayInputStream    bIn = new ByteArrayInputStream(keyBytes);
-        ASN1InputStream         aIn = new ASN1InputStream(bIn);
-        ASN1Sequence            seq = (ASN1Sequence)aIn.readObject();
-
-        if (type.equals("RSA"))
-        {
-//            DERInteger              v = (DERInteger)seq.getObjectAt(0);
-            DERInteger              mod = (DERInteger)seq.getObjectAt(1);
-            DERInteger              pubExp = (DERInteger)seq.getObjectAt(2);
-            DERInteger              privExp = (DERInteger)seq.getObjectAt(3);
-            DERInteger              p1 = (DERInteger)seq.getObjectAt(4);
-            DERInteger              p2 = (DERInteger)seq.getObjectAt(5);
-            DERInteger              exp1 = (DERInteger)seq.getObjectAt(6);
-            DERInteger              exp2 = (DERInteger)seq.getObjectAt(7);
-            DERInteger              crtCoef = (DERInteger)seq.getObjectAt(8);
-
-            pubSpec = new RSAPublicKeySpec(
-                        mod.getValue(), pubExp.getValue());
-            privSpec = new RSAPrivateCrtKeySpec(
-                    mod.getValue(), pubExp.getValue(), privExp.getValue(),
-                    p1.getValue(), p2.getValue(),
-                    exp1.getValue(), exp2.getValue(),
-                    crtCoef.getValue());
-        }
-        else    // "DSA"
-        {
-//            DERInteger              v = (DERInteger)seq.getObjectAt(0);
-            DERInteger              p = (DERInteger)seq.getObjectAt(1);
-            DERInteger              q = (DERInteger)seq.getObjectAt(2);
-            DERInteger              g = (DERInteger)seq.getObjectAt(3);
-            DERInteger              y = (DERInteger)seq.getObjectAt(4);
-            DERInteger              x = (DERInteger)seq.getObjectAt(5);
-
-            privSpec = new DSAPrivateKeySpec(
-                        x.getValue(), p.getValue(),
-                            q.getValue(), g.getValue());
-            pubSpec = new DSAPublicKeySpec(
-                        y.getValue(), p.getValue(),
-                            q.getValue(), g.getValue());
-        }
-
-        KeyFactory          fact = KeyFactory.getInstance(type, provider);
-
-        return new KeyPair(
-                    fact.generatePublic(pubSpec),
-                    fact.generatePrivate(privSpec));
-    }
-
-    private ECNamedCurveParameterSpec readECParameters(String endMarker)
-        throws IOException
-    {
-        DERObjectIdentifier oid = (DERObjectIdentifier)ASN1Object.fromByteArray(readBytes(endMarker));
-
-        return ECNamedCurveTable.getParameterSpec(oid.getId());
-    }
-
-    private KeyPair readECPrivateKey(String endMarker)
-        throws IOException
-    {
-        try
-        {
-            ECPrivateKeyStructure pKey = new ECPrivateKeyStructure((ASN1Sequence)ASN1Object.fromByteArray(readBytes(endMarker)));
-            AlgorithmIdentifier   algId = new AlgorithmIdentifier(X9ObjectIdentifiers.id_ecPublicKey, pKey.getParameters());
-            PrivateKeyInfo        privInfo = new PrivateKeyInfo(algId, pKey.getDERObject());
-            SubjectPublicKeyInfo  pubInfo = new SubjectPublicKeyInfo(algId, pKey.getPublicKey().getBytes());
-            PKCS8EncodedKeySpec   privSpec = new PKCS8EncodedKeySpec(privInfo.getEncoded());
-            X509EncodedKeySpec    pubSpec = new X509EncodedKeySpec(pubInfo.getEncoded());
-            KeyFactory            fact = KeyFactory.getInstance("ECDSA", provider);
-
-            return new KeyPair(fact.generatePublic(pubSpec), fact.generatePrivate(privSpec));
-        }
-        catch (ClassCastException e)
-        { 
-            throw new IOException("wrong ASN.1 object found in stream");
-        }
-        catch (Exception e)
-        {
-            throw new IOException("problem parsing EC private key: " + e);
-        }
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/openssl/PEMUtilities.java b/azureus2/src/org/bouncycastle/openssl/PEMUtilities.java
deleted file mode 100644
index 3262243..0000000
--- a/azureus2/src/org/bouncycastle/openssl/PEMUtilities.java
+++ /dev/null
@@ -1,185 +0,0 @@
-package org.bouncycastle.openssl;
-
-import org.bouncycastle.crypto.PBEParametersGenerator;
-import org.bouncycastle.crypto.generators.OpenSSLPBEParametersGenerator;
-import org.bouncycastle.crypto.params.KeyParameter;
-
-import javax.crypto.Cipher;
-import javax.crypto.SecretKey;
-import javax.crypto.spec.IvParameterSpec;
-import javax.crypto.spec.RC2ParameterSpec;
-import java.io.IOException;
-import java.security.Key;
-import java.security.spec.AlgorithmParameterSpec;
-
-final class PEMUtilities
-{
-    static byte[] crypt(
-        boolean encrypt,
-        String  provider,
-        byte[]  bytes,
-        char[]  password,
-        String  dekAlgName,
-        byte[]  iv)
-        throws IOException
-    {
-        AlgorithmParameterSpec paramSpec = new IvParameterSpec(iv);
-        String                 alg;
-        String                 blockMode = "CBC";
-        String                 padding = "PKCS5Padding";
-        Key                    sKey;
-
-
-        // Figure out block mode and padding.
-        if (dekAlgName.endsWith("-CFB"))
-        {
-            blockMode = "CFB";
-            padding = "NoPadding";
-        }
-        if (dekAlgName.endsWith("-ECB") ||
-            "DES-EDE".equals(dekAlgName) ||
-            "DES-EDE3".equals(dekAlgName))
-        {
-            // ECB is actually the default (though seldom used) when OpenSSL
-            // uses DES-EDE (des2) or DES-EDE3 (des3).
-            blockMode = "ECB";
-            paramSpec = null;
-        }
-        if (dekAlgName.endsWith("-OFB"))
-        {
-            blockMode = "OFB";
-            padding = "NoPadding";
-        }
-
-
-        // Figure out algorithm and key size.
-        if (dekAlgName.startsWith("DES-EDE"))
-        {
-            alg = "DESede";
-            // "DES-EDE" is actually des2 in OpenSSL-speak!
-            // "DES-EDE3" is des3.
-            boolean des2 = !dekAlgName.startsWith("DES-EDE3");
-            sKey = getKey(password, alg, 24, iv, des2);
-        }
-        else if (dekAlgName.startsWith("DES-"))
-        {
-            alg = "DES";
-            sKey = getKey(password, alg, 8, iv);
-        }
-        else if (dekAlgName.startsWith("BF-"))
-        {
-            alg = "Blowfish";
-            sKey = getKey(password, alg, 16, iv);
-        }
-        else if (dekAlgName.startsWith("RC2-"))
-        {
-            alg = "RC2";
-            int keyBits = 128;
-            if (dekAlgName.startsWith("RC2-40-"))
-            {
-                keyBits = 40;
-            }
-            else if (dekAlgName.startsWith("RC2-64-"))
-            {
-                keyBits = 64;
-            }
-            sKey = getKey(password, alg, keyBits / 8, iv);
-            if (paramSpec == null) // ECB block mode
-            {
-                paramSpec = new RC2ParameterSpec(keyBits);
-            }
-            else
-            {
-                paramSpec = new RC2ParameterSpec(keyBits, iv);
-            }
-        }
-        else if (dekAlgName.startsWith("AES-"))
-        {
-            alg = "AES";
-            byte[] salt = iv;
-            if (salt.length > 8)
-            {
-                salt = new byte[8];
-                System.arraycopy(iv, 0, salt, 0, 8);
-            }
-
-            int keyBits;
-            if (dekAlgName.startsWith("AES-128-"))
-            {
-                keyBits = 128;
-            }
-            else if (dekAlgName.startsWith("AES-192-"))
-            {
-                keyBits = 192;
-            }
-            else if (dekAlgName.startsWith("AES-256-"))
-            {
-                keyBits = 256;
-            }
-            else
-            {
-                throw new IOException("unknown AES encryption with private key");
-            }
-            sKey = getKey(password, "AES", keyBits / 8, salt);
-        }
-        else
-        {
-            throw new IOException("unknown encryption with private key");
-        }
-
-        String transformation = alg + "/" + blockMode + "/" + padding;
-
-        try
-        {
-            Cipher c = Cipher.getInstance(transformation, provider);
-            int    mode = encrypt ? Cipher.ENCRYPT_MODE : Cipher.DECRYPT_MODE;
-
-            if (paramSpec == null) // ECB block mode
-            {
-                c.init(mode, sKey);
-            }
-            else
-            {
-                c.init(mode, sKey, paramSpec);
-            }
-            return c.doFinal(bytes);
-        }
-        catch (Exception e)
-        {
-            throw new IOException("exception using cipher: " + e.toString());
-        }
-    }
-
-    private static SecretKey getKey(
-        char[]  password,
-        String  algorithm,
-        int     keyLength,
-        byte[]  salt)
-        throws IOException
-    {
-        return getKey(password, algorithm, keyLength, salt, false);
-    }
-
-    private static SecretKey getKey(
-        char[]  password,
-        String  algorithm,
-        int     keyLength,
-        byte[]  salt,
-        boolean des2)
-        throws IOException
-    {
-        OpenSSLPBEParametersGenerator   pGen = new OpenSSLPBEParametersGenerator();
-
-        pGen.init(PBEParametersGenerator.PKCS5PasswordToBytes(password), salt);
-
-        KeyParameter keyParam;
-        keyParam = (KeyParameter) pGen.generateDerivedParameters(keyLength * 8);
-        byte[] key = keyParam.getKey();
-        if (des2 && key.length >= 24)
-        {
-            // For DES2, we must copy first 8 bytes into the last 8 bytes.
-            System.arraycopy(key, 0, key, 16, 8);
-        }
-        return new javax.crypto.spec.SecretKeySpec(key, algorithm);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/openssl/PEMWriter.java b/azureus2/src/org/bouncycastle/openssl/PEMWriter.java
deleted file mode 100644
index 0a7218c..0000000
--- a/azureus2/src/org/bouncycastle/openssl/PEMWriter.java
+++ /dev/null
@@ -1,312 +0,0 @@
-package org.bouncycastle.openssl;
-
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Object;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.cms.ContentInfo;
-import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
-import org.bouncycastle.asn1.pkcs.RSAPrivateKeyStructure;
-import org.bouncycastle.asn1.x509.DSAParameter;
-import org.bouncycastle.jce.PKCS10CertificationRequest;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.bouncycastle.util.Strings;
-import org.bouncycastle.util.encoders.Base64;
-import org.bouncycastle.util.encoders.Hex;
-import org.bouncycastle.x509.X509AttributeCertificate;
-import org.bouncycastle.x509.X509V2AttributeCertificate;
-
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.Writer;
-import java.math.BigInteger;
-import java.security.Key;
-import java.security.KeyPair;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.SecureRandom;
-import java.security.cert.CRLException;
-import java.security.cert.CertificateEncodingException;
-import java.security.cert.X509CRL;
-import java.security.cert.X509Certificate;
-import java.security.interfaces.DSAParams;
-import java.security.interfaces.DSAPrivateKey;
-import java.security.interfaces.RSAPrivateCrtKey;
-import java.security.interfaces.RSAPrivateKey;
-
-/**
- * General purpose writer for OpenSSL PEM objects.
- */
-public class PEMWriter
-    extends BufferedWriter
-{
-    private String provider;
-
-    /**
-     * Base constructor.
-     * 
-     * @param out output stream to use.
-     */
-    public PEMWriter(Writer out)
-    {
-        this(out, BouncyCastleProvider.PROVIDER_NAME);
-    }
-
-    public PEMWriter(
-        Writer  out,
-        String  provider)
-    {
-        super(out);
-
-        this.provider = provider;
-    }
-
-    private void writeHexEncoded(byte[] bytes)
-        throws IOException
-    {
-        bytes = Hex.encode(bytes);
-        
-        for (int i = 0; i != bytes.length; i++)
-        {
-            this.write((char)bytes[i]);
-        }
-    }
-
-    private void writeEncoded(byte[] bytes) 
-        throws IOException
-    {
-        char[]  buf = new char[64];
-        
-        bytes = Base64.encode(bytes);
-        
-        for (int i = 0; i < bytes.length; i += buf.length)
-        {
-            int index = 0;
-            
-            while (index != buf.length)
-            {
-                if ((i + index) >= bytes.length)
-                {
-                    break;
-                }
-                buf[index] = (char)bytes[i + index];
-                index++;
-            }
-            this.write(buf, 0, index);
-            this.newLine();
-        }
-    }
-    
-    public void writeObject(
-        Object  o) 
-        throws IOException
-    {
-        String  type;
-        byte[]  encoding;
-        
-        if (o instanceof X509Certificate)
-        {
-            type = "CERTIFICATE";
-            try
-            {
-                encoding = ((X509Certificate)o).getEncoded();
-            }
-            catch (CertificateEncodingException e)
-            {
-                throw new IOException("Cannot encode object: " + e.toString());
-            }
-        }
-        else if (o instanceof X509CRL)
-        {
-            type = "X509 CRL";
-            try
-            {
-                encoding = ((X509CRL)o).getEncoded();
-            }
-            catch (CRLException e)
-            {
-                throw new IOException("Cannot encode object: " + e.toString());
-            }
-        }
-        else if (o instanceof KeyPair)
-        {
-            writeObject(((KeyPair)o).getPrivate());
-            return;
-        }
-        else if (o instanceof PrivateKey)
-        {
-            PrivateKeyInfo info = new PrivateKeyInfo(
-                (ASN1Sequence) ASN1Object.fromByteArray(((Key)o).getEncoded()));
-
-            if (o instanceof RSAPrivateKey)
-            {
-                type = "RSA PRIVATE KEY";
-
-                encoding = info.getPrivateKey().getEncoded();
-            }
-            else if (o instanceof DSAPrivateKey)
-            {
-                type = "DSA PRIVATE KEY";
-                
-                DSAParameter        p = DSAParameter.getInstance(info.getAlgorithmId().getParameters());
-                ASN1EncodableVector v = new ASN1EncodableVector();
-                
-                v.add(new DERInteger(0));
-                v.add(new DERInteger(p.getP()));
-                v.add(new DERInteger(p.getQ()));
-                v.add(new DERInteger(p.getG()));
-                
-                BigInteger x = ((DSAPrivateKey)o).getX();
-                BigInteger y = p.getG().modPow(x, p.getP());
-                
-                v.add(new DERInteger(y));
-                v.add(new DERInteger(x));
-
-                encoding = new DERSequence(v).getEncoded();
-            }
-            else
-            {
-                throw new IOException("Cannot identify private key");
-            }
-        }
-        else if (o instanceof PublicKey)
-        {
-            type = "PUBLIC KEY";
-            
-            encoding = ((PublicKey)o).getEncoded();
-        }
-        else if (o instanceof X509AttributeCertificate)
-        {
-            type = "ATTRIBUTE CERTIFICATE";
-            encoding = ((X509V2AttributeCertificate)o).getEncoded();
-        }
-        else if (o instanceof PKCS10CertificationRequest)
-        {
-            type = "CERTIFICATE REQUEST";
-            encoding = ((PKCS10CertificationRequest)o).getEncoded();
-        }
-        else if (o instanceof ContentInfo)
-        {
-            type = "PKCS7";
-            encoding = ((ContentInfo)o).getEncoded();
-        }
-        else
-        {
-            throw new IOException("unknown object passed - can't encode.");
-        }
-
-        writeHeader(type);
-        writeEncoded(encoding);
-        writeFooter(type);
-    }
-
-    public void writeObject(
-        Object       obj,
-        String       algorithm,
-        char[]       password,
-        SecureRandom random)
-        throws IOException
-    {
-        if (obj instanceof KeyPair)
-        {
-            writeObject(((KeyPair)obj).getPrivate());
-            return;
-        }
-
-
-        String type = null;
-        byte[] keyData = null;
-
-        if (obj instanceof RSAPrivateCrtKey)
-        {
-            type = "RSA PRIVATE KEY";
-
-            RSAPrivateCrtKey k = (RSAPrivateCrtKey)obj;
-
-            RSAPrivateKeyStructure keyStruct = new RSAPrivateKeyStructure(
-                k.getModulus(),
-                k.getPublicExponent(),
-                k.getPrivateExponent(),
-                k.getPrimeP(),
-                k.getPrimeQ(),
-                k.getPrimeExponentP(),
-                k.getPrimeExponentQ(),
-                k.getCrtCoefficient());
-
-            // convert to bytearray
-            keyData = keyStruct.getEncoded();
-        }
-        else if (obj instanceof DSAPrivateKey)
-        {
-            type = "DSA PRIVATE KEY";
-
-            DSAPrivateKey       k = (DSAPrivateKey)obj;
-            DSAParams           p = k.getParams();
-            ASN1EncodableVector v = new ASN1EncodableVector();
-
-            v.add(new DERInteger(0));
-            v.add(new DERInteger(p.getP()));
-            v.add(new DERInteger(p.getQ()));
-            v.add(new DERInteger(p.getG()));
-
-            BigInteger x = k.getX();
-            BigInteger y = p.getG().modPow(x, p.getP());
-
-            v.add(new DERInteger(y));
-            v.add(new DERInteger(x));
-
-            keyData = new DERSequence(v).getEncoded();
-        }
-
-        if (type == null || keyData == null)
-        {
-            // TODO Support other types?
-            throw new IllegalArgumentException("Object type not supported: " + obj.getClass().getName());
-        }
-
-
-        String dekAlgName = Strings.toUpperCase(algorithm);
-
-        // Note: For backward compatibility
-        if (dekAlgName.equals("DESEDE"))
-        {
-            dekAlgName = "DES-EDE3-CBC";
-        }
-
-        int ivLength = dekAlgName.startsWith("AES-") ? 16 : 8;
-
-        byte[] iv = new byte[ivLength];
-        random.nextBytes(iv);
-
-        byte[] encData = PEMUtilities.crypt(true, provider, keyData, password, dekAlgName, iv);
-
-
-        // write the data
-        writeHeader(type);
-        this.write("Proc-Type: 4,ENCRYPTED");
-        this.newLine();
-        this.write("DEK-Info: " + dekAlgName + ",");
-        this.writeHexEncoded(iv);
-        this.newLine();
-        this.newLine();
-        this.writeEncoded(encData);
-        writeFooter(type);
-    }
-
-    private void writeHeader(
-        String type)
-        throws IOException
-    {
-        this.write("-----BEGIN " + type + "-----");
-        this.newLine();
-    }
-
-    private void writeFooter(
-        String type)
-        throws IOException
-    {
-        this.write("-----END " + type + "-----");
-        this.newLine();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/openssl/PasswordFinder.java b/azureus2/src/org/bouncycastle/openssl/PasswordFinder.java
deleted file mode 100644
index fb89cf0..0000000
--- a/azureus2/src/org/bouncycastle/openssl/PasswordFinder.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.bouncycastle.openssl;
-
-/**
- * call back to allow a password to be fetched when one is requested.
- */
-public interface PasswordFinder
-{
-    public char[] getPassword();
-}
diff --git a/azureus2/src/org/bouncycastle/util/Arrays.java b/azureus2/src/org/bouncycastle/util/Arrays.java
deleted file mode 100644
index 59aed3e..0000000
--- a/azureus2/src/org/bouncycastle/util/Arrays.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package org.bouncycastle.util;
-
-/**
- * General array utilities.
- */
-public final class Arrays
-{
-    private Arrays() 
-    {
-        // static class, hide constructor
-    }
-    
-    public static boolean areEqual(
-        byte[]  a,
-        byte[]  b)
-    {
-        if (a == b)
-        {
-            return true;
-        }
-
-        if (a == null || b == null)
-        {
-            return false;
-        }
-
-        if (a.length != b.length)
-        {
-            return false;
-        }
-
-        for (int i = 0; i != a.length; i++)
-        {
-            if (a[i] != b[i])
-            {
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    public static boolean areEqual(
-        int[]  a,
-        int[]  b)
-    {
-        if (a == b)
-        {
-            return true;
-        }
-
-        if (a == null || b == null)
-        {
-            return false;
-        }
-
-        if (a.length != b.length)
-        {
-            return false;
-        }
-
-        for (int i = 0; i != a.length; i++)
-        {
-            if (a[i] != b[i])
-            {
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    public static void fill(
-        byte[] array,
-        byte value)
-    {
-        for (int i = 0; i < array.length; i++)
-        {
-            array[i] = value;
-        }
-    }
-    
-    public static void fill(
-        long[] array,
-        long value)
-    {
-        for (int i = 0; i < array.length; i++)
-        {
-            array[i] = value;
-        }
-    }
-
-    public static void fill(
-        short[] array, 
-        short value)
-    {
-        for (int i = 0; i < array.length; i++)
-        {
-            array[i] = value;
-        }
-    }
-
-    public static int hashCode(byte[] data)
-    {
-        int value = 0;
-
-        if (data != null)
-        {
-            for (int i = 0; i != data.length; i++)
-            {
-                value ^= (data[i] & 0xff) << (i % 4);
-            }
-        }
-
-        return value;
-    }
-
-    public static byte[] clone(byte[] data)
-    {
-        byte[] copy = new byte[data.length];
-
-        System.arraycopy(data, 0, copy, 0, data.length);
-
-        return copy;
-    }
-
-    public static int[] clone(int[] data)
-    {
-        int[] copy = new int[data.length];
-
-        System.arraycopy(data, 0, copy, 0, data.length);
-
-        return copy;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/util/BigIntegers.java b/azureus2/src/org/bouncycastle/util/BigIntegers.java
deleted file mode 100644
index 2115799..0000000
--- a/azureus2/src/org/bouncycastle/util/BigIntegers.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.bouncycastle.util;
-
-import java.math.BigInteger;
-import java.security.SecureRandom;
-
-/**
- * BigInteger utilities.
- */
-public final class BigIntegers
-{
-    private static final int MAX_ITERATIONS = 1000;
-    private static final BigInteger ZERO = BigInteger.valueOf(0);
-
-    /**
-     * Return the passed in value as an unsigned byte array.
-     * 
-     * @param value value to be converted.
-     * @return a byte array without a leading zero byte if present in the signed encoding.
-     */
-    public static byte[] asUnsignedByteArray(
-        BigInteger value)
-    {
-        byte[] bytes = value.toByteArray();
-        
-        if (bytes[0] == 0)
-        {
-            byte[] tmp = new byte[bytes.length - 1];
-            
-            System.arraycopy(bytes, 1, tmp, 0, tmp.length);
-            
-            return tmp;
-        }
-        
-        return bytes;
-    }
-
-    /**
-     * Return a random BigInteger not less than 'min' and not greater than 'max'
-     * 
-     * @param min the least value that may be generated
-     * @param max the greatest value that may be generated
-     * @param random the source of randomness
-     * @return a random BigInteger value in the range [min,max]
-     */
-    public static BigInteger createRandomInRange(
-        BigInteger      min,
-        BigInteger      max,
-        SecureRandom    random)
-    {
-        int cmp = min.compareTo(max);
-        if (cmp >= 0)
-        {
-            if (cmp > 0)
-            {
-                throw new IllegalArgumentException("'min' may not be greater than 'max'");
-            }
-
-            return min;
-        }
-
-        if (min.bitLength() > max.bitLength() / 2)
-        {
-            return createRandomInRange(ZERO, max.subtract(min), random).add(min);
-        }
-
-        for (int i = 0; i < MAX_ITERATIONS; ++i)
-        {
-            BigInteger x = new BigInteger(max.bitLength(), random);
-            if (x.compareTo(min) >= 0 && x.compareTo(max) <= 0)
-            {
-                return x;
-            }
-        }
-
-        // fall back to a faster (restricted) method
-        return new BigInteger(max.subtract(min).bitLength() - 1, random).add(min);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/util/IPAddress.java b/azureus2/src/org/bouncycastle/util/IPAddress.java
deleted file mode 100644
index 5b8ce04..0000000
--- a/azureus2/src/org/bouncycastle/util/IPAddress.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package org.bouncycastle.util;
-
-import java.math.BigInteger;
-
-public class IPAddress
-{
-    private static final BigInteger ZERO = BigInteger.valueOf(0);
-    /**
-     * Validate the given IPv4 or IPv6 address.
-     * 
-     * @param address the IP address as a String.
-     * 
-     * @return true if a valid address, false otherwise
-     */
-    public static boolean isValid(
-        String address)
-    {
-        return isValidIPv4(address) || isValidIPv6(address);
-    }
-
-    /**
-     * Validate the given IPv4 address.
-     * 
-     * @param address the IP address as a String.
-     *
-     * @return true if a valid IPv4 address, false otherwise
-     */
-    private static boolean isValidIPv4(
-        String address)
-    {
-        if (address.length() == 0)
-        {
-            return false;
-        }
-
-        BigInteger octet;
-        int octets = 0;
-        
-        String temp = address+".";
-
-        int pos;
-        int start = 0;
-        while (start < temp.length()
-            && (pos = temp.indexOf('.', start)) > start)
-        {
-            if (octets == 4)
-            {
-                return false;
-            }
-            try
-            {
-                octet = (new BigInteger(temp.substring(start, pos)));
-            }
-            catch (NumberFormatException ex)
-            {
-                return false;
-            }
-            if (octet.compareTo(ZERO) == -1
-                || octet.compareTo(BigInteger.valueOf(255)) == 1)
-            {
-                return false;
-            }
-            start = pos + 1;
-            octets++;
-        }
-
-        return octets == 4;
-    }
-
-    /**
-     * Validate the given IPv6 address.
-     *
-     * @param address the IP address as a String.
-     *
-     * @return true if a valid IPv4 address, false otherwise
-     */
-    private static boolean isValidIPv6(
-        String address)
-    {
-        if (address.length() == 0)
-        {
-            return false;
-        }
-
-        BigInteger octet;
-        int octets = 0;
-
-        String temp = address + ":";
-        
-        int pos;
-        int start = 0;
-        while (start < temp.length()
-            && (pos = temp.indexOf(':', start)) > start)
-        {
-            if (octets == 8)
-            {
-                return false;
-            }
-            try
-            {
-                octet = (new BigInteger(temp.substring(start, pos), 16));
-            }
-            catch (NumberFormatException ex)
-            {
-                return false;
-            }
-            if (octet.compareTo(ZERO) == -1
-                || octet.compareTo(BigInteger.valueOf(0xFFFF)) == 1)
-            {
-                return false;
-            }
-            start = pos + 1;
-            octets++;
-        }
-
-        return octets == 8;
-    }
-}
-
-
diff --git a/azureus2/src/org/bouncycastle/util/Selector.java b/azureus2/src/org/bouncycastle/util/Selector.java
deleted file mode 100644
index 7ad86bf..0000000
--- a/azureus2/src/org/bouncycastle/util/Selector.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.bouncycastle.util;
-
-public interface Selector
-    extends Cloneable
-{
-    boolean match(Object obj);
-
-    Object clone();
-}
diff --git a/azureus2/src/org/bouncycastle/util/Strings.java b/azureus2/src/org/bouncycastle/util/Strings.java
deleted file mode 100644
index 5e1c069..0000000
--- a/azureus2/src/org/bouncycastle/util/Strings.java
+++ /dev/null
@@ -1,241 +0,0 @@
-package org.bouncycastle.util;
-
-import java.io.ByteArrayOutputStream;
-import java.util.Vector;
-
-public final class Strings
-{
-    public static String fromUTF8ByteArray(byte[] bytes)
-    {
-        int i = 0;
-        int length = 0;
-
-        while (i < bytes.length)
-        {
-            length++;
-            if ((bytes[i] & 0xf0) == 0xf0)
-            {
-                // surrogate pair
-                length++;
-                i += 4;
-            }
-            else if ((bytes[i] & 0xe0) == 0xe0)
-            {
-                i += 3;
-            }
-            else if ((bytes[i] & 0xc0) == 0xc0)
-            {
-                i += 2;
-            }
-            else
-            {
-                i += 1;
-            }
-        }
-
-        char[] cs = new char[length];
-
-        i = 0;
-        length = 0;
-
-        while (i < bytes.length)
-        {
-            char ch;
-
-            if ((bytes[i] & 0xf0) == 0xf0)
-            {
-                int codePoint = ((bytes[i] & 0x03) << 18) | ((bytes[i+1] & 0x3F) << 12) | ((bytes[i+2] & 0x3F) << 6) | (bytes[i+3] & 0x3F);
-                int U = codePoint - 0x10000;
-                char W1 = (char)(0xD800 | (U >> 10));
-                char W2 = (char)(0xDC00 | (U & 0x3FF));
-                cs[length++] = W1;
-                ch = W2;
-                i += 4;
-            }
-            else if ((bytes[i] & 0xe0) == 0xe0)
-            {
-                ch = (char)(((bytes[i] & 0x0f) << 12)
-                        | ((bytes[i + 1] & 0x3f) << 6) | (bytes[i + 2] & 0x3f));
-                i += 3;
-            }
-            else if ((bytes[i] & 0xd0) == 0xd0)
-            {
-                ch = (char)(((bytes[i] & 0x1f) << 6) | (bytes[i + 1] & 0x3f));
-                i += 2;
-            }
-            else if ((bytes[i] & 0xc0) == 0xc0)
-            {
-                ch = (char)(((bytes[i] & 0x1f) << 6) | (bytes[i + 1] & 0x3f));
-                i += 2;
-            }
-            else
-            {
-                ch = (char)(bytes[i] & 0xff);
-                i += 1;
-            }
-
-            cs[length++] = ch;
-        }
-
-        return new String(cs);
-    }
-    
-    public static byte[] toUTF8ByteArray(String string)
-    {
-        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
-        char[] c = string.toCharArray();
-        int i = 0;
-
-        while (i < c.length)
-        {
-            char ch = c[i];
-
-            if (ch < 0x0080)
-            {
-                bOut.write(ch);
-            }
-            else if (ch < 0x0800)
-            {
-                bOut.write(0xc0 | (ch >> 6));
-                bOut.write(0x80 | (ch & 0x3f));
-            }
-            // surrogate pair
-            else if (ch >= 0xD800 && ch <= 0xDFFF)
-            {
-                // in error - can only happen, if the Java String class has a
-                // bug.
-                if (i + 1 >= c.length)
-                {
-                    throw new IllegalStateException("invalid UTF-16 codepoint");
-                }
-                char W1 = ch;
-                ch = c[++i];
-                char W2 = ch;
-                // in error - can only happen, if the Java String class has a
-                // bug.
-                if (W1 > 0xDBFF)
-                {
-                    throw new IllegalStateException("invalid UTF-16 codepoint");
-                }
-                int codePoint = (((W1 & 0x03FF) << 10) | (W2 & 0x03FF)) + 0x10000;
-                bOut.write(0xf0 | (codePoint >> 18));
-                bOut.write(0x80 | ((codePoint >> 12) & 0x3F));
-                bOut.write(0x80 | ((codePoint >> 6) & 0x3F));
-                bOut.write(0x80 | (codePoint & 0x3F));
-            }
-            else
-            {
-                bOut.write(0xe0 | (ch >> 12));
-                bOut.write(0x80 | ((ch >> 6) & 0x3F));
-                bOut.write(0x80 | (ch & 0x3F));
-            }
-
-            i++;
-        }
-        
-        return bOut.toByteArray();
-    }
-    
-    /**
-     * A locale independent version of toUpperCase.
-     * 
-     * @param string input to be converted
-     * @return a US Ascii uppercase version
-     */
-    public static String toUpperCase(String string)
-    {
-        boolean changed = false;
-        char[] chars = string.toCharArray();
-        
-        for (int i = 0; i != chars.length; i++)
-        {
-            char ch = chars[i];
-            if ('a' <= ch && 'z' >= ch)
-            {
-                changed = true;
-                chars[i] = (char)(ch - 'a' + 'A');
-            }
-        }
-        
-        if (changed)
-        {
-            return new String(chars);
-        }
-        
-        return string;
-    }
-    
-    /**
-     * A locale independent version of toLowerCase.
-     * 
-     * @param string input to be converted
-     * @return a US ASCII lowercase version
-     */
-    public static String toLowerCase(String string)
-    {
-        boolean changed = false;
-        char[] chars = string.toCharArray();
-        
-        for (int i = 0; i != chars.length; i++)
-        {
-            char ch = chars[i];
-            if ('A' <= ch && 'Z' >= ch)
-            {
-                changed = true;
-                chars[i] = (char)(ch - 'A' + 'a');
-            }
-        }
-        
-        if (changed)
-        {
-            return new String(chars);
-        }
-        
-        return string;
-    }
-
-    public static byte[] toByteArray(String string)
-    {
-        byte[] bytes = new byte[string.length()];
-
-        for (int i = 0; i != bytes.length; i++)
-        {
-            char ch = string.charAt(i);
-
-            bytes[i] = (byte)ch;
-        }
-
-        return bytes;
-    }
-
-    public static String[] split(String input, char delimiter)
-    {
-        Vector           v = new Vector();
-        boolean moreTokens = true;
-        String subString;
-
-        while (moreTokens)
-        {
-            int tokenLocation = input.indexOf(delimiter);
-            if (tokenLocation > 0)
-            {
-                subString = input.substring(0, tokenLocation);
-                v.addElement(subString);
-                input = input.substring(tokenLocation + 1);
-            }
-            else
-            {
-                moreTokens = false;
-                v.addElement(input);
-            }
-        }
-
-        String[] res = new String[v.size()];
-
-        for (int i = 0; i != res.length; i++)
-        {
-            res[i] = (String)v.elementAt(i);
-        }
-        return res;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/util/encoders/Base64.java b/azureus2/src/org/bouncycastle/util/encoders/Base64.java
deleted file mode 100644
index 5a352f0..0000000
--- a/azureus2/src/org/bouncycastle/util/encoders/Base64.java
+++ /dev/null
@@ -1,345 +0,0 @@
-package org.bouncycastle.util.encoders;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-public class Base64
-{
-	private static final byte[] encodingTable =
-		{
-		    (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
-            (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
-            (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
-            (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
-		    (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
-            (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
-            (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
-            (byte)'v',
-		    (byte)'w', (byte)'x', (byte)'y', (byte)'z',
-		    (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6',
-            (byte)'7', (byte)'8', (byte)'9',
-		    (byte)'+', (byte)'/'
-		};
-
-	/**
-	 * encode the input data producong a base 64 encoded byte array.
-	 *
-	 * @return a byte array containing the base 64 encoded data.
-	 */
-	public static byte[] encode(
-		byte[]	data)
-	{
-		byte[]	bytes;
-		
-		int modulus = data.length % 3;
-		if (modulus == 0)
-		{
-			bytes = new byte[4 * data.length / 3];
-		}
-		else
-		{
-			bytes = new byte[4 * ((data.length / 3) + 1)];
-		}
-
-        int dataLength = (data.length - modulus);
-		int a1, a2, a3;
-		for (int i = 0, j = 0; i < dataLength; i += 3, j += 4)
-		{
-			a1 = data[i] & 0xff;
-			a2 = data[i + 1] & 0xff;
-			a3 = data[i + 2] & 0xff;
-
-			bytes[j] = encodingTable[(a1 >>> 2) & 0x3f];
-			bytes[j + 1] = encodingTable[((a1 << 4) | (a2 >>> 4)) & 0x3f];
-			bytes[j + 2] = encodingTable[((a2 << 2) | (a3 >>> 6)) & 0x3f];
-			bytes[j + 3] = encodingTable[a3 & 0x3f];
-		}
-
-		/*
-		 * process the tail end.
-		 */
-		int	b1, b2, b3;
-		int	d1, d2;
-
-		switch (modulus)
-		{
-		case 0:		/* nothing left to do */
-			break;
-		case 1:
-			d1 = data[data.length - 1] & 0xff;
-			b1 = (d1 >>> 2) & 0x3f;
-			b2 = (d1 << 4) & 0x3f;
-
-			bytes[bytes.length - 4] = encodingTable[b1];
-			bytes[bytes.length - 3] = encodingTable[b2];
-			bytes[bytes.length - 2] = (byte)'=';
-			bytes[bytes.length - 1] = (byte)'=';
-			break;
-		case 2:
-			d1 = data[data.length - 2] & 0xff;
-			d2 = data[data.length - 1] & 0xff;
-
-			b1 = (d1 >>> 2) & 0x3f;
-			b2 = ((d1 << 4) | (d2 >>> 4)) & 0x3f;
-			b3 = (d2 << 2) & 0x3f;
-
-			bytes[bytes.length - 4] = encodingTable[b1];
-			bytes[bytes.length - 3] = encodingTable[b2];
-			bytes[bytes.length - 2] = encodingTable[b3];
-			bytes[bytes.length - 1] = (byte)'=';
-			break;
-		}
-
-		return bytes;
-	}
-
-	/*
-	 * set up the decoding table.
-	 */
-	private static final byte[] decodingTable;
-
-	static
-	{
-		decodingTable = new byte[128];
-
-		for (int i = 'A'; i <= 'Z'; i++)
-		{
-			decodingTable[i] = (byte)(i - 'A');
-		}
-
-		for (int i = 'a'; i <= 'z'; i++)
-		{
-			decodingTable[i] = (byte)(i - 'a' + 26);
-		}
-
-		for (int i = '0'; i <= '9'; i++)
-		{
-			decodingTable[i] = (byte)(i - '0' + 52);
-		}
-
-		decodingTable['+'] = 62;
-		decodingTable['/'] = 63;
-	}
-
-	/**
-	 * decode the base 64 encoded input data.
-	 *
-	 * @return a byte array representing the decoded data.
-	 */
-	public static byte[] decode(
-		byte[]	data)
-	{
-			// PARG - fix up for zero length encodes/decodes
-		
-		if ( data.length == 0 ){
-			return( data );
-		}
-		
-		byte[]	bytes;
-		byte	b1, b2, b3, b4;
-
-		if (data[data.length - 2] == '=')
-		{
-			bytes = new byte[(((data.length / 4) - 1) * 3) + 1];
-		}
-		else if (data[data.length - 1] == '=')
-		{
-			bytes = new byte[(((data.length / 4) - 1) * 3) + 2];
-		}
-		else
-		{
-			bytes = new byte[((data.length / 4) * 3)];
-		}
-
-		for (int i = 0, j = 0; i < data.length - 4; i += 4, j += 3)
-		{
-			b1 = decodingTable[data[i]];
-			b2 = decodingTable[data[i + 1]];
-			b3 = decodingTable[data[i + 2]];
-			b4 = decodingTable[data[i + 3]];
-
-			bytes[j] = (byte)((b1 << 2) | (b2 >> 4));
-			bytes[j + 1] = (byte)((b2 << 4) | (b3 >> 2));
-			bytes[j + 2] = (byte)((b3 << 6) | b4);
-		}
-
-		if (data[data.length - 2] == '=')
-		{
-			b1 = decodingTable[data[data.length - 4]];
-			b2 = decodingTable[data[data.length - 3]];
-
-			bytes[bytes.length - 1] = (byte)((b1 << 2) | (b2 >> 4));
-		}
-		else if (data[data.length - 1] == '=')
-		{
-			b1 = decodingTable[data[data.length - 4]];
-			b2 = decodingTable[data[data.length - 3]];
-			b3 = decodingTable[data[data.length - 2]];
-
-			bytes[bytes.length - 2] = (byte)((b1 << 2) | (b2 >> 4));
-			bytes[bytes.length - 1] = (byte)((b2 << 4) | (b3 >> 2));
-		}
-		else
-		{
-			b1 = decodingTable[data[data.length - 4]];
-			b2 = decodingTable[data[data.length - 3]];
-			b3 = decodingTable[data[data.length - 2]];
-			b4 = decodingTable[data[data.length - 1]];
-
-			bytes[bytes.length - 3] = (byte)((b1 << 2) | (b2 >> 4));
-			bytes[bytes.length - 2] = (byte)((b2 << 4) | (b3 >> 2));
-			bytes[bytes.length - 1] = (byte)((b3 << 6) | b4);
-		}
-
-		return bytes;
-	}
-
-	/**
-	 * decode the base 64 encoded String data.
-	 *
-	 * @return a byte array representing the decoded data.
-	 */
-	public static byte[] decode(
-		String	data)
-	{
-			// PARG - fix up for zero length encodes/decodes
-		
-		if ( data.length() == 0 ){
-			
-			return( new byte[0] );
-		}
-		
-		byte[]	bytes;
-		byte	b1, b2, b3, b4;
-
-		if (data.charAt(data.length() - 2) == '=')
-		{
-			bytes = new byte[(((data.length() / 4) - 1) * 3) + 1];
-		}
-		else if (data.charAt(data.length() - 1) == '=')
-		{
-			bytes = new byte[(((data.length() / 4) - 1) * 3) + 2];
-		}
-		else
-		{
-			bytes = new byte[((data.length() / 4) * 3)];
-		}
-
-		for (int i = 0, j = 0; i < data.length() - 4; i += 4, j += 3)
-		{
-			b1 = decodingTable[data.charAt(i)];
-			b2 = decodingTable[data.charAt(i + 1)];
-			b3 = decodingTable[data.charAt(i + 2)];
-			b4 = decodingTable[data.charAt(i + 3)];
-
-			bytes[j] = (byte)((b1 << 2) | (b2 >> 4));
-			bytes[j + 1] = (byte)((b2 << 4) | (b3 >> 2));
-			bytes[j + 2] = (byte)((b3 << 6) | b4);
-		}
-
-		if (data.charAt(data.length() - 2) == '=')
-		{
-			b1 = decodingTable[data.charAt(data.length() - 4)];
-			b2 = decodingTable[data.charAt(data.length() - 3)];
-
-			bytes[bytes.length - 1] = (byte)((b1 << 2) | (b2 >> 4));
-		}
-		else if (data.charAt(data.length() - 1) == '=')
-		{
-			b1 = decodingTable[data.charAt(data.length() - 4)];
-			b2 = decodingTable[data.charAt(data.length() - 3)];
-			b3 = decodingTable[data.charAt(data.length() - 2)];
-
-			bytes[bytes.length - 2] = (byte)((b1 << 2) | (b2 >> 4));
-			bytes[bytes.length - 1] = (byte)((b2 << 4) | (b3 >> 2));
-		}
-		else
-		{
-			b1 = decodingTable[data.charAt(data.length() - 4)];
-			b2 = decodingTable[data.charAt(data.length() - 3)];
-			b3 = decodingTable[data.charAt(data.length() - 2)];
-			b4 = decodingTable[data.charAt(data.length() - 1)];
-
-			bytes[bytes.length - 3] = (byte)((b1 << 2) | (b2 >> 4));
-			bytes[bytes.length - 2] = (byte)((b2 << 4) | (b3 >> 2));
-			bytes[bytes.length - 1] = (byte)((b3 << 6) | b4);
-		}
-
-		return bytes;
-	}
-	
-	/**
-	 * decode the base 64 encoded String data writing it to the given output stream
-	 *
-	 * @return the number of bytes produced.
-	 */
-	public static int decode(
-		String				data,
-		OutputStream	out) 
-		throws IOException
-	{
-			// PARG
-		if ( data.length()== 0 ){
-			
-			return( 0 );
-		}
-		
-		byte	b1, b2, b3, b4;
-		int		length;
-
-		if (data.charAt(data.length() - 2) == '=')
-		{
-			length = (((data.length() / 4) - 1) * 3) + 1;
-		}
-		else if (data.charAt(data.length() - 1) == '=')
-		{
-			length = (((data.length() / 4) - 1) * 3) + 2;
-		}
-		else
-		{
-			length = ((data.length() / 4) * 3);
-		}
-		
-		for (int i = 0, j = 0; i < data.length() - 4; i += 4, j += 3)
-		{
-			b1 = decodingTable[data.charAt(i)];
-			b2 = decodingTable[data.charAt(i + 1)];
-			b3 = decodingTable[data.charAt(i + 2)];
-			b4 = decodingTable[data.charAt(i + 3)];
-
-			out.write((b1 << 2) | (b2 >> 4));
-			out.write((b2 << 4) | (b3 >> 2));
-			out.write((b3 << 6) | b4);
-		}
-
-		if (data.charAt(data.length() - 2) == '=')
-		{
-			b1 = decodingTable[data.charAt(data.length() - 4)];
-			b2 = decodingTable[data.charAt(data.length() - 3)];
-
-			out.write((b1 << 2) | (b2 >> 4));
-		}
-		else if (data.charAt(data.length() - 1) == '=')
-		{
-			b1 = decodingTable[data.charAt(data.length() - 4)];
-			b2 = decodingTable[data.charAt(data.length() - 3)];
-			b3 = decodingTable[data.charAt(data.length() - 2)];
-
-			out.write((b1 << 2) | (b2 >> 4));
-			out.write((b2 << 4) | (b3 >> 2));
-		}
-		else
-		{
-			b1 = decodingTable[data.charAt(data.length() - 4)];
-			b2 = decodingTable[data.charAt(data.length() - 3)];
-			b3 = decodingTable[data.charAt(data.length() - 2)];
-			b4 = decodingTable[data.charAt(data.length() - 1)];
-
-			out.write((b1 << 2) | (b2 >> 4));
-			out.write((b2 << 4) | (b3 >> 2));
-			out.write((b3 << 6) | b4);
-		}
-
-		return length;
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/util/encoders/BufferedDecoder.java b/azureus2/src/org/bouncycastle/util/encoders/BufferedDecoder.java
deleted file mode 100644
index 9df63c4..0000000
--- a/azureus2/src/org/bouncycastle/util/encoders/BufferedDecoder.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.bouncycastle.util.encoders;
-
-
-/**
- * a buffering class to allow translation from one format to another to
- * be done in discrete chunks.
- */
-public class BufferedDecoder
-{
-	protected byte[]        buf;
-	protected int           bufOff;
-
-    protected Translator    translator;
-
-    /**
-     * @param translator the translator to use.
-     * @param bufSize amount of input to buffer for each chunk.
-     */
-	public BufferedDecoder(
-        Translator  translator,
-        int         bufSize)
-	{
-        this.translator = translator;
-
-        if ((bufSize % translator.getEncodedBlockSize()) != 0)
-        {
-            throw new IllegalArgumentException("buffer size not multiple of input block size");
-        }
-
-        buf = new byte[bufSize];
-        bufOff = 0;
-	}
-
-	public int processByte(
-        byte        in,
-		byte[]      out,
-		int         outOff)
-    {
-        int         resultLen = 0;
-
-        buf[bufOff++] = in;
-
-        if (bufOff == buf.length)
-        {
-            resultLen = translator.decode(buf, 0, buf.length, out, outOff);
-            bufOff = 0;
-        }
-
-        return resultLen;
-    }
-
-	public int processBytes(
-		byte[]      in,
-		int         inOff,
-		int         len,
-		byte[]      out,
-		int         outOff)
-	{
-        if (len < 0)
-        {
-            throw new IllegalArgumentException("Can't have a negative input length!");
-        }
-
-		int resultLen = 0;
-        int gapLen = buf.length - bufOff;
-
-        if (len > gapLen)
-        {
-            System.arraycopy(in, inOff, buf, bufOff, gapLen);
-
-            resultLen += translator.decode(buf, 0, buf.length, out, outOff);
-
-            bufOff = 0;
-
-            len -= gapLen;
-            inOff += gapLen;
-            outOff += resultLen;
-
-            int chunkSize = len - (len % buf.length);
-
-            resultLen += translator.decode(in, inOff, chunkSize, out, outOff);
-
-            len -= chunkSize;
-            inOff += chunkSize;
-        }
-
-        if (len != 0)
-        {
-            System.arraycopy(in, inOff, buf, bufOff, len);
-
-            bufOff += len;
-        }
-
-        return resultLen;
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/util/encoders/BufferedEncoder.java b/azureus2/src/org/bouncycastle/util/encoders/BufferedEncoder.java
deleted file mode 100644
index 1db8a05..0000000
--- a/azureus2/src/org/bouncycastle/util/encoders/BufferedEncoder.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.bouncycastle.util.encoders;
-
-
-/**
- * a buffering class to allow translation from one format to another to
- * be done in discrete chunks.
- */
-public class BufferedEncoder
-{
-	protected byte[]        buf;
-	protected int           bufOff;
-
-    protected Translator    translator;
-
-    /**
-     * @param translator the translator to use.
-     * @param bufSize amount of input to buffer for each chunk.
-     */
-	public BufferedEncoder(
-        Translator  translator,
-        int         bufSize)
-	{
-        this.translator = translator;
-
-        if ((bufSize % translator.getEncodedBlockSize()) != 0)
-        {
-            throw new IllegalArgumentException("buffer size not multiple of input block size");
-        }
-
-        buf = new byte[bufSize];
-        bufOff = 0;
-	}
-
-	public int processByte(
-        byte        in,
-		byte[]      out,
-		int         outOff)
-    {
-        int         resultLen = 0;
-
-        buf[bufOff++] = in;
-
-        if (bufOff == buf.length)
-        {
-            resultLen = translator.encode(buf, 0, buf.length, out, outOff);
-            bufOff = 0;
-        }
-
-        return resultLen;
-    }
-
-	public int processBytes(
-		byte[]      in,
-		int         inOff,
-		int         len,
-		byte[]      out,
-		int         outOff)
-	{
-        if (len < 0)
-        {
-            throw new IllegalArgumentException("Can't have a negative input length!");
-        }
-
-		int resultLen = 0;
-        int gapLen = buf.length - bufOff;
-
-        if (len > gapLen)
-        {
-            System.arraycopy(in, inOff, buf, bufOff, gapLen);
-
-            resultLen += translator.encode(buf, 0, buf.length, out, outOff);
-
-            bufOff = 0;
-
-            len -= gapLen;
-            inOff += gapLen;
-            outOff += resultLen;
-
-            int chunkSize = len - (len % buf.length);
-
-            resultLen += translator.encode(in, inOff, chunkSize, out, outOff);
-
-            len -= chunkSize;
-            inOff += chunkSize;
-        }
-
-        if (len != 0)
-        {
-            System.arraycopy(in, inOff, buf, bufOff, len);
-
-            bufOff += len;
-        }
-
-        return resultLen;
-	}
-}
diff --git a/azureus2/src/org/bouncycastle/util/encoders/Hex.java b/azureus2/src/org/bouncycastle/util/encoders/Hex.java
deleted file mode 100644
index d2bc3f7..0000000
--- a/azureus2/src/org/bouncycastle/util/encoders/Hex.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.bouncycastle.util.encoders;
-
-/**
- * Converters for going from hex to binary and back.
- * <p>
- * Note: this class assumes ASCII processing.
- */
-public class Hex
-{
-    private static HexTranslator   encoder = new HexTranslator();
-
-    private static final byte[]   hexTable = 
-        { 
-            (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7',
-            (byte)'8', (byte)'9', (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f'
-        };
-
-    public static byte[] encode(
-        byte[]  array)
-    {
-        return encode(array, 0, array.length);
-    }
-
-    public static byte[] encode(
-        byte[]  array,
-        int     off,
-        int     length)
-    {
-        byte[]      enc = new byte[length * 2];
-
-        encoder.encode(array, off, length, enc, 0);
-
-        return enc;
-    }
-
-    public static byte[] decode(
-        String  string)
-    {
-        byte[]          bytes = new byte[string.length() / 2];
-        String          buf = string.toLowerCase();
-		
-        for (int i = 0; i < buf.length(); i += 2)
-        {
-			char    left  = buf.charAt(i);
-			char    right = buf.charAt(i+1);
-            int     index = i / 2;
-			
-            if (left < 'a')
-            {
-                bytes[index] = (byte)((left - '0') << 4);
-            }
-            else
-            {
-                bytes[index] = (byte)((left - 'a' + 10) << 4);
-            }
-            if (right < 'a')
-            {
-                bytes[index] += (byte)(right - '0');
-            }
-            else
-            {
-                bytes[index] += (byte)(right - 'a' + 10);
-            }
-        }
-
-        return bytes;
-    }
-
-    public static byte[] decode(
-        byte[]  array)
-    {
-        byte[]          bytes = new byte[array.length / 2];
-
-        encoder.decode(array, 0, array.length, bytes, 0);
-
-        return bytes;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/util/encoders/HexTranslator.java b/azureus2/src/org/bouncycastle/util/encoders/HexTranslator.java
deleted file mode 100644
index a306102..0000000
--- a/azureus2/src/org/bouncycastle/util/encoders/HexTranslator.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.bouncycastle.util.encoders;
-
-/**
- * Converters for going from hex to binary and back. Note: this class assumes ASCII processing.
- */
-public class HexTranslator
-    implements Translator
-{
-    private static final byte[]   hexTable = 
-        { 
-            (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7',
-            (byte)'8', (byte)'9', (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f'
-        };
-
-    /**
-     * size of the output block on encoding produced by getDecodedBlockSize()
-     * bytes.
-     */
-    public int getEncodedBlockSize()
-    {
-        return 2;
-    }
-
-    public int encode(
-        byte[]  in,
-        int     inOff,
-        int     length,
-        byte[]  out,
-        int     outOff)
-    {
-        for (int i = 0, j = 0; i < length; i++, j += 2)
-        {
-            out[outOff + j] = hexTable[(in[inOff] >> 4) & 0x0f];
-            out[outOff + j + 1] = hexTable[in[inOff] & 0x0f];
-
-            inOff++;
-        }
-
-        return length * 2;
-    }
-
-    /**
-     * size of the output block on decoding produced by getEncodedBlockSize()
-     * bytes.
-     */
-    public int getDecodedBlockSize()
-    {
-        return 1;
-    }
-
-    public int decode(
-        byte[]  in,
-        int     inOff,
-        int     length,
-        byte[]  out,
-        int     outOff)
-    {
-		int halfLength = length / 2;
-		byte left, right;
-        for (int i = 0; i < halfLength; i++)
-        {
-			left  = in[inOff + i * 2];
-			right = in[inOff + i * 2 + 1];
-			
-            if (left < (byte)'a')
-            {
-                out[outOff] = (byte)((left - '0') << 4);
-            }
-            else
-            {
-                out[outOff] = (byte)((left - 'a' + 10) << 4);
-            }
-            if (right < (byte)'a')
-            {
-                out[outOff] += (byte)(right - '0');
-            }
-            else
-            {
-                out[outOff] += (byte)(right - 'a' + 10);
-            }
-
-            outOff++;
-        }
-
-        return halfLength;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/util/encoders/Translator.java b/azureus2/src/org/bouncycastle/util/encoders/Translator.java
deleted file mode 100644
index a3a0cb8..0000000
--- a/azureus2/src/org/bouncycastle/util/encoders/Translator.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.bouncycastle.util.encoders;
-
-/**
- * general interface for an translator.
- */
-public interface Translator
-{
-    /**
-     * size of the output block on encoding produced by getDecodedBlockSize()
-     * bytes.
-     */
-    public int getEncodedBlockSize();
-
-    public int encode(byte[] in, int inOff, int length, byte[] out, int outOff);
-
-    /**
-     * size of the output block on decoding produced by getEncodedBlockSize()
-     * bytes.
-     */
-    public int getDecodedBlockSize();
-
-    public int decode(byte[] in, int inOff, int length, byte[] out, int outOff);
-}
diff --git a/azureus2/src/org/bouncycastle/x509/AttributeCertificateHolder.java b/azureus2/src/org/bouncycastle/x509/AttributeCertificateHolder.java
deleted file mode 100644
index 6f8bba5..0000000
--- a/azureus2/src/org/bouncycastle/x509/AttributeCertificateHolder.java
+++ /dev/null
@@ -1,419 +0,0 @@
-package org.bouncycastle.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-import org.bouncycastle.asn1.x509.GeneralName;
-import org.bouncycastle.asn1.x509.GeneralNames;
-import org.bouncycastle.asn1.x509.Holder;
-import org.bouncycastle.asn1.x509.IssuerSerial;
-import org.bouncycastle.asn1.x509.ObjectDigestInfo;
-import org.bouncycastle.jce.PrincipalUtil;
-import org.bouncycastle.jce.X509Principal;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.bouncycastle.util.Arrays;
-import org.bouncycastle.util.Selector;
-
-import javax.security.auth.x500.X500Principal;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.MessageDigest;
-import java.security.Principal;
-import java.security.cert.CertSelector;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateEncodingException;
-import java.security.cert.CertificateParsingException;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * The Holder object.
- * 
- * <pre>
- *          Holder ::= SEQUENCE {
- *                baseCertificateID   [0] IssuerSerial OPTIONAL,
- *                         -- the issuer and serial number of
- *                         -- the holder's Public Key Certificate
- *                entityName          [1] GeneralNames OPTIONAL,
- *                         -- the name of the claimant or role
- *                objectDigestInfo    [2] ObjectDigestInfo OPTIONAL
- *                         -- used to directly authenticate the holder,
- *                         -- for example, an executable
- *          }
- * </pre>
- * 
- */
-public class AttributeCertificateHolder
-    implements CertSelector, Selector
-{
-    final Holder holder;
-
-    AttributeCertificateHolder(ASN1Sequence seq)
-    {
-        holder = Holder.getInstance(seq);
-    }
-
-    public AttributeCertificateHolder(X509Principal issuerName,
-        BigInteger serialNumber)
-    {
-        holder = new org.bouncycastle.asn1.x509.Holder(new IssuerSerial(
-            new GeneralNames(new DERSequence(new GeneralName(issuerName))),
-            new DERInteger(serialNumber)));
-    }
-
-    public AttributeCertificateHolder(X500Principal issuerName,
-        BigInteger serialNumber)
-    {
-        this(X509Util.convertPrincipal(issuerName), serialNumber);
-    }
-
-    public AttributeCertificateHolder(X509Certificate cert)
-        throws CertificateParsingException
-    {
-        X509Principal name;
-
-        try
-        {
-            name = PrincipalUtil.getIssuerX509Principal(cert);
-        }
-        catch (Exception e)
-        {
-            throw new CertificateParsingException(e.getMessage());
-        }
-
-        holder = new Holder(new IssuerSerial(generateGeneralNames(name),
-            new DERInteger(cert.getSerialNumber())));
-    }
-
-    public AttributeCertificateHolder(X509Principal principal)
-    {
-        holder = new Holder(generateGeneralNames(principal));
-    }
-
-    public AttributeCertificateHolder(X500Principal principal)
-    {
-        this(X509Util.convertPrincipal(principal));
-    }
-
-    /**
-     * Constructs a holder for v2 attribute certificates with a hash value for
-     * some type of object.
-     * <p>
-     * <code>digestedObjectType</code> can be one of the following:
-     * <ul>
-     * <li>0 - publicKey - A hash of the public key of the holder must be
-     * passed.
-     * <li>1 - publicKeyCert - A hash of the public key certificate of the
-     * holder must be passed.
-     * <li>2 - otherObjectDigest - A hash of some other object type must be
-     * passed. <code>otherObjectTypeID</code> must not be empty.
-     * </ul>
-     * <p>
-     * This cannot be used if a v1 attribute certificate is used.
-     * 
-     * @param digestedObjectType The digest object type.
-     * @param digestAlgorithm The algorithm identifier for the hash.
-     * @param otherObjectTypeID The object type ID if
-     *            <code>digestedObjectType</code> is
-     *            <code>otherObjectDigest</code>.
-     * @param objectDigest The hash value.
-     */
-    public AttributeCertificateHolder(int digestedObjectType,
-        String digestAlgorithm, String otherObjectTypeID, byte[] objectDigest)
-    {
-        holder = new Holder(new ObjectDigestInfo(digestedObjectType,
-            otherObjectTypeID, new AlgorithmIdentifier(digestAlgorithm), Arrays
-                .clone(objectDigest)));
-    }
-
-    /**
-     * Returns the digest object type if an object digest info is used.
-     * <p>
-     * <ul>
-     * <li>0 - publicKey - A hash of the public key of the holder must be
-     * passed.
-     * <li>1 - publicKeyCert - A hash of the public key certificate of the
-     * holder must be passed.
-     * <li>2 - otherObjectDigest - A hash of some other object type must be
-     * passed. <code>otherObjectTypeID</code> must not be empty.
-     * </ul>
-     * 
-     * @return The digest object type or -1 if no object digest info is set.
-     */
-    public int getDigestedObjectType()
-    {
-        if (holder.getObjectDigestInfo() != null)
-        {
-            return holder.getObjectDigestInfo().getDigestedObjectType()
-                .getValue().intValue();
-        }
-        return -1;
-    }
-
-    /**
-     * Returns the other object type ID if an object digest info is used.
-     * 
-     * @return The other object type ID or <code>null</code> if no object
-     *         digest info is set.
-     */
-    public String getDigestAlgorithm()
-    {
-        if (holder.getObjectDigestInfo() != null)
-        {
-            holder.getObjectDigestInfo().getDigestAlgorithm().getObjectId()
-                .getId();
-        }
-        return null;
-    }
-
-    /**
-     * Returns the hash if an object digest info is used.
-     * 
-     * @return The hash or <code>null</code> if no object digest info is set.
-     */
-    public byte[] getObjectDigest()
-    {
-        if (holder.getObjectDigestInfo() != null)
-        {
-            holder.getObjectDigestInfo().getObjectDigest().getBytes();
-        }
-        return null;
-    }
-
-    /**
-     * Returns the digest algorithm ID if an object digest info is used.
-     * 
-     * @return The digest algorithm ID or <code>null</code> if no object
-     *         digest info is set.
-     */
-    public String getOtherObjectTypeID()
-    {
-        if (holder.getObjectDigestInfo() != null)
-        {
-            holder.getObjectDigestInfo().getOtherObjectTypeID().getId();
-        }
-        return null;
-    }
-
-    private GeneralNames generateGeneralNames(X509Principal principal)
-    {
-        return new GeneralNames(new DERSequence(new GeneralName(principal)));
-    }
-
-    private boolean matchesDN(X509Principal subject, GeneralNames targets)
-    {
-        GeneralName[] names = targets.getNames();
-
-        for (int i = 0; i != names.length; i++)
-        {
-            GeneralName gn = names[i];
-
-            if (gn.getTagNo() == GeneralName.directoryName)
-            {
-                try
-                {
-                    if (new X509Principal(((ASN1Encodable)gn.getName())
-                        .getEncoded()).equals(subject))
-                    {
-                        return true;
-                    }
-                }
-                catch (IOException e)
-                {
-                }
-            }
-        }
-
-        return false;
-    }
-
-    private Object[] getNames(GeneralName[] names)
-    {
-        List l = new ArrayList(names.length);
-
-        for (int i = 0; i != names.length; i++)
-        {
-            if (names[i].getTagNo() == GeneralName.directoryName)
-            {
-                try
-                {
-                    l.add(new X500Principal(
-                        ((ASN1Encodable)names[i].getName()).getEncoded()));
-                }
-                catch (IOException e)
-                {
-                    throw new RuntimeException("badly formed Name object");
-                }
-            }
-        }
-
-        return l.toArray(new Object[l.size()]);
-    }
-
-    private Principal[] getPrincipals(GeneralNames names)
-    {
-        Object[] p = this.getNames(names.getNames());
-        List l = new ArrayList();
-
-        for (int i = 0; i != p.length; i++)
-        {
-            if (p[i] instanceof Principal)
-            {
-                l.add(p[i]);
-            }
-        }
-
-        return (Principal[])l.toArray(new Principal[l.size()]);
-    }
-
-    /**
-     * Return any principal objects inside the attribute certificate holder
-     * entity names field.
-     * 
-     * @return an array of Principal objects (usually X500Principal), null if no
-     *         entity names field is set.
-     */
-    public Principal[] getEntityNames()
-    {
-        if (holder.getEntityName() != null)
-        {
-            return getPrincipals(holder.getEntityName());
-        }
-
-        return null;
-    }
-
-    /**
-     * Return the principals associated with the issuer attached to this holder
-     * 
-     * @return an array of principals, null if no BaseCertificateID is set.
-     */
-    public Principal[] getIssuer()
-    {
-        if (holder.getBaseCertificateID() != null)
-        {
-            return getPrincipals(holder.getBaseCertificateID().getIssuer());
-        }
-
-        return null;
-    }
-
-    /**
-     * Return the serial number associated with the issuer attached to this
-     * holder.
-     * 
-     * @return the certificate serial number, null if no BaseCertificateID is
-     *         set.
-     */
-    public BigInteger getSerialNumber()
-    {
-        if (holder.getBaseCertificateID() != null)
-        {
-            return holder.getBaseCertificateID().getSerial().getValue();
-        }
-
-        return null;
-    }
-
-    public Object clone()
-    {
-        return new AttributeCertificateHolder((ASN1Sequence)holder
-            .toASN1Object());
-    }
-
-    public boolean match(Certificate cert)
-    {
-        if (!(cert instanceof X509Certificate))
-        {
-            return false;
-        }
-
-        X509Certificate x509Cert = (X509Certificate)cert;
-
-        try
-        {
-            if (holder.getBaseCertificateID() != null)
-            {
-                return holder.getBaseCertificateID().getSerial().getValue().equals(x509Cert.getSerialNumber())
-                    && matchesDN(PrincipalUtil.getIssuerX509Principal(x509Cert), holder.getBaseCertificateID().getIssuer());
-            }
-
-            if (holder.getEntityName() != null)
-            {
-                if (matchesDN(PrincipalUtil.getSubjectX509Principal(x509Cert),
-                    holder.getEntityName()))
-                {
-                    return true;
-                }
-            }
-            if (holder.getObjectDigestInfo() != null)
-            {
-                MessageDigest md = null;
-                try
-                {
-                    md = MessageDigest.getInstance(getDigestAlgorithm(), BouncyCastleProvider.PROVIDER_NAME);
-
-                }
-                catch (Exception e)
-                {
-                    return false;
-                }
-                switch (getDigestedObjectType())
-                {
-                case ObjectDigestInfo.publicKey:
-                    // TODO: DSA Dss-parms
-                    md.update(cert.getPublicKey().getEncoded());
-                    break;
-                case ObjectDigestInfo.publicKeyCert:
-                    md.update(cert.getEncoded());
-                    break;
-                }
-                if (!Arrays.areEqual(md.digest(), getObjectDigest()))
-                {
-                    return false;
-                }
-            }
-        }
-        catch (CertificateEncodingException e)
-        {
-            return false;
-        }
-
-        return false;
-    }
-
-    public boolean equals(Object obj)
-    {
-        if (obj == this)
-        {
-            return true;
-        }
-
-        if (!(obj instanceof AttributeCertificateHolder))
-        {
-            return false;
-        }
-
-        AttributeCertificateHolder other = (AttributeCertificateHolder)obj;
-
-        return this.holder.equals(other.holder);
-    }
-
-    public int hashCode()
-    {
-        return this.holder.hashCode();
-    }
-
-    public boolean match(Object obj)
-    {
-        if (!(obj instanceof X509Certificate))
-        {
-            return false;
-        }
-
-        return match((Certificate)obj);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/x509/AttributeCertificateIssuer.java b/azureus2/src/org/bouncycastle/x509/AttributeCertificateIssuer.java
deleted file mode 100644
index c20e0d9..0000000
--- a/azureus2/src/org/bouncycastle/x509/AttributeCertificateIssuer.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package org.bouncycastle.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.DERSequence;
-import org.bouncycastle.asn1.x509.AttCertIssuer;
-import org.bouncycastle.asn1.x509.GeneralName;
-import org.bouncycastle.asn1.x509.GeneralNames;
-import org.bouncycastle.asn1.x509.V2Form;
-import org.bouncycastle.jce.X509Principal;
-import org.bouncycastle.util.Selector;
-
-import javax.security.auth.x500.X500Principal;
-import java.io.IOException;
-import java.security.Principal;
-import java.security.cert.CertSelector;
-import java.security.cert.Certificate;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Carrying class for an attribute certificate issuer.
- */
-public class AttributeCertificateIssuer
-    implements CertSelector, Selector
-{
-    final ASN1Encodable form;
-
-    /**
-     * Set the issuer directly with the ASN.1 structure.
-     * 
-     * @param issuer The issuer
-     */
-    AttributeCertificateIssuer(AttCertIssuer issuer)
-    {
-        form = issuer.getIssuer();
-    }
-
-    public AttributeCertificateIssuer(X500Principal principal)
-        throws IOException
-    {
-        this(new X509Principal(principal.getEncoded()));
-    }
-
-    public AttributeCertificateIssuer(X509Principal principal)
-    {
-        form = new V2Form(new GeneralNames(new DERSequence(new GeneralName(principal))));
-    }
-
-    private Object[] getNames()
-    {
-        GeneralNames name;
-
-        if (form instanceof V2Form)
-        {
-            name = ((V2Form)form).getIssuerName();
-        }
-        else
-        {
-            name = (GeneralNames)form;
-        }
-
-        GeneralName[] names = name.getNames();
-
-        List l = new ArrayList(names.length);
-
-        for (int i = 0; i != names.length; i++)
-        {
-            if (names[i].getTagNo() == GeneralName.directoryName)
-            {
-                try
-                {
-                    l.add(new X500Principal(
-                        ((ASN1Encodable)names[i].getName()).getEncoded()));
-                }
-                catch (IOException e)
-                {
-                    throw new RuntimeException("badly formed Name object");
-                }
-            }
-        }
-
-        return l.toArray(new Object[l.size()]);
-    }
-
-    /**
-     * Return any principal objects inside the attribute certificate issuer
-     * object.
-     * 
-     * @return an array of Principal objects (usually X500Principal)
-     */
-    public Principal[] getPrincipals()
-    {
-        Object[] p = this.getNames();
-        List l = new ArrayList();
-
-        for (int i = 0; i != p.length; i++)
-        {
-            if (p[i] instanceof Principal)
-            {
-                l.add(p[i]);
-            }
-        }
-
-        return (Principal[])l.toArray(new Principal[l.size()]);
-    }
-
-    private boolean matchesDN(X500Principal subject, GeneralNames targets)
-    {
-        GeneralName[] names = targets.getNames();
-
-        for (int i = 0; i != names.length; i++)
-        {
-            GeneralName gn = names[i];
-
-            if (gn.getTagNo() == GeneralName.directoryName)
-            {
-                try
-                {
-                    if (new X500Principal(((ASN1Encodable)gn.getName()).getEncoded()).equals(subject))
-                    {
-                        return true;
-                    }
-                }
-                catch (IOException e)
-                {
-                }
-            }
-        }
-
-        return false;
-    }
-
-    public Object clone()
-    {
-        return new AttributeCertificateIssuer(AttCertIssuer.getInstance(form));
-    }
-
-    public boolean match(Certificate cert)
-    {
-        if (!(cert instanceof X509Certificate))
-        {
-            return false;
-        }
-
-        X509Certificate x509Cert = (X509Certificate)cert;
-
-        if (form instanceof V2Form)
-        {
-            V2Form issuer = (V2Form)form;
-            if (issuer.getBaseCertificateID() != null)
-            {
-                return issuer.getBaseCertificateID().getSerial().getValue().equals(x509Cert.getSerialNumber())
-                    && matchesDN(x509Cert.getIssuerX500Principal(), issuer.getBaseCertificateID().getIssuer());
-            }
-
-            GeneralNames name = issuer.getIssuerName();
-            if (matchesDN(x509Cert.getSubjectX500Principal(), name))
-            {
-                return true;
-            }
-        }
-        else
-        {
-            GeneralNames name = (GeneralNames)form;
-            if (matchesDN(x509Cert.getSubjectX500Principal(), name))
-            {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    public boolean equals(Object obj)
-    {
-        if (obj == this)
-        {
-            return true;
-        }
-
-        if (!(obj instanceof AttributeCertificateIssuer))
-        {
-            return false;
-        }
-
-        AttributeCertificateIssuer other = (AttributeCertificateIssuer)obj;
-
-        return this.form.equals(other.form);
-    }
-
-    public int hashCode()
-    {
-        return this.form.hashCode();
-    }
-
-    public boolean match(Object obj)
-    {
-        if (!(obj instanceof X509Certificate))
-        {
-            return false;
-        }
-
-        return match((Certificate)obj);
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/x509/X509Attribute.java b/azureus2/src/org/bouncycastle/x509/X509Attribute.java
deleted file mode 100644
index f4c65ab..0000000
--- a/azureus2/src/org/bouncycastle/x509/X509Attribute.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.bouncycastle.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1EncodableVector;
-import org.bouncycastle.asn1.ASN1Set;
-import org.bouncycastle.asn1.DERObject;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DERSet;
-import org.bouncycastle.asn1.x509.Attribute;
-
-/**
- * Class for carrying the values in an X.509 Attribute.
- */
-public class X509Attribute
-    extends ASN1Encodable
-{
-    Attribute    attr;
-    
-    /**
-     * @param at an object representing an attribute.
-     */
-    X509Attribute(
-        ASN1Encodable   at)
-    {
-        this.attr = Attribute.getInstance(at);
-    }
-
-    /**
-     * Create an X.509 Attribute with the type given by the passed in oid and
-     * the value represented by an ASN.1 Set containing value.
-     * 
-     * @param oid type of the attribute
-     * @param value value object to go into the atribute's value set.
-     */
-    public X509Attribute(
-        String          oid,
-        ASN1Encodable   value)
-    {
-        this.attr = new Attribute(new DERObjectIdentifier(oid), new DERSet(value));
-    }
-    
-    /**
-     * Create an X.59 Attribute with the type given by the passed in oid and the
-     * value represented by an ASN.1 Set containing the objects in value.
-     * 
-     * @param oid type of the attribute
-     * @param value vector of values to go in the attribute's value set.
-     */
-    public X509Attribute(
-        String              oid,
-        ASN1EncodableVector value)
-    {
-        this.attr = new Attribute(new DERObjectIdentifier(oid), new DERSet(value));
-    }
-    
-    public String getOID()
-    {
-        return attr.getAttrType().getId();
-    }
-    
-    public ASN1Encodable[] getValues()
-    {
-        ASN1Set         s = attr.getAttrValues();
-        ASN1Encodable[] values = new ASN1Encodable[s.size()];
-        
-        for (int i = 0; i != s.size(); i++)
-        {
-            values[i] = (ASN1Encodable)s.getObjectAt(i);
-        }
-        
-        return values;
-    }
-    
-    public DERObject toASN1Object()
-    {
-        return attr.toASN1Object();
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/x509/X509AttributeCertificate.java b/azureus2/src/org/bouncycastle/x509/X509AttributeCertificate.java
deleted file mode 100644
index 48a825f..0000000
--- a/azureus2/src/org/bouncycastle/x509/X509AttributeCertificate.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.bouncycastle.x509;
-
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.PublicKey;
-import java.security.SignatureException;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateExpiredException;
-import java.security.cert.CertificateNotYetValidException;
-import java.security.cert.X509Extension;
-import java.util.Date;
-
-/**
- * Interface for an X.509 Attribute Certificate.
- */
-public interface X509AttributeCertificate
-    extends X509Extension
-{   
-    /**
-     * Return the version number for the certificate.
-     * 
-     * @return the version number.
-     */
-    public int getVersion();
-    
-    /**
-     * Return the serial number for the certificate.
-     * 
-     * @return the serial number.
-     */
-    public BigInteger getSerialNumber();
-    
-    /**
-     * Return the date before which the certificate is not valid.
-     * 
-     * @return the "not valid before" date.
-     */
-    public Date getNotBefore();
-    
-    /**
-     * Return the date after which the certificate is not valid.
-     * 
-     * @return the "not valid afer" date.
-     */
-    public Date getNotAfter();
-    
-    /**
-     * Return the holder of the certificate.
-     * 
-     * @return the holder.
-     */
-    public AttributeCertificateHolder getHolder();
-    
-    /**
-     * Return the issuer details for the certificate.
-     * 
-     * @return the issuer details.
-     */
-    public AttributeCertificateIssuer getIssuer();
-    
-    /**
-     * Return the attributes contained in the attribute block in the certificate.
-     * 
-     * @return an array of attributes.
-     */
-    public X509Attribute[] getAttributes();
-    
-    /**
-     * Return the attributes with the same type as the passed in oid.
-     * 
-     * @param oid the object identifier we wish to match.
-     * @return an array of matched attributes, null if there is no match.
-     */
-    public X509Attribute[] getAttributes(String oid);
-    
-    public boolean[] getIssuerUniqueID();
-    
-    public void checkValidity()
-        throws CertificateExpiredException, CertificateNotYetValidException;
-    
-    public void checkValidity(Date date)
-        throws CertificateExpiredException, CertificateNotYetValidException;
-    
-    public byte[] getSignature();
-    
-    public void verify(PublicKey key, String provider)
-            throws CertificateException, NoSuchAlgorithmException,
-            InvalidKeyException, NoSuchProviderException, SignatureException;
-    
-    /**
-     * Return an ASN.1 encoded byte array representing the attribute certificate.
-     * 
-     * @return an ASN.1 encoded byte array.
-     * @throws IOException if the certificate cannot be encoded.
-     */
-    public byte[] getEncoded()
-        throws IOException;
-}
diff --git a/azureus2/src/org/bouncycastle/x509/X509Util.java b/azureus2/src/org/bouncycastle/x509/X509Util.java
deleted file mode 100644
index 6a9a4ec..0000000
--- a/azureus2/src/org/bouncycastle/x509/X509Util.java
+++ /dev/null
@@ -1,411 +0,0 @@
-package org.bouncycastle.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.DEREncodable;
-import org.bouncycastle.asn1.DERInteger;
-import org.bouncycastle.asn1.DERNull;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-//import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers;
-//import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
-//import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
-import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
-//import org.bouncycastle.asn1.pkcs.RSASSAPSSparams;
-import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers;
-import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
-import org.bouncycastle.asn1.x9.X9ObjectIdentifiers;
-import org.bouncycastle.jce.X509Principal;
-import org.bouncycastle.util.Strings;
-
-import javax.security.auth.x500.X500Principal;
-import java.io.IOException;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.PrivateKey;
-import java.security.Provider;
-import java.security.SecureRandom;
-import java.security.Security;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-class X509Util
-{
-    private static Hashtable algorithms = new Hashtable();
-    private static Hashtable params = new Hashtable();
-    private static Set       noParams = new HashSet();
-    
-    static
-    {   
-        algorithms.put("MD2WITHRSAENCRYPTION", PKCSObjectIdentifiers.md2WithRSAEncryption);
-        algorithms.put("MD2WITHRSA", PKCSObjectIdentifiers.md2WithRSAEncryption);
-        algorithms.put("MD5WITHRSAENCRYPTION", PKCSObjectIdentifiers.md5WithRSAEncryption);
-        algorithms.put("MD5WITHRSA", PKCSObjectIdentifiers.md5WithRSAEncryption);
-        algorithms.put("SHA1WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha1WithRSAEncryption);
-        algorithms.put("SHA1WITHRSA", PKCSObjectIdentifiers.sha1WithRSAEncryption);
-     //   algorithms.put("SHA224WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha224WithRSAEncryption);
-     //   algorithms.put("SHA224WITHRSA", PKCSObjectIdentifiers.sha224WithRSAEncryption);
-        algorithms.put("SHA256WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha256WithRSAEncryption);
-        algorithms.put("SHA256WITHRSA", PKCSObjectIdentifiers.sha256WithRSAEncryption);
-        algorithms.put("SHA384WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha384WithRSAEncryption);
-        algorithms.put("SHA384WITHRSA", PKCSObjectIdentifiers.sha384WithRSAEncryption);
-        algorithms.put("SHA512WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha512WithRSAEncryption);
-        algorithms.put("SHA512WITHRSA", PKCSObjectIdentifiers.sha512WithRSAEncryption);
-    //    algorithms.put("SHA1WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS);
-    //    algorithms.put("SHA224WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS);
-    //    algorithms.put("SHA256WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS);
-    //    algorithms.put("SHA384WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS);
-    //    algorithms.put("SHA512WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS);
-        algorithms.put("RIPEMD160WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160);
-        algorithms.put("RIPEMD160WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160);
-        algorithms.put("RIPEMD128WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128);
-        algorithms.put("RIPEMD128WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128);
-        algorithms.put("RIPEMD256WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256);
-        algorithms.put("RIPEMD256WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256);
-        algorithms.put("SHA1WITHDSA", X9ObjectIdentifiers.id_dsa_with_sha1);
-        algorithms.put("DSAWITHSHA1", X9ObjectIdentifiers.id_dsa_with_sha1);
-    //    algorithms.put("SHA224WITHDSA", NISTObjectIdentifiers.dsa_with_sha224);
-    //    algorithms.put("SHA256WITHDSA", NISTObjectIdentifiers.dsa_with_sha256);
-        algorithms.put("SHA1WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA1);
-        algorithms.put("ECDSAWITHSHA1", X9ObjectIdentifiers.ecdsa_with_SHA1);
-    //    algorithms.put("SHA224WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA224);
-    //    algorithms.put("SHA256WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA256);
-    //    algorithms.put("SHA384WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA384);
-    //    algorithms.put("SHA512WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA512);
-    //    algorithms.put("GOST3411WITHGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94);
-    //    algorithms.put("GOST3411WITHGOST3410-94", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94);
-    //    algorithms.put("GOST3411WITHECGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001);
-    //    algorithms.put("GOST3411WITHECGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001);
-    //    algorithms.put("GOST3411WITHGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001);
-
-        //
-        // According to RFC 3279, the ASN.1 encoding SHALL (id-dsa-with-sha1) or MUST (ecdsa-with-SHA*) omit the parameters field. 
-        // The parameters field SHALL be NULL for RSA based signature algorithms.
-        //
-        noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA1);
-    //    noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA224);
-    //    noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA256);
-    //    noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA384);
-    //    noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA512);
-        noParams.add(X9ObjectIdentifiers.id_dsa_with_sha1);
-   //     noParams.add(NISTObjectIdentifiers.dsa_with_sha224);
-   //     noParams.add(NISTObjectIdentifiers.dsa_with_sha256);
-
-        //
-        // RFC 4491
-        //
-   //     noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94);
-   //     noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001);
-
-        //
-        // explicit params
-        //
-        /*
-        AlgorithmIdentifier sha1AlgId = new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1, new DERNull());
-        params.put("SHA1WITHRSAANDMGF1", creatPSSParams(sha1AlgId, 20));
-
-        AlgorithmIdentifier sha224AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha224, new DERNull());
-        params.put("SHA224WITHRSAANDMGF1", creatPSSParams(sha224AlgId, 28));
-
-        AlgorithmIdentifier sha256AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256, new DERNull());
-        params.put("SHA256WITHRSAANDMGF1", creatPSSParams(sha256AlgId, 32));
-
-        AlgorithmIdentifier sha384AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha384, new DERNull());
-        params.put("SHA384WITHRSAANDMGF1", creatPSSParams(sha384AlgId, 48));
-
-        AlgorithmIdentifier sha512AlgId = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha512, new DERNull());
-        params.put("SHA512WITHRSAANDMGF1", creatPSSParams(sha512AlgId, 64));
-        */
-    }
-
-    /* PARG - commented out a lot of these
-    private static RSASSAPSSparams creatPSSParams(AlgorithmIdentifier hashAlgId, int saltSize)
-    {
-        return new RSASSAPSSparams(
-            hashAlgId,
-            new AlgorithmIdentifier(PKCSObjectIdentifiers.id_mgf1, hashAlgId),
-            new DERInteger(saltSize),
-            new DERInteger(1));
-    }
-	*/
-    
-    static DERObjectIdentifier getAlgorithmOID(
-        String algorithmName)
-    {
-        algorithmName = Strings.toUpperCase(algorithmName);
-        
-        if (algorithms.containsKey(algorithmName))
-        {
-            return (DERObjectIdentifier)algorithms.get(algorithmName);
-        }
-        
-        return new DERObjectIdentifier(algorithmName);
-    }
-    
-    static AlgorithmIdentifier getSigAlgID(
-        DERObjectIdentifier sigOid,
-        String              algorithmName)
-    {
-        if (noParams.contains(sigOid))
-        {
-            return new AlgorithmIdentifier(sigOid);
-        }
-
-        algorithmName = Strings.toUpperCase(algorithmName);
-
-        if (params.containsKey(algorithmName))
-        {
-            return new AlgorithmIdentifier(sigOid, (DEREncodable)params.get(algorithmName));
-        }
-        else
-        {
-            return new AlgorithmIdentifier(sigOid, new DERNull());
-        }
-    }
-    
-    static Iterator getAlgNames()
-    {
-        Enumeration e = algorithms.keys();
-        List        l = new ArrayList();
-        
-        while (e.hasMoreElements())
-        {
-            l.add(e.nextElement());
-        }
-        
-        return l.iterator();
-    }
-
-    static Signature getSignatureInstance(
-        String algorithm)
-        throws NoSuchAlgorithmException
-    {
-        return Signature.getInstance(algorithm);
-    }
-
-    static Signature getSignatureInstance(
-        String algorithm,
-        String provider)
-        throws NoSuchProviderException, NoSuchAlgorithmException
-    {
-        if (provider != null)
-        {
-            return Signature.getInstance(algorithm, provider);
-        }
-        else
-        {
-            return Signature.getInstance(algorithm);
-        }
-    }
-
-    static byte[] calculateSignature(
-        DERObjectIdentifier sigOid,
-        String              sigName,
-        PrivateKey          key,
-        SecureRandom        random,
-        ASN1Encodable       object)
-        throws IOException, NoSuchAlgorithmException, InvalidKeyException, SignatureException
-    {
-        Signature sig;
-
-        if (sigOid == null)
-        {
-            throw new IllegalStateException("no signature algorithm specified");
-        }
-
-        sig = X509Util.getSignatureInstance(sigName);
-
-        if (random != null)
-        {
-            sig.initSign(key, random);
-        }
-        else
-        {
-            sig.initSign(key);
-        }
-
-        sig.update(object.getEncoded(ASN1Encodable.DER));
-
-        return sig.sign();
-    }
-
-    static byte[] calculateSignature(
-        DERObjectIdentifier sigOid,
-        String              sigName,
-        String              provider,
-        PrivateKey          key,
-        SecureRandom        random,
-        ASN1Encodable       object)
-        throws IOException, NoSuchProviderException, NoSuchAlgorithmException, InvalidKeyException, SignatureException
-    {
-        Signature sig;
-
-        if (sigOid == null)
-        {
-            throw new IllegalStateException("no signature algorithm specified");
-        }
-
-        sig = X509Util.getSignatureInstance(sigName, provider);
-
-        if (random != null)
-        {
-            sig.initSign(key, random);
-        }
-        else
-        {
-            sig.initSign(key);
-        }
-
-        sig.update(object.getEncoded(ASN1Encodable.DER));
-
-        return sig.sign();
-    }
-
-    static X509Principal convertPrincipal(
-        X500Principal principal)
-    {
-        try
-        {
-            return new X509Principal(principal.getEncoded());
-        }
-        catch (IOException e)
-        {
-            throw new IllegalArgumentException("cannot convert principal");
-        }
-    }
-
-    static class Implementation
-    {
-        Object      engine;
-        Provider provider;
-
-        Implementation(
-            Object      engine,
-            Provider    provider)
-        {
-            this.engine = engine;
-            this.provider = provider;
-        }
-
-        Object getEngine()
-        {
-            return engine;
-        }
-
-        Provider getProvider()
-        {
-            return provider;
-        }
-    }
-
-    /**
-     * see if we can find an algorithm (or its alias and what it represents) in
-     * the property table for the given provider.
-     */
-    static Implementation getImplementation(
-        String      baseName,
-        String      algorithm,
-        Provider    prov)
-        throws NoSuchAlgorithmException
-    {
-        algorithm = Strings.toUpperCase(algorithm);
-
-        String      alias;
-
-        while ((alias = prov.getProperty("Alg.Alias." + baseName + "." + algorithm)) != null)
-        {
-            algorithm = alias;
-        }
-
-        String      className = prov.getProperty(baseName + "." + algorithm);
-
-        if (className != null)
-        {
-            try
-            {
-                Class       cls;
-                ClassLoader clsLoader = prov.getClass().getClassLoader();
-
-                if (clsLoader != null)
-                {
-                    cls = clsLoader.loadClass(className);
-                }
-                else
-                {
-                    cls = Class.forName(className);
-                }
-
-                return new Implementation(cls.newInstance(), prov);
-            }
-            catch (ClassNotFoundException e)
-            {
-                throw new IllegalStateException(
-                    "algorithm " + algorithm + " in provider " + prov.getName() + " but no class \"" + className + "\" found!");
-            }
-            catch (Exception e)
-            {
-                throw new IllegalStateException(
-                    "algorithm " + algorithm + " in provider " + prov.getName() + " but class \"" + className + "\" inaccessible!");
-            }
-        }
-
-        throw new NoSuchAlgorithmException("cannot find implementation " + algorithm + " for provider " + prov.getName());
-    }
-
-    /**
-     * return an implementation for a given algorithm/provider.
-     * If the provider is null, we grab the first avalaible who has the required algorithm.
-     */
-    static Implementation getImplementation(
-        String      baseName,
-        String      algorithm)
-        throws NoSuchAlgorithmException
-    {
-        Provider[] prov = Security.getProviders();
-
-        //
-        // search every provider looking for the algorithm we want.
-        //
-        for (int i = 0; i != prov.length; i++)
-        {
-            //
-            // try case insensitive
-            //
-            Implementation imp = getImplementation(baseName, Strings.toUpperCase(algorithm), prov[i]);
-            if (imp != null)
-            {
-                return imp;
-            }
-
-            try
-            {
-                imp = getImplementation(baseName, algorithm, prov[i]);
-            }
-            catch (NoSuchAlgorithmException e)
-            {
-                // continue
-            }
-        }
-
-        throw new NoSuchAlgorithmException("cannot find implementation " + algorithm);
-    }
-
-    static Provider getProvider(String provider)
-        throws NoSuchProviderException
-    {
-        Provider prov = Security.getProvider(provider);
-
-        if (prov == null)
-        {
-            throw new NoSuchProviderException("Provider " + provider + " not found");
-        }
-
-        return prov;
-    }
-}
diff --git a/azureus2/src/org/bouncycastle/x509/X509V2AttributeCertificate.java b/azureus2/src/org/bouncycastle/x509/X509V2AttributeCertificate.java
deleted file mode 100644
index 304d79f..0000000
--- a/azureus2/src/org/bouncycastle/x509/X509V2AttributeCertificate.java
+++ /dev/null
@@ -1,346 +0,0 @@
-package org.bouncycastle.x509;
-
-import org.bouncycastle.asn1.ASN1Encodable;
-import org.bouncycastle.asn1.ASN1InputStream;
-import org.bouncycastle.asn1.ASN1Sequence;
-import org.bouncycastle.asn1.DERBitString;
-import org.bouncycastle.asn1.DERObjectIdentifier;
-import org.bouncycastle.asn1.DEROutputStream;
-import org.bouncycastle.asn1.x509.AttributeCertificate;
-import org.bouncycastle.asn1.x509.X509Extension;
-import org.bouncycastle.asn1.x509.X509Extensions;
-import org.bouncycastle.util.Arrays;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigInteger;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.PublicKey;
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateExpiredException;
-import java.security.cert.CertificateNotYetValidException;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * An implementation of a version 2 X.509 Attribute Certificate.
- */
-public class X509V2AttributeCertificate
-    implements X509AttributeCertificate
-{
-    private AttributeCertificate    cert;
-    private Date                    notBefore;
-    private Date                    notAfter;
-    
-    public X509V2AttributeCertificate(
-        InputStream encIn)
-        throws IOException
-    {
-        this(AttributeCertificate.getInstance(new ASN1InputStream(encIn).readObject()));
-    }
-    
-    public X509V2AttributeCertificate(
-        byte[]  encoded)
-        throws IOException
-    {
-        this(new ByteArrayInputStream(encoded));
-    }
-    
-    X509V2AttributeCertificate(
-        AttributeCertificate    cert)
-        throws IOException
-    {
-        this.cert = cert;
-        
-        try
-        {
-            this.notAfter = cert.getAcinfo().getAttrCertValidityPeriod().getNotAfterTime().getDate();
-            this.notBefore = cert.getAcinfo().getAttrCertValidityPeriod().getNotBeforeTime().getDate();
-        }
-        catch (ParseException e)
-        {
-            throw new IOException("invalid data structure in certificate!");
-        }
-    }
-    
-    public int getVersion()
-    {
-        return cert.getAcinfo().getVersion().getValue().intValue();
-    }
-    
-    public BigInteger getSerialNumber()
-    {
-        return cert.getAcinfo().getSerialNumber().getValue();
-    }
-    
-    public AttributeCertificateHolder getHolder()
-    {
-        return new AttributeCertificateHolder((ASN1Sequence)cert.getAcinfo().getHolder().toASN1Object());
-    }
-    
-    public AttributeCertificateIssuer getIssuer()
-    {
-        return new AttributeCertificateIssuer(cert.getAcinfo().getIssuer());
-    }
-    
-    public Date getNotBefore()
-    {
-        return notBefore;
-    }
-    
-    public Date getNotAfter()
-    {
-        return notAfter;
-    }
-    
-    public boolean[] getIssuerUniqueID()
-    {
-        DERBitString    id = cert.getAcinfo().getIssuerUniqueID();
-
-        if (id != null)
-        {
-            byte[]          bytes = id.getBytes();
-            boolean[]       boolId = new boolean[bytes.length * 8 - id.getPadBits()];
-
-            for (int i = 0; i != boolId.length; i++)
-            {
-                boolId[i] = (bytes[i / 8] & (0x80 >>> (i % 8))) != 0;
-            }
-
-            return boolId;
-        }
-            
-        return null;
-    }
-    
-    public void checkValidity() 
-        throws CertificateExpiredException, CertificateNotYetValidException
-    {
-        this.checkValidity(new Date());
-    }
-    
-    public void checkValidity(
-        Date    date)
-        throws CertificateExpiredException, CertificateNotYetValidException
-    {
-        if (date.after(this.getNotAfter()))
-        {
-            throw new CertificateExpiredException("certificate expired on " + this.getNotAfter());
-        }
-
-        if (date.before(this.getNotBefore()))
-        {
-            throw new CertificateNotYetValidException("certificate not valid till " + this.getNotBefore());
-        }
-    }
-    
-    public byte[] getSignature()
-    {
-        return cert.getSignatureValue().getBytes();
-    }
-    
-    public final void verify(
-            PublicKey   key,
-            String      provider)
-            throws CertificateException, NoSuchAlgorithmException,
-            InvalidKeyException, NoSuchProviderException, SignatureException
-    {
-        Signature   signature = null;
-
-        if (!cert.getSignatureAlgorithm().equals(cert.getAcinfo().getSignature()))
-        {
-            throw new CertificateException("Signature algorithm in certificate info not same as outer certificate");
-        }
-
-        signature = Signature.getInstance(cert.getSignatureAlgorithm().getObjectId().getId(), provider);
-
-        signature.initVerify(key);
-
-        try
-        {
-            signature.update(cert.getAcinfo().getEncoded());
-        }
-        catch (IOException e)
-        {
-            throw new SignatureException("Exception encoding certificate info object");
-        }
-
-        if (!signature.verify(this.getSignature()))
-        {
-            throw new InvalidKeyException("Public key presented not for certificate signature");
-        }
-    }
-    
-    public byte[] getEncoded()
-        throws IOException
-    {
-        return cert.getEncoded();
-    }
-
-    public byte[] getExtensionValue(String oid) 
-    {
-        X509Extensions  extensions = cert.getAcinfo().getExtensions();
-
-        if (extensions != null)
-        {
-            X509Extension   ext = extensions.getExtension(new DERObjectIdentifier(oid));
-
-            if (ext != null)
-            {
-                ByteArrayOutputStream    bOut = new ByteArrayOutputStream();
-                DEROutputStream            dOut = new DEROutputStream(bOut);
-                
-                try
-                {
-                    dOut.writeObject(ext.getValue());
-
-                    return bOut.toByteArray();
-                }
-                catch (Exception e)
-                {
-                    throw new RuntimeException("error encoding " + e.toString());
-                }
-            }
-        }
-
-        return null;
-    }
-
-    private Set getExtensionOIDs(
-        boolean critical) 
-    {
-        X509Extensions  extensions = cert.getAcinfo().getExtensions();
-
-        if (extensions != null)
-        {
-            Set             set = new HashSet();
-            Enumeration     e = extensions.oids();
-
-            while (e.hasMoreElements())
-            {
-                DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement();
-                X509Extension       ext = extensions.getExtension(oid);
-
-                if (ext.isCritical() == critical)
-                {
-                    set.add(oid.getId());
-                }
-            }
-
-            return set;
-        }
-
-        return null;
-    }
-    
-    public Set getNonCriticalExtensionOIDs() 
-    {
-        return getExtensionOIDs(false);
-    }
-
-    public Set getCriticalExtensionOIDs() 
-    {
-        return getExtensionOIDs(true);
-    }
-    
-    public boolean hasUnsupportedCriticalExtension()
-    {
-        Set  extensions = getCriticalExtensionOIDs();
-
-        return extensions != null && !extensions.isEmpty();
-    }
-
-    public X509Attribute[] getAttributes()
-    {
-        ASN1Sequence    seq = cert.getAcinfo().getAttributes();
-        X509Attribute[] attrs = new X509Attribute[seq.size()];
-        
-        for (int i = 0; i != seq.size(); i++)
-        {
-            attrs[i] = new X509Attribute((ASN1Encodable)seq.getObjectAt(i));
-        }
-        
-        return attrs;
-    }
-    
-    public X509Attribute[] getAttributes(String oid)
-    {
-        ASN1Sequence    seq = cert.getAcinfo().getAttributes();
-        List            list = new ArrayList();
-        
-        for (int i = 0; i != seq.size(); i++)
-        {
-            X509Attribute attr = new X509Attribute((ASN1Encodable)seq.getObjectAt(i));
-            if (attr.getOID().equals(oid))
-            {
-                list.add(attr);
-            }
-        }
-        
-        if (list.size() == 0)
-        {
-            return null;
-        }
-        
-        return (X509Attribute[])list.toArray(new X509Attribute[list.size()]);
-    }
-
-    public boolean equals(
-        Object o)
-    {
-        if (o == this)
-        {
-            return true;
-        }
-
-        if (!(o instanceof X509AttributeCertificate))
-        {
-            return false;
-        }
-
-        X509AttributeCertificate other = (X509AttributeCertificate)o;
-
-        try
-        {
-            byte[] b1 = this.getEncoded();
-            byte[] b2 = other.getEncoded();
-
-            return Arrays.areEqual(b1, b2);
-        }
-        catch (IOException e)
-        {
-            return false;
-        }
-    }
-
-    public int hashCode()
-    {
-        try
-        {
-            byte[]  b = this.getEncoded();
-            int     value = 0;
-
-            for (int i = 0; i != b.length; i++)
-            {
-                value ^= (b[i] & 0xff) << (i % 4);
-            }
-
-            return value;
-        }
-        catch (IOException e)
-        {
-            return 0;
-        }
-    }
-}
diff --git a/azureus2/src/org/json/simple/AUTHORS.txt b/azureus2/src/org/json/simple/AUTHORS.txt
deleted file mode 100644
index f5ff495..0000000
--- a/azureus2/src/org/json/simple/AUTHORS.txt
+++ /dev/null
@@ -1 +0,0 @@
-Fang Yidong <fangyidong at yahoo.com.cn>
\ No newline at end of file
diff --git a/azureus2/src/org/json/simple/ItemList.java b/azureus2/src/org/json/simple/ItemList.java
deleted file mode 100644
index 29fd8b3..0000000
--- a/azureus2/src/org/json/simple/ItemList.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * $Id: ItemList.java,v 1.2 2009-03-15 22:12:18 parg Exp $
- * Created on 2006-3-24
- */
-package org.json.simple;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-/**
- * �����÷ָ���ֿ���һ��item.�ָ������һ����һ��item.ÿ��item���߲����ǿհ׷�.
- * ���磺
- * |a:b:c| => |a|,|b|,|c|
- * |:| => ||,||
- * |a:| => |a|,||
- * @author FangYidong<fangyidong at yahoo.com.cn>
- */
-public class ItemList {
-	private final static String sp=",";
-	List<String> items=new ArrayList<String>();
-	
-	
-	public ItemList(){}
-	
-	/**
-	 * 
-	 * @param s �ָ������һ���ַ�������
-	 */
-	public ItemList(String s){
-		this.split(s,sp,items);
-	}
-	/**
-	 * 
-	 * @param s �ָ������һ���ַ�������
-	 * @param sp �ָ��
-	 */
-	//public ItemList(String s,String sp){
-	//	this.sp=s;
-	//	this.split(s,sp,items);
-	//}
-	
-	/**
-	 * 
-	 * @param s
-	 * @param sp
-	 * @param isMultiToken sp�Ƿ�Ϊ��ָ��
-	 */
-	public ItemList(String s,String sp,boolean isMultiToken){
-		split(s,sp,items,isMultiToken);
-	}
-	
-	public List<String> getItems(){
-		return this.items;
-	}
-	
-	public String[] getArray(){
-		return (String[])this.items.toArray(new String[items.size()]);
-	}
-	
-	public void split(String s,String sp,List<String> append,boolean isMultiToken){
-		if(s==null || sp==null)
-			return;
-		if(isMultiToken){
-			StringTokenizer tokens=new StringTokenizer(s,sp);
-			while(tokens.hasMoreTokens()){
-				append.add(tokens.nextToken().trim());
-			}
-		}
-		else{
-			this.split(s,sp,append);
-		}
-	}
-	
-	public void split(String s,String sp,List<String> append){
-		if(s==null || sp==null)
-			return;
-		int pos=0;
-		int prevPos=0;
-		do{
-			prevPos=pos;
-			pos=s.indexOf(sp,pos);
-			if(pos==-1)
-				break;
-			append.add(s.substring(prevPos,pos).trim());
-			pos+=sp.length();
-		}while(pos!=-1);
-		append.add(s.substring(prevPos).trim());
-	}
-	
-	/**
-	 * ���÷ָ��.
-	 * @param sp �ָ��
-	 */
-	//public void setSP(String sp){
-	//	this.sp=sp;
-	//}
-	
-	/**
-	 * ���뵥��item.
-	 * @param i �����λ��(֮ǰ)
-	 * @param item
-	 */
-	public void add(int i,String item){
-		if(item==null)
-			return;
-		items.add(i,item.trim());
-	}
-	/**
-	 * ���뵥��item.
-	 * @param item
-	 */
-	public void add(String item){
-		if(item==null)
-			return;
-		items.add(item.trim());
-	}
-	
-	/**
-	 * ��һ��item.
-	 * @param list �����list
-	 */
-	public void addAll(ItemList list){
-		items.addAll(list.items);
-	}
-	
-	/**
-	 * ��һ��item.
-	 * @param s �ָ������һ���ַ�������
-	 */
-	public void addAll(String s){
-		this.split(s,sp,items);
-	}
-	
-	/**
-	 * ��һ��item.
-	 * @param s �ָ������һ���ַ�������
-	 * @param sp �ָ��
-	 */
-	public void addAll(String s,String sp){
-		this.split(s,sp,items);
-	}
-	
-	public void addAll(String s,String sp,boolean isMultiToken){
-		this.split(s,sp,items,isMultiToken);
-	}
-	
-	/**
-	 * ��õ�i��item. 0-based.
-	 * @param i
-	 * @return
-	 */
-	public String get(int i){
-		return (String)items.get(i);
-	}
-	
-	/**
-	 * ���item��.
-	 * @return
-	 */
-	public int size(){
-		return items.size();
-	}
-	/**
-	 * �÷ָ���ָ�ı�ʾ.
-	 */
-	public String toString(){
-		return toString(sp);
-	}
-	
-	/**
-	 * �÷ָ���ָ�ı�ʾ.
-	 * @param sp ����ø÷ָ���ָ�.
-	 * @return
-	 */
-	public String toString(String sp){
-		StringBuffer sb=new StringBuffer();
-		
-		for(int i=0;i<items.size();i++){
-			if(i==0)
-				sb.append(items.get(i));
-			else{
-				sb.append(sp);
-				sb.append(items.get(i));
-			}
-		}
-		return sb.toString();
-
-	}
-	
-	/**
-	 * �������item.
-	 */
-	public void clear(){
-		items.clear();
-	}
-	
-	/**
-	 * ��λ.������ݣ����ָ�����Ĭ��ֵ.
-	 */
-	public void reset(){
-		//sp=",";
-		items.clear();
-	}
-}
diff --git a/azureus2/src/org/json/simple/JSONArray.java b/azureus2/src/org/json/simple/JSONArray.java
deleted file mode 100644
index 172e8b0..0000000
--- a/azureus2/src/org/json/simple/JSONArray.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * $Id: JSONArray.java,v 1.1 2007-06-05 00:43:56 tuxpaper Exp $
- * Created on 2006-4-10
- */
-package org.json.simple;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-
-/**
- * @author FangYidong<fangyidong at yahoo.com.cn>
- */
-public class JSONArray extends ArrayList<Object> {
-	public JSONArray() {
-		super();
-	}
-
-	public JSONArray(Collection<Object> arg0) {
-		super(arg0);
-	}
-
-	public JSONArray(int initialCapacity) {
-		super(initialCapacity);
-	}
-
-	public String toString(){
-		ItemList list=new ItemList();
-		
-		Iterator<Object> iter=iterator();
-		
-		while(iter.hasNext()){
-			Object value=iter.next();				
-			if(value instanceof String){
-				list.add("\""+JSONObject.escape((String)value)+"\"");
-			}
-			else
-				list.add(String.valueOf(value));
-		}
-		return "["+list.toString()+"]";
-	}
-	
-	public void toString( StringBuilder sb ){
-		sb.append( "[" );
-
-		Iterator<Object> iter=iterator();
-		
-		boolean	first = true;
-		while(iter.hasNext()){
-			if ( first ){
-				first = false;
-			}else{
-				sb.append( "," );
-			}
-			Object value=iter.next();	
-			if(value instanceof String){
-				sb.append( "\"" );
-				JSONObject.escape(sb, (String)value);
-				sb.append( "\"");
-			}else if ( value instanceof JSONObject ){
-				((JSONObject)value).toString( sb );
-			}else if ( value instanceof JSONArray ){
-				((JSONArray)value).toString( sb ); 
-			}else{
-				sb.append(String.valueOf(value));
-			}
-		}
-		
-		sb.append( "]" );
-	}
-}
diff --git a/azureus2/src/org/json/simple/JSONObject.java b/azureus2/src/org/json/simple/JSONObject.java
deleted file mode 100644
index 08129bd..0000000
--- a/azureus2/src/org/json/simple/JSONObject.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * $Id: JSONObject.java,v 1.2 2008-08-07 01:18:54 parg Exp $
- * Created on 2006-4-10
- */
-package org.json.simple;
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.gudy.azureus2.core3.util.LightHashMap;
-
-/**
- * @author FangYidong<fangyidong at yahoo.com.cn>
- */
-public class JSONObject extends LightHashMap<String,Object>{
-	
-	public JSONObject() {
-		super();
-	}
-
-	public JSONObject(int initialCapacity, float loadFactor) {
-		super(initialCapacity, loadFactor);
-	}
-
-	public JSONObject(int initialCapacity) {
-		super(initialCapacity);
-	}
-
-	public JSONObject(Map<String,Object> arg0) {
-		super(arg0);
-	}
-
-	public String toString(){
-		ItemList list=new ItemList();
-		Iterator<Map.Entry<String, Object>> iter=entrySet().iterator();
-		
-		while(iter.hasNext()){
-			Map.Entry<String, Object> entry=iter.next();
-			list.add(toString(entry.getKey().toString(),entry.getValue()));
-		}
-		return "{"+list.toString()+"}";
-	}
-	
-	public void toString( StringBuilder sb ){
-		
-		sb.append( "{" );
-
-		Iterator iter=entrySet().iterator();
-		
-		boolean first = true;
-		
-		while(iter.hasNext()){
-			if ( first ){
-				first = false;
-			}else{
-				sb.append( "," );
-			}
-			Map.Entry entry=(Map.Entry)iter.next();
-			toString(sb, entry.getKey().toString(),entry.getValue());
-		}
-		
-		sb.append( "}" );
-	}
-	
-	public static String toString(String key,Object value){
-		StringBuffer sb=new StringBuffer();
-		
-		sb.append("\"");
-		sb.append(escape(key));
-		sb.append("\":");
-		if(value==null){
-			sb.append("null");
-			return sb.toString();
-		}
-		
-		if(value instanceof String){
-			sb.append("\"");
-			sb.append(escape((String)value));
-			sb.append("\"");
-		}
-		else
-			sb.append(value);
-		return sb.toString();
-	}
-	
-	public static void toString(StringBuilder sb, String key,Object value){
-		sb.append("\"");
-		escape(sb,key);
-		sb.append("\":");
-		if(value==null){
-			sb.append("null");
-			return;
-		}
-		
-		if(value instanceof String){
-			sb.append("\"");
-			escape(sb,(String)value);
-			sb.append("\"");
-		}else if ( value instanceof JSONObject ){
-			((JSONObject)value).toString( sb );
-		}else if ( value instanceof JSONArray ){
-			((JSONArray)value).toString( sb );
-		}else{
-			sb.append(String.valueOf( value ));
-		}
-	}
-	
-	/**
-	 * " => \" , \ => \\
-	 * @param s
-	 * @return
-	 */
-	public static String escape(String s){
-		if(s==null)
-			return null;
-		StringBuffer sb=new StringBuffer();
-		for(int i=0;i<s.length();i++){
-			char ch=s.charAt(i);
-			switch(ch){
-			case '"':
-				sb.append("\\\"");
-				break;
-			case '\\':
-				sb.append("\\\\");
-				break;
-			case '\b':
-				sb.append("\\b");
-				break;
-			case '\f':
-				sb.append("\\f");
-				break;
-			case '\n':
-				sb.append("\\n");
-				break;
-			case '\r':
-				sb.append("\\r");
-				break;
-			case '\t':
-				sb.append("\\t");
-				break;
-			case '/':
-				sb.append("\\/");
-				break;
-			default:
-				if(ch>='\u0000' && ch<='\u001F'){
-					String ss=Integer.toHexString(ch);
-					sb.append("\\u");
-					for(int k=0;k<4-ss.length();k++){
-						sb.append('0');
-					}
-					sb.append(ss.toUpperCase());
-				}
-				else{
-					sb.append(ch);
-				}
-			}
-		}//for
-		return sb.toString();
-	}
-	
-	public static void escape(StringBuilder sb, String s){
-		if(s==null){
-			sb.append((String)null);
-		}else{
-			for(int i=0;i<s.length();i++){
-				char ch=s.charAt(i);
-				switch(ch){
-				case '"':
-					sb.append("\\\"");
-					break;
-				case '\\':
-					sb.append("\\\\");
-					break;
-				case '\b':
-					sb.append("\\b");
-					break;
-				case '\f':
-					sb.append("\\f");
-					break;
-				case '\n':
-					sb.append("\\n");
-					break;
-				case '\r':
-					sb.append("\\r");
-					break;
-				case '\t':
-					sb.append("\\t");
-					break;
-				case '/':
-					sb.append("\\/");
-					break;
-				default:
-					if(ch>='\u0000' && ch<='\u001F'){
-						String ss=Integer.toHexString(ch);
-						sb.append("\\u");
-						for(int k=0;k<4-ss.length();k++){
-							sb.append('0');
-						}
-						sb.append(ss.toUpperCase());
-					}
-					else{
-						sb.append(ch);
-					}
-				}
-			}//for
-		}
-	}
-}
diff --git a/azureus2/src/org/json/simple/JSONValue.java b/azureus2/src/org/json/simple/JSONValue.java
deleted file mode 100644
index 50e388a..0000000
--- a/azureus2/src/org/json/simple/JSONValue.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * $Id: JSONValue.java,v 1.1 2007-06-05 00:43:56 tuxpaper Exp $
- * Created on 2006-4-15
- */
-package org.json.simple;
-
-import java.io.Reader;
-import java.io.StringReader;
-
-import org.json.simple.parser.JSONParser;
-
-
-/**
- * @author FangYidong<fangyidong at yahoo.com.cn>
- */
-public class JSONValue {
-	/**
-	 * parse into java object from input source.
-	 * @param in
-	 * @return instance of : JSONObject,JSONArray,String,Boolean,Long,Double or null
-	 */
-	public static Object parse(Reader in){
-		try{
-			JSONParser parser=new JSONParser();
-			return parser.parse(in);
-		}
-		catch(Exception e){
-			return null;
-		}
-	}
-	
-	public static Object parse(String s){
-		StringReader in=new StringReader(s);
-		return parse(in);
-	}
-}
diff --git a/azureus2/src/org/json/simple/LICENSE.txt b/azureus2/src/org/json/simple/LICENSE.txt
deleted file mode 100644
index 5ab7695..0000000
--- a/azureus2/src/org/json/simple/LICENSE.txt
+++ /dev/null
@@ -1,504 +0,0 @@
-		  GNU LESSER GENERAL PUBLIC LICENSE
-		       Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL.  It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-  This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it.  You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
-  When we speak of free software, we are referring to freedom of use,
-not price.  Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
-  To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights.  These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
-  For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-  We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
-  To protect each distributor, we want to make it very clear that
-there is no warranty for the free library.  Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-

-  Finally, software patents pose a constant threat to the existence of
-any free program.  We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder.  Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
-  Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License.  This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License.  We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
-  When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library.  The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom.  The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
-  We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License.  It also provides other free software developers Less
-of an advantage over competing non-free programs.  These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries.  However, the Lesser license provides advantages in certain
-special circumstances.
-
-  For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard.  To achieve this, non-free programs must be
-allowed to use the library.  A more frequent case is that a free
-library does the same job as widely used non-free libraries.  In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
-  In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software.  For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
-  Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.  Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library".  The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-

-		  GNU LESSER GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
-  A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
-  The "Library", below, refers to any such software library or work
-which has been distributed under these terms.  A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language.  (Hereinafter, translation is
-included without limitation in the term "modification".)
-
-  "Source code" for a work means the preferred form of the work for
-making modifications to it.  For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
-  Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it).  Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-  
-  1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
-  You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-

-  2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-
-    b) You must cause the files modified to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    c) You must cause the whole of the work to be licensed at no
-    charge to all third parties under the terms of this License.
-
-    d) If a facility in the modified Library refers to a function or a
-    table of data to be supplied by an application program that uses
-    the facility, other than as an argument passed when the facility
-    is invoked, then you must make a good faith effort to ensure that,
-    in the event an application does not supply such function or
-    table, the facility still operates, and performs whatever part of
-    its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has
-    a purpose that is entirely well-defined independent of the
-    application.  Therefore, Subsection 2d requires that any
-    application-supplied function or table used by this function must
-    be optional: if the application does not supply it, the square
-    root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library.  To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License.  (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.)  Do not make any other change in
-these notices.
-

-  Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
-  This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
-  4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
-  If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library".  Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
-  However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library".  The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
-  When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library.  The
-threshold for this to be true is not precisely defined by law.
-
-  If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work.  (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
-  Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-

-  6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
-  You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License.  You must supply a copy of this License.  If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License.  Also, you must do one
-of these things:
-
-    a) Accompany the work with the complete corresponding
-    machine-readable source code for the Library including whatever
-    changes were used in the work (which must be distributed under
-    Sections 1 and 2 above); and, if the work is an executable linked
-    with the Library, with the complete machine-readable "work that
-    uses the Library", as object code and/or source code, so that the
-    user can modify the Library and then relink to produce a modified
-    executable containing the modified Library.  (It is understood
-    that the user who changes the contents of definitions files in the
-    Library will not necessarily be able to recompile the application
-    to use the modified definitions.)
-
-    b) Use a suitable shared library mechanism for linking with the
-    Library.  A suitable mechanism is one that (1) uses at run time a
-    copy of the library already present on the user's computer system,
-    rather than copying library functions into the executable, and (2)
-    will operate properly with a modified version of the library, if
-    the user installs one, as long as the modified version is
-    interface-compatible with the version that the work was made with.
-
-    c) Accompany the work with a written offer, valid for at
-    least three years, to give the same user the materials
-    specified in Subsection 6a, above, for a charge no more
-    than the cost of performing this distribution.
-
-    d) If distribution of the work is made by offering access to copy
-    from a designated place, offer equivalent access to copy the above
-    specified materials from the same place.
-
-    e) Verify that the user has already received a copy of these
-    materials or that you have already sent this user a copy.
-
-  For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it.  However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
-  It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system.  Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-

-  7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
-    a) Accompany the combined library with a copy of the same work
-    based on the Library, uncombined with any other library
-    facilities.  This must be distributed under the terms of the
-    Sections above.
-
-    b) Give prominent notice with the combined library of the fact
-    that part of it is a work based on the Library, and explaining
-    where to find the accompanying uncombined form of the same work.
-
-  8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.  Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License.  However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-  9. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Library or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
-  10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-

-  11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded.  In such case, this License incorporates the limitation as if
-written in the body of this License.
-
-  13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation.  If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-

-  14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission.  For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this.  Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
-			    NO WARRANTY
-
-  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-

-           How to Apply These Terms to Your New Libraries
-
-  If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change.  You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
-  To apply these terms, attach the following notices to the library.  It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the library's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-  <signature of Ty Coon>, 1 April 1990
-  Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/azureus2/src/org/json/simple/README.txt b/azureus2/src/org/json/simple/README.txt
deleted file mode 100644
index 71e8475..0000000
--- a/azureus2/src/org/json/simple/README.txt
+++ /dev/null
@@ -1,144 +0,0 @@
-Simple Java toolkit for JSON (JSON.simple)
-==========================================
-
-1.Why the Simple Java toolkit (also named as JSON.simple) for JSON?
-  
-  When I use JSON as the data exchange format between the AJAX client and JSP 
-  for the first time, what worry me mostly is how to encode Java strings and 
-  numbers correctly in the server side so the AJAX client will receive a well
-  formed JSON data. When I looked into the 'JSON in Java' directory in JSON
-  website,I found that wrappers to JSONObject and JSONArray can be simpler, 
-  due to the simplicity of JSON itself. So I wrote the JSON.simple package.
-
-2.Is it simple,really?
-  
-  I think so. Take an example:
-
-  import org.json.simple.JSONObject;
-
-  JSONObject obj=new JSONObject();
-  obj.put("name","foo");
-  obj.put("num",new Integer(100));
-  obj.put("balance",new Double(1000.21));
-  obj.put("is_vip",new Boolean(true));
-  obj.put("nickname",null);
-  System.out.print(obj);
-
-  Result:
-  {"nickname":null,"num":100,"balance":1000.21,"is_vip":true,"name":"foo"}
-
-  The JSONObject.toString() will escape controls and specials correctly.
-
-3.How to use JSON.simple in JSP?
-
-  Take an example in JSP:
-  
-  <%@page contentType="text/html; charset=UTF-8"%>
-  <%@page import="org.json.simple.JSONObject"%>
-  <%
-	JSONObject obj=new JSONObject();
-  	obj.put("name","foo");
-  	obj.put("num",new Integer(100));
-  	obj.put("balance",new Double(1000.21));
-  	obj.put("is_vip",new Boolean(true));
-  	obj.put("nickname",null);
-	out.print(obj);
-	out.flush();
-  %>
-  
-  So the AJAX client will get the responseText.
-
-4.Some details about JSONObject?
-  
-  JSONObject inherits java.util.HashMap,so it don't have to worry about the 
-  mapping things between keys and values. Feel free to use the Map methods 
-  like get(), put(), and remove() and others. JSONObject.toString() will 
-  combine key value pairs to get the JSON data string. Values will be escaped
-  into JSON quote string format if it's an instance of java.lang.String. Other
-  type of instance like java.lang.Number,java.lang.Boolean,null,JSONObject and
-  JSONArray will NOT escape, just take their java.lang.String.valueOf() result.
-  null value will be the JSON 'null' in the result.
-
-  It's still correct if you put an instance of JSONObject or JSONArray into an 
-  instance of JSONObject or JSONArray. Take the example about:
-
-  JSONObject obj2=new JSONObject();
-  obj2.put("phone","123456");
-  obj2.put("zip","7890");
-  obj.put("contact",obj2);
-  System.out.print(obj);
-
-  Result:
-  {"nickname":null,"num":100,"contact":{"phone":"123456","zip":"7890"},"balance":1000.21,"is_vip":true,"name":"foo"}
-
-  The method JSONObject.escape() is used to escape Java string into JSON quote 
-  string. Controls and specials will be escaped correctly into \b,\f,\r,\n,\t,
-  \",\\,\/,\uhhhh.
-
-5.Some detail about JSONArray?
-  
-  org.json.simple.JSONArray inherits java.util.ArrayList. Feel free to use the
-  List methods like get(),add(),remove(),iterator() and so on. The rules of 
-  JSONArray.toString() is similar to JSONObject.toString(). Here's the example:
-
-  import org.json.simple.JSONArray;
-
-  JSONArray array=new JSONArray();
-  array.add("hello");
-  array.add(new Integer(123));
-  array.add(new Boolean(false));
-  array.add(null);
-  array.add(new Double(123.45));
-  array.add(obj2);//see above
-  System.out.print(array);
-
-  Result:
-  ["hello",123,false,null,123.45,{"phone":"123456","zip":"7890"}]
-
-6.What is JSONValue for?  
-
-  org.json.simple.JSONValue is use to parse JSON data into Java Object. 
-  In JSON, the topmost entity is JSON value, not the JSON object. But
-  it's not necessary to wrap JSON string,boolean,number and null again,
-  for the Java has already had the according classes: java.lang.String,
-  java.lang.Boolean,java.lang.Number and null. The mapping is:
-
-  JSON			Java
-  ------------------------------------------------
-  string      <=>  	java.lang.String 
-  number      <=>	java.lang.Number
-  true|false  <=>	java.lang.Boolean
-  null        <=>	null
-  array	      <=>	org.json.simple.JSONArray
-  object      <=>       org.json.simple.JSONObject
-  ------------------------------------------------
-
-  JSONValue has only one kind of method, JSONValue.parse(), which receives
-  a java.io.Reader or java.lang.String. Return type of JSONValue.parse() 
-  is according to the mapping above. If the input is incorrect in syntax or
-  there's exceptions during the parsing, I choose to return null, ignoring 
-  the exception: I have no idea if it's a serious implementaion, but I think
-  it's convenient to the user.
-  
-  Here's the example:
-  
-  String s="[0,{\"1\":{\"2\":{\"3\":{\"4\":[5,{\"6\":7}]}}}}]";
-  Object obj=JSONValue.parse(s);
-  JSONArray array=(JSONArray)obj;
-  System.out.println(array.get(1));
-  JSONObject obj2=(JSONObject)array.get(1);
-  System.out.println(obj2.get("1"));
-
-  Result:
-  {"1":{"2":{"3":{"4":[5,{"6":7}]}}}}
-  {"2":{"3":{"4":[5,{"6":7}]}}}
-
-7.About the author.
-
-  I'm a Java EE developer on Linux. 
-  I'm working on web systems and information retrieval systems.
-  I also develop 3D games and Flash games. 
-
-  You can contact me through: 
-  Fang Yidong<fangyidong at yahoo.com.cn>
-  Fang Yidong<fangyidng at gmail.com> 
diff --git a/azureus2/src/org/json/simple/Test.java b/azureus2/src/org/json/simple/Test.java
deleted file mode 100644
index 750b34b..0000000
--- a/azureus2/src/org/json/simple/Test.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * $Id: Test.java,v 1.1 2007-06-05 00:43:56 tuxpaper Exp $
- * Created on 2006-4-15
- */
-package org.json.simple;
-
-
-/**
- * @author FangYidong<fangyidong at yahoo.com.cn>
- */
-public class Test {
-
-	public static void main(String[] args) throws Exception{
-		JSONArray array1=new JSONArray();
-		array1.add("abc\u0010a/");
-		array1.add(new Integer(123));
-		array1.add(new Double(122.22));
-		array1.add(new Boolean(true));
-		System.out.println("======array1==========");
-		System.out.println(array1);
-		System.out.println();
-		
-		JSONObject obj1=new JSONObject();
-		obj1.put("name","fang");
-		obj1.put("age",new Integer(27));
-		obj1.put("is_developer",new Boolean(true));
-		obj1.put("weight",new Double(60.21));
-		obj1.put("array1",array1);
-		System.out.println();
-		
-		System.out.println("======obj1 with array1===========");
-		System.out.println(obj1);
-		System.out.println();
-		
-		obj1.remove("array1");
-		array1.add(obj1);
-		System.out.println("======array1 with obj1========");
-		System.out.println(array1);
-		System.out.println();
-		
-		System.out.println("======parse to java========");
-
-		String s="[0,{\"1\":{\"2\":{\"3\":{\"4\":[5,{\"6\":7}]}}}}]";
-		Object obj=JSONValue.parse(s);
-		JSONArray array=(JSONArray)obj;
-		System.out.println("======the 2nd element of array======");
-		System.out.println(array.get(1));
-		System.out.println();
-		
-		JSONObject obj2=(JSONObject)array.get(1);
-		System.out.println("======field \"1\"==========");
-		System.out.println(obj2.get("1"));	
-	}
-}
diff --git a/azureus2/src/org/json/simple/parser/JSONParser.java b/azureus2/src/org/json/simple/parser/JSONParser.java
deleted file mode 100644
index 90e0886..0000000
--- a/azureus2/src/org/json/simple/parser/JSONParser.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * $Id: JSONParser.java,v 1.2 2008-08-07 01:18:55 parg Exp $
- * Created on 2006-4-15
- */
-package org.json.simple.parser;
-
-import java.io.Reader;
-import java.util.Stack;
-
-import org.gudy.azureus2.core3.util.LightHashMap;
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-
-
-/**
- * @author FangYidong<fangyidong at yahoo.com.cn>
- */
-public class JSONParser {
-	public static final int S_INIT=0;
-	public static final int S_IN_FINISHED_VALUE=1;//string,number,boolean,null,object,array
-	public static final int S_IN_OBJECT=2;
-	public static final int S_IN_ARRAY=3;
-	public static final int S_PASSED_PAIR_KEY=4;
-	public static final int S_IN_ERROR=-1;
-	
-	private int peekStatus(Stack statusStack){
-		if(statusStack.size()==0)
-			return -1;
-		Integer status=(Integer)statusStack.peek();
-		return status.intValue();
-	}
-	
-	public Object parse(Reader in) throws Exception{
-		Stack statusStack=new Stack();
-		Stack valueStack=new Stack();
-		Yylex lexer=new Yylex(in);
-		Yytoken token=null;
-		int status=S_INIT;
-		
-		try{
-			do{
-				token=lexer.yylex();
-				if(token==null)
-					token=new Yytoken(Yytoken.TYPE_EOF,null);
-				switch(status){
-				case S_INIT:
-					switch(token.type){
-					case Yytoken.TYPE_VALUE:
-						status=S_IN_FINISHED_VALUE;
-						statusStack.push(new Integer(status));
-						valueStack.push(token.value);
-						break;
-					case Yytoken.TYPE_LEFT_BRACE:
-						status=S_IN_OBJECT;
-						statusStack.push(new Integer(status));
-						valueStack.push(new JSONObject());
-						break;
-					case Yytoken.TYPE_LEFT_SQUARE:
-						status=S_IN_ARRAY;
-						statusStack.push(new Integer(status));
-						valueStack.push(new JSONArray());
-						break;
-					default:
-						status=S_IN_ERROR;
-					}//inner switch
-					break;
-					
-				case S_IN_FINISHED_VALUE:
-					if(token.type==Yytoken.TYPE_EOF)
-						return valueStack.pop();
-					else
-						return null;
-					
-				case S_IN_OBJECT:
-					switch(token.type){
-					case Yytoken.TYPE_COMMA:
-						break;
-					case Yytoken.TYPE_VALUE:
-						if(token.value instanceof String){
-							String key=(String)token.value;
-							valueStack.push(key);
-							status=S_PASSED_PAIR_KEY;
-							statusStack.push(new Integer(status));
-						}
-						else{
-							status=S_IN_ERROR;
-						}
-						break;
-					case Yytoken.TYPE_RIGHT_BRACE:
-						if(valueStack.size()>1){
-							statusStack.pop();
-							JSONObject map = (JSONObject)valueStack.pop();
-							map.compactify(-0.9f);
-							status=peekStatus(statusStack);
-						}
-						else{
-							status=S_IN_FINISHED_VALUE;
-						}
-						break;
-					default:
-						status=S_IN_ERROR;
-						break;
-					}//inner switch
-					break;
-					
-				case S_PASSED_PAIR_KEY:
-					switch(token.type){
-					case Yytoken.TYPE_COLON:
-						break;
-					case Yytoken.TYPE_VALUE:
-						statusStack.pop();
-						String key=(String)valueStack.pop();
-						JSONObject parent=(JSONObject)valueStack.peek();
-						parent.put(key,token.value);
-						status=peekStatus(statusStack);
-						break;
-					case Yytoken.TYPE_LEFT_SQUARE:
-						statusStack.pop();
-						key=(String)valueStack.pop();
-						parent=(JSONObject)valueStack.peek();
-						JSONArray newArray=new JSONArray();
-						parent.put(key,newArray);
-						status=S_IN_ARRAY;
-						statusStack.push(new Integer(status));
-						valueStack.push(newArray);
-						break;
-					case Yytoken.TYPE_LEFT_BRACE:
-						statusStack.pop();
-						key=(String)valueStack.pop();
-						parent=(JSONObject)valueStack.peek();
-						JSONObject newObject=new JSONObject();
-						parent.put(key,newObject);
-						status=S_IN_OBJECT;
-						statusStack.push(new Integer(status));
-						valueStack.push(newObject);
-						break;
-					default:
-						status=S_IN_ERROR;
-					}
-					break;
-					
-				case S_IN_ARRAY:
-					switch(token.type){
-					case Yytoken.TYPE_COMMA:
-						break;
-					case Yytoken.TYPE_VALUE:
-						JSONArray val=(JSONArray)valueStack.peek();
-						val.add(token.value);
-						break;
-					case Yytoken.TYPE_RIGHT_SQUARE:
-						if(valueStack.size()>1){
-							statusStack.pop();
-							valueStack.pop();
-							status=peekStatus(statusStack);
-						}
-						else{
-							status=S_IN_FINISHED_VALUE;
-						}
-						break;
-					case Yytoken.TYPE_LEFT_BRACE:
-						val=(JSONArray)valueStack.peek();
-						JSONObject newObject=new JSONObject();
-						val.add(newObject);
-						status=S_IN_OBJECT;
-						statusStack.push(new Integer(status));
-						valueStack.push(newObject);
-						break;
-					case Yytoken.TYPE_LEFT_SQUARE:
-						val=(JSONArray)valueStack.peek();
-						JSONArray newArray=new JSONArray();
-						val.add(newArray);
-						status=S_IN_ARRAY;
-						statusStack.push(new Integer(status));
-						valueStack.push(newArray);
-						break;
-					default:
-						status=S_IN_ERROR;
-					}//inner switch
-					break;
-				case S_IN_ERROR:
-					return null;
-				}//switch
-				if(status==S_IN_ERROR)
-					return null;
-			}while(token.type!=Yytoken.TYPE_EOF);
-		}
-		catch(Exception e){
-			throw e;
-		}
-		return null;
-	}
-}
diff --git a/azureus2/src/org/json/simple/parser/Yylex.java b/azureus2/src/org/json/simple/parser/Yylex.java
deleted file mode 100644
index cf79958..0000000
--- a/azureus2/src/org/json/simple/parser/Yylex.java
+++ /dev/null
@@ -1,428 +0,0 @@
-package org.json.simple.parser;
-
-
-class Yylex {
-	private final static int YY_BUFFER_SIZE = 512;
-	private final static int YY_F = -1;
-	private final static int YY_NO_STATE = -1;
-	private final static int YY_NOT_ACCEPT = 0;
-	//private final static int YY_START = 1;
-	private final static int YY_END = 2;
-	private final static int YY_NO_ANCHOR = 4;
-	private final static int YY_BOL = 65536;
-	private final static int YY_EOF = 65537;
-
-private StringBuffer sb=new StringBuffer();
-	private java.io.BufferedReader yy_reader;
-	private int yy_buffer_index;
-	private int yy_buffer_read;
-	private int yy_buffer_start;
-	private int yy_buffer_end;
-	private char yy_buffer[];
-	private boolean yy_at_bol;
-	private int yy_lexical_state;
-
-	Yylex (java.io.Reader reader) {
-		this ();
-		if (null == reader) {
-			throw (new Error("Error: Bad input stream initializer."));
-		}
-		yy_reader = new java.io.BufferedReader(reader);
-	}
-
-	Yylex (java.io.InputStream instream) {
-		this ();
-		if (null == instream) {
-			throw (new Error("Error: Bad input stream initializer."));
-		}
-		yy_reader = new java.io.BufferedReader(new java.io.InputStreamReader(instream));
-	}
-
-	private Yylex () {
-		yy_buffer = new char[YY_BUFFER_SIZE];
-		yy_buffer_read = 0;
-		yy_buffer_index = 0;
-		yy_buffer_start = 0;
-		yy_buffer_end = 0;
-		yy_at_bol = true;
-		yy_lexical_state = YYINITIAL;
-	}
-
-	//private boolean yy_eof_done = false;
-	private static final int YYINITIAL = 0;
-	private static final int STRING_BEGIN = 1;
-	private static final int yy_state_dtrans[] = {
-		0,
-		39
-	};
-	private void yybegin (int state) {
-		yy_lexical_state = state;
-	}
-	private int yy_advance ()
-		throws java.io.IOException {
-		int next_read;
-		int i;
-		int j;
-
-		if (yy_buffer_index < yy_buffer_read) {
-			return yy_buffer[yy_buffer_index++];
-		}
-
-		if (0 != yy_buffer_start) {
-			i = yy_buffer_start;
-			j = 0;
-			while (i < yy_buffer_read) {
-				yy_buffer[j] = yy_buffer[i];
-				++i;
-				++j;
-			}
-			yy_buffer_end = yy_buffer_end - yy_buffer_start;
-			yy_buffer_start = 0;
-			yy_buffer_read = j;
-			yy_buffer_index = j;
-			next_read = yy_reader.read(yy_buffer,
-					yy_buffer_read,
-					yy_buffer.length - yy_buffer_read);
-			if (-1 == next_read) {
-				return YY_EOF;
-			}
-			yy_buffer_read = yy_buffer_read + next_read;
-		}
-
-		while (yy_buffer_index >= yy_buffer_read) {
-			if (yy_buffer_index >= yy_buffer.length) {
-				yy_buffer = yy_double(yy_buffer);
-			}
-			next_read = yy_reader.read(yy_buffer,
-					yy_buffer_read,
-					yy_buffer.length - yy_buffer_read);
-			if (-1 == next_read) {
-				return YY_EOF;
-			}
-			yy_buffer_read = yy_buffer_read + next_read;
-		}
-		return yy_buffer[yy_buffer_index++];
-	}
-	private void yy_move_end () {
-		if (yy_buffer_end > yy_buffer_start &&
-		    '\n' == yy_buffer[yy_buffer_end-1])
-			yy_buffer_end--;
-		if (yy_buffer_end > yy_buffer_start &&
-		    '\r' == yy_buffer[yy_buffer_end-1])
-			yy_buffer_end--;
-	}
-	//private boolean yy_last_was_cr=false;
-	private void yy_mark_start () {
-		yy_buffer_start = yy_buffer_index;
-	}
-	private void yy_mark_end () {
-		yy_buffer_end = yy_buffer_index;
-	}
-	private void yy_to_mark () {
-		yy_buffer_index = yy_buffer_end;
-		yy_at_bol = (yy_buffer_end > yy_buffer_start) &&
-		            ('\r' == yy_buffer[yy_buffer_end-1] ||
-		             '\n' == yy_buffer[yy_buffer_end-1] ||
-		             2028/*LS*/ == yy_buffer[yy_buffer_end-1] ||
-		             2029/*PS*/ == yy_buffer[yy_buffer_end-1]);
-	}
-	private java.lang.String yytext () {
-		return (new java.lang.String(yy_buffer,
-			yy_buffer_start,
-			yy_buffer_end - yy_buffer_start));
-	}
-	//private int yylength () {
-	//	return yy_buffer_end - yy_buffer_start;
-	//}
-	private char[] yy_double (char buf[]) {
-		int i;
-		char newbuf[];
-		newbuf = new char[2*buf.length];
-		for (i = 0; i < buf.length; ++i) {
-			newbuf[i] = buf[i];
-		}
-		return newbuf;
-	}
-	private static final int YY_E_INTERNAL = 0;
-	//private final int YY_E_MATCH = 1;
-	private java.lang.String yy_error_string[] = {
-		"Error: Internal error.\n",
-		"Error: Unmatched input.\n"
-	};
-	private void yy_error (int code,boolean fatal) {
-		java.lang.System.out.print(yy_error_string[code]);
-		java.lang.System.out.flush();
-		if (fatal) {
-			throw new Error("Fatal Error.\n");
-		}
-	}
-	private static int[][] unpackFromString(int size1, int size2, String st) {
-		int colonIndex = -1;
-		String lengthString;
-		int sequenceLength = 0;
-		int sequenceInteger = 0;
-
-		int commaIndex;
-		String workString;
-
-		int res[][] = new int[size1][size2];
-		for (int i= 0; i < size1; i++) {
-			for (int j= 0; j < size2; j++) {
-				if (sequenceLength != 0) {
-					res[i][j] = sequenceInteger;
-					sequenceLength--;
-					continue;
-				}
-				commaIndex = st.indexOf(',');
-				workString = (commaIndex==-1) ? st :
-					st.substring(0, commaIndex);
-				st = st.substring(commaIndex+1);
-				colonIndex = workString.indexOf(':');
-				if (colonIndex == -1) {
-					res[i][j]=Integer.parseInt(workString);
-					continue;
-				}
-				lengthString =
-					workString.substring(colonIndex+1);
-				sequenceLength=Integer.parseInt(lengthString);
-				workString=workString.substring(0,colonIndex);
-				sequenceInteger=Integer.parseInt(workString);
-				res[i][j] = sequenceInteger;
-				sequenceLength--;
-			}
-		}
-		return res;
-	}
-	private static final int yy_acpt[] = {
-		/* 0 */ YY_NOT_ACCEPT,
-		/* 1 */ YY_NO_ANCHOR,
-		/* 2 */ YY_NO_ANCHOR,
-		/* 3 */ YY_NO_ANCHOR,
-		/* 4 */ YY_NO_ANCHOR,
-		/* 5 */ YY_NO_ANCHOR,
-		/* 6 */ YY_NO_ANCHOR,
-		/* 7 */ YY_NO_ANCHOR,
-		/* 8 */ YY_NO_ANCHOR,
-		/* 9 */ YY_NO_ANCHOR,
-		/* 10 */ YY_NO_ANCHOR,
-		/* 11 */ YY_NO_ANCHOR,
-		/* 12 */ YY_NO_ANCHOR,
-		/* 13 */ YY_NO_ANCHOR,
-		/* 14 */ YY_NO_ANCHOR,
-		/* 15 */ YY_NO_ANCHOR,
-		/* 16 */ YY_NO_ANCHOR,
-		/* 17 */ YY_NO_ANCHOR,
-		/* 18 */ YY_NO_ANCHOR,
-		/* 19 */ YY_NO_ANCHOR,
-		/* 20 */ YY_NO_ANCHOR,
-		/* 21 */ YY_NO_ANCHOR,
-		/* 22 */ YY_NO_ANCHOR,
-		/* 23 */ YY_NO_ANCHOR,
-		/* 24 */ YY_NO_ANCHOR,
-		/* 25 */ YY_NOT_ACCEPT,
-		/* 26 */ YY_NO_ANCHOR,
-		/* 27 */ YY_NO_ANCHOR,
-		/* 28 */ YY_NOT_ACCEPT,
-		/* 29 */ YY_NOT_ACCEPT,
-		/* 30 */ YY_NOT_ACCEPT,
-		/* 31 */ YY_NOT_ACCEPT,
-		/* 32 */ YY_NOT_ACCEPT,
-		/* 33 */ YY_NOT_ACCEPT,
-		/* 34 */ YY_NOT_ACCEPT,
-		/* 35 */ YY_NOT_ACCEPT,
-		/* 36 */ YY_NOT_ACCEPT,
-		/* 37 */ YY_NOT_ACCEPT,
-		/* 38 */ YY_NOT_ACCEPT,
-		/* 39 */ YY_NOT_ACCEPT,
-		/* 40 */ YY_NOT_ACCEPT,
-		/* 41 */ YY_NOT_ACCEPT,
-		/* 42 */ YY_NOT_ACCEPT,
-		/* 43 */ YY_NOT_ACCEPT,
-		/* 44 */ YY_NOT_ACCEPT
-	};
-	private static final int yy_cmap[] = unpackFromString(1,65538,
-"11:8,27:2,28,11,27,28,11:18,27,11,2,11:8,16,25,12,14,3,13:10,26,11:6,10:4,1" +
-"5,10,11:20,23,1,24,11:3,18,4,10:2,17,5,11:5,19,11,6,11:3,7,20,8,9,11:5,21,1" +
-"1,22,11:65410,0:2")[0];
-
-	private static final int yy_rmap[] = unpackFromString(1,45,
-"0,1:2,2,1:7,3,1:2,4,1:10,5,6,1,7,8,9,10,11,12,13,14,15,16,6,17,18,19,20,21," +
-"22")[0];
-
-	private static final int yy_nxt[][] = unpackFromString(23,29,
-"1,-1,2,-1:2,25,28,-1,29,-1:3,30,3,-1:7,4,5,6,7,8,9,10:2,-1:42,3,33,34,-1,34" +
-",-1:24,11,-1,34,-1,34,-1:12,16,17,18,19,20,21,22,23,40,-1:37,31,-1:23,26,-1" +
-":24,42,-1:26,32,-1:34,3,-1:34,35,-1:18,37,-1:32,11,-1:27,38,26,-1:2,38,-1:3" +
-"2,37,-1:27,12,-1:26,13,-1:11,1,14,15,27:25,-1:5,44:2,-1:4,44,-1:2,44,-1,44," +
-"-1,44:2,-1:14,24:2,-1:4,24,-1:2,24,-1,24,-1,24:2,-1:29,36,-1:13,41:2,-1:4,4" +
-"1,-1:2,41,-1,41,-1,41:2,-1:14,43:2,-1:4,43,-1:2,43,-1,43,-1,43:2,-1:10");
-
-	public Yytoken yylex ()
-		throws java.io.IOException {
-		int yy_lookahead;
-		int yy_anchor = YY_NO_ANCHOR;
-		int yy_state = yy_state_dtrans[yy_lexical_state];
-		int yy_next_state = YY_NO_STATE;
-		int yy_last_accept_state = YY_NO_STATE;
-		boolean yy_initial = true;
-		int yy_this_accept;
-
-		yy_mark_start();
-		yy_this_accept = yy_acpt[yy_state];
-		if (YY_NOT_ACCEPT != yy_this_accept) {
-			yy_last_accept_state = yy_state;
-			yy_mark_end();
-		}
-		while (true) {
-			if (yy_initial && yy_at_bol) yy_lookahead = YY_BOL;
-			else yy_lookahead = yy_advance();
-			yy_next_state = YY_F;
-			yy_next_state = yy_nxt[yy_rmap[yy_state]][yy_cmap[yy_lookahead]];
-			if (YY_EOF == yy_lookahead && true == yy_initial) {
-				return null;
-			}
-			if (YY_F != yy_next_state) {
-				yy_state = yy_next_state;
-				yy_initial = false;
-				yy_this_accept = yy_acpt[yy_state];
-				if (YY_NOT_ACCEPT != yy_this_accept) {
-					yy_last_accept_state = yy_state;
-					yy_mark_end();
-				}
-			}
-			else {
-				if (YY_NO_STATE == yy_last_accept_state) {
-					throw (new Error("Lexical Error: Unmatched Input."));
-				}
-				else {
-					yy_anchor = yy_acpt[yy_last_accept_state];
-					if (0 != (YY_END & yy_anchor)) {
-						yy_move_end();
-					}
-					yy_to_mark();
-					switch (yy_last_accept_state) {
-					case 1:
-						
-					case -2:
-						break;
-					case 2:
-						{ sb.delete(0,sb.length());yybegin(STRING_BEGIN);}
-					case -3:
-						break;
-					case 3:
-						{ Long val=Long.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE,val);}
-					case -4:
-						break;
-					case 4:
-						{ return new Yytoken(Yytoken.TYPE_LEFT_BRACE,null);}
-					case -5:
-						break;
-					case 5:
-						{ return new Yytoken(Yytoken.TYPE_RIGHT_BRACE,null);}
-					case -6:
-						break;
-					case 6:
-						{ return new Yytoken(Yytoken.TYPE_LEFT_SQUARE,null);}
-					case -7:
-						break;
-					case 7:
-						{ return new Yytoken(Yytoken.TYPE_RIGHT_SQUARE,null);}
-					case -8:
-						break;
-					case 8:
-						{ return new Yytoken(Yytoken.TYPE_COMMA,null);}
-					case -9:
-						break;
-					case 9:
-						{ return new Yytoken(Yytoken.TYPE_COLON,null);}
-					case -10:
-						break;
-					case 10:
-						{}
-					case -11:
-						break;
-					case 11:
-						{ Double val=Double.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE,val);}
-					case -12:
-						break;
-					case 12:
-						{ return new Yytoken(Yytoken.TYPE_VALUE,null);}
-					case -13:
-						break;
-					case 13:
-						{ Boolean val=Boolean.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE,val);}
-					case -14:
-						break;
-					case 14:
-						{ sb.append(yytext());}
-					case -15:
-						break;
-					case 15:
-						{ yybegin(YYINITIAL);return new Yytoken(Yytoken.TYPE_VALUE,sb.toString());}
-					case -16:
-						break;
-					case 16:
-						{sb.append('\\');}
-					case -17:
-						break;
-					case 17:
-						{sb.append('"');}
-					case -18:
-						break;
-					case 18:
-						{sb.append('/');}
-					case -19:
-						break;
-					case 19:
-						{sb.append('\b');}
-					case -20:
-						break;
-					case 20:
-						{sb.append('\f');}
-					case -21:
-						break;
-					case 21:
-						{sb.append('\n');}
-					case -22:
-						break;
-					case 22:
-						{sb.append('\r');}
-					case -23:
-						break;
-					case 23:
-						{sb.append('\t');}
-					case -24:
-						break;
-					case 24:
-						{	int ch=Integer.parseInt(yytext().substring(2),16);
-													sb.append((char)ch);
-												}
-					case -25:
-						break;
-					case 26:
-						{ Double val=Double.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE,val);}
-					case -26:
-						break;
-					case 27:
-						{ sb.append(yytext());}
-					case -27:
-						break;
-					default:
-						yy_error(YY_E_INTERNAL,false);
-					case -1:
-					}
-					yy_initial = true;
-					yy_state = yy_state_dtrans[yy_lexical_state];
-					yy_next_state = YY_NO_STATE;
-					yy_last_accept_state = YY_NO_STATE;
-					yy_mark_start();
-					yy_this_accept = yy_acpt[yy_state];
-					if (YY_NOT_ACCEPT != yy_this_accept) {
-						yy_last_accept_state = yy_state;
-						yy_mark_end();
-					}
-				}
-			}
-		}
-	}
-}
diff --git a/azureus2/src/org/json/simple/parser/Yytoken.java b/azureus2/src/org/json/simple/parser/Yytoken.java
deleted file mode 100644
index 4c90001..0000000
--- a/azureus2/src/org/json/simple/parser/Yytoken.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * $Id: Yytoken.java,v 1.1 2007-06-05 00:43:56 tuxpaper Exp $
- * Created on 2006-4-15
- */
-package org.json.simple.parser;
-
-/**
- * @author FangYidong<fangyidong at yahoo.com.cn>
- */
-public class Yytoken {
-	public static final int TYPE_VALUE=0;//JSON primitive value: string,number,boolean,null
-	public static final int TYPE_LEFT_BRACE=1;
-	public static final int TYPE_RIGHT_BRACE=2;
-	public static final int TYPE_LEFT_SQUARE=3;
-	public static final int TYPE_RIGHT_SQUARE=4;
-	public static final int TYPE_COMMA=5;
-	public static final int TYPE_COLON=6;
-	public static final int TYPE_EOF=-1;//end of file
-	
-	public int type=0;
-	public Object value=null;
-	
-	public Yytoken(int type,Object value){
-		this.type=type;
-		this.value=value;
-	}
-	
-	public String toString(){
-		return String.valueOf(type+"=>|"+value+"|");
-	}
-}
diff --git a/azureus3/src/org/apache/commons/lang/Entities.java b/azureus3/src/org/apache/commons/lang/Entities.java
deleted file mode 100644
index 735ab01..0000000
--- a/azureus3/src/org/apache/commons/lang/Entities.java
+++ /dev/null
@@ -1,681 +0,0 @@
-/*
- * Copyright 2002-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.commons.lang;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TreeMap;
-
-/**
- * <p>Provides HTML and XML entity utilities.</p>
- *
- * @see <a href="http://hotwired.lycos.com/webmonkey/reference/special_characters/">ISO Entities</a>
- * @see </br><a href="http://www.w3.org/TR/REC-html32#latin1">HTML 3.2 Character Entities for ISO Latin-1</a>
- * @see </br><a href="http://www.w3.org/TR/REC-html40/sgml/entities.html">HTML 4.0 Character entity references</a>
- * @see </br><a href="http://www.w3.org/TR/html401/charset.html#h-5.3">HTML 4.01 Character References</a>
- * @see </br><a href="http://www.w3.org/TR/html401/charset.html#code-position">HTML 4.01 Code positions</a>
- *
- * @author <a href="mailto:alex at purpletech.com">Alexander Day Chaffee</a>
- * @author <a href="mailto:ggregory at seagullsw.com">Gary Gregory</a>
- * @since 2.0
- * @version $Id: Entities.java,v 1.1 2008-05-02 15:43:01 gudy Exp $
- */
-public class Entities {
-
-    private static final String[][] BASIC_ARRAY = {
-        {"quot", "34"}, // " - double-quote
-        {"amp", "38"}, // & - ampersand
-        {"lt", "60"}, // < - less-than
-        {"gt", "62"}, // > - greater-than
-    };
-
-    private static final String[][] APOS_ARRAY = {
-        {"apos", "39"}, // XML apostrophe
-    };
-
-    // package scoped for testing
-    static final String[][] ISO8859_1_ARRAY = {
-        {"nbsp", "160"}, // non-breaking space
-        {"iexcl", "161"}, //inverted exclamation mark
-        {"cent", "162"}, //cent sign
-        {"pound", "163"}, //pound sign
-        {"curren", "164"}, //currency sign
-        {"yen", "165"}, //yen sign = yuan sign
-        {"brvbar", "166"}, //broken bar = broken vertical bar
-        {"sect", "167"}, //section sign
-        {"uml", "168"}, //diaeresis = spacing diaeresis
-        {"copy", "169"}, //  - copyright sign
-        {"ordf", "170"}, //feminine ordinal indicator
-        {"laquo", "171"}, //left-pointing double angle quotation mark = left pointing guillemet
-        {"not", "172"}, //not sign
-        {"shy", "173"}, //soft hyphen = discretionary hyphen
-        {"reg", "174"}, //  - registered trademark sign
-        {"macr", "175"}, //macron = spacing macron = overline = APL overbar
-        {"deg", "176"}, //degree sign
-        {"plusmn", "177"}, //plus-minus sign = plus-or-minus sign
-        {"sup2", "178"}, //superscript two = superscript digit two = squared
-        {"sup3", "179"}, //superscript three = superscript digit three = cubed
-        {"acute", "180"}, //acute accent = spacing acute
-        {"micro", "181"}, //micro sign
-        {"para", "182"}, //pilcrow sign = paragraph sign
-        {"middot", "183"}, //middle dot = Georgian comma = Greek middle dot
-        {"cedil", "184"}, //cedilla = spacing cedilla
-        {"sup1", "185"}, //superscript one = superscript digit one
-        {"ordm", "186"}, //masculine ordinal indicator
-        {"raquo", "187"}, //right-pointing double angle quotation mark = right pointing guillemet
-        {"frac14", "188"}, //vulgar fraction one quarter = fraction one quarter
-        {"frac12", "189"}, //vulgar fraction one half = fraction one half
-        {"frac34", "190"}, //vulgar fraction three quarters = fraction three quarters
-        {"iquest", "191"}, //inverted question mark = turned question mark
-        {"Agrave", "192"}, //  - uppercase A, grave accent
-        {"Aacute", "193"}, //  - uppercase A, acute accent
-        {"Acirc", "194"}, //  - uppercase A, circumflex accent
-        {"Atilde", "195"}, //  - uppercase A, tilde
-        {"Auml", "196"}, //  - uppercase A, umlaut
-        {"Aring", "197"}, //  - uppercase A, ring
-        {"AElig", "198"}, //  - uppercase AE
-        {"Ccedil", "199"}, //  - uppercase C, cedilla
-        {"Egrave", "200"}, //  - uppercase E, grave accent
-        {"Eacute", "201"}, //  - uppercase E, acute accent
-        {"Ecirc", "202"}, //  - uppercase E, circumflex accent
-        {"Euml", "203"}, //  - uppercase E, umlaut
-        {"Igrave", "204"}, //  - uppercase I, grave accent
-        {"Iacute", "205"}, //  - uppercase I, acute accent
-        {"Icirc", "206"}, //  - uppercase I, circumflex accent
-        {"Iuml", "207"}, //  - uppercase I, umlaut
-        {"ETH", "208"}, //  - uppercase Eth, Icelandic
-        {"Ntilde", "209"}, //  - uppercase N, tilde
-        {"Ograve", "210"}, //  - uppercase O, grave accent
-        {"Oacute", "211"}, //  - uppercase O, acute accent
-        {"Ocirc", "212"}, //  - uppercase O, circumflex accent
-        {"Otilde", "213"}, //  - uppercase O, tilde
-        {"Ouml", "214"}, //  - uppercase O, umlaut
-        {"times", "215"}, //multiplication sign
-        {"Oslash", "216"}, //  - uppercase O, slash
-        {"Ugrave", "217"}, //  - uppercase U, grave accent
-        {"Uacute", "218"}, //  - uppercase U, acute accent
-        {"Ucirc", "219"}, //  - uppercase U, circumflex accent
-        {"Uuml", "220"}, //  - uppercase U, umlaut
-        {"Yacute", "221"}, //  - uppercase Y, acute accent
-        {"THORN", "222"}, //  - uppercase THORN, Icelandic
-        {"szlig", "223"}, //  - lowercase sharps, German
-        {"agrave", "224"}, //  - lowercase a, grave accent
-        {"aacute", "225"}, //  - lowercase a, acute accent
-        {"acirc", "226"}, //  - lowercase a, circumflex accent
-        {"atilde", "227"}, //  - lowercase a, tilde
-        {"auml", "228"}, //  - lowercase a, umlaut
-        {"aring", "229"}, //  - lowercase a, ring
-        {"aelig", "230"}, //  - lowercase ae
-        {"ccedil", "231"}, //  - lowercase c, cedilla
-        {"egrave", "232"}, //  - lowercase e, grave accent
-        {"eacute", "233"}, //  - lowercase e, acute accent
-        {"ecirc", "234"}, //  - lowercase e, circumflex accent
-        {"euml", "235"}, //  - lowercase e, umlaut
-        {"igrave", "236"}, //  - lowercase i, grave accent
-        {"iacute", "237"}, //  - lowercase i, acute accent
-        {"icirc", "238"}, //  - lowercase i, circumflex accent
-        {"iuml", "239"}, //  - lowercase i, umlaut
-        {"eth", "240"}, //  - lowercase eth, Icelandic
-        {"ntilde", "241"}, //  - lowercase n, tilde
-        {"ograve", "242"}, //  - lowercase o, grave accent
-        {"oacute", "243"}, //  - lowercase o, acute accent
-        {"ocirc", "244"}, //  - lowercase o, circumflex accent
-        {"otilde", "245"}, //  - lowercase o, tilde
-        {"ouml", "246"}, //  - lowercase o, umlaut
-        {"divide", "247"}, // division sign
-        {"oslash", "248"}, //  - lowercase o, slash
-        {"ugrave", "249"}, //  - lowercase u, grave accent
-        {"uacute", "250"}, //  - lowercase u, acute accent
-        {"ucirc", "251"}, //  - lowercase u, circumflex accent
-        {"uuml", "252"}, //  - lowercase u, umlaut
-        {"yacute", "253"}, //  - lowercase y, acute accent
-        {"thorn", "254"}, //  - lowercase thorn, Icelandic
-        {"yuml", "255"}, //  - lowercase y, umlaut
-    };
-
-    // http://www.w3.org/TR/REC-html40/sgml/entities.html
-    // package scoped for testing
-    static final String[][] HTML40_ARRAY = {
-// <!-- Latin Extended-B -->
-        {"fnof", "402"}, //latin small f with hook = function= florin, U+0192 ISOtech -->
-// <!-- Greek -->
-        {"Alpha", "913"}, //greek capital letter alpha, U+0391 -->
-        {"Beta", "914"}, //greek capital letter beta, U+0392 -->
-        {"Gamma", "915"}, //greek capital letter gamma,U+0393 ISOgrk3 -->
-        {"Delta", "916"}, //greek capital letter delta,U+0394 ISOgrk3 -->
-        {"Epsilon", "917"}, //greek capital letter epsilon, U+0395 -->
-        {"Zeta", "918"}, //greek capital letter zeta, U+0396 -->
-        {"Eta", "919"}, //greek capital letter eta, U+0397 -->
-        {"Theta", "920"}, //greek capital letter theta,U+0398 ISOgrk3 -->
-        {"Iota", "921"}, //greek capital letter iota, U+0399 -->
-        {"Kappa", "922"}, //greek capital letter kappa, U+039A -->
-        {"Lambda", "923"}, //greek capital letter lambda,U+039B ISOgrk3 -->
-        {"Mu", "924"}, //greek capital letter mu, U+039C -->
-        {"Nu", "925"}, //greek capital letter nu, U+039D -->
-        {"Xi", "926"}, //greek capital letter xi, U+039E ISOgrk3 -->
-        {"Omicron", "927"}, //greek capital letter omicron, U+039F -->
-        {"Pi", "928"}, //greek capital letter pi, U+03A0 ISOgrk3 -->
-        {"Rho", "929"}, //greek capital letter rho, U+03A1 -->
-// <!-- there is no Sigmaf, and no U+03A2 character either -->
-        {"Sigma", "931"}, //greek capital letter sigma,U+03A3 ISOgrk3 -->
-        {"Tau", "932"}, //greek capital letter tau, U+03A4 -->
-        {"Upsilon", "933"}, //greek capital letter upsilon,U+03A5 ISOgrk3 -->
-        {"Phi", "934"}, //greek capital letter phi,U+03A6 ISOgrk3 -->
-        {"Chi", "935"}, //greek capital letter chi, U+03A7 -->
-        {"Psi", "936"}, //greek capital letter psi,U+03A8 ISOgrk3 -->
-        {"Omega", "937"}, //greek capital letter omega,U+03A9 ISOgrk3 -->
-        {"alpha", "945"}, //greek small letter alpha,U+03B1 ISOgrk3 -->
-        {"beta", "946"}, //greek small letter beta, U+03B2 ISOgrk3 -->
-        {"gamma", "947"}, //greek small letter gamma,U+03B3 ISOgrk3 -->
-        {"delta", "948"}, //greek small letter delta,U+03B4 ISOgrk3 -->
-        {"epsilon", "949"}, //greek small letter epsilon,U+03B5 ISOgrk3 -->
-        {"zeta", "950"}, //greek small letter zeta, U+03B6 ISOgrk3 -->
-        {"eta", "951"}, //greek small letter eta, U+03B7 ISOgrk3 -->
-        {"theta", "952"}, //greek small letter theta,U+03B8 ISOgrk3 -->
-        {"iota", "953"}, //greek small letter iota, U+03B9 ISOgrk3 -->
-        {"kappa", "954"}, //greek small letter kappa,U+03BA ISOgrk3 -->
-        {"lambda", "955"}, //greek small letter lambda,U+03BB ISOgrk3 -->
-        {"mu", "956"}, //greek small letter mu, U+03BC ISOgrk3 -->
-        {"nu", "957"}, //greek small letter nu, U+03BD ISOgrk3 -->
-        {"xi", "958"}, //greek small letter xi, U+03BE ISOgrk3 -->
-        {"omicron", "959"}, //greek small letter omicron, U+03BF NEW -->
-        {"pi", "960"}, //greek small letter pi, U+03C0 ISOgrk3 -->
-        {"rho", "961"}, //greek small letter rho, U+03C1 ISOgrk3 -->
-        {"sigmaf", "962"}, //greek small letter final sigma,U+03C2 ISOgrk3 -->
-        {"sigma", "963"}, //greek small letter sigma,U+03C3 ISOgrk3 -->
-        {"tau", "964"}, //greek small letter tau, U+03C4 ISOgrk3 -->
-        {"upsilon", "965"}, //greek small letter upsilon,U+03C5 ISOgrk3 -->
-        {"phi", "966"}, //greek small letter phi, U+03C6 ISOgrk3 -->
-        {"chi", "967"}, //greek small letter chi, U+03C7 ISOgrk3 -->
-        {"psi", "968"}, //greek small letter psi, U+03C8 ISOgrk3 -->
-        {"omega", "969"}, //greek small letter omega,U+03C9 ISOgrk3 -->
-        {"thetasym", "977"}, //greek small letter theta symbol,U+03D1 NEW -->
-        {"upsih", "978"}, //greek upsilon with hook symbol,U+03D2 NEW -->
-        {"piv", "982"}, //greek pi symbol, U+03D6 ISOgrk3 -->
-// <!-- General Punctuation -->
-        {"bull", "8226"}, //bullet = black small circle,U+2022 ISOpub  -->
-// <!-- bullet is NOT the same as bullet operator, U+2219 -->
-        {"hellip", "8230"}, //horizontal ellipsis = three dot leader,U+2026 ISOpub  -->
-        {"prime", "8242"}, //prime = minutes = feet, U+2032 ISOtech -->
-        {"Prime", "8243"}, //double prime = seconds = inches,U+2033 ISOtech -->
-        {"oline", "8254"}, //overline = spacing overscore,U+203E NEW -->
-        {"frasl", "8260"}, //fraction slash, U+2044 NEW -->
-// <!-- Letterlike Symbols -->
-        {"weierp", "8472"}, //script capital P = power set= Weierstrass p, U+2118 ISOamso -->
-        {"image", "8465"}, //blackletter capital I = imaginary part,U+2111 ISOamso -->
-        {"real", "8476"}, //blackletter capital R = real part symbol,U+211C ISOamso -->
-        {"trade", "8482"}, //trade mark sign, U+2122 ISOnum -->
-        {"alefsym", "8501"}, //alef symbol = first transfinite cardinal,U+2135 NEW -->
-// <!-- alef symbol is NOT the same as hebrew letter alef,U+05D0 although the same glyph could be used to depict both characters -->
-// <!-- Arrows -->
-        {"larr", "8592"}, //leftwards arrow, U+2190 ISOnum -->
-        {"uarr", "8593"}, //upwards arrow, U+2191 ISOnum-->
-        {"rarr", "8594"}, //rightwards arrow, U+2192 ISOnum -->
-        {"darr", "8595"}, //downwards arrow, U+2193 ISOnum -->
-        {"harr", "8596"}, //left right arrow, U+2194 ISOamsa -->
-        {"crarr", "8629"}, //downwards arrow with corner leftwards= carriage return, U+21B5 NEW -->
-        {"lArr", "8656"}, //leftwards double arrow, U+21D0 ISOtech -->
-// <!-- ISO 10646 does not say that lArr is the same as the 'is implied by' arrowbut also does not have any other character for that function. So ? lArr canbe used for 'is implied by' as ISOtech suggests -->
-        {"uArr", "8657"}, //upwards double arrow, U+21D1 ISOamsa -->
-        {"rArr", "8658"}, //rightwards double arrow,U+21D2 ISOtech -->
-// <!-- ISO 10646 does not say this is the 'implies' character but does not have another character with this function so ?rArr can be used for 'implies' as ISOtech suggests -->
-        {"dArr", "8659"}, //downwards double arrow, U+21D3 ISOamsa -->
-        {"hArr", "8660"}, //left right double arrow,U+21D4 ISOamsa -->
-// <!-- Mathematical Operators -->
-        {"forall", "8704"}, //for all, U+2200 ISOtech -->
-        {"part", "8706"}, //partial differential, U+2202 ISOtech  -->
-        {"exist", "8707"}, //there exists, U+2203 ISOtech -->
-        {"empty", "8709"}, //empty set = null set = diameter,U+2205 ISOamso -->
-        {"nabla", "8711"}, //nabla = backward difference,U+2207 ISOtech -->
-        {"isin", "8712"}, //element of, U+2208 ISOtech -->
-        {"notin", "8713"}, //not an element of, U+2209 ISOtech -->
-        {"ni", "8715"}, //contains as member, U+220B ISOtech -->
-// <!-- should there be a more memorable name than 'ni'? -->
-        {"prod", "8719"}, //n-ary product = product sign,U+220F ISOamsb -->
-// <!-- prod is NOT the same character as U+03A0 'greek capital letter pi' though the same glyph might be used for both -->
-        {"sum", "8721"}, //n-ary summation, U+2211 ISOamsb -->
-// <!-- sum is NOT the same character as U+03A3 'greek capital letter sigma' though the same glyph might be used for both -->
-        {"minus", "8722"}, //minus sign, U+2212 ISOtech -->
-        {"lowast", "8727"}, //asterisk operator, U+2217 ISOtech -->
-        {"radic", "8730"}, //square root = radical sign,U+221A ISOtech -->
-        {"prop", "8733"}, //proportional to, U+221D ISOtech -->
-        {"infin", "8734"}, //infinity, U+221E ISOtech -->
-        {"ang", "8736"}, //angle, U+2220 ISOamso -->
-        {"and", "8743"}, //logical and = wedge, U+2227 ISOtech -->
-        {"or", "8744"}, //logical or = vee, U+2228 ISOtech -->
-        {"cap", "8745"}, //intersection = cap, U+2229 ISOtech -->
-        {"cup", "8746"}, //union = cup, U+222A ISOtech -->
-        {"int", "8747"}, //integral, U+222B ISOtech -->
-        {"there4", "8756"}, //therefore, U+2234 ISOtech -->
-        {"sim", "8764"}, //tilde operator = varies with = similar to,U+223C ISOtech -->
-// <!-- tilde operator is NOT the same character as the tilde, U+007E,although the same glyph might be used to represent both  -->
-        {"cong", "8773"}, //approximately equal to, U+2245 ISOtech -->
-        {"asymp", "8776"}, //almost equal to = asymptotic to,U+2248 ISOamsr -->
-        {"ne", "8800"}, //not equal to, U+2260 ISOtech -->
-        {"equiv", "8801"}, //identical to, U+2261 ISOtech -->
-        {"le", "8804"}, //less-than or equal to, U+2264 ISOtech -->
-        {"ge", "8805"}, //greater-than or equal to,U+2265 ISOtech -->
-        {"sub", "8834"}, //subset of, U+2282 ISOtech -->
-        {"sup", "8835"}, //superset of, U+2283 ISOtech -->
-// <!-- note that nsup, 'not a superset of, U+2283' is not covered by the Symbol font encoding and is not included. Should it be, for symmetry?It is in ISOamsn  --> <!ENTITY nsub", "8836"},  //not a subset of, U+2284 ISOamsn -->
-        {"sube", "8838"}, //subset of or equal to, U+2286 ISOtech -->
-        {"supe", "8839"}, //superset of or equal to,U+2287 ISOtech -->
-        {"oplus", "8853"}, //circled plus = direct sum,U+2295 ISOamsb -->
-        {"otimes", "8855"}, //circled times = vector product,U+2297 ISOamsb -->
-        {"perp", "8869"}, //up tack = orthogonal to = perpendicular,U+22A5 ISOtech -->
-        {"sdot", "8901"}, //dot operator, U+22C5 ISOamsb -->
-// <!-- dot operator is NOT the same character as U+00B7 middle dot -->
-// <!-- Miscellaneous Technical -->
-        {"lceil", "8968"}, //left ceiling = apl upstile,U+2308 ISOamsc  -->
-        {"rceil", "8969"}, //right ceiling, U+2309 ISOamsc  -->
-        {"lfloor", "8970"}, //left floor = apl downstile,U+230A ISOamsc  -->
-        {"rfloor", "8971"}, //right floor, U+230B ISOamsc  -->
-        {"lang", "9001"}, //left-pointing angle bracket = bra,U+2329 ISOtech -->
-// <!-- lang is NOT the same character as U+003C 'less than' or U+2039 'single left-pointing angle quotation mark' -->
-        {"rang", "9002"}, //right-pointing angle bracket = ket,U+232A ISOtech -->
-// <!-- rang is NOT the same character as U+003E 'greater than' or U+203A 'single right-pointing angle quotation mark' -->
-// <!-- Geometric Shapes -->
-        {"loz", "9674"}, //lozenge, U+25CA ISOpub -->
-// <!-- Miscellaneous Symbols -->
-        {"spades", "9824"}, //black spade suit, U+2660 ISOpub -->
-// <!-- black here seems to mean filled as opposed to hollow -->
-        {"clubs", "9827"}, //black club suit = shamrock,U+2663 ISOpub -->
-        {"hearts", "9829"}, //black heart suit = valentine,U+2665 ISOpub -->
-        {"diams", "9830"}, //black diamond suit, U+2666 ISOpub -->
-
-// <!-- Latin Extended-A -->
-        {"OElig", "338"}, //  -- latin capital ligature OE,U+0152 ISOlat2 -->
-        {"oelig", "339"}, //  -- latin small ligature oe, U+0153 ISOlat2 -->
-// <!-- ligature is a misnomer, this is a separate character in some languages -->
-        {"Scaron", "352"}, //  -- latin capital letter S with caron,U+0160 ISOlat2 -->
-        {"scaron", "353"}, //  -- latin small letter s with caron,U+0161 ISOlat2 -->
-        {"Yuml", "376"}, //  -- latin capital letter Y with diaeresis,U+0178 ISOlat2 -->
-// <!-- Spacing Modifier Letters -->
-        {"circ", "710"}, //  -- modifier letter circumflex accent,U+02C6 ISOpub -->
-        {"tilde", "732"}, //small tilde, U+02DC ISOdia -->
-// <!-- General Punctuation -->
-        {"ensp", "8194"}, //en space, U+2002 ISOpub -->
-        {"emsp", "8195"}, //em space, U+2003 ISOpub -->
-        {"thinsp", "8201"}, //thin space, U+2009 ISOpub -->
-        {"zwnj", "8204"}, //zero width non-joiner,U+200C NEW RFC 2070 -->
-        {"zwj", "8205"}, //zero width joiner, U+200D NEW RFC 2070 -->
-        {"lrm", "8206"}, //left-to-right mark, U+200E NEW RFC 2070 -->
-        {"rlm", "8207"}, //right-to-left mark, U+200F NEW RFC 2070 -->
-        {"ndash", "8211"}, //en dash, U+2013 ISOpub -->
-        {"mdash", "8212"}, //em dash, U+2014 ISOpub -->
-        {"lsquo", "8216"}, //left single quotation mark,U+2018 ISOnum -->
-        {"rsquo", "8217"}, //right single quotation mark,U+2019 ISOnum -->
-        {"sbquo", "8218"}, //single low-9 quotation mark, U+201A NEW -->
-        {"ldquo", "8220"}, //left double quotation mark,U+201C ISOnum -->
-        {"rdquo", "8221"}, //right double quotation mark,U+201D ISOnum -->
-        {"bdquo", "8222"}, //double low-9 quotation mark, U+201E NEW -->
-        {"dagger", "8224"}, //dagger, U+2020 ISOpub -->
-        {"Dagger", "8225"}, //double dagger, U+2021 ISOpub -->
-        {"permil", "8240"}, //per mille sign, U+2030 ISOtech -->
-        {"lsaquo", "8249"}, //single left-pointing angle quotation mark,U+2039 ISO proposed -->
-// <!-- lsaquo is proposed but not yet ISO standardized -->
-        {"rsaquo", "8250"}, //single right-pointing angle quotation mark,U+203A ISO proposed -->
-// <!-- rsaquo is proposed but not yet ISO standardized -->
-        {"euro", "8364"}, //  -- euro sign, U+20AC NEW -->
-    };
-
-    /**
-     * <p>The set of entities supported by standard XML.</p>
-     */
-    public static final Entities XML;
-
-    /**
-     * <p>The set of entities supported by HTML 3.2.</p>
-     */
-    public static final Entities HTML32;
-
-    /**
-     * <p>The set of entities supported by HTML 4.0.</p>
-     */
-    public static final Entities HTML40;
-
-    static {
-        XML = new Entities();
-        XML.addEntities(BASIC_ARRAY);
-        XML.addEntities(APOS_ARRAY);
-    }
-
-    static {
-        HTML32 = new Entities();
-        HTML32.addEntities(BASIC_ARRAY);
-        HTML32.addEntities(ISO8859_1_ARRAY);
-    }
-
-    static {
-        HTML40 = new Entities();
-        fillWithHtml40Entities(HTML40);
-    }
-
-    static void fillWithHtml40Entities(Entities entities) {
-        entities.addEntities(BASIC_ARRAY);
-        entities.addEntities(ISO8859_1_ARRAY);
-        entities.addEntities(HTML40_ARRAY);
-    }
-
-    static interface EntityMap {
-        void add(String name, int value);
-
-        String name(int value);
-
-        int value(String name);
-    }
-
-    static class PrimitiveEntityMap implements EntityMap {
-        private Map mapNameToValue = new HashMap();
-        private IntHashMap mapValueToName = new IntHashMap();
-
-        public void add(String name, int value) {
-            mapNameToValue.put(name, new Integer(value));
-            mapValueToName.put(value, name);
-        }
-
-        public String name(int value) {
-            return (String) mapValueToName.get(value);
-        }
-
-        public int value(String name) {
-            Object value = mapNameToValue.get(name);
-            if (value == null) {
-                return -1;
-            }
-            return ((Integer) value).intValue();
-        }
-    }
-
-
-    static abstract class MapIntMap implements Entities.EntityMap {
-        protected Map mapNameToValue;
-        protected Map mapValueToName;
-
-        public void add(String name, int value) {
-            mapNameToValue.put(name, new Integer(value));
-            mapValueToName.put(new Integer(value), name);
-        }
-
-        public String name(int value) {
-            return (String) mapValueToName.get(new Integer(value));
-        }
-
-        public int value(String name) {
-            Object value = mapNameToValue.get(name);
-            if (value == null) {
-                return -1;
-            }
-            return ((Integer) value).intValue();
-        }
-    }
-
-    static class HashEntityMap extends MapIntMap {
-        public HashEntityMap() {
-            mapNameToValue = new HashMap();
-            mapValueToName = new HashMap();
-        }
-    }
-
-    static class TreeEntityMap extends MapIntMap {
-        public TreeEntityMap() {
-            mapNameToValue = new TreeMap();
-            mapValueToName = new TreeMap();
-        }
-    }
-
-    static class LookupEntityMap extends PrimitiveEntityMap {
-        private String[] lookupTable;
-        private int LOOKUP_TABLE_SIZE = 256;
-
-        public String name(int value) {
-            if (value < LOOKUP_TABLE_SIZE) {
-                return lookupTable()[value];
-            }
-            return super.name(value);
-        }
-
-        private String[] lookupTable() {
-            if (lookupTable == null) {
-                createLookupTable();
-            }
-            return lookupTable;
-        }
-
-        private void createLookupTable() {
-            lookupTable = new String[LOOKUP_TABLE_SIZE];
-            for (int i = 0; i < LOOKUP_TABLE_SIZE; ++i) {
-                lookupTable[i] = super.name(i);
-            }
-        }
-    }
-
-    static class ArrayEntityMap implements EntityMap {
-        protected int growBy = 100;
-        protected int size = 0;
-        protected String[] names;
-        protected int[] values;
-
-        public ArrayEntityMap() {
-            names = new String[growBy];
-            values = new int[growBy];
-        }
-
-        public ArrayEntityMap(int growBy) {
-            this.growBy = growBy;
-            names = new String[growBy];
-            values = new int[growBy];
-        }
-
-        public void add(String name, int value) {
-            ensureCapacity(size + 1);
-            names[size] = name;
-            values[size] = value;
-            size++;
-        }
-
-        protected void ensureCapacity(int capacity) {
-            if (capacity > names.length) {
-                int newSize = Math.max(capacity, size + growBy);
-                String[] newNames = new String[newSize];
-                System.arraycopy(names, 0, newNames, 0, size);
-                names = newNames;
-                int[] newValues = new int[newSize];
-                System.arraycopy(values, 0, newValues, 0, size);
-                values = newValues;
-            }
-        }
-
-        public String name(int value) {
-            for (int i = 0; i < size; ++i) {
-                if (values[i] == value) {
-                    return names[i];
-                }
-            }
-            return null;
-        }
-
-        public int value(String name) {
-            for (int i = 0; i < size; ++i) {
-                if (names[i].equals(name)) {
-                    return values[i];
-                }
-            }
-            return -1;
-        }
-    }
-
-    static class BinaryEntityMap extends ArrayEntityMap {
-
-        public BinaryEntityMap() {
-        }
-
-        public BinaryEntityMap(int growBy) {
-            super(growBy);
-        }
-
-        // based on code in java.util.Arrays
-        private int binarySearch(int key) {
-            int low = 0;
-            int high = size - 1;
-
-            while (low <= high) {
-                int mid = (low + high) >> 1;
-                int midVal = values[mid];
-
-                if (midVal < key) {
-                    low = mid + 1;
-                } else if (midVal > key) {
-                    high = mid - 1;
-                } else {
-                    return mid; // key found
-                }
-            }
-            return -(low + 1);  // key not found.
-        }
-
-        public void add(String name, int value) {
-            ensureCapacity(size + 1);
-            int insertAt = binarySearch(value);
-            if (insertAt > 0) {
-                return;    // note: this means you can't insert the same value twice
-            }
-            insertAt = -(insertAt + 1);  // binarySearch returns it negative and off-by-one
-            System.arraycopy(values, insertAt, values, insertAt + 1, size - insertAt);
-            values[insertAt] = value;
-            System.arraycopy(names, insertAt, names, insertAt + 1, size - insertAt);
-            names[insertAt] = name;
-            size++;
-        }
-
-        public String name(int value) {
-            int index = binarySearch(value);
-            if (index < 0) {
-                return null;
-            }
-            return names[index];
-        }
-    }
-
-    // package scoped for testing
-    EntityMap map = new Entities.LookupEntityMap();
-
-    public void addEntities(String[][] entityArray) {
-        for (int i = 0; i < entityArray.length; ++i) {
-            addEntity(entityArray[i][0], Integer.parseInt(entityArray[i][1]));
-        }
-    }
-
-    public void addEntity(String name, int value) {
-        map.add(name, value);
-    }
-
-    public String entityName(int value) {
-        return map.name(value);
-    }
-
-
-    public int entityValue(String name) {
-        return map.value(name);
-    }
-
-    /**
-     * <p>Escapes the characters in a <code>String</code>.</p>
-     *
-     * <p>For example, if you have called addEntity("foo", 0xA1),
-     * escape("\u00A1") will return "&foo;"</p>
-     *
-     * @param str The <code>String</code> to escape.
-     * @return A new escaped <code>String</code>.
-     */
-    public String escape(String str) {
-        //todo: rewrite to use a Writer
-        StringBuffer buf = new StringBuffer(str.length() * 2);
-        int i;
-        for (i = 0; i < str.length(); ++i) {
-            char ch = str.charAt(i);
-            String entityName = this.entityName(ch);
-            if (entityName == null) {
-                if (ch > 0x7F) {
-                    int intValue = ch;
-                    buf.append("&#");
-                    buf.append(intValue);
-                    buf.append(';');
-                } else {
-                    buf.append(ch);
-                }
-            } else {
-                buf.append('&');
-                buf.append(entityName);
-                buf.append(';');
-            }
-        }
-        return buf.toString();
-    }
-
-    /**
-     * <p>Unescapes the entities in a <code>String</code>.</p>
-     *
-     * <p>For example, if you have called addEntity("foo", 0xA1),
-     * unescape("&foo;") will return "\u00A1"</p>
-     *
-     * @param str The <code>String</code> to escape.
-     * @return A new escaped <code>String</code>.
-     */
-    public String unescape(String str) {
-        StringBuffer buf = new StringBuffer(str.length());
-        int i;
-        for (i = 0; i < str.length(); ++i) {
-            char ch = str.charAt(i);
-            if (ch == '&') {
-                int semi = str.indexOf(';', i + 1);
-                if (semi == -1) {
-                    buf.append(ch);
-                    continue;
-                }
-                String entityName = str.substring(i + 1, semi);
-                int entityValue;
-                if (entityName.charAt(0) == '#') {
-                	try{
-	                    char charAt1 = entityName.charAt(1);
-	                    if (charAt1 == 'x' || charAt1=='X') {
-	                        entityValue = Integer.valueOf(entityName.substring(2), 16).intValue();
-	                    } else {
-	                        entityValue = Integer.parseInt(entityName.substring(1));
-	                    }
-                	}catch( Throwable e ){
-                			// malformed, ignore
-                		entityValue = -1;
-                	}
-                } else {
-                    entityValue = this.entityValue(entityName);
-                }
-                if (entityValue == -1) {
-                    buf.append('&');
-                    buf.append(entityName);
-                    buf.append(';');
-                } else {
-                    buf.append((char) (entityValue));
-                }
-                i = semi;
-            } else {
-                buf.append(ch);
-            }
-        }
-        return buf.toString();
-    }
-
-}
diff --git a/azureus3/src/org/apache/commons/lang/IntHashMap.java b/azureus3/src/org/apache/commons/lang/IntHashMap.java
deleted file mode 100644
index 18062ec..0000000
--- a/azureus3/src/org/apache/commons/lang/IntHashMap.java
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * Copyright 2002-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.
- */
-
-/*
- * Note: originally released under the GNU LGPL v2.1, 
- * but rereleased by the original author under the ASF license (above).
- */
-package org.apache.commons.lang;
-
-/**
- * <p>A hash map that uses primitive ints for the key rather than objects.</p>
- *
- * <p>Note that this class is for internal optimization purposes only, and may
- * not be supported in future releases of Jakarta Commons Lang.  Utilities of
- * this sort may be included in future releases of Jakarta Commons Collections.</p>
- *
- * @author Justin Couch
- * @author Alex Chaffee (alex at apache.org)
- * @author Stephen Colebourne
- * @since 2.0
- * @version $Revision: 1.1 $
- * @see java.util.HashMap
- */
-class IntHashMap {
-
-    /**
-     * The hash table data.
-     */
-    private transient Entry table[];
-
-    /**
-     * The total number of entries in the hash table.
-     */
-    private transient int count;
-
-    /**
-     * The table is rehashed when its size exceeds this threshold.  (The
-     * value of this field is (int)(capacity * loadFactor).)
-     *
-     * @serial
-     */
-    private int threshold;
-
-    /**
-     * The load factor for the hashtable.
-     *
-     * @serial
-     */
-    private float loadFactor;
-
-    /**
-     * <p>Innerclass that acts as a datastructure to create a new entry in the
-     * table.</p>
-     */
-    private static class Entry {
-        int hash;
-        int key;
-        Object value;
-        Entry next;
-
-        /**
-         * <p>Create a new entry with the given values.</p>
-         *
-         * @param hash The code used to hash the object with
-         * @param key The key used to enter this in the table
-         * @param value The value for this key
-         * @param next A reference to the next entry in the table
-         */
-        protected Entry(int hash, int key, Object value, Entry next) {
-            this.hash = hash;
-            this.key = key;
-            this.value = value;
-            this.next = next;
-        }
-    }
-
-    /**
-     * <p>Constructs a new, empty hashtable with a default capacity and load
-     * factor, which is <code>20</code> and <code>0.75</code> respectively.</p>
-     */
-    public IntHashMap() {
-        this(20, 0.75f);
-    }
-
-    /**
-     * <p>Constructs a new, empty hashtable with the specified initial capacity
-     * and default load factor, which is <code>0.75</code>.</p>
-     *
-     * @param  initialCapacity the initial capacity of the hashtable.
-     * @throws IllegalArgumentException if the initial capacity is less
-     *   than zero.
-     */
-    public IntHashMap(int initialCapacity) {
-        this(initialCapacity, 0.75f);
-    }
-
-    /**
-     * <p>Constructs a new, empty hashtable with the specified initial
-     * capacity and the specified load factor.</p>
-     *
-     * @param initialCapacity the initial capacity of the hashtable.
-     * @param loadFactor the load factor of the hashtable.
-     * @throws IllegalArgumentException  if the initial capacity is less
-     *             than zero, or if the load factor is nonpositive.
-     */
-    public IntHashMap(int initialCapacity, float loadFactor) {
-        super();
-        if (initialCapacity < 0) {
-            throw new IllegalArgumentException("Illegal Capacity: " + initialCapacity);
-        }
-        if (loadFactor <= 0) {
-            throw new IllegalArgumentException("Illegal Load: " + loadFactor);
-        }
-        if (initialCapacity == 0) {
-            initialCapacity = 1;
-        }
-
-        this.loadFactor = loadFactor;
-        table = new Entry[initialCapacity];
-        threshold = (int) (initialCapacity * loadFactor);
-    }
-
-    /**
-     * <p>Returns the number of keys in this hashtable.</p>
-     *
-     * @return  the number of keys in this hashtable.
-     */
-    public int size() {
-        return count;
-    }
-
-    /**
-     * <p>Tests if this hashtable maps no keys to values.</p>
-     *
-     * @return  <code>true</code> if this hashtable maps no keys to values;
-     *          <code>false</code> otherwise.
-     */
-    public boolean isEmpty() {
-        return count == 0;
-    }
-
-    /**
-     * <p>Tests if some key maps into the specified value in this hashtable.
-     * This operation is more expensive than the <code>containsKey</code>
-     * method.</p>
-     *
-     * <p>Note that this method is identical in functionality to containsValue,
-     * (which is part of the Map interface in the collections framework).</p>
-     *
-     * @param      value   a value to search for.
-     * @return     <code>true</code> if and only if some key maps to the
-     *             <code>value</code> argument in this hashtable as
-     *             determined by the <tt>equals</tt> method;
-     *             <code>false</code> otherwise.
-     * @throws  NullPointerException  if the value is <code>null</code>.
-     * @see        #containsKey(int)
-     * @see        #containsValue(Object)
-     * @see        java.util.Map
-     */
-    public boolean contains(Object value) {
-        if (value == null) {
-            throw new NullPointerException();
-        }
-
-        Entry tab[] = table;
-        for (int i = tab.length; i-- > 0;) {
-            for (Entry e = tab[i]; e != null; e = e.next) {
-                if (e.value.equals(value)) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
-     * <p>Returns <code>true</code> if this HashMap maps one or more keys
-     * to this value.</p>
-     *
-     * <p>Note that this method is identical in functionality to contains
-     * (which predates the Map interface).</p>
-     *
-     * @param value value whose presence in this HashMap is to be tested.
-     * @see    java.util.Map
-     * @since JDK1.2
-     */
-    public boolean containsValue(Object value) {
-        return contains(value);
-    }
-
-    /**
-     * <p>Tests if the specified object is a key in this hashtable.</p>
-     *
-     * @param  key  possible key.
-     * @return <code>true</code> if and only if the specified object is a
-     *    key in this hashtable, as determined by the <tt>equals</tt>
-     *    method; <code>false</code> otherwise.
-     * @see #contains(Object)
-     */
-    public boolean containsKey(int key) {
-        Entry tab[] = table;
-        int hash = key;
-        int index = (hash & 0x7FFFFFFF) % tab.length;
-        for (Entry e = tab[index]; e != null; e = e.next) {
-            if (e.hash == hash) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * <p>Returns the value to which the specified key is mapped in this map.</p>
-     *
-     * @param   key   a key in the hashtable.
-     * @return  the value to which the key is mapped in this hashtable;
-     *          <code>null</code> if the key is not mapped to any value in
-     *          this hashtable.
-     * @see     #put(int, Object)
-     */
-    public Object get(int key) {
-        Entry tab[] = table;
-        int hash = key;
-        int index = (hash & 0x7FFFFFFF) % tab.length;
-        for (Entry e = tab[index]; e != null; e = e.next) {
-            if (e.hash == hash) {
-                return e.value;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * <p>Increases the capacity of and internally reorganizes this
-     * hashtable, in order to accommodate and access its entries more
-     * efficiently.</p>
-     *
-     * <p>This method is called automatically when the number of keys
-     * in the hashtable exceeds this hashtable's capacity and load
-     * factor.</p>
-     */
-    protected void rehash() {
-        int oldCapacity = table.length;
-        Entry oldMap[] = table;
-
-        int newCapacity = oldCapacity * 2 + 1;
-        Entry newMap[] = new Entry[newCapacity];
-
-        threshold = (int) (newCapacity * loadFactor);
-        table = newMap;
-
-        for (int i = oldCapacity; i-- > 0;) {
-            for (Entry old = oldMap[i]; old != null;) {
-                Entry e = old;
-                old = old.next;
-
-                int index = (e.hash & 0x7FFFFFFF) % newCapacity;
-                e.next = newMap[index];
-                newMap[index] = e;
-            }
-        }
-    }
-
-    /**
-     * <p>Maps the specified <code>key</code> to the specified
-     * <code>value</code> in this hashtable. The key cannot be
-     * <code>null</code>. </p>
-     *
-     * <p>The value can be retrieved by calling the <code>get</code> method
-     * with a key that is equal to the original key.</p>
-     *
-     * @param key     the hashtable key.
-     * @param value   the value.
-     * @return the previous value of the specified key in this hashtable,
-     *         or <code>null</code> if it did not have one.
-     * @throws  NullPointerException  if the key is <code>null</code>.
-     * @see     #get(int)
-     */
-    public Object put(int key, Object value) {
-        // Makes sure the key is not already in the hashtable.
-        Entry tab[] = table;
-        int hash = key;
-        int index = (hash & 0x7FFFFFFF) % tab.length;
-        for (Entry e = tab[index]; e != null; e = e.next) {
-            if (e.hash == hash) {
-                Object old = e.value;
-                e.value = value;
-                return old;
-            }
-        }
-
-        if (count >= threshold) {
-            // Rehash the table if the threshold is exceeded
-            rehash();
-
-            tab = table;
-            index = (hash & 0x7FFFFFFF) % tab.length;
-        }
-
-        // Creates the new entry.
-        Entry e = new Entry(hash, key, value, tab[index]);
-        tab[index] = e;
-        count++;
-        return null;
-    }
-
-    /**
-     * <p>Removes the key (and its corresponding value) from this
-     * hashtable.</p>
-     *
-     * <p>This method does nothing if the key is not present in the
-     * hashtable.</p>
-     *
-     * @param   key   the key that needs to be removed.
-     * @return  the value to which the key had been mapped in this hashtable,
-     *          or <code>null</code> if the key did not have a mapping.
-     */
-    public Object remove(int key) {
-        Entry tab[] = table;
-        int hash = key;
-        int index = (hash & 0x7FFFFFFF) % tab.length;
-        for (Entry e = tab[index], prev = null; e != null; prev = e, e = e.next) {
-            if (e.hash == hash) {
-                if (prev != null) {
-                    prev.next = e.next;
-                } else {
-                    tab[index] = e.next;
-                }
-                count--;
-                Object oldValue = e.value;
-                e.value = null;
-                return oldValue;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * <p>Clears this hashtable so that it contains no keys.</p>
-     */
-    public synchronized void clear() {
-        Entry tab[] = table;
-        for (int index = tab.length; --index >= 0;) {
-            tab[index] = null;
-        }
-        count = 0;
-    }
-    
-}
diff --git a/debian/NEWS.Debian b/debian/NEWS.Debian
deleted file mode 100644
index 46a8f64..0000000
--- a/debian/NEWS.Debian
+++ /dev/null
@@ -1,16 +0,0 @@
-azureus (4.2.0.4-1) unstable; urgency=low
-
-  * New upstream release.
-  * This release is the result of a major packaging rewrite as part of
-    package adoption.
-  * Important changes:
-    - Most user-visible bugs fixed.
-    - Add multiuser support: allow multiple instances running in the
-      same machine.
-    - Fixes "a malicious user could control another user's instance".
-    - Handle file associations and magnet URL links.
-    - Refer to Vuze in menus.
-    - No updates that break sync with the Debian package manager.
-    - Launcher automatically detects installed JVM and sets classpath.
-
- -- Adrian Perez <adrianperez.deb at gmail.com>  Wed, 12 Aug 2009 11:20:03 -0400
diff --git a/debian/azureus.desktop b/debian/azureus.desktop
deleted file mode 100644
index 4f1058a..0000000
--- a/debian/azureus.desktop
+++ /dev/null
@@ -1,9 +0,0 @@
-[Desktop Entry]
-Categories=Java;Network;FileTransfer;P2P
-Comment=Download and share files using the BitTorrent P2P network
-Exec=azureus %f
-GenericName=BitTorrent client
-Icon=Azureus
-MimeType=application/x-bittorrent
-Name=Vuze
-Type=Application
diff --git a/debian/azureus.install b/debian/azureus.install
new file mode 100644
index 0000000..b998416
--- /dev/null
+++ b/debian/azureus.install
@@ -0,0 +1 @@
+dist/azureus.jar usr/share/java
diff --git a/debian/azureus.manifest b/debian/azureus.manifest
new file mode 100644
index 0000000..b67a831
--- /dev/null
+++ b/debian/azureus.manifest
@@ -0,0 +1,4 @@
+usr/share/java/azureus.jar:
+ Class-Path: /usr/share/java/commons-cli.jar /usr/share/java/log4j-1.2.jar /usr/share/java/swt-gtk-4.3.jar 
+ Main-Class: org.gudy.azureus2.ui.common.Main 
+ Debian-Java-Home: /usr/lib/jvm/default-java
diff --git a/debian/wrappers/azureus b/debian/bin/azureus
similarity index 54%
rename from debian/wrappers/azureus
rename to debian/bin/azureus
index 6d02ceb..6449225 100644
--- a/debian/wrappers/azureus
+++ b/debian/bin/azureus
@@ -1,4 +1,5 @@
 #!/bin/sh
+set -e
 
 # Include java-wrappers
 . /usr/lib/java-wrappers/java-wrappers.sh
@@ -6,13 +7,13 @@
 JAVA_CLASSPATH="/usr/lib/jni:/usr/lib/java"
 VUZE_BIN="/usr/bin/vuze"
 
-find_java_runtime openjdk sunmin5
+require_java_runtime java7
 
-find_jars Azureus2 log4j-1.2 commons-cli swt
+find_jars azureus log4j-1.2 commons-cli swt-gtk-4.3 commons-lang3 json-simple bcprov
 
 if [ ! -x $VUZE_BIN ]; then
 	UI=-Dforce.ui=az2
 fi
 
-run_java -Dazureus.install.path="$HOME/.azureus" $UI \
+run_java -Dazureus.skipSWTcheck=true -Dazureus.install.path="$HOME/.azureus" $UI \
     org.gudy.azureus2.ui.common.Main "$@"
diff --git a/debian/build.properties b/debian/build.properties
deleted file mode 100644
index 93b4c43..0000000
--- a/debian/build.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-root.dir=${basedir}
-src.dir=${root.dir}
-build.dir=${basedir}/build
-lib.dir=${src.dir}/libs
-dist.dir=${basedir}/dist
-generic.excludes=.bzr/** **/debian/** .bzr* **/.pc/**
-platform.excludes=**/macosx/** org/gudy/azureus2/ui/swt/osx/**  org/gudy/azureus2/platform/macosx/* org/gudy/azureus2/ui/swt/win32/** org/gudy/azureus2/ui/swt/test/** org/gudy/azureus2/platform/macosx/**/*.java org/gudy/azureus2/platform/macosx/PlatformManagerImpl.java
-compile.excludes=${platform.excludes} ${generic.excludes} *build.xml azureus Azureus.* *.properties **/*.gif **/*.png **/Azureus2.jar
-jar.mainclass=org.gudy.azureus2.ui.common.Main
-jar.classpath=Azureus2.jar commons-cli.jar log4j-1.2.jar swt.jar /usr/lib/jni
-jar.excludes=**/*.java ${generic.excludes} ${platform.excludes} **/Azureus2.jar azureus Azureus.* *build.xml build.properties **/build/**
diff --git a/debian/build.xml b/debian/build.xml
deleted file mode 100644
index 5206fbc..0000000
--- a/debian/build.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-   build.xml - Vuze/Azureus Project Builder
-   Copyright (C) 2009 - Adrian Perez <adrianperez.deb at gmail.com>
-
-   This program 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 of the License, or
-   (at your option) any later version.
-
-   This program 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.
-
--->
-
-<!--
-  ==============================================
-   Build file to compile Azureus2.jar and Vuze.
-  ==============================================
--->
-
-<project name="azureus" default="package" basedir="..">
-  <description>
-    This build file will compile the Azureus and Vuze files
-    from the Vuze source distribution.
-    Vuze is a Multimedia BitTorrent Client.
-  </description>
-
-        <property file="debian/build.properties" />
-
-        <!-- The debian classpath. This is the default way of building. -->
-        <!-- TODO Make generic and use condition properties. -->
-
-        <path id="debian.classpath">
-          <fileset dir="/usr/share/java/">
-            <include name="swt.jar" />
-            <include name="commons-cli.jar" />
-            <include name="log4j-1.2.jar" />
-            <include name="junit.jar" />
-          </fileset>
-        </path>
-
-        <!-- The bundled classpath. This was the default way of building. -->
-        <path id="bundled.classpath">
-          <fileset dir="${src.dir}/${lib.dir}" includes="**/*.jar" />
-        </path>
-
-        <target name="init">
-          <!-- Create a build timestamp -->
-          <tstamp />
-          <!-- Create the build directory -->
-          <mkdir dir="${build.dir}" />
-        </target>
-
-        <target name="compile" depends="init" description="compile all files">
-          <javac srcdir="${src.dir}" destdir="${build.dir}" source="1.5" target="1.5"
-                 includeAntRuntime="no" nowarn="yes" debug="true" excludes="${compile.excludes}">
-            <classpath>
-              <path refid="debian.classpath" />
-            </classpath>
-          </javac>
-        </target>
-
-        <target name="package" depends="compile,buildcopy" description="package Azureus2.jar">
-          <!-- Create the "dist" directory. -->
-          <mkdir dir="${dist.dir}" />
-          <copy todir="${build.dir}" file="${src.dir}/ChangeLog.txt"/>
-
-          <!-- Create the jar file and use exclusions -->
-          <jar destfile="${dist.dir}/Azureus2.jar" basedir="${build.dir}" excludes="${jar.excludes}">
-            <manifest>
-              <attribute name="Main-Class" value="${jar.mainclass}" />
-              <attribute name="Class-Path" value="${jar.classpath}" />
-            </manifest>
-          </jar>
-
-        </target>
-
-        <target name="clean" description="clean the build environment">
-          <!-- Delete the build and dist directories -->
-          <delete dir="${build.dir}" />
-          <delete dir="${dist.dir}" />
-        </target>
-
-        <target name="run" description="run the application">
-          <java jar="${dist.dir}/Azureus2.jar" fork="true" />
-        </target>
-
-        <target name="buildcopy" description="copy the build files">
-          <!-- Copy all non-source files to the JAR. -->
-          <copy todir="${build.dir}" includeEmptyDirs="false">
-            <fileset dir="${src.dir}" excludes="${jar.excludes}"/>
-          </copy>
-        </target>
-
-        <target name="echo" description="echo">
-          <echo message="${compile.excludes}"/>
-        </target>
-
-</project>
-
-
diff --git a/debian/changelog b/debian/changelog
index 5ec3796..5ba6cd8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,23 @@
+azureus (5.3.0.0-1) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * Upgrade to latest upstream version. (Closes: #724867, #642189)
+  * Updated dependency on swt3 to swt4. (Closes: #588033, #638026)
+  * Adopt the azureus package. (Closes: #710908)
+  * Switch to dh with javahelper build system. 
+  * Checkout source from svn to get build files.
+  * Exclude jars and non-Linux platform-specific files from upstream tarball.
+  * Unbundle json simple to use Debian dependency.
+      - Thanks to David Juran <djuran at redhat.com>
+  * Unbundle commons lang to use Debian dependency.
+      - Thanks to David Juran <djuran at redhat.com>
+  * Unbundle bouncy castle to use Debian dependency.
+      - Thanks to David Juran <djuran at redhat.com>
+  * Refreshed patches.
+  * Update policy to 3.9.5.
+
+ -- Stephen Nelson <stephen at eccostudio.com>  Wed, 18 Jun 2014 22:41:15 +0100
+
 azureus (4.3.0.6-6) UNRELASED; urgency=low
 
   * Add libswt-cairo-gtk-3-jni to depends.  (Closes: #684464)
diff --git a/debian/compat b/debian/compat
index 7f8f011..ec63514 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-7
+9
diff --git a/debian/control b/debian/control
index 66f26b4..3302ff3 100644
--- a/debian/control
+++ b/debian/control
@@ -1,25 +1,37 @@
-Source: azureus
+Source: azureus 
 Section: net
 Priority: optional
 Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
-Uploaders: Adrian Perez <adrianperez.deb at gmail.com>
-Build-Depends: ant, cdbs, debhelper (>= 7.0)
-Build-Depends-Indep: default-jdk,
- libcommons-cli-java,
- liblog4j1.2-java, 
- libswt-gtk-3-java,
- junit
-Standards-Version: 3.9.4
-Vcs-Git: git://git.debian.org/git/pkg-java/azureus.git
-Vcs-Browser: http://git.debian.org/?p=pkg-java/azureus.git
+Uploaders: Adrian Perez <adrianperez.deb at gmail.com>, Stephen Nelson <stephen at eccostudio.com>
+Build-Depends: ant
+             , debhelper (>= 9)
+             , default-jdk
+             , javahelper (>= 0.45)
+             , junit4
+             , libbcprov-java
+             , libjson-simple-java
+             , libswt-gtk-4-java
+             , libcommons-cli-java
+             , libcommons-lang3-java
+             , liblog4j1.2-java
+Standards-Version: 3.9.5
 Homepage: http://azureus.sourceforge.net
+Vcs-Git: git://anonscm.debian.org/pkg-java/azureus.git
+Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-java/azureus.git
 
 Package: azureus
 Architecture: all
-Depends: openjdk-7-jre | openjdk-6-jre | sun-java5-jre | sun-java6-jre, 
- libcommons-cli-java, liblog4j1.2-java, libswt-gtk-3-java,
- libswt-cairo-gtk-3-jni, 
- java-wrappers, ${misc:Depends}
+Depends: default-jre | java7-runtime
+       , java-wrappers
+       , libbcprov-java
+       , libcommons-cli-java
+       , libcommons-lang3-java
+       , libjson-simple-java
+       , liblog4j1.2-java
+       , libswt-gtk-4-java
+       , libswt-cairo-gtk-4-jni
+       , ${java:Depends}
+       , ${misc:Depends}
 Recommends: vuze
 Description: BitTorrent client
  BitTorrent is a peer-to-peer file distribution tool.
@@ -31,8 +43,11 @@ Description: BitTorrent client
 
 Package: vuze
 Architecture: all
-Depends: azureus, libswt-cairo-gtk-3-jni, libswt-gnome-gtk-3-jni,
- libswt-webkit-gtk-3-jni | libswt-mozilla-gtk-3-jni, ${misc:Depends}
+Depends: azureus
+       , libswt-cairo-gtk-4-jni
+       , libswt-gnome-gtk-4-jni
+       , libswt-webkit-gtk-4-jni | libswt-mozilla-gtk-4-jni
+       , ${misc:Depends}
 Description: Multimedia BitTorrent client
  BitTorrent is a peer-to-peer file distribution tool.
  .
@@ -44,6 +59,6 @@ Description: Multimedia BitTorrent client
  web-browser, support for multiple Content Networks, sharing .vuze files,
  popularity contexts, categories and tagging, IPv6 compact tracker support,
  automatic URL handling, and a plugin architecture; besides other features.
- . 
+ .
  This package is part of the azureus package, and provides the dependencies
  necessary to run the new user interface.
diff --git a/debian/copyright b/debian/copyright
index cb74f6a..63cb8bd 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -27,18 +27,6 @@ Files: org/gudy/azureus2/core3/util/BrokenMd5Hasher.java
 Copyright: 2005, jMuleGroup
 License: GPL-2
 
-Files: org/json/simple/*
-Copyright: 2006-2009, Fang Yidong <fangyidong at yahoo.com.cn>
-License: LGPL-2.1
-
-Files: org/apache/commons/lang/*
-Copyright: 2002-2004, The Apache Software Foundation
-License: Apache-2.0
-
-Files: org/bouncycastle/*
-Copyright: 2000, The Legion Of The Bouncy Castle
-License: other
-
 Files: org/pf/*
 Copyright: 1999-2003, Manfred Duchrow
 License: CPL-1.0
@@ -46,6 +34,7 @@ License: CPL-1.0
 Files: debian/*
 Copyright: 2009, Adrian Perez <adrianperez.deb at gmail.com>
            2005-2009, Shaun Jackman <sjackman at debian.org>
+           2014, Stephen Nelson <stephen at eccostudio.com>
 License: GPL-2+
 
 
diff --git a/debian/azureus.1 b/debian/man/azureus.1
similarity index 91%
rename from debian/azureus.1
rename to debian/man/azureus.1
index d06daf4..10550bf 100644
--- a/debian/azureus.1
+++ b/debian/man/azureus.1
@@ -1,4 +1,4 @@
-.TH azureus "1" "2009-07-08" "azureus 4.2.0.4" "User Commands"
+.TH azureus "1" "2014-04-09" "azureus 5.3.0.0" "User Commands"
 
 .SH NAME
 azureus \- a BitTorrent client
@@ -24,7 +24,7 @@ for the Debian project (and may be used by others).
 Report bugs to <azureus at gmail.com>.
 
 .SH COPYRIGHT
-Copyright 2009 Vuze, Inc.
+Copyright 2009-2014 Vuze, Inc.
 Copyright 2003-2009 Aelitis.
 
 This is free software; see the source for copying conditions. There is
diff --git a/debian/manpages b/debian/manpages
deleted file mode 100644
index 2de4af8..0000000
--- a/debian/manpages
+++ /dev/null
@@ -1 +0,0 @@
-debian/azureus.1
diff --git a/debian/menu b/debian/menu
deleted file mode 100644
index 45f54e5..0000000
--- a/debian/menu
+++ /dev/null
@@ -1,4 +0,0 @@
-?package(azureus):needs="X11" section="Applications/Network/File Transfer"\
-  icon="/usr/share/pixmaps/azureus.xpm"\
-  title="Azureus" command="/usr/bin/azureus" \
-  hints="Internet"
diff --git a/debian/orig-tar.sh b/debian/orig-tar.sh
new file mode 100755
index 0000000..16ca68a
--- /dev/null
+++ b/debian/orig-tar.sh
@@ -0,0 +1,16 @@
+#!/bin/sh -e
+
+VERSION=$2
+TAR=../azureus_$VERSION.orig.tar.xz
+DIR="azureus-$VERSION"
+UPSTREAM_VERSION="`echo $VERSION | sed  's/\.//g'`"
+TAG="RELEASE_$UPSTREAM_VERSION"
+echo "Version: $VERSION"
+echo "Upstream version: $UPSTREAM_VERSION"
+
+svn export http://svn.vuze.com/public/client/tags/${TAG} $DIR
+XZ_OPT=--best tar -c -J -f $TAR --exclude '*.jar' \
+  --exclude '*.class' --exclude 'Tree2.java' --exclude 'azureus2/lib/*' \
+  --exclude 'azureus2/src/org/json/*' --exclude 'azureus3/src/org/apache/*' \
+  --exclude 'azureus2/src/org/bouncycastle/*' $DIR
+rm -rf $DIR ../$TAG $3
diff --git a/debian/patches/01_amend_build_classpath.patch b/debian/patches/01_amend_build_classpath.patch
new file mode 100644
index 0000000..e0a1dec
--- /dev/null
+++ b/debian/patches/01_amend_build_classpath.patch
@@ -0,0 +1,46 @@
+# Description: Amends build script to use packaged jars.
+# Author: Stephen Nelson <stephen at eccostudio.com>
+# Forwarded: not-needed
+# Last-Update: 2014-06-23
+--- a/build.xml
++++ b/build.xml
+@@ -17,7 +17,7 @@
+ 	<property name="major.ver"  value="0000"/>
+ 	<property name="minor.ver"  value="00"/>
+ 	<property name="build.ver"  value="${major.ver}-${minor.ver}"/>
+-	<property name="build.name" value="Vuze_${build.ver}" />
++	<property name="build.name" value="azureus" />
+ 	
+ 	<property name="azureus2.dir" value="azureus2"/>
+ 	<property name="azureus3.dir" value="azureus3"/>
+@@ -32,9 +32,10 @@
+ 	<!-- REUSABLE REFERENCES -->
+ 	
+ 	<path id="build.classpath">
+-		<fileset dir="${azureus2.dir}/lib" includes="*.jar" excludes="swt-carbon.jar"/>
++		<fileset dir="/usr/share/java" includes="swt-gtk-4.3.jar,commons-cli.jar,log4j-1.2.jar,junit4.jar" />
++		<!--<fileset dir="${azureus2.dir}/lib" includes="*.jar" excludes="swt-carbon.jar"/>
+ 		<fileset dir="${azureus3.dir}/lib" includes="*.jar" />
+-		<fileset dir="${uis.dir}/lib" includes="*.jar" />
++		<fileset dir="${uis.dir}/lib" includes="*.jar" />-->
+ 	</path>
+ 	
+ 	<patternset id="pluginapi.inc">
+@@ -87,7 +88,7 @@
+ 		</copy>
+ 		
+ 		<!-- Compile source code -->
+-		<javac encoding="8859_1" includeAntRuntime="no" debug="true" debuglevel="source,lines,vars" destdir="${build.dir}" source="1.5" target="1.5" fork="yes" memoryMaximumSize="256m" >
++		<javac encoding="8859_1" includeAntRuntime="no" debug="true" debuglevel="source,lines,vars" destdir="${build.dir}" source="1.6" target="1.6" fork="yes" memoryMaximumSize="256m" >
+ 			<src path="${azureus2.dir}/src"/>
+ 			<src path="${azureus3.dir}/src"/>
+ 			<src path="${uis.dir}/src"/>
+@@ -101,7 +102,7 @@
+ 	 	<jar destfile="${dist.dir}/${build.name}.jar" basedir="${build.dir}" level="9" >
+ 	       <manifest>
+ 	          <attribute name="Main-Class" value="org.gudy.azureus2.ui.common.Main" />
+-	          <attribute name="Class-Path" value="swt.jar commons-cli.jar log4j.jar junit.jar" />
++	          <attribute name="Class-Path" value="swt-gtk-4.3.jar commons-cli.jar log4j.jar junit.jar" />
+ 	       	 <attribute name="Built-By" value="VZCB:${ant.project.name}:build.xml"/>
+ 	       	 <attribute name="Build-Version" value="${build.ver}"/>
+ 	       </manifest>
diff --git a/debian/patches/debian/speedtest.diff b/debian/patches/02_speedtest.patch
similarity index 63%
rename from debian/patches/debian/speedtest.diff
rename to debian/patches/02_speedtest.patch
index 0c61cfc..a40ca6d 100644
--- a/debian/patches/debian/speedtest.diff
+++ b/debian/patches/02_speedtest.patch
@@ -1,18 +1,16 @@
-From: Scott Wolchok <scott at wolchok.org>
-Subject: [PATCH] debian/speedtest
-
-Disable Client-side validation for Speed Test.
-
-Signed-off-by: Adrian Perez <adrianperez.deb at gmail.com>
-
+# Description: Disable Client-side validation for Speed Test
+# Author: Scott Wolchok <scott at wolchok.org>
+# Acked-by: Adrian Perez <adrianperez.deb at gmail.com>
+# Forwarded: no
+# Last-Update: 2014-06-23
 ---
  .../NetworkAdminSpeedTestScheduledTestImpl.java    |    8 +++++---
  1 files changed, 5 insertions(+), 3 deletions(-)
 
-diff --git a/com/aelitis/azureus/core/networkmanager/admin/impl/NetworkAdminSpeedTestScheduledTestImpl.java b/com/aelitis/azureus/core/networkmanager/admin/impl/NetworkAdminSpeedTestScheduledTestImpl.java
+diff --git a/azureus2/src/com/aelitis/azureus/core/networkmanager/admin/impl/NetworkAdminSpeedTestScheduledTestImpl.java b/azureus2/src/com/aelitis/azureus/core/networkmanager/admin/impl/NetworkAdminSpeedTestScheduledTestImpl.java
 index 01022eb..76e27df 100644
---- a/com/aelitis/azureus/core/networkmanager/admin/impl/NetworkAdminSpeedTestScheduledTestImpl.java
-+++ b/com/aelitis/azureus/core/networkmanager/admin/impl/NetworkAdminSpeedTestScheduledTestImpl.java
+--- a/azureus2/src/com/aelitis/azureus/core/networkmanager/admin/impl/NetworkAdminSpeedTestScheduledTestImpl.java
++++ b/azureus2/src/com/aelitis/azureus/core/networkmanager/admin/impl/NetworkAdminSpeedTestScheduledTestImpl.java
 @@ -461,20 +461,22 @@ NetworkAdminSpeedTestScheduledTestImpl
              if( size==null || offset==null  )
                  throw new IllegalStateException("scheduleTestWithSpeedTestService had a null parameter.");
diff --git a/debian/patches/03_update_disable.patch b/debian/patches/03_update_disable.patch
new file mode 100644
index 0000000..8584eb4
--- /dev/null
+++ b/debian/patches/03_update_disable.patch
@@ -0,0 +1,73 @@
+# Description: Prevent the automatic update of several components, specially the Core and the
+#  SWT libraries; avoids sync breakage with the Debian repositories.
+# Author: Adrian Perez <adrianperez.deb at gmail.com>
+# Forwarded: no
+# Last-Update: 2014-06-23
+---
+ com/aelitis/azureus/ui/swt/Initializer.java        |    8 ++++++--
+ .../azureus2/ui/swt/mainwindow/Initializer.java    |    8 ++++++--
+ org/gudy/azureus2/update/CorePatchChecker.java     |    6 +++++-
+ org/gudy/azureus2/update/CoreUpdateChecker.java    |    5 ++++-
+ 4 files changed, 21 insertions(+), 6 deletions(-)
+
+--- a/azureus3/src/com/aelitis/azureus/ui/swt/Initializer.java
++++ b/azureus3/src/com/aelitis/azureus/ui/swt/Initializer.java
+@@ -49,9 +49,10 @@
+ import org.gudy.azureus2.ui.swt.pluginsinstaller.InstallPluginWizard;
+ import org.gudy.azureus2.ui.swt.progress.ProgressWindow;
+ import org.gudy.azureus2.ui.swt.update.UpdateMonitor;
++/* --- Adrian Perez: Don't initialize SWTUpdateChecker in Debian.
+ import org.gudy.azureus2.ui.swt.updater2.PreUpdateChecker;
+ import org.gudy.azureus2.ui.swt.updater2.SWTUpdateChecker;
+-
++*/
+ import com.aelitis.azureus.core.*;
+ import com.aelitis.azureus.core.messenger.ClientMessageContext;
+ import com.aelitis.azureus.core.messenger.PlatformMessenger;
+@@ -444,12 +445,15 @@
+ 					}
+ 					
+ 					reportCurrentTaskByKey("splash.openViews");
+-	
++/*
++ * Adrian Perez: Don't initialize SWTUpdateChecker in Debian
++ *
+ 					SWTUpdateChecker.initialize();
+ 	
+ 					PreUpdateChecker.initialize(core,
+ 							COConfigurationManager.getStringParameter("ui"));
+ 	
++*/
+ 					UpdateMonitor.getSingleton(core); // setup the update monitor
+ 	
+ 					//Tell listeners that all is initialized :
+--- a/azureus2/src/org/gudy/azureus2/update/CorePatchChecker.java
++++ b/azureus2/src/org/gudy/azureus2/update/CorePatchChecker.java
+@@ -68,7 +68,11 @@
+ 				System.out.println( "CorePatchChecker: TESTING !!!!" );
+ 			}
+ 			
+-			plugin_interface.getUpdateManager().registerUpdatableComponent( this, false );
++			/*
++			 * Adrian Perez: Don't register Core Patcher in Debian
++			 * 
++			 * plugin_interface.getUpdateManager().registerUpdatableComponent( this, false );
++			 */
+ 		}
+ 	}
+ 	
+--- a/azureus2/src/org/gudy/azureus2/update/CoreUpdateChecker.java
++++ b/azureus2/src/org/gudy/azureus2/update/CoreUpdateChecker.java
+@@ -131,8 +131,11 @@
+ 		props.setProperty( "plugin.version", plugin_interface.getAzureusVersion());
+ 		
+ 		rdf = plugin_interface.getUtilities().getResourceDownloaderFactory();
+-	
++	/*
++	 * Adrian Perez: Don't update Azureus Core in Debian.
++	 *
+ 		plugin_interface.getUpdateManager().registerUpdatableComponent( this, true );
++	*/
+ 	}
+ 	
+ 	public String
diff --git a/debian/patches/04_unbundle_json.patch b/debian/patches/04_unbundle_json.patch
new file mode 100644
index 0000000..c670985
--- /dev/null
+++ b/debian/patches/04_unbundle_json.patch
@@ -0,0 +1,66 @@
+# Description: Removes the json simple code bundled with upstream. Patch taken from Fedora project.
+# Origin: vendor, http://pkgs.fedoraproject.org/cgit/azureus.git/commit/?id=c220c2c8d9aff45192640e3031bbac6fca379c13
+# Author: Sérgio Basto <sergio at serjux.com>, David Juran <djuran at redhat.com>
+# Forwarded: no
+# Last-Update: 2014-06-23
+--- a/azureus2/src/com/aelitis/azureus/util/JSONUtils.java
++++ b/azureus2/src/com/aelitis/azureus/util/JSONUtils.java
+@@ -74,7 +74,7 @@
+ 	 * @since 3.0.1.5
+ 	 */
+ 	public static JSONObject encodeToJSONObject(Map map) {
+-		JSONObject newMap = new JSONObject((int)(map.size()*1.5));
++		JSONObject newMap = new JSONObject();
+ 
+ 		for (Map.Entry<String, Object> entry: ((Map<String,Object>)map).entrySet()){
+ 			String key 		= entry.getKey();
+@@ -105,9 +105,7 @@
+ 	 */
+ 	public static String encodeToJSON(Map map) {
+ 		JSONObject jobj = encodeToJSONObject(map);		
+-		StringBuilder	sb = new StringBuilder(8192);
+-		jobj.toString( sb );
+-		return( sb.toString());
++		return( jobj.toString());
+ 	}
+ 
+ 	public static String encodeToJSON(Collection list) {
+@@ -138,7 +136,7 @@
+ 	 * @since 3.0.1.5
+ 	 */
+ 	private static JSONArray encodeToJSONArray(Collection list) {
+-		JSONArray newList = new JSONArray(list.size());
++		JSONArray newList = new JSONArray();
+ 
+ 		for ( Object value: list ){
+ 
+--- a/azureus3/src/com/aelitis/azureus/util/ImportExportUtils.java
++++ b/azureus3/src/com/aelitis/azureus/util/ImportExportUtils.java
+@@ -360,7 +360,7 @@
+ 	
+ 		throws IOException
+ 	{
+-		List	l = new JSONArray(data.length);
++		List	l = new JSONArray();
+ 		
+ 		map.put( key, l );
+ 		
+--- a/build.xml
++++ b/build.xml
+@@ -32,7 +32,7 @@
+ 	<!-- REUSABLE REFERENCES -->
+ 	
+ 	<path id="build.classpath">
+-		<fileset dir="/usr/share/java" includes="swt-gtk-4.3.jar,commons-cli.jar,log4j-1.2.jar,junit4.jar" />
++		<fileset dir="/usr/share/java" includes="swt-gtk-4.3.jar,commons-cli.jar,log4j-1.2.jar,junit4.jar,json-simple.jar" />
+ 		<!--<fileset dir="${azureus2.dir}/lib" includes="*.jar" excludes="swt-carbon.jar"/>
+ 		<fileset dir="${azureus3.dir}/lib" includes="*.jar" />
+ 		<fileset dir="${uis.dir}/lib" includes="*.jar" />-->
+@@ -102,7 +102,6 @@
+ 	 	<jar destfile="${dist.dir}/${build.name}.jar" basedir="${build.dir}" level="9" >
+ 	       <manifest>
+ 	          <attribute name="Main-Class" value="org.gudy.azureus2.ui.common.Main" />
+-	          <attribute name="Class-Path" value="swt-gtk-4.3.jar commons-cli.jar log4j.jar junit.jar" />
+ 	       	 <attribute name="Built-By" value="VZCB:${ant.project.name}:build.xml"/>
+ 	       	 <attribute name="Build-Version" value="${build.ver}"/>
+ 	       </manifest>
diff --git a/debian/patches/05_unbundle_commons_lang.patch b/debian/patches/05_unbundle_commons_lang.patch
new file mode 100644
index 0000000..6150a40
--- /dev/null
+++ b/debian/patches/05_unbundle_commons_lang.patch
@@ -0,0 +1,136 @@
+# Description: Remove the modified Apache Commons Lang source that is bundled with upstream. 
+#  The patch from Fedora was modified to work with Commons Lang 3.
+# Origin: vendor, http://pkgs.fedoraproject.org/cgit/azureus.git/commit/?id=a2b550683ba11c222df15851b1ec88581d9669bb
+# Author: David Juran <djuran at redhat.com>
+# Forwarded: no
+# Last-Update: 2014-06-23
+--- a/azureus3/src/com/aelitis/azureus/core/metasearch/Result.java
++++ b/azureus3/src/com/aelitis/azureus/core/metasearch/Result.java
+@@ -27,7 +27,7 @@
+ import java.util.Map;
+ import java.util.Random;
+ 
+-import org.apache.commons.lang.Entities;
++import org.apache.commons.lang3.StringEscapeUtils;
+ import org.gudy.azureus2.core3.util.DisplayFormatters;
+ import org.json.simple.JSONObject;
+ 
+@@ -372,6 +372,6 @@
+ 		if ( input == null ){
+ 			return( null );
+ 		}
+-		return( Entities.HTML40.unescape( input ));
++		return( StringEscapeUtils.unescapeHtml4( input ));
+ 	}
+ }
+--- a/azureus3/src/com/aelitis/azureus/core/metasearch/impl/web/WebResult.java
++++ b/azureus3/src/com/aelitis/azureus/core/metasearch/impl/web/WebResult.java
+@@ -23,7 +23,7 @@
+ import java.util.Date;
+ import java.util.StringTokenizer;
+ 
+-import org.apache.commons.lang.*;
++import org.apache.commons.lang3.*;
+ import org.gudy.azureus2.core3.util.Base32;
+ import org.gudy.azureus2.core3.util.ByteFormatter;
+ import org.gudy.azureus2.core3.util.Debug;
+@@ -88,14 +88,14 @@
+ 	public void setNameFromHTML(String name) {
+ 		if(name != null) {
+ 			name = removeHTMLTags(name);
+-			this.name = Entities.HTML40.unescape(name);
++			this.name = StringEscapeUtils.unescapeHtml4(name);
+ 		}
+ 	}
+ 	
+ 	public void setCommentsFromHTML(String comments) {
+ 		if(comments != null) {
+ 			comments = removeHTMLTags(comments);
+-			comments = Entities.HTML40.unescape(comments);
++			comments = StringEscapeUtils.unescapeHtml4(comments);
+ 			comments = comments.replaceAll(",", "");
+ 			comments = comments.replaceAll(" ", "");
+ 			try{
+@@ -108,7 +108,7 @@
+ 	public void setCategoryFromHTML(String category) {
+ 		if(category != null) {
+ 			category = removeHTMLTags(category);
+-			this.category = Entities.HTML40.unescape(category).trim();
++			this.category = StringEscapeUtils.unescapeHtml4(category).trim();
+ 			/*int separator = this.category.indexOf(">");
+ 			
+ 			if(separator != -1) {
+@@ -133,7 +133,7 @@
+ 	public void setNbPeersFromHTML(String nbPeers) {
+ 		if(nbPeers != null) {
+ 			nbPeers = removeHTMLTags(nbPeers);
+-			String nbPeersS = Entities.HTML40.unescape(nbPeers);
++			String nbPeersS = StringEscapeUtils.unescapeHtml4(nbPeers);
+ 			nbPeersS = nbPeersS.replaceAll(",", "");
+ 			nbPeersS = nbPeersS.replaceAll(" ", "");
+ 			try {
+@@ -148,7 +148,7 @@
+ 	public void setNbSeedsFromHTML(String nbSeeds) {
+ 		if(nbSeeds != null) {
+ 			nbSeeds = removeHTMLTags(nbSeeds);
+-			String nbSeedsS = Entities.HTML40.unescape(nbSeeds);
++			String nbSeedsS = StringEscapeUtils.unescapeHtml4(nbSeeds);
+ 			nbSeedsS = nbSeedsS.replaceAll(",", "");
+ 			nbSeedsS = nbSeedsS.replaceAll(" ", "");
+ 			try {
+@@ -163,7 +163,7 @@
+ 	public void setNbSuperSeedsFromHTML(String nbSuperSeeds) {
+ 		if(nbSuperSeeds != null) {
+ 			nbSuperSeeds = removeHTMLTags(nbSuperSeeds);
+-			String nbSuperSeedsS = Entities.HTML40.unescape(nbSuperSeeds);
++			String nbSuperSeedsS = StringEscapeUtils.unescapeHtml4(nbSuperSeeds);
+ 			nbSuperSeedsS = nbSuperSeedsS.replaceAll(",", "");
+ 			nbSuperSeedsS = nbSuperSeedsS.replaceAll(" ", "");
+ 			try {
+@@ -230,7 +230,7 @@
+ 	public void setPublishedDateFromHTML(String publishedDate) {
+ 		if(publishedDate != null) {
+ 			publishedDate = removeHTMLTags(publishedDate);
+-			String publishedDateS = Entities.HTML40.unescape(publishedDate).replace((char)160,(char)32);
++			String publishedDateS = StringEscapeUtils.unescapeHtml4(publishedDate).replace((char)160,(char)32);
+ 			this.publishedDate = dateParser.parseDate(publishedDateS);
+ 		}
+ 	}
+@@ -239,7 +239,7 @@
+ 	public void setSizeFromHTML(String size) {
+ 		if(size != null) {
+ 			size = removeHTMLTags(size);
+-			String sizeS = Entities.HTML40.unescape(size).replace((char)160,(char)32);
++			String sizeS = StringEscapeUtils.unescapeHtml4(size).replace((char)160,(char)32);
+ 			sizeS = sizeS.replaceAll("<[^>]+>", " ");
+ 			//Add a space between the digits and unit if there is none
+ 			sizeS = sizeS.replaceFirst("(\\d)([a-zA-Z])", "$1 $2");
+@@ -285,7 +285,7 @@
+ 	public void setVotesFromHTML(String votes_str) {
+ 		if(votes_str != null) {
+ 			votes_str = removeHTMLTags(votes_str);
+-			votes_str = Entities.HTML40.unescape(votes_str);
++			votes_str = StringEscapeUtils.unescapeHtml4(votes_str);
+ 			votes_str = votes_str.replaceAll(",", "");
+ 			votes_str = votes_str.replaceAll(" ", "");
+ 			try {
+@@ -299,7 +299,7 @@
+ 	public void setVotesDownFromHTML(String votes_str) {
+ 		if(votes_str != null) {
+ 			votes_str = removeHTMLTags(votes_str);
+-			votes_str = Entities.HTML40.unescape(votes_str);
++			votes_str = StringEscapeUtils.unescapeHtml4(votes_str);
+ 			votes_str = votes_str.replaceAll(",", "");
+ 			votes_str = votes_str.replaceAll(" ", "");
+ 			try {
+--- a/build.xml
++++ b/build.xml
+@@ -32,7 +32,7 @@
+ 	<!-- REUSABLE REFERENCES -->
+ 	
+ 	<path id="build.classpath">
+-		<fileset dir="/usr/share/java" includes="swt-gtk-4.3.jar,commons-cli.jar,log4j-1.2.jar,junit4.jar,json-simple.jar" />
++		<fileset dir="/usr/share/java" includes="swt-gtk-4.3.jar,commons-cli.jar,log4j-1.2.jar,junit4.jar,json-simple.jar,commons-lang3.jar" />
+ 		<!--<fileset dir="${azureus2.dir}/lib" includes="*.jar" excludes="swt-carbon.jar"/>
+ 		<fileset dir="${azureus3.dir}/lib" includes="*.jar" />
+ 		<fileset dir="${uis.dir}/lib" includes="*.jar" />-->
diff --git a/debian/patches/06_unbundle_bouncy_castle.patch b/debian/patches/06_unbundle_bouncy_castle.patch
new file mode 100644
index 0000000..0a9ca74
--- /dev/null
+++ b/debian/patches/06_unbundle_bouncy_castle.patch
@@ -0,0 +1,237 @@
+--- a/azureus2/src/com/aelitis/azureus/core/security/impl/CryptoSTSEngineImpl.java
++++ b/azureus2/src/com/aelitis/azureus/core/security/impl/CryptoSTSEngineImpl.java
+@@ -30,10 +30,12 @@
+ import java.security.PrivateKey;
+ import java.security.PublicKey;
+ import java.security.SecureRandom;
++import java.security.Security;
+ import java.security.Signature;
+ 
++import javax.crypto.KeyAgreement;
++
+ import org.bouncycastle.jce.provider.BouncyCastleProvider;
+-import org.bouncycastle.jce.provider.JCEECDHKeyAgreement;
+ 
+ import com.aelitis.azureus.core.security.CryptoECCUtils;
+ import com.aelitis.azureus.core.security.CryptoManagerException;
+@@ -56,9 +58,9 @@
+ 	private PrivateKey	myPrivateKey;
+ 	private PublicKey 	remotePubKey;
+ 	private byte[] 		sharedSecret;
+-	
+-	private InternalDH	ecDH;
+-	
++
++        private KeyAgreement ecDH;
++
+ 	/**
+ 	 * 
+ 	 * @param myIdent keypair representing our current identity
+@@ -76,10 +78,8 @@
+ 		ephemeralKeyPair = CryptoECCUtils.createKeys();
+ 		
+ 		try{
+-			ecDH = new InternalDH();
+-			
+-			//ecDH = KeyAgreement.getInstance("ECDH", BouncyCastleProvider.PROVIDER_NAME);
+-			
++                        Security.addProvider(new BouncyCastleProvider());
++                        ecDH = KeyAgreement.getInstance("ECDH");
+ 			ecDH.init(ephemeralKeyPair.getPrivate());
+ 			
+ 		}catch (Exception e){
+@@ -402,38 +402,5 @@
+ 			throw( new CryptoManagerException( "Failed to put byte[]", e ));
+ 		}
+ 	}
+-	
+-	class 
+-	InternalDH 
+-		extends JCEECDHKeyAgreement.DH
+-	{
+-			// we use this class to obtain compatability with BC
+-		
+-		public void
+-		init(
+-			Key		key )
+-
+-			throws InvalidKeyException, InvalidAlgorithmParameterException
+-		{
+-			engineInit( key, null );
+-		}
+-
+-		public Key
+-		doPhase(
+-			Key		key,
+-			boolean	lastPhase )
+-
+-			throws InvalidKeyException, IllegalStateException
+-		{
+-			return( engineDoPhase( key, lastPhase ));
+-		}
++}
+ 
+-		public byte[] 
+-		generateSecret() 
+-		
+-			throws IllegalStateException
+-		{
+-			return( engineGenerateSecret());
+-		}
+-	}
+-}
+\ No newline at end of file
+--- a/azureus2/src/org/gudy/azureus2/core3/security/impl/SESecurityManagerBC.java
++++ b/azureus2/src/org/gudy/azureus2/core3/security/impl/SESecurityManagerBC.java
+@@ -39,6 +39,7 @@
+ import org.bouncycastle.jce.*;
+ import org.bouncycastle.jce.provider.BouncyCastleProvider;
+ import org.bouncycastle.asn1.x509.X509Name;
++import org.bouncycastle.x509.X509V3CertificateGenerator;
+ import org.gudy.azureus2.core3.util.Constants;
+ import org.gudy.azureus2.core3.util.Debug;
+ import org.gudy.azureus2.core3.util.RandomUtils;
+--- a/build.xml
++++ b/build.xml
+@@ -32,7 +32,7 @@
+ 	<!-- REUSABLE REFERENCES -->
+ 	
+ 	<path id="build.classpath">
+-		<fileset dir="/usr/share/java" includes="swt-gtk-4.3.jar,commons-cli.jar,log4j-1.2.jar,junit4.jar,json-simple.jar,commons-lang3.jar" />
++		<fileset dir="/usr/share/java" includes="swt-gtk-4.3.jar,commons-cli.jar,log4j-1.2.jar,junit4.jar,json-simple.jar,commons-lang3.jar, bcprov.jar" />
+ 		<!--<fileset dir="${azureus2.dir}/lib" includes="*.jar" excludes="swt-carbon.jar"/>
+ 		<fileset dir="${azureus3.dir}/lib" includes="*.jar" />
+ 		<fileset dir="${uis.dir}/lib" includes="*.jar" />-->
+--- a/azureus2/src/com/aelitis/azureus/core/clientmessageservice/secure/impl/SecureMessageServiceClientHelper.java
++++ b/azureus2/src/com/aelitis/azureus/core/clientmessageservice/secure/impl/SecureMessageServiceClientHelper.java
+@@ -36,7 +36,6 @@
+ import org.bouncycastle.crypto.encodings.PKCS1Encoding;
+ import org.bouncycastle.crypto.engines.RSAEngine;
+ import org.bouncycastle.crypto.params.ParametersWithRandom;
+-import org.bouncycastle.jce.provider.RSAUtil;
+ import org.gudy.azureus2.core3.util.Debug;
+ import org.gudy.azureus2.core3.util.RandomUtils;
+ import org.gudy.azureus2.plugins.utils.StaticUtilities;
+@@ -83,29 +82,11 @@
+ 				
+ 			byte[] secret_bytes = session_key.getEncoded();
+ 			
+-			try{
+ 				Cipher	rsa_cipher = Cipher.getInstance( "RSA" );
+ 		    
+ 				rsa_cipher.init( Cipher.ENCRYPT_MODE, public_key );
+ 		    
+ 				encryped_session_key = rsa_cipher.doFinal( secret_bytes );
+-				
+-			}catch( Throwable e ){
+-				
+-					// fallback to the BC implementation for jdk1.4.2 as JCE RSA not available
+-				
+-				RSAEngine	eng = new RSAEngine();
+-				
+-				PKCS1Encoding	padded_eng = new PKCS1Encoding( eng );
+-				
+-	            CipherParameters param = RSAUtil.generatePublicKeyParameter(public_key);
+-	            
+-	            param = new ParametersWithRandom(param, RandomUtils.SECURE_RANDOM);
+-	            
+-	            padded_eng.init( true, param );
+-				
+-				encryped_session_key = padded_eng.processBlock(secret_bytes, 0, secret_bytes.length);
+-			}
+ 
+ 		}catch( Throwable e ){
+ 			
+--- a/azureus2/src/com/aelitis/azureus/core/security/impl/CryptoHandlerECC.java
++++ b/azureus2/src/com/aelitis/azureus/core/security/impl/CryptoHandlerECC.java
+@@ -29,6 +29,7 @@
+ import java.security.PrivateKey;
+ import java.security.PublicKey;
+ import java.security.SecureRandom;
++import java.security.Security;
+ import java.security.Signature;
+ import java.security.spec.AlgorithmParameterSpec;
+ import java.util.Arrays;
+@@ -37,7 +38,7 @@
+ import javax.crypto.Cipher;
+ import javax.crypto.IllegalBlockSizeException;
+ 
+-import org.bouncycastle.jce.provider.JCEIESCipher;
++import org.bouncycastle.jce.provider.BouncyCastleProvider;
+ import org.bouncycastle.jce.spec.IEKeySpec;
+ import org.bouncycastle.jce.spec.IESParameterSpec;
+ import org.gudy.azureus2.core3.config.COConfigurationManager;
+@@ -79,6 +80,7 @@
+ 		CryptoManagerImpl		_manager,
+ 		int						_instance_id )
+ 	{
++                Security.addProvider(new BouncyCastleProvider());
+ 		manager	= _manager;
+ 		
+ 		CONFIG_PREFIX += _instance_id + ".";
+@@ -225,11 +227,11 @@
+ 			
+ 			IESParameterSpec param = new IESParameterSpec( d, e, 128);
+ 		
+-			InternalECIES	cipher = new InternalECIES();
++                        Cipher cipher = Cipher.getInstance("ECIES");
+ 	
+-			cipher.internalEngineInit( Cipher.ENCRYPT_MODE, key_spec, param, null ); 
++                        cipher.init( Cipher.ENCRYPT_MODE, key_spec, param, null );
+ 		
+-			byte[]	encrypted = cipher.internalEngineDoFinal(data, 0, data.length );
++                        byte[]	encrypted = cipher.doFinal(data, 0, data.length );
+ 			
+ 			byte[] result = new byte[32+encrypted.length];
+ 			
+@@ -267,12 +269,9 @@
+ 			System.arraycopy( data, 16, e, 0, 16 );
+ 			
+ 			IESParameterSpec param = new IESParameterSpec( d, e, 128);
+-		
+-			InternalECIES	cipher = new InternalECIES();
+-	
+-			cipher.internalEngineInit( Cipher.DECRYPT_MODE, key_spec, param, null ); 
+-		
+-			return( cipher.internalEngineDoFinal( data, 32, data.length - 32 ));
++                        Cipher cipher = Cipher.getInstance("ECIES");
++                        cipher.init( Cipher.DECRYPT_MODE, key_spec, param, null );
++                        return( cipher.doFinal( data, 32, data.length - 32 ));
+ 			
+ 		}catch( CryptoManagerException e ){
+ 			
+@@ -859,33 +858,5 @@
+ 	{
+ 		return((int)COConfigurationManager.getIntParameter( CONFIG_PREFIX + "pwtype", CryptoManagerPasswordHandler.HANDLER_TYPE_USER ));
+ 	}
+-	
+-	class InternalECIES 
+-		extends JCEIESCipher.ECIES
+-	{
+-			// we use this class to obtain compatability with BC
+-
+-		public void 
+-		internalEngineInit(
+-			int                     opmode,
+-			Key                     key,
+-			AlgorithmParameterSpec  params,
+-			SecureRandom            random ) 
+-		
+-			throws InvalidKeyException, InvalidAlgorithmParameterException
+-		{
+-			engineInit(opmode, key, params, random);
+-		}
+-
+-		protected byte[] 
+-		internalEngineDoFinal(
+-			byte[]  input,
+-			int     inputOffset,
+-			int     inputLen ) 
+-		
+-			throws IllegalBlockSizeException, BadPaddingException
+-		{
+-			return engineDoFinal(input, inputOffset, inputLen);
+-		}
+-	}
+ }
++
diff --git a/debian/patches/07_platform.patch b/debian/patches/07_platform.patch
new file mode 100644
index 0000000..4c162cc
--- /dev/null
+++ b/debian/patches/07_platform.patch
@@ -0,0 +1,86 @@
+# Description: Remove the Windows and OSX platform specific code causing a FTBFS. 
+# Author: Adrian Perez <adrianperez.deb at gmail.com> 
+# Forwarded: no
+# Last-Update: 2014-06-23
+--- a/azureus2/src/com/aelitis/azureus/core/update/impl/AzureusRestarterImpl.java
++++ b/azureus2/src/com/aelitis/azureus/core/update/impl/AzureusRestarterImpl.java
+@@ -30,8 +30,10 @@
+ import org.gudy.azureus2.platform.PlatformManager;
+ import org.gudy.azureus2.platform.PlatformManagerFactory;
+ import org.gudy.azureus2.platform.unix.ScriptAfterShutdown;
++/*  --- Adrian Perez: Don't import this when building for Linux.
+ import org.gudy.azureus2.platform.win32.access.AEWin32Access;
+ import org.gudy.azureus2.platform.win32.access.AEWin32Manager;
++*/
+ import org.gudy.azureus2.plugins.PluginInterface;
+ import org.gudy.azureus2.plugins.platform.PlatformManagerException;
+ import org.gudy.azureus2.pluginsimpl.local.PluginInitializer;
+@@ -317,7 +319,8 @@
+ 		}
+ 
+ 		try {
+-			int result;
++			int result = -123; // Adrian Perez: Evade Win32 logic, key: "nowin32"
++/*
+ 			AEWin32Access accessor = AEWin32Manager.getAccessor(true);
+ 			if (accessor == null) {
+ 				result = -123;
+@@ -372,6 +375,7 @@
+ 							SystemProperties.getApplicationPath(), AEWin32Access.SW_NORMAL);
+ 				}
+ 			}
++*/
+ 
+ 			/*
+ 			 * Some results:
+--- a/azureus2/src/org/gudy/azureus2/platform/PlatformManagerPluginDelegate.java
++++ b/azureus2/src/org/gudy/azureus2/platform/PlatformManagerPluginDelegate.java
+@@ -24,6 +24,10 @@
+ 
+ import org.gudy.azureus2.platform.unix.PlatformManagerUnixPlugin;
+ 
++/* --- Adrian Perez: Don't use Win32 UpdateChecker in Linux.
++import org.gudy.azureus2.platform.win32.PlatformManagerUpdateChecker;
++*/
++
+ import org.gudy.azureus2.plugins.Plugin;
+ import org.gudy.azureus2.plugins.PluginException;
+ import org.gudy.azureus2.plugins.PluginInterface;
+@@ -54,16 +58,21 @@
+ 		PlatformManager platform = PlatformManagerFactory.getPlatformManager();
+ 
+ 		int platformType = platform.getPlatformType();
+-		if ( platformType == PlatformManager.PT_WINDOWS ){
++
++                  /* Adrian Perez:
++                   * We're not in Windows or MacOS
++                   *
++                if ( platformType == PlatformManager.PT_WINDOWS ){
+ 			org.gudy.azureus2.platform.win32.PlatformManagerUpdateChecker plugin = new org.gudy.azureus2.platform.win32.PlatformManagerUpdateChecker();
+ 			plugin.initialize(pluginInterface);
+ 		}else if ( platformType == PlatformManager.PT_MACOSX ){
+ 			org.gudy.azureus2.platform.macosx.PlatformManagerUpdateChecker plugin = new org.gudy.azureus2.platform.macosx.PlatformManagerUpdateChecker();
+ 			plugin.initialize(pluginInterface);
+-		}else if ( platformType == PlatformManager.PT_UNIX ){
++                  */
++		if ( platformType == PlatformManager.PT_UNIX ){
+ 			PlatformManagerUnixPlugin plugin = new PlatformManagerUnixPlugin();
+ 			plugin.initialize(pluginInterface);
+-		}else{
++		} else {
+ 			Properties pluginProperties = pluginInterface.getPluginProperties();
+ 			pluginProperties.setProperty("plugin.name", "Platform-Specific Support");
+ 			pluginProperties.setProperty("plugin.version", "1.0");
+--- a/azureus2/src/org/gudy/azureus2/platform/PlatformManagerFactory.java
++++ b/azureus2/src/org/gudy/azureus2/platform/PlatformManagerFactory.java
+@@ -58,10 +58,6 @@
+ 						if ( getPlatformType() == PlatformManager.PT_WINDOWS ){
+ 							
+ 							platform_manager = org.gudy.azureus2.platform.win32.PlatformManagerImpl.getSingleton();
+-							
+-						}else if( getPlatformType() == PlatformManager.PT_MACOSX ){
+-							
+-		                    platform_manager = org.gudy.azureus2.platform.macosx.PlatformManagerImpl.getSingleton();
+ 		                    
+ 						}else if( getPlatformType() == PlatformManager.PT_UNIX ){
+ 							
diff --git a/debian/patches/08_multi_user.patch b/debian/patches/08_multi_user.patch
new file mode 100644
index 0000000..9581a1c
--- /dev/null
+++ b/debian/patches/08_multi_user.patch
@@ -0,0 +1,183 @@
+# Description: Allow one single instance of Azureus per user, instead of one per
+#  machine. Add authentication to the control interface.
+# Author: Stefano Maioli <smaioli at gmx.com>
+# Bug-Debian: http://bugs.debian.org/329018
+# Bug-Ubuntu: https://bugs.launchpad.net/222630
+# Acked-by: Onkar Shinde <onkarshinde at ubuntu.com>
+# Acked-by: Adrian Perez <adrianperez.deb at gmail.com>
+
+--- /dev/null
++++ b/azureus2/src/org/gudy/azureus2/core3/util/LocalSocketHelper.java
+@@ -0,0 +1,128 @@
++/*
++ * Created on Aug 24, 2008
++ * Created by Stefano Maioli
++ * Copyright (C) 2008 Stefano Maioli, All Rights Reserved.
++ *
++ * This program 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
++ * of the License, or (at your option) any later version.
++ * This program 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 this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
++ */
++
++package org.gudy.azureus2.core3.util;
++
++import java.io.*;
++import java.net.*;
++
++/**
++ *
++ * @author Stefano Maioli
++ */
++public class LocalSocketHelper {
++
++    static private LocalSocketHelper helper = null;
++
++    private int port;
++    private long key;
++    private boolean wasLocked;
++    private File lock;
++    private ServerSocket listenSocket = null;
++    private Socket outSocket = null;
++
++    private LocalSocketHelper() throws IOException {
++        String path = SystemProperties.getUserPath();
++        lock = new File(path, "localport.lock");
++        if(lock.exists()) {
++            DataInputStream inlock = new DataInputStream(new FileInputStream(lock));
++            port = inlock.readInt();
++            key = inlock.readLong();
++            inlock.close();
++            wasLocked = true;
++        } else {
++            key = new java.util.Random().nextLong();
++            do {
++                port = (int)(Math.random()*(65535-49152) + 49152);
++                try {
++                    listenSocket = new AuthServerSocket(port, 50, InetAddress.getByName("127.0.0.1"));
++                } catch(BindException ex) { listenSocket.close(); }
++            } while(!listenSocket.isBound());
++
++            DataOutputStream outlock = new DataOutputStream(
++                    new BufferedOutputStream(new FileOutputStream(lock)));
++            outlock.writeInt(port);
++            outlock.writeLong(key);
++            outlock.close();
++            lock.deleteOnExit();
++            wasLocked = false;
++        }
++    }
++
++    public static Socket connect() throws IOException {
++        if(helper == null) helper = new LocalSocketHelper();
++        if(helper.outSocket != null && helper.outSocket.isConnected())
++            return helper.outSocket;
++
++        if(!helper.wasLocked) throw new IOException("No previous instance to connect to.");
++
++        Socket s;
++        try {
++            s = new Socket("127.0.0.1", helper.port);
++            DataOutputStream out = new DataOutputStream(s.getOutputStream());
++            DataInputStream in = new DataInputStream(s.getInputStream());
++            out.writeLong(helper.key);
++            out.flush();
++            in.readByte();
++        } catch(IOException ex) {
++            helper.lock.delete();
++            helper = new LocalSocketHelper();
++            throw ex;
++        }
++        helper.outSocket = s;
++
++        return s;
++    }
++
++    public static ServerSocket listen() throws IOException {
++        try {
++            connect();
++        } catch(IOException ex) {}
++        if(helper.listenSocket != null)
++            return helper.listenSocket;
++        else {
++            throw new IOException("Other instance detected");
++        }
++    }
++
++    private class AuthServerSocket extends ServerSocket {
++
++        public AuthServerSocket(int port, int backlog, InetAddress bindAddr) throws IOException {
++            super(port, backlog, bindAddr);
++        }
++
++        //@Override
++        public Socket accept() throws IOException {
++            Socket s = super.accept();
++            DataInputStream in = new DataInputStream(s.getInputStream());
++            if(in.readLong() != key) {
++                in.close();
++                throw new SocketException("Connection closed: invalid authentication");
++            }
++            DataOutputStream out = new DataOutputStream(s.getOutputStream());
++            out.writeByte(1);
++            out.flush();
++            return s;
++        }
++
++        //@Override
++        public void close() throws IOException {
++        }
++
++    }
++}
+--- a/azureus2/src/org/gudy/azureus2/core3/util/RandomUtils.java
++++ b/azureus2/src/org/gudy/azureus2/core3/util/RandomUtils.java
+@@ -80,7 +80,7 @@
+ 	
+ 	
+ 	public static final int LISTEN_PORT_MIN = 10000;
+-	public static final int LISTEN_PORT_MAX = 65535;
++	public static final int LISTEN_PORT_MAX = 49151;
+ 	
+ 	
+ 	/**
+--- a/azureus2/src/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionConnection.java
++++ b/azureus2/src/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionConnection.java
+@@ -128,7 +128,7 @@
+ 			label.setLayoutData(gridData);
+ 
+ 			final IntParameter udp_listen = new IntParameter(cMiniArea,
+-					"UDP.Listen.Port", 1, 65535);
++					"UDP.Listen.Port", 1, 49151);
+ 			gridData = new GridData();
+ 			udp_listen.setLayoutData(gridData);
+ 
+--- a/azureus2/src/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionConnectionAdvanced.java
++++ b/azureus2/src/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionConnectionAdvanced.java
+@@ -190,7 +190,7 @@
+ 		Label lpbind = new Label(gSocket, SWT.NULL);
+ 		Messages.setLanguageText(lpbind, CFG_PREFIX + "bind_port");
+ 		final IntParameter port_bind = new IntParameter(gSocket,
+-				"network.bind.local.port", 0, 65535);
++				"network.bind.local.port", 0, 49151);
+ 		gridData = new GridData();
+ 		gridData.horizontalSpan = 2;
+ 		port_bind.setLayoutData(gridData);
+--- a/azureus2/src/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionTrackerClient.java
++++ b/azureus2/src/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionTrackerClient.java
+@@ -220,7 +220,7 @@
+     		try
+ 			{
+     			int portVal = Integer.parseInt(toValue);
+-				if(portVal >= 0 && portVal <= 65535)
++				if(portVal >= 0 && portVal <= 49151)
+ 					return;
+ 			} catch (NumberFormatException e) {}
+ 			p.setValue("");
diff --git a/debian/patches/debian/no-auto-update.patch b/debian/patches/09_no_auto_update.patch
similarity index 51%
rename from debian/patches/debian/no-auto-update.patch
rename to debian/patches/09_no_auto_update.patch
index c4275fe..00c4eb7 100644
--- a/debian/patches/debian/no-auto-update.patch
+++ b/debian/patches/09_no_auto_update.patch
@@ -1,13 +1,13 @@
-Disable auto-updates of the azureus platform, since we want to use debian packages
-to manage updates instead.
-
-Index: azureus/org/gudy/azureus2/core3/config/impl/ConfigurationDefaults.java
-===================================================================
---- azureus.orig/org/gudy/azureus2/core3/config/impl/ConfigurationDefaults.java	2011-06-07 22:07:05.588553689 +0100
-+++ azureus/org/gudy/azureus2/core3/config/impl/ConfigurationDefaults.java	2011-06-07 22:07:57.567719664 +0100
-@@ -231,9 +231,9 @@
- 		File f = new File(docPath, "Azureus Downloads");
- 		def.put("Default save path", f.getAbsolutePath());
+# Description: Disable auto-updates of the azureus platform, since we want to use debian packages
+#  to manage updates instead.
+# Author: Adrian Perez <adrianperez.deb at gmail.com>
+# Forwarded: no
+# Last-Update: 2014-06-23
+--- a/azureus2/src/org/gudy/azureus2/core3/config/impl/ConfigurationDefaults.java
++++ b/azureus2/src/org/gudy/azureus2/core3/config/impl/ConfigurationDefaults.java
+@@ -276,9 +276,9 @@
+ 	
+ 	def.put("Default save path", f.getAbsolutePath());
      
 -    def.put("update.start",TRUE);
 -    def.put("update.periodic",TRUE);
@@ -18,20 +18,18 @@ Index: azureus/org/gudy/azureus2/core3/config/impl/ConfigurationDefaults.java
      def.put("update.autodownload", FALSE);
  
      def.put("Send Version Info", TRUE);
-@@ -430,7 +430,7 @@
+@@ -488,7 +488,7 @@
+     def.put( "locale", Locale.getDefault().toString() );
      def.put( "locale.set.complete.count", ZERO);
-     def.put( "Confirm Data Delete", TRUE );
      def.put( "Password Confirm", null );
 -    def.put( "Auto Update", TRUE );
 +    def.put( "Auto Update", FALSE );
      def.put( "Alert on close", FALSE );
      def.put( "diskmanager.friendly.hashchecking", FALSE );
      def.put( "diskmanager.hashchecking.smallestfirst", TRUE );    
-Index: azureus/org/gudy/azureus2/pluginsimpl/update/PluginUpdatePlugin.java
-===================================================================
---- azureus.orig/org/gudy/azureus2/pluginsimpl/update/PluginUpdatePlugin.java	2011-06-07 22:15:58.037720459 +0100
-+++ azureus/org/gudy/azureus2/pluginsimpl/update/PluginUpdatePlugin.java	2011-06-07 22:23:03.417720345 +0100
-@@ -86,7 +86,7 @@
+--- a/azureus2/src/org/gudy/azureus2/pluginsimpl/update/PluginUpdatePlugin.java
++++ b/azureus2/src/org/gudy/azureus2/pluginsimpl/update/PluginUpdatePlugin.java
+@@ -93,7 +93,7 @@
  		
  		final PluginConfig	plugin_config = plugin_interface.getPluginconfig();
  		
@@ -40,7 +38,7 @@ Index: azureus/org/gudy/azureus2/pluginsimpl/update/PluginUpdatePlugin.java
  
  		model.setConfigSectionID(PLUGIN_CONFIGSECTION_ID);
  		model.getStatus().setText( enabled?"Running":"Optional checks disabled" );
-@@ -115,7 +115,7 @@
+@@ -122,7 +122,7 @@
  		
  		BasicPluginConfigModel config = ui_manager.createBasicPluginConfigModel(ConfigSection.SECTION_PLUGINS, PLUGIN_CONFIGSECTION_ID);
  		
@@ -49,16 +47,14 @@ Index: azureus/org/gudy/azureus2/pluginsimpl/update/PluginUpdatePlugin.java
  				
  		plugin_interface.addEventListener(
  			new PluginEventListener()
-Index: azureus/com/aelitis/azureus/ui/swt/UIConfigDefaultsSWTv3.java
-===================================================================
---- azureus.orig/com/aelitis/azureus/ui/swt/UIConfigDefaultsSWTv3.java	2011-06-07 22:19:06.657720379 +0100
-+++ azureus/com/aelitis/azureus/ui/swt/UIConfigDefaultsSWTv3.java	2011-06-07 22:19:22.817720827 +0100
-@@ -137,7 +137,7 @@
+--- a/azureus3/src/com/aelitis/azureus/ui/swt/UIConfigDefaultsSWTv3.java
++++ b/azureus3/src/com/aelitis/azureus/ui/swt/UIConfigDefaultsSWTv3.java
+@@ -142,7 +142,7 @@
  
  			defaults.addParameter("window.maximized", true);
  
 -			defaults.addParameter("update.autodownload", true);
 +			defaults.addParameter("update.autodownload", false);
  			
- 			defaults.addParameter("suppress_file_download_dialog", true);
+ 			//defaults.addParameter("suppress_file_download_dialog", true);
  			
diff --git a/debian/patches/debian/update-disable.diff b/debian/patches/debian/update-disable.diff
deleted file mode 100644
index cd058e0..0000000
--- a/debian/patches/debian/update-disable.diff
+++ /dev/null
@@ -1,116 +0,0 @@
-From: Adrian Perez <adrianperez.deb at gmail.com>
-Subject: [PATCH] debian/update-disable
-
-Prevent the automatic update of several components, specially the Core and the
-SWT libraries; avoids sync breakage with the Debian repositories.
-
-Signed-off-by: Adrian Perez <adrianperez.deb at gmail.com>
-
----
- com/aelitis/azureus/ui/swt/Initializer.java        |    8 ++++++--
- .../azureus2/ui/swt/mainwindow/Initializer.java    |    8 ++++++--
- org/gudy/azureus2/update/CorePatchChecker.java     |    6 +++++-
- org/gudy/azureus2/update/CoreUpdateChecker.java    |    5 ++++-
- 4 files changed, 21 insertions(+), 6 deletions(-)
-
-diff --git a/com/aelitis/azureus/ui/swt/Initializer.java b/com/aelitis/azureus/ui/swt/Initializer.java
-index 8a959c4..9069f3d 100644
---- a/com/aelitis/azureus/ui/swt/Initializer.java
-+++ b/com/aelitis/azureus/ui/swt/Initializer.java
-@@ -44,9 +44,10 @@ import org.gudy.azureus2.ui.swt.networks.SWTNetworkSelection;
- import org.gudy.azureus2.ui.swt.pluginsinstaller.InstallPluginWizard;
- import org.gudy.azureus2.ui.swt.progress.ProgressWindow;
- import org.gudy.azureus2.ui.swt.update.UpdateMonitor;
-+/* --- Adrian Perez: Don't initialize SWTUpdateChecker in Debian.
- import org.gudy.azureus2.ui.swt.updater2.PreUpdateChecker;
- import org.gudy.azureus2.ui.swt.updater2.SWTUpdateChecker;
--
-+*/
- import com.aelitis.azureus.core.*;
- import com.aelitis.azureus.core.cnetwork.ContentNetwork;
- import com.aelitis.azureus.core.messenger.ClientMessageContext;
-@@ -358,12 +359,15 @@ public class Initializer
- 					}
- 					
- 					reportCurrentTaskByKey("splash.openViews");
--	
-+/*
-+ * Adrian Perez: Don't initialize SWTUpdateChecker in Debian
-+ *
- 					SWTUpdateChecker.initialize();
- 	
- 					PreUpdateChecker.initialize(core,
- 							COConfigurationManager.getStringParameter("ui"));
- 	
-+*/
- 					UpdateMonitor.getSingleton(core); // setup the update monitor
- 	
- 					//Tell listeners that all is initialized :
-diff --git a/org/gudy/azureus2/ui/swt/mainwindow/Initializer.java b/org/gudy/azureus2/ui/swt/mainwindow/Initializer.java
-index 620829f..d9e4478 100644
---- a/org/gudy/azureus2/ui/swt/mainwindow/Initializer.java
-+++ b/org/gudy/azureus2/ui/swt/mainwindow/Initializer.java
-@@ -45,9 +45,10 @@ import org.gudy.azureus2.ui.swt.networks.SWTNetworkSelection;
- import org.gudy.azureus2.ui.swt.pluginsinstaller.InstallPluginWizard;
- import org.gudy.azureus2.ui.swt.progress.ProgressWindow;
- import org.gudy.azureus2.ui.swt.update.UpdateMonitor;
-+/* --- Adrian Perez: Don't initialize SWTUpdateChecker in Debian.
- import org.gudy.azureus2.ui.swt.updater2.PreUpdateChecker;
- import org.gudy.azureus2.ui.swt.updater2.SWTUpdateChecker;
--
-+*/
- import com.aelitis.azureus.core.*;
- import com.aelitis.azureus.core.util.CopyOnWriteList;
- import com.aelitis.azureus.launcher.Launcher;
-@@ -253,11 +254,14 @@ Initializer
- 	
- 						if (finalLogListener != null)
- 							Logger.removeListener(finalLogListener);
--	
-+/*
-+ * Adrian Perez: Don't initialize SWTUpdateChecker in Debian.
-+ *
- 						SWTUpdateChecker.initialize();
- 	
- 						PreUpdateChecker.initialize( core, COConfigurationManager.getStringParameter("ui"));
- 	
-+*/
- 						UpdateMonitor.getSingleton(core); // setup the update monitor
- 	
- 						//Tell listeners that all is initialized :
-diff --git a/org/gudy/azureus2/update/CorePatchChecker.java b/org/gudy/azureus2/update/CorePatchChecker.java
-index 82fd9ae..b87f55a 100644
---- a/org/gudy/azureus2/update/CorePatchChecker.java
-+++ b/org/gudy/azureus2/update/CorePatchChecker.java
-@@ -65,7 +65,11 @@ CorePatchChecker
- 				System.out.println( "CorePatchChecker: TESTING !!!!" );
- 			}
- 			
--			plugin_interface.getUpdateManager().registerUpdatableComponent( this, false );
-+			/*
-+			 * Adrian Perez: Don't register Core Patcher in Debian
-+			 * 
-+			 * plugin_interface.getUpdateManager().registerUpdatableComponent( this, false );
-+			 */
- 		}
- 	}
- 	
-diff --git a/org/gudy/azureus2/update/CoreUpdateChecker.java b/org/gudy/azureus2/update/CoreUpdateChecker.java
-index a19e928..75dd887 100644
---- a/org/gudy/azureus2/update/CoreUpdateChecker.java
-+++ b/org/gudy/azureus2/update/CoreUpdateChecker.java
-@@ -127,8 +127,11 @@ CoreUpdateChecker
- 		props.setProperty( "plugin.version", plugin_interface.getAzureusVersion());
- 		
- 		rdf = plugin_interface.getUtilities().getResourceDownloaderFactory();
--	
-+	/*
-+	 * Adrian Perez: Don't update Azureus Core in Debian.
-+	 *
- 		plugin_interface.getUpdateManager().registerUpdatableComponent( this, true );
-+	*/
- 	}
- 	
- 	public String
--- 
-tg: (3001c78..) debian/update-disable (depends on: upstream)
diff --git a/debian/patches/fixes/multiuser.diff b/debian/patches/fixes/multiuser.diff
deleted file mode 100644
index 45f86ec..0000000
--- a/debian/patches/fixes/multiuser.diff
+++ /dev/null
@@ -1,521 +0,0 @@
-From: Stefano Maioli <smaioli at gmx.com>
-Subject: [PATCH] fixes/multiuser
-
-Allow one single instance of Azureus per user, instead of one per
-machine. Add authentication to the control interface.
-
-Bug-Debian: http://bugs.debian.org/329018
-Bug-Ubuntu: https://bugs.launchpad.net/222630
-Acked-by: Onkar Shinde <onkarshinde at ubuntu.com>
-Signed-off-by: Adrian Perez <adrianperez.deb at gmail.com>
-
----
- .../core/impl/AzureusCoreSingleInstanceClient.java |    8 +-
- .../impl/tcp/IncomingSocketChannelManager.java     |    2 +-
- .../networkmanager/impl/udp/UDPNetworkManager.java |    4 +-
- .../core3/config/impl/ConfigurationChecker.java    |    2 +-
- .../core3/ipchecker/natchecker/NatChecker.java     |    2 +-
- .../azureus2/core3/util/LocalSocketHelper.java     |  128 ++++++++++++++++++++
- org/gudy/azureus2/core3/util/RandomUtils.java      |    2 +-
- .../platform/unix/ScriptBeforeStartup.java         |    2 +-
- org/gudy/azureus2/ui/common/Main.java              |    2 +-
- org/gudy/azureus2/ui/common/StartServer.java       |    6 +-
- org/gudy/azureus2/ui/swt/Main.java                 |    4 +-
- org/gudy/azureus2/ui/swt/StartServer.java          |    6 +-
- org/gudy/azureus2/ui/swt/StartSocket.java          |    4 +-
- org/gudy/azureus2/ui/swt/osx/Start.java            |    2 +-
- .../azureus2/ui/swt/updater/snippets/Main.java     |    2 +-
- .../azureus2/ui/swt/updater/snippets/Started.java  |    4 +-
- .../configsections/ConfigSectionConnection.java    |   18 ++--
- .../ConfigSectionConnectionAdvanced.java           |    2 +-
- .../configsections/ConfigSectionTrackerClient.java |    2 +-
- 19 files changed, 164 insertions(+), 38 deletions(-)
-
-diff --git a/com/aelitis/azureus/core/impl/AzureusCoreSingleInstanceClient.java b/com/aelitis/azureus/core/impl/AzureusCoreSingleInstanceClient.java
-index ada3ce6..a9b92d2 100644
---- a/com/aelitis/azureus/core/impl/AzureusCoreSingleInstanceClient.java
-+++ b/com/aelitis/azureus/core/impl/AzureusCoreSingleInstanceClient.java
-@@ -29,8 +29,8 @@ import java.io.*;
- /**
-  * Single instance management is a bit of a mess. For some reason the UIs have their own implementations of clients and servers.
-  * We also have a more generic plugin-accessible single instance service that can be used by launchable plugins but don't give
-- * a generic mechanism for dealing with the basic mechanism used by the UIs (that run on 6880).
-- * I have introduced this class to give a programmatic way of passing arguments using the existing 6880 port. Perhaps one day
-+ * a generic mechanism for dealing with the basic mechanism used by the UIs (that run on main local port).
-+ * I have introduced this class to give a programmatic way of passing arguments using the existing local port. Perhaps one day
-  * the various UI implementations will be rewritten to use this...
-  * @author Parg
-  */
-@@ -69,9 +69,7 @@ AzureusCoreSingleInstanceClient
- 			Socket	sock = null;
- 			
- 			try{
--				sock = new Socket();
--				
--				sock.connect( new InetSocketAddress( "127.0.0.1", 6880 ), CONNECT_TIMEOUT );
-+				sock = org.gudy.azureus2.core3.util.LocalSocketHelper.connect();
- 				
- 				sock.setSoTimeout( READ_TIMEOUT );
- 				
-diff --git a/com/aelitis/azureus/core/networkmanager/impl/tcp/IncomingSocketChannelManager.java b/com/aelitis/azureus/core/networkmanager/impl/tcp/IncomingSocketChannelManager.java
-index d74e5ef..4189790 100644
---- a/com/aelitis/azureus/core/networkmanager/impl/tcp/IncomingSocketChannelManager.java
-+++ b/com/aelitis/azureus/core/networkmanager/impl/tcp/IncomingSocketChannelManager.java
-@@ -370,7 +370,7 @@ public class IncomingSocketChannelManager
- 		{
- 			this_mon.enter();
- 			
--			if (tcp_listen_port < 0 || tcp_listen_port > 65535 || tcp_listen_port == 6880)
-+			if (tcp_listen_port < 0 || tcp_listen_port >= 49152)
- 			{
- 				String msg = "Invalid incoming TCP listen port configured, " + tcp_listen_port + ". Port reset to default. Please check your config!";
- 				Debug.out(msg);
-diff --git a/com/aelitis/azureus/core/networkmanager/impl/udp/UDPNetworkManager.java b/com/aelitis/azureus/core/networkmanager/impl/udp/UDPNetworkManager.java
-index daa77dd..9354448 100644
---- a/com/aelitis/azureus/core/networkmanager/impl/udp/UDPNetworkManager.java
-+++ b/com/aelitis/azureus/core/networkmanager/impl/udp/UDPNetworkManager.java
-@@ -118,7 +118,7 @@ UDPNetworkManager
- 						   return;
- 					   }
- 					   
--					   if ( port < 0 || port > 65535 || port == 6880 ) {
-+					   if ( port < 0 || port >= 49152 ) {
- 						   
- 					        String msg = "Invalid incoming UDP listen port configured, " +port+ ". The port has been reset. Please check your config!";
- 					        
-@@ -151,7 +151,7 @@ UDPNetworkManager
- 							   return;
- 						   }
- 						   
--						   if ( port < 0 || port > 65535 || port == 6880 ) {
-+						   if ( port < 0 || port >= 49152 ) {
- 							   
- 						        String msg = "Invalid incoming UDP non-data listen port configured, " +port+ ". The port has been reset. Please check your config!";
- 						        
-diff --git a/org/gudy/azureus2/core3/config/impl/ConfigurationChecker.java b/org/gudy/azureus2/core3/config/impl/ConfigurationChecker.java
-index 15a1912..d3d70cf 100644
---- a/org/gudy/azureus2/core3/config/impl/ConfigurationChecker.java
-+++ b/org/gudy/azureus2/core3/config/impl/ConfigurationChecker.java
-@@ -454,7 +454,7 @@ ConfigurationChecker
- 	    
- 	    	// reset invalid ports - single-instance socket port and (small) magnet uri listener port range
- 	    
--	    if ( tcp_port == 6880 || ( tcp_port >= 45100 && tcp_port <= 45103 )){
-+	    if ( tcp_port >= 49152 || ( tcp_port >= 45100 && tcp_port <= 45103 )){
- 	    
- 	    	int	new_tcp_port	=  RandomUtils.generateRandomNetworkListenPort();
- 	    	
-diff --git a/org/gudy/azureus2/core3/ipchecker/natchecker/NatChecker.java b/org/gudy/azureus2/core3/ipchecker/natchecker/NatChecker.java
-index c8aec8d..18138a6 100644
---- a/org/gudy/azureus2/core3/ipchecker/natchecker/NatChecker.java
-+++ b/org/gudy/azureus2/core3/ipchecker/natchecker/NatChecker.java
-@@ -70,7 +70,7 @@ public class NatChecker {
-   {	
-     String check = "azureus_rand_" + String.valueOf( (int)(Math.random() * 100000) );
-     
--    if ( port < 0 || port > 65535 || port == 6880 ){
-+    if ( port < 0 || port >= 49152 ){
-     	
-     	result = NAT_UNABLE;
-     	
-diff --git a/org/gudy/azureus2/core3/util/LocalSocketHelper.java b/org/gudy/azureus2/core3/util/LocalSocketHelper.java
-new file mode 100644
-index 0000000..568efaa
---- /dev/null
-+++ b/org/gudy/azureus2/core3/util/LocalSocketHelper.java
-@@ -0,0 +1,128 @@
-+/*
-+ * Created on Aug 24, 2008
-+ * Created by Stefano Maioli
-+ * Copyright (C) 2008 Stefano Maioli, All Rights Reserved.
-+ *
-+ * This program 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
-+ * of the License, or (at your option) any later version.
-+ * This program 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 this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-+ */
-+
-+package org.gudy.azureus2.core3.util;
-+
-+import java.io.*;
-+import java.net.*;
-+
-+/**
-+ *
-+ * @author Stefano Maioli
-+ */
-+public class LocalSocketHelper {
-+
-+    static private LocalSocketHelper helper = null;
-+
-+    private int port;
-+    private long key;
-+    private boolean wasLocked;
-+    private File lock;
-+    private ServerSocket listenSocket = null;
-+    private Socket outSocket = null;
-+
-+    private LocalSocketHelper() throws IOException {
-+        String path = SystemProperties.getUserPath();
-+        lock = new File(path, "localport.lock");
-+        if(lock.exists()) {
-+            DataInputStream inlock = new DataInputStream(new FileInputStream(lock));
-+            port = inlock.readInt();
-+            key = inlock.readLong();
-+            inlock.close();
-+            wasLocked = true;
-+        } else {
-+            key = new java.util.Random().nextLong();
-+            do {
-+                port = (int)(Math.random()*(65535-49152) + 49152);
-+                try {
-+                    listenSocket = new AuthServerSocket(port, 50, InetAddress.getByName("127.0.0.1"));
-+                } catch(BindException ex) { listenSocket.close(); }
-+            } while(!listenSocket.isBound());
-+
-+            DataOutputStream outlock = new DataOutputStream(
-+                    new BufferedOutputStream(new FileOutputStream(lock)));
-+            outlock.writeInt(port);
-+            outlock.writeLong(key);
-+            outlock.close();
-+            lock.deleteOnExit();
-+            wasLocked = false;
-+        }
-+    }
-+
-+    public static Socket connect() throws IOException {
-+        if(helper == null) helper = new LocalSocketHelper();
-+        if(helper.outSocket != null && helper.outSocket.isConnected())
-+            return helper.outSocket;
-+
-+        if(!helper.wasLocked) throw new IOException("No previous instance to connect to.");
-+
-+        Socket s;
-+        try {
-+            s = new Socket("127.0.0.1", helper.port);
-+            DataOutputStream out = new DataOutputStream(s.getOutputStream());
-+            DataInputStream in = new DataInputStream(s.getInputStream());
-+            out.writeLong(helper.key);
-+            out.flush();
-+            in.readByte();
-+        } catch(IOException ex) {
-+            helper.lock.delete();
-+            helper = new LocalSocketHelper();
-+            throw ex;
-+        }
-+        helper.outSocket = s;
-+
-+        return s;
-+    }
-+
-+    public static ServerSocket listen() throws IOException {
-+        try {
-+            connect();
-+        } catch(IOException ex) {}
-+        if(helper.listenSocket != null)
-+            return helper.listenSocket;
-+        else {
-+            throw new IOException("Other instance detected");
-+        }
-+    }
-+
-+    private class AuthServerSocket extends ServerSocket {
-+
-+        public AuthServerSocket(int port, int backlog, InetAddress bindAddr) throws IOException {
-+            super(port, backlog, bindAddr);
-+        }
-+
-+        //@Override
-+        public Socket accept() throws IOException {
-+            Socket s = super.accept();
-+            DataInputStream in = new DataInputStream(s.getInputStream());
-+            if(in.readLong() != key) {
-+                in.close();
-+                throw new SocketException("Connection closed: invalid authentication");
-+            }
-+            DataOutputStream out = new DataOutputStream(s.getOutputStream());
-+            out.writeByte(1);
-+            out.flush();
-+            return s;
-+        }
-+
-+        //@Override
-+        public void close() throws IOException {
-+        }
-+
-+    }
-+}
-diff --git a/org/gudy/azureus2/core3/util/RandomUtils.java b/org/gudy/azureus2/core3/util/RandomUtils.java
-index 210f6ec..12bd5a2 100644
---- a/org/gudy/azureus2/core3/util/RandomUtils.java
-+++ b/org/gudy/azureus2/core3/util/RandomUtils.java
-@@ -70,7 +70,7 @@ RandomUtils
- 	
- 	
- 	public static final int LISTEN_PORT_MIN = 10000;
--	public static final int LISTEN_PORT_MAX = 65535;
-+	public static final int LISTEN_PORT_MAX = 49151;
- 	
- 	
- 	/**
-diff --git a/org/gudy/azureus2/platform/unix/ScriptBeforeStartup.java b/org/gudy/azureus2/platform/unix/ScriptBeforeStartup.java
-index af273a6..e377dd1 100644
---- a/org/gudy/azureus2/platform/unix/ScriptBeforeStartup.java
-+++ b/org/gudy/azureus2/platform/unix/ScriptBeforeStartup.java
-@@ -42,7 +42,7 @@ public class ScriptBeforeStartup
-   		boolean argsSent = new AzureusCoreSingleInstanceClient().sendArgs(args, 500);
-   		if (argsSent) {
-   			// azureus was open..
--  			String msg = "Passing startup args to already-running " + Constants.APP_NAME + " java process listening on [127.0.0.1: 6880]";
-+  			String msg = "Passing startup args to already-running " + Constants.APP_NAME + " java process";
-   			log(msg);
-   			sysout.println("exit");
-   
-diff --git a/org/gudy/azureus2/ui/common/Main.java b/org/gudy/azureus2/ui/common/Main.java
-index 40cf3d7..6686913 100644
---- a/org/gudy/azureus2/ui/common/Main.java
-+++ b/org/gudy/azureus2/ui/common/Main.java
-@@ -358,7 +358,7 @@ public class Main {
-         
- 		// NOTE - this formatting is also used by AzureusCoreSingleInstanceClient and other org.gudy.azureus2.ui.swt.StartSocket
-         
--        sck = new Socket("127.0.0.1",6880);
-+        sck = org.gudy.azureus2.core3.util.LocalSocketHelper.connect();
-         pw = new PrintWriter(new OutputStreamWriter(sck.getOutputStream()));
-         StringBuffer buffer = new StringBuffer(AzureusCoreSingleInstanceClient.ACCESS_STRING+";args;");
-         for(int i = 0 ; i < args.length ; i++) {
-diff --git a/org/gudy/azureus2/ui/common/StartServer.java b/org/gudy/azureus2/ui/common/StartServer.java
-index c5f5603..3b46395 100644
---- a/org/gudy/azureus2/ui/common/StartServer.java
-+++ b/org/gudy/azureus2/ui/common/StartServer.java
-@@ -35,16 +35,16 @@ public class StartServer extends Thread {
-   public StartServer() {
-     super("Start Server");
-     try {
--      socket = new ServerSocket(6880, 50, InetAddress.getByName("127.0.0.1")); //NOLAR: only bind to localhost
-+      socket = org.gudy.azureus2.core3.util.LocalSocketHelper.listen(); //NOLAR: only bind to localhost
-       state = STATE_LISTENING;
--      Logger.getLogger("azureus2").info("StartServer: listening on 127.0.0.1:6880 for passed torrent info");
-+      Logger.getLogger("azureus2").info("StartServer: listening on 127.0.0.1:" + socket.getLocalPort() + " for passed torrent info");
-     } catch (Exception e) {
-       state = STATE_FAULTY;
- 
- 		// DON'T USE LOGGER here as we DON't want to initialise all the logger stuff
- 		// and in particular AEDiagnostics config dirty stuff!!!!
- 
--      System.out.println( "StartServer ERROR: unable to bind to 127.0.0.1:6880 for passed torrent info");
-+      System.out.println( "StartServer ERROR: unable to bind to a local port for passed torrent info");
-     }
-   }
- 
-diff --git a/org/gudy/azureus2/ui/swt/Main.java b/org/gudy/azureus2/ui/swt/Main.java
-index d9e8463..ccc2588 100644
---- a/org/gudy/azureus2/ui/swt/Main.java
-+++ b/org/gudy/azureus2/ui/swt/Main.java
-@@ -215,13 +215,13 @@ Main
-     }
-     
-     
--     if( another_instance ) {  //looks like there's already a process listening on 127.0.0.1:6880
-+     if( another_instance ) {  //looks like there's already a process listening
-     	//attempt to pass args to existing instance
-     	StartSocket ss = new StartSocket(args);
-     	
-     	if( !ss.sendArgs() ) {  //arg passing attempt failed, so start core anyway
-     		another_instance = false;
--    		String msg = "There appears to be another program process already listening on socket [127.0.0.1: 6880].\nLoading of torrents via command line parameter will fail until this is fixed.";
-+    		String msg = "Impossible to bind to a local socket.\nLoading of torrents via command line parameter will fail until this is fixed.";
-     		System.out.println( msg );
-     		Logger.log(new LogAlert(LogAlert.REPEATABLE, LogAlert.AT_WARNING, msg));
-     	}
-diff --git a/org/gudy/azureus2/ui/swt/StartServer.java b/org/gudy/azureus2/ui/swt/StartServer.java
-index 88f520e..e354014 100644
---- a/org/gudy/azureus2/ui/swt/StartServer.java
-+++ b/org/gudy/azureus2/ui/swt/StartServer.java
-@@ -68,13 +68,13 @@ StartServer
-     	// DON'T USE LOGGER HERE DUE TO COMMENTS BELOW - IF AZ ALREADY RUNNING THEN THE SERVERSOCKET
-     	// CALL WILL THROW AN EXCEPTION 
-     	
--    	socket = new ServerSocket(6880, 50, InetAddress.getByName("127.0.0.1")); //NOLAR: only bind to localhost
-+    	socket = org.gudy.azureus2.core3.util.LocalSocketHelper.listen(); //NOLAR: only bind to localhost
-         
-         state = STATE_LISTENING;    
-         
-         if (Logger.isEnabled())
-         	Logger.log(new LogEvent(LOGID, "StartServer: listening on "
--        			+ "127.0.0.1:6880 for passed torrent info"));
-+        			+ "127.0.0.1:" + socket.getLocalPort() + " for passed torrent info"));
-     
-     }catch (Throwable t) {
-     	
-@@ -84,7 +84,7 @@ StartServer
-       state = STATE_FAULTY;
-       String reason = t.getMessage() == null ? "<>" : t.getMessage();
- 
--      System.out.println( "StartServer ERROR: unable" + " to bind to 127.0.0.1:6880 listening"
-+      System.out.println( "StartServer ERROR: unable" + " to bind to a local port listening"
- 							+ " for passed torrent info: " + reason);
-     }
-   }
-diff --git a/org/gudy/azureus2/ui/swt/StartSocket.java b/org/gudy/azureus2/ui/swt/StartSocket.java
-index 2071c96..d6d73de 100644
---- a/org/gudy/azureus2/ui/swt/StartSocket.java
-+++ b/org/gudy/azureus2/ui/swt/StartSocket.java
-@@ -49,14 +49,14 @@ public class StartSocket {
-     	Socket sck = null;
-     	PrintWriter pw = null;
-     	try {
--    		String msg = "StartSocket: passing startup args to already-running Azureus java process listening on [127.0.0.1: 6880]";
-+    		String msg = "StartSocket: passing startup args to already-running Azureus java process";
-     		
-     			// DON'T USE LOGGER here as we DON't want to initialise all the logger stuff
-     			// and in particular AEDiagnostics config dirty stuff!!!!
-     		
-     		System.out.println( msg );
-        	
--    		sck = new Socket("127.0.0.1", 6880);
-+    		sck = org.gudy.azureus2.core3.util.LocalSocketHelper.connect();
-          
-     			// NOTE - this formatting is also used by AzureusCoreSingleInstanceClient and other org.gudy.azureus2.ui.common.Main.StartSocket
-     		
-diff --git a/org/gudy/azureus2/ui/swt/osx/Start.java b/org/gudy/azureus2/ui/swt/osx/Start.java
-index 5f20cd3..c70a78e 100644
---- a/org/gudy/azureus2/ui/swt/osx/Start.java
-+++ b/org/gudy/azureus2/ui/swt/osx/Start.java
-@@ -38,7 +38,7 @@ public class Start {
-       try {          
-         System.out.println("StartSocket: passing startup args to already-running Azureus java process.");
-         
--        sck = new Socket("127.0.0.1", 6880);
-+        sck = org.gudy.azureus2.core3.util.LocalSocketHelper.connect();
-         
-         pw = new PrintWriter(new OutputStreamWriter(sck.getOutputStream(),"UTF8"));
-         
-diff --git a/org/gudy/azureus2/ui/swt/updater/snippets/Main.java b/org/gudy/azureus2/ui/swt/updater/snippets/Main.java
-index fe96aab..99ffec1 100644
---- a/org/gudy/azureus2/ui/swt/updater/snippets/Main.java
-+++ b/org/gudy/azureus2/ui/swt/updater/snippets/Main.java
-@@ -36,7 +36,7 @@ public class Main {
-     
-     public static void main(String args[]) {
-         try {
--        	ServerSocket server = new ServerSocket(6880, 50, InetAddress.getByName("127.0.0.1"));
-+          ServerSocket server = org.gudy.azureus2.core3.util.LocalSocketHelper.listen();
-           spawnStarted();
-           server.close();
-         } catch(Exception e) {
-diff --git a/org/gudy/azureus2/ui/swt/updater/snippets/Started.java b/org/gudy/azureus2/ui/swt/updater/snippets/Started.java
-index 023a557..7619e99 100644
---- a/org/gudy/azureus2/ui/swt/updater/snippets/Started.java
-+++ b/org/gudy/azureus2/ui/swt/updater/snippets/Started.java
-@@ -36,11 +36,11 @@ public class Started {
-         try {
-             while(!ok) {
-               try{
--                ServerSocket server = new ServerSocket(6880, 50, InetAddress.getByName("127.0.0.1"));
-+                ServerSocket server = org.gudy.azureus2.core3.util.LocalSocketHelper.listen();
-                 ok = true;
-                 server.close();
-               } catch(Exception e) {
--                Logger.log("Exception while trying to bind on port 6880 : " + e);
-+                Logger.log("Exception while trying to bind to local port : " + e);
-                 Thread.sleep(1000);
-               }
-             }
-diff --git a/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionConnection.java b/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionConnection.java
-index 00171c7..b321361 100644
---- a/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionConnection.java
-+++ b/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionConnection.java
-@@ -102,14 +102,14 @@ public class ConfigSectionConnection implements UISWTConfigSection {
- 		label.setLayoutData(gridData);
- 
- 		final IntParameter tcplisten = new IntParameter(cMiniArea,
--				"TCP.Listen.Port", 1, 65535);
-+				"TCP.Listen.Port", 1, 49151);
- 		gridData = new GridData();
- 		tcplisten.setLayoutData(gridData);
- 
- 		tcplisten.addChangeListener(new ParameterChangeAdapter() {
- 			public void intParameterChanging(Parameter p, int toValue) {
--				if (toValue == 6880) {
--					toValue = 6881;
-+				if (toValue > 49151) {
-+					toValue = 49151;
- 					tcplisten.setValue(toValue);
- 				}
- 
-@@ -129,7 +129,7 @@ public class ConfigSectionConnection implements UISWTConfigSection {
- 			label.setLayoutData(gridData);
- 
- 			final IntParameter udp_listen = new IntParameter(cMiniArea,
--					"UDP.Listen.Port", 1, 65535);
-+					"UDP.Listen.Port", 1, 49151);
- 			gridData = new GridData();
- 			udp_listen.setLayoutData(gridData);
- 
-@@ -137,8 +137,8 @@ public class ConfigSectionConnection implements UISWTConfigSection {
- 			
- 			udp_listen.addChangeListener(new ParameterChangeAdapter() {
- 				public void intParameterChanging(Parameter p, int toValue) {
--					if (toValue == 6880) {
--						toValue = 6881;
-+					if (toValue > 49151) {
-+						toValue = 49151;
- 						udp_listen.setValue(toValue);
- 					}
- 
-@@ -173,8 +173,8 @@ public class ConfigSectionConnection implements UISWTConfigSection {
- 					new ParameterChangeAdapter() 
- 					{
- 						public void intParameterChanging(Parameter p, int toValue) {
--							if (toValue == 6880) {
--								toValue = 6881;
-+							if (toValue > 49151) {
-+								toValue = 49151;
- 								non_data_udp_listen.setValue(toValue);
- 							}
- 						}
-@@ -189,7 +189,7 @@ public class ConfigSectionConnection implements UISWTConfigSection {
- 									
- 									int udp_listen_port = udp_listen.getValue();
- 			
--									if ( udp_listen_port != 6880 ){
-+									if ( udp_listen_port < 49152 ){
- 										
- 										COConfigurationManager.setParameter( "UDP.NonData.Listen.Port", udp_listen_port );
- 										
-diff --git a/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionConnectionAdvanced.java b/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionConnectionAdvanced.java
-index 0b1ad25..bb5ce14 100644
---- a/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionConnectionAdvanced.java
-+++ b/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionConnectionAdvanced.java
-@@ -168,7 +168,7 @@ public class ConfigSectionConnectionAdvanced implements UISWTConfigSection {
- 		Label lpbind = new Label(gSocket, SWT.NULL);
- 		Messages.setLanguageText(lpbind, CFG_PREFIX + "bind_port");
- 		final IntParameter port_bind = new IntParameter(gSocket,
--				"network.bind.local.port", 0, 65535);
-+				"network.bind.local.port", 0, 49151);
- 		gridData = new GridData();
- 		port_bind.setLayoutData(gridData);
- 		
-diff --git a/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionTrackerClient.java b/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionTrackerClient.java
-index fce3910..fabed84 100644
---- a/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionTrackerClient.java
-+++ b/org/gudy/azureus2/ui/swt/views/configsections/ConfigSectionTrackerClient.java
-@@ -176,7 +176,7 @@ ConfigSectionTrackerClient
-     		try
- 			{
-     			int portVal = Integer.parseInt(toValue);
--				if(portVal >= 0 && portVal <= 65535)
-+				if(portVal >= 0 && portVal <= 49151)
- 					return;
- 			} catch (NumberFormatException e) {}
- 			p.setValue("");
--- 
-tg: (49ad0c1..) fixes/multiuser (depends on: fixes/sunsecurity)
diff --git a/debian/patches/fixes/platform.diff b/debian/patches/fixes/platform.diff
deleted file mode 100644
index 32fafbd..0000000
--- a/debian/patches/fixes/platform.diff
+++ /dev/null
@@ -1,142 +0,0 @@
-From: Adrian Perez <adrianperez.deb at gmail.com>
-Subject: [PATCH] fixes/platform
-
-Fixes the FTBFS caused by the use of Win32 and MacOS-X 
-platforms imports and logic.
-
-Signed-off-by: Adrian Perez <adrianperez.deb at gmail.com>
-
----
- .../core/update/impl/AzureusRestarterImpl.java     |    6 +++++-
- .../ui/swt/views/skin/TorrentListViewsUtils.java   |    8 +++++++-
- .../azureus2/platform/PlatformManagerFactory.java  |    4 ++--
- .../platform/PlatformManagerPluginDelegate.java    |   15 ++++++++++++---
- 4 files changed, 26 insertions(+), 7 deletions(-)
-
-diff --git a/com/aelitis/azureus/core/update/impl/AzureusRestarterImpl.java b/com/aelitis/azureus/core/update/impl/AzureusRestarterImpl.java
-index b4438fb..d238dc6 100644
---- a/com/aelitis/azureus/core/update/impl/AzureusRestarterImpl.java
-+++ b/com/aelitis/azureus/core/update/impl/AzureusRestarterImpl.java
-@@ -30,8 +30,10 @@ import org.gudy.azureus2.core3.util.*;
- import org.gudy.azureus2.platform.PlatformManager;
- import org.gudy.azureus2.platform.PlatformManagerFactory;
- import org.gudy.azureus2.platform.unix.ScriptAfterShutdown;
-+/*  --- Adrian Perez: Don't import this when building for Linux.
- import org.gudy.azureus2.platform.win32.access.AEWin32Access;
- import org.gudy.azureus2.platform.win32.access.AEWin32Manager;
-+*/
- import org.gudy.azureus2.plugins.PluginInterface;
- import org.gudy.azureus2.plugins.platform.PlatformManagerException;
- import org.gudy.azureus2.pluginsimpl.local.PluginInitializer;
-@@ -306,7 +308,8 @@ AzureusRestarterImpl
- 		}
- 
- 		try {
--			int result;
-+			int result = -123; // Adrian Perez: Evade Win32 logic, key: "nowin32"
-+/*
- 			AEWin32Access accessor = AEWin32Manager.getAccessor(true);
- 			if (accessor == null) {
- 				result = -123;
-@@ -345,6 +348,7 @@ AzureusRestarterImpl
- 							SystemProperties.getApplicationPath(), AEWin32Access.SW_NORMAL);
- 				}
- 			}
-+*/
- 
- 			/*
- 			 * Some results:
-diff --git a/com/aelitis/azureus/ui/swt/views/skin/TorrentListViewsUtils.java b/com/aelitis/azureus/ui/swt/views/skin/TorrentListViewsUtils.java
-index 190af45..cb104fe 100644
---- a/com/aelitis/azureus/ui/swt/views/skin/TorrentListViewsUtils.java
-+++ b/com/aelitis/azureus/ui/swt/views/skin/TorrentListViewsUtils.java
-@@ -76,8 +76,10 @@ import com.aelitis.azureus.util.ContentNetworkUtils;
- import com.aelitis.azureus.util.DLReferals;
- import com.aelitis.azureus.util.DataSourceUtils;
- import com.aelitis.azureus.util.PlayUtils;
--import com.aelitis.azureus.util.win32.Win32Utils;
- 
-+/* --- Adrian Perez: Don't import this when building for Linux.
-+import com.aelitis.azureus.util.win32.Win32Utils;
-+*/
- /**
-  * @author TuxPaper
-  * @created Oct 12, 2006
-@@ -615,6 +617,9 @@ public class TorrentListViewsUtils
- 	 */
- 	private static boolean runInMediaPlayer(String mediaFile) {
- 
-+	// debugDCAD("enter - runInMediaPlayer");
-+
-+/* --- Adrian Perez: Don't use Win32 media player. Always return false.
- 		if (Constants.isWindows) {
- 			String wmpEXE = Win32Utils.getWMP();
- 			if (new File(wmpEXE).exists()) {
-@@ -626,6 +631,7 @@ public class TorrentListViewsUtils
- 				}
- 			}
- 		}
-+*/
- 		return false;
- 	}
- 
-diff --git a/org/gudy/azureus2/platform/PlatformManagerFactory.java b/org/gudy/azureus2/platform/PlatformManagerFactory.java
-index 82fcb69..6eec2eb 100644
---- a/org/gudy/azureus2/platform/PlatformManagerFactory.java
-+++ b/org/gudy/azureus2/platform/PlatformManagerFactory.java
-@@ -51,11 +51,11 @@ PlatformManagerFactory
- 					if ( getPlatformType() == PlatformManager.PT_WINDOWS ){
- 						
- 						platform_manager = org.gudy.azureus2.platform.win32.PlatformManagerImpl.getSingleton();
--						
-+/* --- Adrian Perez: Don't use MacOS-X's PlatformManagerImpl
- 					}else if( getPlatformType() == PlatformManager.PT_MACOSX ){
- 						
- 	                    platform_manager = org.gudy.azureus2.platform.macosx.PlatformManagerImpl.getSingleton();
--	                    
-+*/
- 					}else if( getPlatformType() == PlatformManager.PT_UNIX ){
- 						
- 						platform_manager = org.gudy.azureus2.platform.unix.PlatformManagerImpl.getSingleton();
-diff --git a/org/gudy/azureus2/platform/PlatformManagerPluginDelegate.java b/org/gudy/azureus2/platform/PlatformManagerPluginDelegate.java
-index 3beeb39..b98a0bf 100644
---- a/org/gudy/azureus2/platform/PlatformManagerPluginDelegate.java
-+++ b/org/gudy/azureus2/platform/PlatformManagerPluginDelegate.java
-@@ -24,6 +24,10 @@ import java.util.Properties;
- 
- import org.gudy.azureus2.platform.unix.PlatformManagerUnixPlugin;
- 
-+/* --- Adrian Perez: Don't use Win32 UpdateChecker in Linux.
-+import org.gudy.azureus2.platform.win32.PlatformManagerUpdateChecker;
-+*/
-+
- import org.gudy.azureus2.plugins.Plugin;
- import org.gudy.azureus2.plugins.PluginException;
- import org.gudy.azureus2.plugins.PluginInterface;
-@@ -44,16 +48,21 @@ public class PlatformManagerPluginDelegate
- 		PlatformManager platform = PlatformManagerFactory.getPlatformManager();
- 
- 		int platformType = platform.getPlatformType();
--		if ( platformType == PlatformManager.PT_WINDOWS ){
-+
-+                  /* Adrian Perez: 
-+                   * We're not in Windows or MacOS
-+                   *
-+                if ( platformType == PlatformManager.PT_WINDOWS ){
- 			org.gudy.azureus2.platform.win32.PlatformManagerUpdateChecker plugin = new org.gudy.azureus2.platform.win32.PlatformManagerUpdateChecker();
- 			plugin.initialize(pluginInterface);
- 		}else if ( platformType == PlatformManager.PT_MACOSX ){
- 			org.gudy.azureus2.platform.macosx.PlatformManagerUpdateChecker plugin = new org.gudy.azureus2.platform.macosx.PlatformManagerUpdateChecker();
- 			plugin.initialize(pluginInterface);
--		}else if ( platformType == PlatformManager.PT_UNIX ){
-+                  */
-+		if ( platformType == PlatformManager.PT_UNIX ){
- 			PlatformManagerUnixPlugin plugin = new PlatformManagerUnixPlugin();
- 			plugin.initialize(pluginInterface);
--		}else{
-+		} else {
- 			Properties pluginProperties = pluginInterface.getPluginProperties();
- 			pluginProperties.setProperty("plugin.name", "Platform-Specific Support");
- 			pluginProperties.setProperty("plugin.version", "1.0");
--- 
-tg: (7f589b9..) fixes/platform (depends on: upstream)
diff --git a/debian/patches/series b/debian/patches/series
index e187fa2..8b6fd96 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,5 +1,9 @@
-debian/speedtest.diff -p1
-debian/update-disable.diff -p1
-fixes/multiuser.diff -p1
-fixes/platform.diff -p1
-debian/no-auto-update.patch
+01_amend_build_classpath.patch
+02_speedtest.patch -p1
+03_update_disable.patch -p1
+04_unbundle_json.patch
+05_unbundle_commons_lang.patch
+06_unbundle_bouncy_castle.patch
+07_platform.patch
+08_multi_user.patch
+09_no_auto_update.patch 
diff --git a/debian/rules b/debian/rules
index b62b755..e27f106 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,23 +1,19 @@
 #!/usr/bin/make -f
-# -*- makefile -*-
+#export DH_VERBOSE=1
+export JAVA_HOME=/usr/lib/jvm/default-java
+export ANT_OPTS=-Xmx512m
 
-include /usr/share/cdbs/1/rules/debhelper.mk
-include /usr/share/cdbs/1/class/ant.mk
--include /usr/share/topgit/tg2quilt.mk
+%:
+	dh $@ --with javahelper
 
-JAVA_HOME 		:= /usr/lib/jvm/default-java
-DEB_ANT_BUILDFILE 	:= debian/build.xml
-DEB_ANT_BUILD_TARGET 	:= package
-DEB_JARS 		:= log4j commons-cli swt junit
-ANT_OPTS		:= -Xmx512m
-QUILT_PATCH_DIR		:= debian/patches/
-
-build/azureus::
+override_dh_auto_build:
+	dh_auto_build
 	perl -ne 'print(unpack "u", $$_)' debian/Azureus.png.uu > \
 		debian/Azureus.png
 	perl -ne 'print(unpack "u", $$_)' debian/Azureus.torrent.png.uu > \
 		debian/Azureus.torrent.png
 
-clean::
-	-rm -f debian/Azureus.png
-	-rm -f debian/Azureus.torrent.png
+override_dh_clean:
+	dh_clean
+	rm -f debian/Azureus.png
+	rm -f debian/Azureus.torrent.png
diff --git a/debian/vuze.desktop b/debian/vuze.desktop
index c13ba14..1765ba7 100644
--- a/debian/vuze.desktop
+++ b/debian/vuze.desktop
@@ -1,4 +1,6 @@
 [Desktop Entry]
+Version=1.0
+Name=Vuze
 Encoding=UTF-8
 Categories=Java;Network;FileTransfer;P2P
 Comment=Powerful BitTorrent client and open content platform
@@ -6,5 +8,5 @@ Exec=vuze %f
 GenericName=Multimedia BitTorrent client
 Icon=/usr/share/pixmaps/Azureus.png
 MimeType=application/x-bittorrent
-Name=Vuze
+Terminal=false
 Type=Application
diff --git a/debian/install b/debian/vuze.install
similarity index 59%
rename from debian/install
rename to debian/vuze.install
index a4c93d7..1785355 100644
--- a/debian/install
+++ b/debian/vuze.install
@@ -1,7 +1,6 @@
+debian/bin/azureus usr/bin
 debian/Azureus.png usr/share/pixmaps
 debian/Azureus.torrent.png usr/share/pixmaps
-dist/Azureus2.jar usr/share/java
-debian/wrappers/azureus usr/bin
-debian/azureus.desktop usr/share/applications
+debian/vuze.desktop usr/share/applications
 debian/azureus.xpm usr/share/pixmaps
 debian/azureus.schemas usr/share/gconf/schemas
diff --git a/debian/vuze.manpages b/debian/vuze.manpages
new file mode 100644
index 0000000..727919f
--- /dev/null
+++ b/debian/vuze.manpages
@@ -0,0 +1 @@
+debian/man/azureus.1
diff --git a/debian/vuze.menu b/debian/vuze.menu
new file mode 100644
index 0000000..d943a81
--- /dev/null
+++ b/debian/vuze.menu
@@ -0,0 +1,6 @@
+?package(vuze):needs="X11" \
+section="Applications/Network/File Transfer" \
+icon="/usr/share/pixmaps/azureus.xpm" \
+title="Azureus" \
+command="/usr/bin/azureus" \
+hints="Internet"
diff --git a/debian/watch b/debian/watch
index fcc779c..75f680b 100644
--- a/debian/watch
+++ b/debian/watch
@@ -1,2 +1,3 @@
 version=3
-http://sf.net/azureus/Vuze_(.+)_source\.zip
+opts="uversionmangle=s/(\d)(?=\d)/$1\./g" \
+ http://sf.net/azureus/Vuze_(.+)_source\.zip debian debian/orig-tar.sh 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/azureus.git



More information about the pkg-java-commits mailing list