Merge "Canonicalize additional Android-changed comments."
diff --git a/luni/src/test/java/libcore/java/nio/channels/AsynchronousFileChannelTest.java b/luni/src/test/java/libcore/java/nio/channels/AsynchronousFileChannelTest.java
index 905f120..3b072f2 100644
--- a/luni/src/test/java/libcore/java/nio/channels/AsynchronousFileChannelTest.java
+++ b/luni/src/test/java/libcore/java/nio/channels/AsynchronousFileChannelTest.java
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousFileChannel;
+import java.nio.channels.ClosedChannelException;
import java.nio.channels.CompletionHandler;
import java.nio.channels.NonReadableChannelException;
import java.nio.channels.NonWritableChannelException;
@@ -680,4 +681,24 @@
assertSame(serviceThread.get(), observedThreads.take());
assertEquals(0, observedThreads.size());
}
+
+ @Test
+ public void testForce() throws Throwable {
+ Path tempDir = Files.createTempFile("ASFCTest_test_force", "");
+
+ AsynchronousFileChannel afc = AsynchronousFileChannel.open(tempDir,
+ StandardOpenOption.CREATE, StandardOpenOption.WRITE);
+ // Test that force can be called, not much else can be tested.
+ assertEquals(2, (int) afc.write(ByteBuffer.wrap(new byte[] { 'x', 'y'}), 0).get());
+ afc.force(false);
+ assertEquals(2, (int) afc.write(ByteBuffer.wrap(new byte[] { 'x', 'y'}), 0).get());
+ afc.force(true);
+ afc.close();
+
+ try {
+ afc.force(true);
+ fail();
+ } catch(ClosedChannelException expected) {}
+ }
+
}
diff --git a/luni/src/test/java/libcore/java/nio/channels/AsynchronousServerSocketChannelTest.java b/luni/src/test/java/libcore/java/nio/channels/AsynchronousServerSocketChannelTest.java
index 1638d9a..025abb6 100644
--- a/luni/src/test/java/libcore/java/nio/channels/AsynchronousServerSocketChannelTest.java
+++ b/luni/src/test/java/libcore/java/nio/channels/AsynchronousServerSocketChannelTest.java
@@ -236,6 +236,7 @@
assertNull(assc.getLocalAddress());
assc.bind(new InetSocketAddress(0));
assertNotNull(assc.getLocalAddress());
+ assertEquals(provider, assc.provider());
assc.close();
}
diff --git a/luni/src/test/java/libcore/java/nio/channels/spi/AsynchronousChannelProviderTest.java b/luni/src/test/java/libcore/java/nio/channels/spi/AsynchronousChannelProviderTest.java
index 4a8d35c..16d0881 100644
--- a/luni/src/test/java/libcore/java/nio/channels/spi/AsynchronousChannelProviderTest.java
+++ b/luni/src/test/java/libcore/java/nio/channels/spi/AsynchronousChannelProviderTest.java
@@ -39,6 +39,9 @@
assertNotNull(provider.openAsynchronousServerSocketChannel(
AsynchronousChannelGroup.withFixedThreadPool(1, new TestThreadFactory())));
+ assertNotNull(provider.openAsynchronousSocketChannel(
+ AsynchronousChannelGroup.withFixedThreadPool(1, new TestThreadFactory())));
+
assertNotNull(provider.openAsynchronousChannelGroup(1, new TestThreadFactory()));
}
diff --git a/luni/src/test/java/libcore/java/nio/file/attribute/AclEntryTest.java b/luni/src/test/java/libcore/java/nio/file/attribute/AclEntryTest.java
index 2f4b901..6e0ccd8 100644
--- a/luni/src/test/java/libcore/java/nio/file/attribute/AclEntryTest.java
+++ b/luni/src/test/java/libcore/java/nio/file/attribute/AclEntryTest.java
@@ -40,6 +40,7 @@
AclEntry aclEntry = AclEntry.newBuilder()
.setType(AclEntryType.ALLOW)
.setPrincipal(user)
+ .setFlags(AclEntryFlag.INHERIT_ONLY)
.setPermissions(AclEntryPermission.READ_DATA, AclEntryPermission.READ_ATTRIBUTES)
.build();
assertEquals(AclEntryType.ALLOW, aclEntry.type());
@@ -49,5 +50,9 @@
assertEquals(2, permissions.size());
assertTrue(permissions.contains(AclEntryPermission.READ_DATA));
assertTrue(permissions.contains(AclEntryPermission.READ_ATTRIBUTES));
+
+ Set<AclEntryFlag> flags = aclEntry.flags();
+ assertEquals(1, flags.size());
+ assertTrue(flags.contains(AclEntryFlag.INHERIT_ONLY));
}
}
diff --git a/ojluni/src/main/java/java/util/Properties.java b/ojluni/src/main/java/java/util/Properties.java
index fe61f98..3d6f1db 100644
--- a/ojluni/src/main/java/java/util/Properties.java
+++ b/ojluni/src/main/java/java/util/Properties.java
@@ -36,6 +36,7 @@
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
+// Android-changed: Removed dead native2ascii links
/**
* The {@code Properties} class represents a persistent set of
* properties. The {@code Properties} can be saved to a stream
@@ -107,9 +108,6 @@
* <p>This class is thread-safe: multiple threads can share a single
* <tt>Properties</tt> object without the need for external synchronization.
*
- * @see <a href="{@docRoot}openjdk-redirect.html?v=8&path=/technotes/tools/solaris/native2ascii.html">native2ascii tool for Solaris</a>
- * @see <a href="{@docRoot}openjdk-redirect.html?v=8&path=/technotes/tools/windows/native2ascii.html">native2ascii tool for Windows</a>
- *
* @author Arthur van Hoff
* @author Michael McCloskey
* @author Xueming Shen
diff --git a/tools/docs/crypto/README b/tools/docs/crypto/README
new file mode 100644
index 0000000..cc6b6eb
--- /dev/null
+++ b/tools/docs/crypto/README
@@ -0,0 +1,41 @@
+The tools in this directory are a scheme for autogenerating crypto doc support.
+
+The central file is data/crypto_support.json, which is a JSON file that contains
+the supported API levels for each crypto algorithm that has ever been supported
+by Android. The categories are identified as described in the JCA.
+
+Each algorithm has up to three properties:
+
+name - The name of the algorithm. These are currently normalized to
+all-uppercase versions, but this produces substandard results in some cases
+(eg, PBEWITHHMACSHA versus PBEWithHmacSHA), so it could be improved.
+
+supported_api_levels: The set of Android API levels that this algorithm was/is
+supported for. It should be a sequence of zero or more "N" values or "N-M"
+ranges separated by commas followed by a "N+" value if the algorithm is
+currently supported. For example: "17+", "1-8,22+", "1-10,15,22-24".
+
+deprecated: Whether the algorithm is unsupported at the current API level. This
+is equivalent to supported_api_levels.endswith('+'), but is included for
+clarity's sake.
+
+Updating the documentation is a three-step process: get the set of supported
+algorithms, update the data file, then generate HTML based on the data file.
+
+Getting the set of supported algorithms is done using
+src/java/libcore/java/security/ListProviders.java. It's important that this is
+run using vogar (in mode=device, the default) rather than in an app container,
+as this documentation only includes the libcore-supported crypto support, but
+the Android frameworks (in particular, Android KeyStore) can add additional
+support.
+
+The data from ListProviders is fed into update_crypto_support.py, which rewrites
+the data file. Any newly-added algorithms will be added to the file's data,
+and any newly-removed algorithms will have their supported API levels updated.
+
+The preceding two steps can be performed together by running
+run_update_crypto_support.sh.
+
+Finally, format_supported_algorithm_table.py reads the data file and outputs
+a collection of HTML tables suitable for copying-and-pasting into the docs
+to stdout.
diff --git a/tools/docs/crypto/data/crypto_support.json b/tools/docs/crypto/data/crypto_support.json
index 0343135..d50eb2c 100644
--- a/tools/docs/crypto/data/crypto_support.json
+++ b/tools/docs/crypto/data/crypto_support.json
@@ -1,123 +1,826 @@
+# This file is autogenerated. See libcore/tools/docs/crypto/README for details.
{
- "api_level": "26",
+ "api_level": "26",
"categories": [
{
"algorithms": [
{
- "deprecated": "true",
- "name": "DESEDEMAC",
+ "deprecated": "true",
+ "name": "AES",
"supported_api_levels": "1-8"
- },
+ },
{
- "deprecated": "true",
- "name": "DESEDEMAC/CFB8",
+ "deprecated": "true",
+ "name": "DES",
"supported_api_levels": "1-8"
- },
+ },
{
- "deprecated": "true",
- "name": "DESEDEMAC64",
+ "deprecated": "true",
+ "name": "DESEDE",
"supported_api_levels": "1-8"
- },
+ },
{
- "deprecated": "true",
- "name": "DESMAC",
- "supported_api_levels": "1-8"
- },
- {
- "deprecated": "true",
- "name": "DESMAC/CFB8",
- "supported_api_levels": "1-8"
- },
- {
- "deprecated": "true",
- "name": "DESWITHISO9797",
- "supported_api_levels": "1-8"
- },
- {
- "name": "HMACMD5",
+ "name": "DH",
"supported_api_levels": "1+"
- },
+ },
{
- "name": "HMACSHA1",
+ "name": "DSA",
"supported_api_levels": "1+"
- },
- {
- "name": "HMACSHA224",
- "supported_api_levels": "1-8,22+"
- },
- {
- "name": "HMACSHA256",
- "supported_api_levels": "1+"
- },
- {
- "name": "HMACSHA384",
- "supported_api_levels": "1+"
- },
- {
- "name": "HMACSHA512",
- "supported_api_levels": "1+"
- },
- {
- "deprecated": "true",
- "name": "ISO9797ALG3MAC",
- "supported_api_levels": "1-8"
- },
- {
- "name": "PBEWITHHMACSHA",
- "supported_api_levels": "1+"
- },
- {
- "name": "PBEWITHHMACSHA1",
- "supported_api_levels": "1+"
- },
- {
- "name": "PBEWITHHMACSHA224",
- "supported_api_levels": "26+"
- },
- {
- "name": "PBEWITHHMACSHA256",
- "supported_api_levels": "26+"
- },
- {
- "name": "PBEWITHHMACSHA384",
- "supported_api_levels": "26+"
- },
- {
- "name": "PBEWITHHMACSHA512",
- "supported_api_levels": "26+"
}
- ],
- "name": "Mac"
- },
+ ],
+ "name": "AlgorithmParameterGenerator"
+ },
{
"algorithms": [
{
- "name": "MD5",
+ "name": "AES",
"supported_api_levels": "1+"
- },
+ },
{
- "name": "SHA-1",
+ "name": "BLOWFISH",
+ "supported_api_levels": "10+"
+ },
+ {
+ "name": "DES",
"supported_api_levels": "1+"
- },
+ },
{
- "name": "SHA-224",
- "supported_api_levels": "1-8,22+"
- },
- {
- "name": "SHA-256",
+ "name": "DESEDE",
"supported_api_levels": "1+"
- },
+ },
{
- "name": "SHA-384",
+ "name": "DH",
"supported_api_levels": "1+"
- },
+ },
{
- "name": "SHA-512",
+ "name": "DSA",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "EC",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "GCM",
+ "supported_api_levels": "22+"
+ },
+ {
+ "deprecated": "true",
+ "name": "IES",
+ "supported_api_levels": "1-8"
+ },
+ {
+ "name": "OAEP",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHHMACSHA1ANDAES_128",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA1ANDAES_256",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA224ANDAES_128",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA224ANDAES_256",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA256ANDAES_128",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA256ANDAES_256",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA384ANDAES_128",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA384ANDAES_256",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA512ANDAES_128",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA512ANDAES_256",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PKCS12PBE",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PSS",
+ "supported_api_levels": "1-8,24+"
+ }
+ ],
+ "name": "AlgorithmParameters"
+ },
+ {
+ "algorithms": [
+ {
+ "name": "PKIX",
"supported_api_levels": "1+"
}
- ],
+ ],
+ "name": "CertPathBuilder"
+ },
+ {
+ "algorithms": [
+ {
+ "name": "PKIX",
+ "supported_api_levels": "1+"
+ }
+ ],
+ "name": "CertPathValidator"
+ },
+ {
+ "algorithms": [
+ {
+ "name": "COLLECTION",
+ "supported_api_levels": "1+"
+ }
+ ],
+ "name": "CertStore"
+ },
+ {
+ "algorithms": [
+ {
+ "name": "X.509",
+ "supported_api_levels": "1+"
+ }
+ ],
+ "name": "CertificateFactory"
+ },
+ {
+ "algorithms": [
+ {
+ "name": "DH",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "ECDH",
+ "supported_api_levels": "11+"
+ }
+ ],
+ "name": "KeyAgreement"
+ },
+ {
+ "algorithms": [
+ {
+ "name": "DH",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "DSA",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "EC",
+ "supported_api_levels": "11+"
+ },
+ {
+ "name": "RSA",
+ "supported_api_levels": "1+"
+ },
+ {
+ "deprecated": "true",
+ "name": "X.509",
+ "supported_api_levels": "1-8"
+ }
+ ],
+ "name": "KeyFactory"
+ },
+ {
+ "algorithms": [
+ {
+ "name": "AES",
+ "supported_api_levels": "1+"
+ },
+ {
+ "deprecated": "true",
+ "name": "AESWRAP",
+ "supported_api_levels": "1-8"
+ },
+ {
+ "name": "ARC4",
+ "supported_api_levels": "14+"
+ },
+ {
+ "name": "BLOWFISH",
+ "supported_api_levels": "10+"
+ },
+ {
+ "name": "DES",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "DESEDE",
+ "supported_api_levels": "1+"
+ },
+ {
+ "deprecated": "true",
+ "name": "DESEDEWRAP",
+ "supported_api_levels": "1-8"
+ },
+ {
+ "name": "HMACMD5",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "HMACSHA1",
+ "supported_api_levels": "11+"
+ },
+ {
+ "name": "HMACSHA224",
+ "supported_api_levels": "1-8,22+"
+ },
+ {
+ "name": "HMACSHA256",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "HMACSHA384",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "HMACSHA512",
+ "supported_api_levels": "1+"
+ },
+ {
+ "deprecated": "true",
+ "name": "RC4",
+ "supported_api_levels": "10-13"
+ }
+ ],
+ "name": "KeyGenerator"
+ },
+ {
+ "algorithms": [
+ {
+ "name": "PKIX",
+ "supported_api_levels": "1+"
+ }
+ ],
+ "name": "KeyManagerFactory"
+ },
+ {
+ "algorithms": [
+ {
+ "name": "DH",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "DSA",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "EC",
+ "supported_api_levels": "11+"
+ },
+ {
+ "name": "RSA",
+ "supported_api_levels": "1+"
+ }
+ ],
+ "name": "KeyPairGenerator"
+ },
+ {
+ "algorithms": [
+ {
+ "name": "ANDROIDCASTORE",
+ "supported_api_levels": "14+"
+ },
+ {
+ "name": "ANDROIDKEYSTORE",
+ "supported_api_levels": "18+"
+ },
+ {
+ "deprecated": "true",
+ "name": "BCPKCS12",
+ "supported_api_levels": "1-8"
+ },
+ {
+ "name": "BKS",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "BOUNCYCASTLE",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PKCS12",
+ "supported_api_levels": "1+"
+ },
+ {
+ "deprecated": "true",
+ "name": "PKCS12-DEF",
+ "supported_api_levels": "1-8"
+ }
+ ],
+ "name": "KeyStore"
+ },
+ {
+ "algorithms": [
+ {
+ "deprecated": "true",
+ "name": "DESEDEMAC",
+ "supported_api_levels": "1-8"
+ },
+ {
+ "deprecated": "true",
+ "name": "DESEDEMAC/CFB8",
+ "supported_api_levels": "1-8"
+ },
+ {
+ "deprecated": "true",
+ "name": "DESEDEMAC64",
+ "supported_api_levels": "1-8"
+ },
+ {
+ "deprecated": "true",
+ "name": "DESMAC",
+ "supported_api_levels": "1-8"
+ },
+ {
+ "deprecated": "true",
+ "name": "DESMAC/CFB8",
+ "supported_api_levels": "1-8"
+ },
+ {
+ "deprecated": "true",
+ "name": "DESWITHISO9797",
+ "supported_api_levels": "1-8"
+ },
+ {
+ "name": "HMACMD5",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "HMACSHA1",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "HMACSHA224",
+ "supported_api_levels": "1-8,22+"
+ },
+ {
+ "name": "HMACSHA256",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "HMACSHA384",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "HMACSHA512",
+ "supported_api_levels": "1+"
+ },
+ {
+ "deprecated": "true",
+ "name": "ISO9797ALG3MAC",
+ "supported_api_levels": "1-8"
+ },
+ {
+ "name": "PBEWITHHMACSHA",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHHMACSHA1",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHHMACSHA224",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA256",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA384",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA512",
+ "supported_api_levels": "26+"
+ }
+ ],
+ "name": "Mac"
+ },
+ {
+ "algorithms": [
+ {
+ "name": "MD5",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "SHA-1",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "SHA-224",
+ "supported_api_levels": "1-8,22+"
+ },
+ {
+ "name": "SHA-256",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "SHA-384",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "SHA-512",
+ "supported_api_levels": "1+"
+ }
+ ],
"name": "MessageDigest"
+ },
+ {
+ "algorithms": [
+ {
+ "name": "DEFAULT",
+ "supported_api_levels": "10+"
+ },
+ {
+ "name": "SSL",
+ "supported_api_levels": "10+"
+ },
+ {
+ "deprecated": "true",
+ "name": "SSLV3",
+ "supported_api_levels": "10-25"
+ },
+ {
+ "name": "TLS",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "TLSV1",
+ "supported_api_levels": "10+"
+ },
+ {
+ "name": "TLSV1.1",
+ "supported_api_levels": "16+"
+ },
+ {
+ "name": "TLSV1.2",
+ "supported_api_levels": "16+"
+ }
+ ],
+ "name": "SSLContext"
+ },
+ {
+ "algorithms": [
+ {
+ "name": "AES",
+ "supported_api_levels": "23+"
+ },
+ {
+ "name": "DES",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "DESEDE",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "HMACSHA1",
+ "supported_api_levels": "23+"
+ },
+ {
+ "name": "HMACSHA224",
+ "supported_api_levels": "23+"
+ },
+ {
+ "name": "HMACSHA256",
+ "supported_api_levels": "23+"
+ },
+ {
+ "name": "HMACSHA384",
+ "supported_api_levels": "23+"
+ },
+ {
+ "name": "HMACSHA512",
+ "supported_api_levels": "23+"
+ },
+ {
+ "name": "PBEWITHHMACSHA1",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHHMACSHA1ANDAES_128",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA1ANDAES_256",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA224ANDAES_128",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA224ANDAES_256",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA256ANDAES_128",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA256ANDAES_256",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA384ANDAES_128",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA384ANDAES_256",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA512ANDAES_128",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHHMACSHA512ANDAES_256",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBEWITHMD5AND128BITAES-CBC-OPENSSL",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHMD5AND192BITAES-CBC-OPENSSL",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHMD5AND256BITAES-CBC-OPENSSL",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHMD5ANDDES",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHMD5ANDRC2",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHSHA1ANDDES",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHSHA1ANDRC2",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHSHA256AND128BITAES-CBC-BC",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHSHA256AND192BITAES-CBC-BC",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHSHA256AND256BITAES-CBC-BC",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHSHAAND128BITAES-CBC-BC",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHSHAAND128BITRC2-CBC",
+ "supported_api_levels": "10+"
+ },
+ {
+ "name": "PBEWITHSHAAND128BITRC4",
+ "supported_api_levels": "10+"
+ },
+ {
+ "name": "PBEWITHSHAAND192BITAES-CBC-BC",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHSHAAND2-KEYTRIPLEDES-CBC",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHSHAAND256BITAES-CBC-BC",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHSHAAND3-KEYTRIPLEDES-CBC",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHSHAAND40BITRC2-CBC",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "PBEWITHSHAAND40BITRC4",
+ "supported_api_levels": "10+"
+ },
+ {
+ "name": "PBEWITHSHAANDTWOFISH-CBC",
+ "supported_api_levels": "10+"
+ },
+ {
+ "name": "PBKDF2WITHHMACSHA1",
+ "supported_api_levels": "10+"
+ },
+ {
+ "name": "PBKDF2WITHHMACSHA1AND8BIT",
+ "supported_api_levels": "19+"
+ },
+ {
+ "name": "PBKDF2WITHHMACSHA224",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBKDF2WITHHMACSHA256",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBKDF2WITHHMACSHA384",
+ "supported_api_levels": "26+"
+ },
+ {
+ "name": "PBKDF2WITHHMACSHA512",
+ "supported_api_levels": "26+"
+ }
+ ],
+ "name": "SecretKeyFactory"
+ },
+ {
+ "algorithms": [
+ {
+ "name": "SHA1PRNG",
+ "supported_api_levels": "1+"
+ }
+ ],
+ "name": "SecureRandom"
+ },
+ {
+ "algorithms": [
+ {
+ "name": "DSA",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "DSAWITHSHA1",
+ "supported_api_levels": "1+"
+ },
+ {
+ "deprecated": "true",
+ "name": "DSS",
+ "supported_api_levels": "1-19"
+ },
+ {
+ "name": "ECDSA",
+ "supported_api_levels": "11+"
+ },
+ {
+ "name": "ECDSAWITHSHA1",
+ "supported_api_levels": "11+"
+ },
+ {
+ "deprecated": "true",
+ "name": "MD2WITHRSA",
+ "supported_api_levels": "1-3"
+ },
+ {
+ "deprecated": "true",
+ "name": "MD4WITHRSA",
+ "supported_api_levels": "1-8"
+ },
+ {
+ "name": "MD5WITHRSA",
+ "supported_api_levels": "1+"
+ },
+ {
+ "deprecated": "true",
+ "name": "MD5WITHRSA/ISO9796-2",
+ "supported_api_levels": "1-8"
+ },
+ {
+ "name": "NONEWITHDSA",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "NONEWITHECDSA",
+ "supported_api_levels": "11+"
+ },
+ {
+ "name": "NONEWITHRSA",
+ "supported_api_levels": "17+"
+ },
+ {
+ "deprecated": "true",
+ "name": "RSASSA-PSS",
+ "supported_api_levels": "1-8"
+ },
+ {
+ "name": "SHA1WITHDSA",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "SHA1WITHECDSA",
+ "supported_api_levels": "11+"
+ },
+ {
+ "name": "SHA1WITHRSA",
+ "supported_api_levels": "1+"
+ },
+ {
+ "deprecated": "true",
+ "name": "SHA1WITHRSA/ISO9796-2",
+ "supported_api_levels": "1-8"
+ },
+ {
+ "name": "SHA1WITHRSA/PSS",
+ "supported_api_levels": "23+"
+ },
+ {
+ "name": "SHA224WITHDSA",
+ "supported_api_levels": "20+"
+ },
+ {
+ "name": "SHA224WITHECDSA",
+ "supported_api_levels": "20+"
+ },
+ {
+ "name": "SHA224WITHRSA",
+ "supported_api_levels": "20+"
+ },
+ {
+ "name": "SHA224WITHRSA/PSS",
+ "supported_api_levels": "23+"
+ },
+ {
+ "name": "SHA256WITHDSA",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "SHA256WITHECDSA",
+ "supported_api_levels": "11+"
+ },
+ {
+ "name": "SHA256WITHRSA",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "SHA256WITHRSA/PSS",
+ "supported_api_levels": "23+"
+ },
+ {
+ "name": "SHA384WITHECDSA",
+ "supported_api_levels": "11+"
+ },
+ {
+ "name": "SHA384WITHRSA",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "SHA384WITHRSA/PSS",
+ "supported_api_levels": "23+"
+ },
+ {
+ "name": "SHA512WITHECDSA",
+ "supported_api_levels": "11+"
+ },
+ {
+ "name": "SHA512WITHRSA",
+ "supported_api_levels": "1+"
+ },
+ {
+ "name": "SHA512WITHRSA/PSS",
+ "supported_api_levels": "23+"
+ }
+ ],
+ "name": "Signature"
+ },
+ {
+ "algorithms": [
+ {
+ "name": "PKIX",
+ "supported_api_levels": "1+"
+ }
+ ],
+ "name": "TrustManagerFactory"
}
- ],
- "last_updated": "2017-03-08 16:37:36 UTC"
+ ],
+ "last_updated": "2017-03-14 15:13:50 UTC"
}
\ No newline at end of file
diff --git a/tools/docs/crypto/run_update_crypto_support.sh b/tools/docs/crypto/run_update_crypto_support.sh
index 2d308b7..5908fcc 100755
--- a/tools/docs/crypto/run_update_crypto_support.sh
+++ b/tools/docs/crypto/run_update_crypto_support.sh
@@ -14,4 +14,4 @@
fi
make -j48 vogar
-vogar libcore/tools/docs/crypto/src/java/libcore/java/security/ListProviders.java | libcore/tools/docs/crypto/update_crypto_support.py --api_level=$1 --rewrite_file libcore/tools/docs/crypto/data/crypto_support.json
+vogar --mode=activity --toolchain=jdk --multidex=false libcore/tools/docs/crypto/src/java/libcore/java/security/ListProviders.java | libcore/tools/docs/crypto/update_crypto_support.py --api_level=$1 --rewrite_file libcore/tools/docs/crypto/data/crypto_support.json
diff --git a/tools/docs/crypto/src/java/libcore/java/security/ListProviders.java b/tools/docs/crypto/src/java/libcore/java/security/ListProviders.java
index f222e24..34aed4b 100644
--- a/tools/docs/crypto/src/java/libcore/java/security/ListProviders.java
+++ b/tools/docs/crypto/src/java/libcore/java/security/ListProviders.java
@@ -18,7 +18,11 @@
import java.security.Provider;
import java.security.Security;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import java.util.TreeSet;
@@ -29,6 +33,16 @@
* {@code vogar libcore/tools/src/java/libcore/java/security/ListProviders.java}
*/
public class ListProviders {
+
+ // These algorithms were previously provided, but now are aliases for a different
+ // algorithm. For documentation purposes, we want to continue having them show up
+ // as supported.
+ private static final Set<String> KNOWN_ALIASES = new HashSet<>(Arrays.asList(new String[]{
+ "Alg.Alias.Signature.DSA",
+ "Alg.Alias.Signature.DSAwithSHA1",
+ "Alg.Alias.Signature.ECDSA",
+ "Alg.Alias.Signature.ECDSAwithSHA1",
+ }));
public static void main(String[] argv) {
System.out.println("BEGIN ALGORITHM LIST");
for (Provider p : Security.getProviders()) {
@@ -46,6 +60,12 @@
for (Provider.Service s : services) {
System.out.println(s.getType() + " " + s.getAlgorithm());
}
+ for (String alias : KNOWN_ALIASES) {
+ if (p.containsKey(alias)) {
+ String[] elements = alias.split("\\."); // Split takes a regex
+ System.out.println(elements[2] + " " + elements[3]);
+ }
+ }
}
System.out.println("END ALGORITHM LIST");
}
diff --git a/tools/docs/crypto/update_crypto_support.py b/tools/docs/crypto/update_crypto_support.py
index 8e6ec06..c8d19df 100755
--- a/tools/docs/crypto/update_crypto_support.py
+++ b/tools/docs/crypto/update_crypto_support.py
@@ -31,8 +31,25 @@
# TODO(b/35793879): Support more categories
SUPPORTED_CATEGORIES = [
+ 'AlgorithmParameterGenerator',
+ 'AlgorithmParameters',
+ 'CertificateFactory',
+ 'CertPathBuilder',
+ 'CertPathValidator',
+ 'CertStore',
+ 'KeyAgreement',
+ 'KeyFactory',
+ 'KeyGenerator',
+ 'KeyManagerFactory',
+ 'KeyPairGenerator',
+ 'KeyStore',
'Mac',
'MessageDigest',
+ 'SecretKeyFactory',
+ 'SecureRandom',
+ 'Signature',
+ 'SSLContext',
+ 'TrustManagerFactory',
]
@@ -49,6 +66,15 @@
return sorted(seq, key=lambda x: x['name'])
+def normalize_name(name):
+ """Returns a normalized version of the given algorithm name."""
+ name = name.upper()
+ # BouncyCastle uses X.509 with an alias of X509, Conscrypt does the
+ # reverse. X.509 is the official name of the standard, so use that.
+ if name == "X509":
+ name = "X.509"
+ return name
+
def get_current_data(f):
"""Returns a map of the algorithms in the given input.
@@ -58,7 +84,7 @@
input can supply arbitrary values outside of the BEGIN and END lines, it
will be ignored.
- The returned algorithms will have their names normalized to all-uppercase.
+ The returned algorithms will have their names normalized.
Raises:
EOFError: If either the BEGIN or END sentinel lines are not present.
@@ -81,7 +107,7 @@
category, algorithm = line.split()
if category not in SUPPORTED_CATEGORIES:
continue
- current_data[category].append(algorithm.upper())
+ current_data[category].append(normalize_name(algorithm))
if not saw_begin:
raise EOFError(
@@ -174,7 +200,13 @@
args = parser.parse_args()
f = open(args.file)
- prev_data = json.load(f)
+ # JSON doesn't allow comments, but we have some header docs in our file,
+ # so strip comments out before parsing
+ stripped_contents = ''
+ for line in f:
+ if not line.strip().startswith('#'):
+ stripped_contents += line
+ prev_data = json.loads(stripped_contents)
f.close()
current_data = get_current_data(sys.stdin)
@@ -186,9 +218,14 @@
if args.rewrite_file:
f = open(args.file, 'w')
- json.dump(new_data, f, indent=2, sort_keys=True)
+ f.write('# This file is autogenerated.'
+ ' See libcore/tools/docs/crypto/README for details.\n')
+ json.dump(
+ new_data, f, indent=2, sort_keys=True, separators=(',', ': '))
+ f.close()
else:
- print json.dumps(new_data, indent=2, sort_keys=True)
+ print json.dumps(
+ new_data, indent=2, sort_keys=True, separators=(',', ': '))
if __name__ == '__main__':