Merge "CTS test for SslCertificate.getX509Certificate" am: 446150cd66

am: 179a0a0eff

Change-Id: I5d34c06bc177a5dad365dbe39f85eff206cc3fc2
This commit is contained in:
Adam Vartanian
2018-08-07 10:51:40 -07:00
committed by android-build-merger

View File

@@ -230,6 +230,19 @@ public class SslCertificateTest extends TestCase {
final String EXPECTED = "Issued to: c=ccc,o=testOName,ou=testUName,cn=testCName;\n"
+ "Issued by: e=aeei,c=adb,o=testOName,ou=testUName,cn=testCName;\n";
assertEquals(EXPECTED, ssl.toString());
assertNull(ssl.getX509Certificate());
}
public void testGetX509Certificate() {
final String TO = "c=ccc,o=testOName,ou=testUName,cn=testCName";
final String BY = "e=aeei,c=adb,o=testOName,ou=testUName,cn=testCName";
Date validNotBefore = new Date(System.currentTimeMillis() - 1000);
Date validNotAfter = new Date(System.currentTimeMillis());
SslCertificate ssl = new SslCertificate(TO, BY, validNotBefore, validNotAfter);
assertNull(ssl.getX509Certificate());
X509Certificate cert = new MockX509Certificate();
ssl = new SslCertificate(cert);
assertSame(cert, ssl.getX509Certificate());
}
}