1Bouncy Castle on the Android platform. 2--- 3 4The code in this directory is based on $BOUNCYCASTLE_VERSION in the 5file bouncycastle.version. See patches/README for more information on 6how the code differs from $BOUNCYCASTLE_VERSION. 7 8Porting New Versions of Bouncy Castle. 9-- 10 11The following steps are recommended for porting new Bouncy Castle versions. 12 131) Retrieve the appropriate version of the Bouncy Castle source from 14 www.bouncycastle.org/latest_releases.html (both bcprov-jdk*-*.tar.gz 15 and bcpkix-jdk*-*.tar.gz files). 16 17 Check the checksum (found at http://bouncycastle.org/checksums.html) with: 18 19 md5sum bcprov-jdk*-*.tar.gz 20 sha1sum bcprov-jdk*-*.tar.gz 21 md5sum bcpkix-jdk*-*.tar.gz 22 sha1sum bcpkix-jdk*-*.tar.gz 23 242) Update the variables in bouncycastle.config and bouncycastle.version as appropriate. 25 At the very least you will need to update the bouncycastle.version. 26 273) Run: 28 29 ./import_bouncycastle.sh import bcprov-jdk*-*.tar.gz 30 31 Note the script expects to find the bcpkix-jdk*-*.tar.gz alongside the bcprov file. 32 334) If there are any errors, then modify bouncycastle.config, bouncycastle.version 34 and patches in patches/ as appropriate. You might want to use: 35 36 ./import_bouncycastle.sh regenerate patches/*.patch 37 38 Repeat step 3. 39 405) Cleanup before building with: 41 42 m -j16 clean-bouncycastle 43 446) Build the bouncycastle target from the external/bouncycastle directory with: 45 46 mm -j16 snod && adb sync system 47 48 If there are build errors, then patches/*.mk or bouncycastle.config 49 may need updating. 50 517) Run tests to make sure things are working: 52 53 Some suggested tests by area: 54 - java.security.AlgorithmParameterGenerator 55 libcore/luni/src/test/java/libcore/java/security/OldAlgorithmParameterGeneratorTest.java 56 libcore/luni/src/test/java/libcore/javax/crypto/spec/AlgorithmParameterGeneratorTestDH.java 57 libcore/luni/src/test/java/libcore/javax/crypto/spec/AlgorithmParameterGeneratorTestDSA.java 58 - java.security.AlgorithmParameters 59 libcore/luni/src/test/java/libcore/javax/crypto/spec/AlgorithmParametersTestDSA.java 60 libcore/luni/src/test/java/libcore/javax/crypto/spec/AlgorithmParametersTestAES.java 61 libcore/luni/src/test/java/libcore/javax/crypto/spec/AlgorithmParametersTestDH.java 62 libcore/luni/src/test/java/libcore/javax/crypto/spec/AlgorithmParametersTestDESede.java 63 libcore/luni/src/test/java/libcore/javax/crypto/spec/AlgorithmParametersTestDES.java 64 libcore/luni/src/test/java/libcore/javax/crypto/spec/AlgorithmParametersTestOAEP.java 65 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/AlgorithmParameterGenerator1Test.java 66 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/AlgorithmParameterGenerator2Test.java 67 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/AlgorithmParametersSpiTest.java 68 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/AlgorithmParametersTest.java 69 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/AlgorithmParametersTest.java 70 - java.security.cert.CertPathBuilder 71 libcore/luni/src/test/java/tests/targets/security/cert/CertPathBuilderTestPKIX.java 72 - java.security.cert.CertPathValidator 73 libcore/luni/src/test/java/tests/targets/security/cert/CertPathValidatorTestPKIX.java 74 - java.security.cert.CertStore 75 libcore/luni/src/test/java/tests/security/cert/CertStoreSpiTest.java 76 libcore/luni/src/test/java/tests/security/cert/CertStore2Test.java 77 libcore/luni/src/test/java/tests/security/cert/CertStore1Test.java 78 libcore/luni/src/test/java/tests/security/cert/CertStoreExceptionTest.java 79 - java.security.cert.CertificateFactory 80 libcore/luni/src/test/java/libcore/java/security/cert/CertificateFactoryTest.java 81 libcore/luni/src/test/java/tests/targets/security/cert/CertificateFactoryTestX509.java 82 - java.security.CodeSigner 83 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/CodeSignerTest.java 84 - javax.crypto.Cipher 85 libcore/luni/src/test/java/libcore/javax/crypto/CipherTest.java 86 libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/CipherTest.java 87 libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/NullCipherTest.java 88 - java.security.DigestInputStream 89 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/DigestInputStream2Test.java 90 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/DigestInputStreamTest.java 91 - java.security.DigestOutputStream 92 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/DigestOutputStreamTest.java 93 - java.security.GuardedObject 94 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/GuardedObjectTest.java 95 - java.security.Identity 96 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/Identity2Test.java 97 - java.security.IdentityScope 98 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/IdentityScope2Test.java 99 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/IdentityScopeTest.java 100 - javax.crypto.Key 101 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyTest.java 102 - javax.crypto.KeyAgreement 103 libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/KeyAgreementTest.java 104 - java.security.KeyFactory 105 libcore/luni/src/test/java/libcore/javax/crypto/spec/KeyFactoryTestDH.java 106 libcore/luni/src/test/java/libcore/javax/crypto/spec/KeyFactoryTestDSA.java 107 libcore/luni/src/test/java/libcore/javax/crypto/spec/KeyFactoryTestRSA.java 108 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyFactory2Test.java 109 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyFactoryTest.java 110 - java.security.KeyFactorySpi 111 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyFactorySpiTest.java 112 - javax.crypto.KeyGenerator 113 libcore/luni/src/test/java/libcore/javax/crypto/KeyGeneratorTest.java 114 libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/KeyGeneratorTest.java 115 - javax.net.ssl.KeyManagerFactory 116 libcore/luni/src/test/java/libcore/javax/net/ssl/KeyManagerFactoryTest.java 117 - java.security.KeyPair 118 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyPairTest.java 119 - java.security.KeyPairGenerator 120 libcore/luni/src/test/java/libcore/java/security/KeyPairGeneratorTest.java 121 libcore/luni/src/test/java/libcore/java/security/OldKeyPairGeneratorTestDH.java 122 libcore/luni/src/test/java/libcore/javax/crypto/spec/KeyPairGeneratorTestDH.java 123 libcore/luni/src/test/java/libcore/javax/crypto/spec/KeyPairGeneratorTestDSA.java 124 libcore/luni/src/test/java/libcore/javax/crypto/spec/KeyPairGeneratorTestRSA.java 125 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator1Test.java 126 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator2Test.java 127 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator3Test.java 128 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator4Test.java 129 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyPairGeneratorSpiTest.java 130 libcore/luni/src/test/java/tests/security/interfaces/DSAKeyPairGeneratorTest.java 131 - java.security.KeyRep 132 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyRepTest.java 133 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyRepTypeTest.java 134 - java.security.KeyStore 135 libcore/luni/src/test/java/libcore/java/security/KeyStoreTest.java 136 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KSCallbackHandlerProtectionTest.java 137 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KSPasswordProtectionTest.java 138 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KSPrivateKeyEntryTest.java 139 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KSSecretKeyEntryTest.java 140 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KSTrustedCertificateEntryTest.java 141 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStore2Test.java 142 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java 143 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStore4Test.java 144 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStoreBuilderTest.java 145 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStorePrivateKeyEntryTest.java 146 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStoreTest.java 147 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStoreTest.java 148 - java.security.KeyStoreSpi 149 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStoreSpiTest.java 150 - javax.crypto.Mac 151 libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/MacTest.java 152 - java.security.MessageDigest 153 libcore/luni/src/test/java/libcore/java/security/MessageDigestTest.java 154 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/MessageDigest1Test.java 155 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/MessageDigest2Test.java 156 libcore/luni/src/test/java/tests/targets/security/MessageDigestTestMD2.java 157 libcore/luni/src/test/java/tests/targets/security/MessageDigestTestMD5.java 158 libcore/luni/src/test/java/tests/targets/security/MessageDigestTestSHA1.java 159 libcore/luni/src/test/java/tests/targets/security/MessageDigestTestSHA256.java 160 libcore/luni/src/test/java/tests/targets/security/MessageDigestTestSHA384.java 161 libcore/luni/src/test/java/tests/targets/security/MessageDigestTestSHA512.java 162 - java.security.MessageDigestSpi 163 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/MessageDigestSpiTest.java 164 - java.security.PrivateKey 165 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/PrivateKeyTest.java 166 - java.security.PrivilegedAction 167 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/PrivilegedActionTest.java 168 - java.security.Provider 169 libcore/luni/src/test/java/libcore/java/security/ProviderTest.java 170 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/Provider2Test.java 171 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/ProviderServiceTest.java 172 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/ProviderTest.java 173 - java.security.PublicKey 174 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/PublicKeyTest.java 175 - java.security.Security 176 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/Security2Test.java 177 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/SecurityTest.java 178 - javax.net.ssl.SSLContext 179 libcore/luni/src/test/java/libcore/javax/net/ssl/SSLContextTest.java 180 - javax.crypto.SecretKeyFactory 181 libcore/luni/src/test/java/libcore/javax/crypto/SecretKeyFactoryTest.java 182 libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/SecretKeyFactoryTest.java 183 - java.security.SecureRandom 184 libcore/luni/src/test/java/libcore/java/security/SecureRandomTest.java 185 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/SecureRandom2Test.java 186 libcore/luni/src/test/java/tests/java/security/SecureRandomTest.java 187 libcore/luni/src/test/java/tests/targets/security/SecureRandomTestSHA1PRNG.java 188 - java.security.SecureRandomSpi 189 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/SecureRandomSpiTest.java 190 - java.security.Signature 191 libcore/luni/src/test/java/libcore/java/security/SignatureTest.java 192 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/Signature2Test.java 193 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/SignatureTest.java 194 libcore/luni/src/test/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSignatureTest.java 195 libcore/luni/src/test/java/tests/targets/security/SignatureTestMD2withRSA.java 196 - java.security.SignatureSpi 197 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/SignatureSpiTest.java 198 - java.security.SignedObject 199 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/SignedObjectTest.java 200 - java.security.Signer 201 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/SignerTest.java 202 - java.security.Timestamp 203 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/TimestampTest.java 204 - javax.net.ssl.TrustManagerFactory 205 libcore/luni/src/test/java/libcore/javax/net/ssl/TrustManagerFactoryTest.java 206 - javax.net.ssl.SSLSocket and javax.net.ssl.SSLEngine (which touch on Cipher, MessageDigest, Signature) 207 libcore/luni/src/test/java/libcore/javax/net/ssl/ 208 - Test Android additions to bouncycastle such as org.bouncycastle.crypto.digests.OpenSSLDigest and org.bouncycastle.jce.provider.CertBlacklist 209 libcore/luni/src/test/java/com/android/org/bouncycastle/ 210 - Exception "tests" 211 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/DigestExceptionTest.java 212 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/GeneralSecurityExceptionTest.java 213 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/InvalidAlgorithmParameterExceptionTest.java 214 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/InvalidKeyExceptionTest.java 215 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/InvalidParameterExceptionTest.java 216 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyExceptionTest.java 217 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyManagementExceptionTest.java 218 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStoreExceptionTest.java 219 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/NoSuchAlgorithmExceptionTest.java 220 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/NoSuchProviderExceptionTest.java 221 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/ProviderExceptionTest.java 222 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/SignatureExceptionTest.java 223 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/UnrecoverableEntryExceptionTest.java 224 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/UnrecoverableKeyExceptionTest.java 225 226 2278) Do a full build before checking in: 228 229 m -j16 230