1 Bouncy Castle on the Android platform. 2 --- 3 4 The code in this directory is based on $BOUNCYCASTLE_VERSION in the 5 file bouncycastle.version. See patches/README for more information on 6 how the code differs from $BOUNCYCASTLE_VERSION. 7 8 Porting New Versions of Bouncy Castle. 9 -- 10 11 The following steps are recommended for porting new Bouncy Castle versions. 12 13 1) 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 24 2) 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 27 3) 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 33 4) 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 40 5) Cleanup before building with: 41 42 m -j16 clean-bouncycastle 43 44 6) 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 51 7) 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.Certificate 80 libcore/luni/src/test/java/libcore/java/security/cert/X509CertificateTest.java 81 libcore/luni/src/test/java/tests/api/javax/security/cert/X509CertificateTest.java 82 libcore/luni/src/test/java/tests/security/cert/CertificateCertificateRepTest.java 83 libcore/luni/src/test/java/tests/security/cert/CertificateTest.java 84 libcore/luni/src/test/java/tests/security/cert/X509Certificate2Test.java 85 libcore/luni/src/test/java/tests/targets/security/cert/CertificateTest.java 86 - java.security.cert.CertificateFactory 87 libcore/luni/src/test/java/libcore/java/security/cert/CertificateFactoryTest.java 88 libcore/luni/src/test/java/tests/security/cert/CertificateFactory1Test.java 89 libcore/luni/src/test/java/tests/security/cert/CertificateFactory2Test.java 90 libcore/luni/src/test/java/tests/security/cert/CertificateFactory3Test.java 91 libcore/luni/src/test/java/tests/security/cert/CertificateFactory4Test.java 92 libcore/luni/src/test/java/tests/targets/security/cert/CertificateFactoryTestX509.java 93 - java.security.cert.CertificateFactorySpi 94 libcore/luni/src/test/java/tests/security/cert/CertificateFactorySpiTest.java 95 - java.security.cert.CRL 96 libcore/luni/src/test/java/libcore/java/security/cert/X509CRLSelectorTest.java 97 libcore/luni/src/test/java/libcore/java/security/cert/X509CRLTest.java 98 libcore/luni/src/test/java/tests/security/cert/CRLTest.java 99 libcore/luni/src/test/java/tests/security/cert/X509CRL2Test.java 100 libcore/luni/src/test/java/tests/security/cert/X509CRLEntryTest.java 101 libcore/luni/src/test/java/tests/security/cert/X509CRLSelector2Test.java 102 libcore/luni/src/test/java/tests/security/cert/X509CRLSelectorTest.java 103 libcore/luni/src/test/java/tests/security/cert/X509CRLTest.java 104 - javax.security.cert.Certificate 105 libcore/luni/src/test/java/tests/api/javax/security/cert/CertificateTest.java 106 - java.security.CodeSigner 107 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/CodeSignerTest.java 108 - javax.crypto.Cipher 109 libcore/luni/src/test/java/libcore/javax/crypto/CipherTest.java 110 libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/CipherTest.java 111 libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/NullCipherTest.java 112 - java.security.DigestInputStream 113 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/DigestInputStream2Test.java 114 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/DigestInputStreamTest.java 115 - java.security.DigestOutputStream 116 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/DigestOutputStreamTest.java 117 - javax.crypto.spec.GCMParameterSpec 118 libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/spec/GCMParameterSpecTest.java 119 - java.security.GuardedObject 120 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/GuardedObjectTest.java 121 - java.security.Identity 122 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/Identity2Test.java 123 - java.security.IdentityScope 124 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/IdentityScope2Test.java 125 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/IdentityScopeTest.java 126 - javax.crypto.Key 127 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyTest.java 128 - javax.crypto.KeyAgreement 129 libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/KeyAgreementTest.java 130 - java.security.KeyFactory 131 libcore/luni/src/test/java/libcore/javax/crypto/spec/KeyFactoryTestDH.java 132 libcore/luni/src/test/java/libcore/javax/crypto/spec/KeyFactoryTestDSA.java 133 libcore/luni/src/test/java/libcore/javax/crypto/spec/KeyFactoryTestRSA.java 134 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyFactory2Test.java 135 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyFactoryTest.java 136 - java.security.KeyFactorySpi 137 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyFactorySpiTest.java 138 - javax.crypto.KeyGenerator 139 libcore/luni/src/test/java/libcore/javax/crypto/KeyGeneratorTest.java 140 libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/KeyGeneratorTest.java 141 - javax.net.ssl.KeyManagerFactory 142 libcore/luni/src/test/java/libcore/javax/net/ssl/KeyManagerFactoryTest.java 143 - java.security.KeyPair 144 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyPairTest.java 145 - java.security.KeyPairGenerator 146 libcore/luni/src/test/java/libcore/java/security/KeyPairGeneratorTest.java 147 libcore/luni/src/test/java/libcore/java/security/OldKeyPairGeneratorTestDH.java 148 libcore/luni/src/test/java/libcore/javax/crypto/spec/KeyPairGeneratorTestDH.java 149 libcore/luni/src/test/java/libcore/javax/crypto/spec/KeyPairGeneratorTestDSA.java 150 libcore/luni/src/test/java/libcore/javax/crypto/spec/KeyPairGeneratorTestRSA.java 151 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator1Test.java 152 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator2Test.java 153 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator3Test.java 154 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator4Test.java 155 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyPairGeneratorSpiTest.java 156 libcore/luni/src/test/java/tests/security/interfaces/DSAKeyPairGeneratorTest.java 157 - java.security.KeyRep 158 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyRepTest.java 159 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyRepTypeTest.java 160 - java.security.KeyStore 161 libcore/luni/src/test/java/libcore/java/security/KeyStoreTest.java 162 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KSCallbackHandlerProtectionTest.java 163 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KSPasswordProtectionTest.java 164 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KSPrivateKeyEntryTest.java 165 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KSSecretKeyEntryTest.java 166 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KSTrustedCertificateEntryTest.java 167 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStore2Test.java 168 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java 169 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStore4Test.java 170 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStoreBuilderTest.java 171 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStorePrivateKeyEntryTest.java 172 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStoreTest.java 173 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStoreTest.java 174 - java.security.KeyStoreSpi 175 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStoreSpiTest.java 176 - javax.crypto.Mac 177 libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/MacTest.java 178 - java.security.MessageDigest 179 libcore/luni/src/test/java/libcore/java/security/MessageDigestTest.java 180 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/MessageDigest1Test.java 181 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/MessageDigest2Test.java 182 libcore/luni/src/test/java/tests/targets/security/MessageDigestTestMD2.java 183 libcore/luni/src/test/java/tests/targets/security/MessageDigestTestMD5.java 184 libcore/luni/src/test/java/tests/targets/security/MessageDigestTestSHA1.java 185 libcore/luni/src/test/java/tests/targets/security/MessageDigestTestSHA256.java 186 libcore/luni/src/test/java/tests/targets/security/MessageDigestTestSHA384.java 187 libcore/luni/src/test/java/tests/targets/security/MessageDigestTestSHA512.java 188 - java.security.MessageDigestSpi 189 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/MessageDigestSpiTest.java 190 - java.security.PrivateKey 191 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/PrivateKeyTest.java 192 - java.security.PrivilegedAction 193 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/PrivilegedActionTest.java 194 - java.security.Provider 195 libcore/luni/src/test/java/libcore/java/security/ProviderTest.java 196 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/Provider2Test.java 197 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/ProviderServiceTest.java 198 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/ProviderTest.java 199 - java.security.PublicKey 200 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/PublicKeyTest.java 201 - java.security.Security 202 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/Security2Test.java 203 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/SecurityTest.java 204 - javax.net.ssl.SSLContext 205 libcore/luni/src/test/java/libcore/javax/net/ssl/SSLContextTest.java 206 - javax.crypto.SecretKeyFactory 207 libcore/luni/src/test/java/libcore/javax/crypto/SecretKeyFactoryTest.java 208 libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/SecretKeyFactoryTest.java 209 - java.security.SecureRandom 210 libcore/luni/src/test/java/libcore/java/security/SecureRandomTest.java 211 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/SecureRandom2Test.java 212 libcore/luni/src/test/java/tests/java/security/SecureRandomTest.java 213 libcore/luni/src/test/java/tests/targets/security/SecureRandomTestSHA1PRNG.java 214 - java.security.SecureRandomSpi 215 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/SecureRandomSpiTest.java 216 - java.security.Signature 217 libcore/crypto/src/test/java/org/conscrypt/OpenSSLSignatureTest.java 218 libcore/luni/src/test/java/libcore/java/security/SignatureTest.java 219 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/Signature2Test.java 220 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/SignatureTest.java 221 libcore/luni/src/test/java/tests/targets/security/SignatureTestMD2withRSA.java 222 - java.security.SignatureSpi 223 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/SignatureSpiTest.java 224 - java.security.SignedObject 225 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/SignedObjectTest.java 226 - java.security.Signer 227 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/SignerTest.java 228 - java.security.Timestamp 229 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/TimestampTest.java 230 - java.security.cert.TrustAnchor 231 libcore/luni/src/test/java/tests/security/cert/TrustAnchorTest.java 232 - javax.net.ssl.TrustManagerFactory 233 libcore/luni/src/test/java/libcore/javax/net/ssl/TrustManagerFactoryTest.java 234 - java.net.URLConnection 235 libcore/luni/src/test/java/libcore/java/net/URLConnectionTest.java 236 libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/net/URLConnectionTest.java 237 - javax.security.auth.x500.X500Principal 238 libcore/luni/src/test/java/libcore/javax/net/ssl/DistinguishedNameParserTest.java 239 libcore/luni/src/test/java/libcore/javax/security/auth/x500/X500PrincipalTest.java 240 libcore/luni/src/test/java/tests/api/javax/security/auth/X500PrincipalTest.java 241 - javax.net.ssl.SSLSocket and javax.net.ssl.SSLEngine (which touch on Cipher, MessageDigest, Signature) 242 libcore/luni/src/test/java/libcore/javax/net/ssl/ 243 - Test Android additions to bouncycastle such as org.bouncycastle.crypto.digests.OpenSSLDigest and org.bouncycastle.jce.provider.CertBlacklist 244 libcore/luni/src/test/java/com/android/org/bouncycastle/ 245 - Exception "tests" 246 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/DigestExceptionTest.java 247 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/GeneralSecurityExceptionTest.java 248 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/InvalidAlgorithmParameterExceptionTest.java 249 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/InvalidKeyExceptionTest.java 250 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/InvalidParameterExceptionTest.java 251 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyExceptionTest.java 252 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyManagementExceptionTest.java 253 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/KeyStoreExceptionTest.java 254 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/NoSuchAlgorithmExceptionTest.java 255 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/NoSuchProviderExceptionTest.java 256 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/ProviderExceptionTest.java 257 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/SignatureExceptionTest.java 258 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/UnrecoverableEntryExceptionTest.java 259 libcore/luni/src/test/java/org/apache/harmony/security/tests/java/security/UnrecoverableKeyExceptionTest.java 260 libcore/luni/src/test/java/tests/api/javax/security/cert/CertificateEncodingExceptionTest.java 261 libcore/luni/src/test/java/tests/api/javax/security/cert/CertificateExceptionTest.java 262 libcore/luni/src/test/java/tests/api/javax/security/cert/CertificateExpiredExceptionTest.java 263 libcore/luni/src/test/java/tests/api/javax/security/cert/CertificateNotYetValidExceptionTest.java 264 libcore/luni/src/test/java/tests/api/javax/security/cert/CertificateParsingExceptionTest.java 265 libcore/luni/src/test/java/tests/security/cert/CRLExceptionTest.java 266 libcore/luni/src/test/java/tests/security/cert/CertificateEncodingException2Test.java 267 libcore/luni/src/test/java/tests/security/cert/CertificateEncodingExceptionTest.java 268 libcore/luni/src/test/java/tests/security/cert/CertificateException2Test.java 269 libcore/luni/src/test/java/tests/security/cert/CertificateExceptionTest.java 270 libcore/luni/src/test/java/tests/security/cert/CertificateExpiredExceptionTest.java 271 libcore/luni/src/test/java/tests/security/cert/CertificateNotYetValidExceptionTest.java 272 libcore/luni/src/test/java/tests/security/cert/CertificateParsingExceptionTest.java 273 274 275 8) Do a full build before checking in: 276 277 m -j16 278