Make KeyFactory.translateKey for OpenSSL keys a no-op.

There's no need for the OpenSSL-backed KeyFactory.translateKey to
create copies of Key instances which are already backed by OpenSSL.

Change-Id: I9411d774453251973703ba9de4fd413fac4b2183
Switch OpenSSLECDHKeyAgreement to KeyFactory.translateKey.

OpenSSL KeyFactory.translateKey encapsulates all the functionality
for translating arbitrary Key instances to OpenSSL-backed Key
instances. Thus, there's no need to replicate that functionality
elsewhere.

Change-Id: I4caa0021e51a83be6932617117275fd033b6d5f7
Disallow KeyFactory.translateKey between public and private

This fixes the bug where OpenSSL-backed KeyFactory instances (RSA,
DSA, EC) could translateKey from PrivateKey to PublicKey and vice
versa when presented with "opaque" keys whose translation is
performed via their primary encoded form.

Change-Id: Ia24a2591a06ac82c5225a3a9e3069af7a01a0c37
Merge "Disallow KeyFactory.translateKey between public and private"
Merge "Switch OpenSSLECDHKeyAgreement to KeyFactory.translateKey."
NativeCrypto: make generation bug compatible

generateCertPath, generateCertificates, and generateCRLs have slightly
different behavior on null input. Match the RI and (apparently) previous
BC behavior.

Bug: 8488314
Change-Id: I7a175815adb77b38783860806ddff93eaef521d2
Use long instead of int for address in DirectByteBuffer constructor

This allows the code to be used on 64-bit platforms.

Change-Id: I1c42d48696296f74135cd209b3042b8973779e40
Merge "Use long instead of int for address in DirectByteBuffer constructor"
Merge "NativeCrypto: make generation bug compatible"
NativeCrypto: adjust BasicConstraints check

OpenSSL checks KeyUsage for "Certificate Signing" when checking for a
CA, but Java just specifies that the getBasicConstraints call only looks
at the BasicConstraints itself.

Bug: 8488314
Change-Id: I072cd2e9f1a9295a717f7587817149200113c65f
Merge "NativeCrypto: adjust BasicConstraints check"
NativeCrypto: adjust thrown exceptions

Should be throwing CertificateException when InputStream is null.

Sometimes OpenSSL doesn't push an error onto the list when PEM encoding
fails. This can be seen with the call to PEM_read_bio_X509 with
hyts_badpem.cer  Throw a generic RuntimeException instead.

Bug: 8488314
Change-Id: Iee3b240e3def076f67e15980897be87ff3bf5e6c
NativeCrypto: add missing native function

This should be covered by NativeCryptoTest as well but there was a missing
native function that caused
tests.security.cert.CertificateCertificateRepTest#testReadResolve
to fail.

There was also a missing OpenSSL error catch that made the same test
fail.

Bug: 8488314
Change-Id: Ic8bca86ab221a478e303c8e94662f28d279c19b6
Merge "NativeCrypto: adjust thrown exceptions"
Merge "NativeCrypto: add missing native function"
Switch to OkHttp as URL's preferred HTTP implementation.

Change-Id: Id724b75dd78b68ed00f5db4989c4070896996ec0
Don't install APK files with unsupported General Purpose Bit Flag bits.

Bug: 8476102
Change-Id: I764c2aec944558129c8ac04ee0593fb3de82870e
Merge "Don't install APK files with unsupported General Purpose Bit Flag bits."
Merge "Switch to OkHttp as URL's preferred HTTP implementation."
Improve the Locale.getISO3Country/getISO3Language documentation and behavior.

Bug: 8541850
Change-Id: I8843aeee25eeefe0f6d5e16dd359ba78ef5a01cc