History log of /libcore/luni/src/test/java/libcore/java/security/cert/CertificateFactoryTest.java
Revision Date Author Comments
e21b3caf3fb4e3e3d9244a000669a547621c16bd 16-Apr-2013 Kenny Root <kroot@google.com> NativeCrypto: fix EOF at beginning of stream

Any InputStream where the first character was an EOF (-1) would cause
OpenSSLBIOInputStream to hang forever. This caused bad X.509
certificates to hang forever in the call to
CertificateFactory#generateCertificate(InputStream)

Bug: 8632056
Change-Id: Ia88f33aa356c3a6a23be872c7eef844873d73d5c
34acecb989e8cecfe10027d3a2c6e6b8a54d970f 19-Feb-2013 Kenny Root <kroot@google.com> Add test for CertPath

Test X509CertificateFactory#GenerateCertPath is functioning
correctly. To be fleshed out in future tests.

Change-Id: I48f31919f5a5c283bc77247edf830ca1ba8dcca5
fd30c751591675c253613373bcc133ca2c53d74f 31-Jan-2013 Kenny Root <kroot@google.com> Add some more X.509 certificate tests

Add a behavior test to see what happens when CertificateFactory is fed
an empty stream.

Fix some date comparisons on X509CRLTest.

Change-Id: Ida9df52859e12c5aced0810cc625b58498d5fa32
bcd731fc88df3806f963b2c6e19b83de5aba8d35 29-Jan-2013 Kenny Root <kroot@google.com> Add tests for CertificateFactory byte offset

Make sure that CertificateFactory ends at the place that it should when
reading an InputStream that supports mark and reset.

Change-Id: I3bc20c1e9766f80f1597908707e69d65a6c3b216
cdeb809350d8c1a14a96924bf01febfa82a8b5b6 23-Sep-2010 Brian Carlstrom <bdc@google.com> Fix ArrayIndexOutOfBoundsExceptions in cert Cache on zero filled array input

The Harmony cert Cache has a long[] where each long is a combination
of a hash and an one-based index into another table containing the
cached values. The cache is searched with Arrays.binarySearch, which
should never find an actual hit, since even a hash hit will look like
a miss since the input hash doesn't contain the one-based index and
entries in the table do. However, this approach has the property that
both hits and misses give the same location in the array, which is
subsequently checked for a real hit/miss with a mask.

However, the hash of a byte array filled with zeroes was zero, which
is found by Arrays.binarySearch in unused slots. Unfortunately, the
code never expects a direct hit, so when it does uses -index-1 to find
the slot to check for hit/miss, it ends up with a negative number,
causing the ArrayIndexOutOfBoundsExceptions.

The solution is ensure that when the hash function returns zero to
simply treat it as a miss. It should not be true for any non-trival
legal input.

Bug: 2753594
Change-Id: I2ee282cc28f22a0ca26da311ae683edf548c67a6