Merge "Move helper function to webkit"
This commit is contained in:
@ -20,7 +20,6 @@ import android.os.Handler;
|
|||||||
import java.security.PrivateKey;
|
import java.security.PrivateKey;
|
||||||
import java.security.cert.CertificateEncodingException;
|
import java.security.cert.CertificateEncodingException;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
import com.android.org.conscrypt.NativeCrypto;
|
|
||||||
import com.android.org.conscrypt.OpenSSLKey;
|
import com.android.org.conscrypt.OpenSSLKey;
|
||||||
import com.android.org.conscrypt.OpenSSLKeyHolder;
|
import com.android.org.conscrypt.OpenSSLKeyHolder;
|
||||||
|
|
||||||
@ -48,12 +47,21 @@ public final class ClientCertRequestHandler extends Handler {
|
|||||||
mTable = table;
|
mTable = table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static byte[][] encodeCertificates(X509Certificate[] certificates)
|
||||||
|
throws CertificateEncodingException {
|
||||||
|
byte[][] certificateBytes = new byte[certificates.length][];
|
||||||
|
for (int i = 0; i < certificates.length; i++) {
|
||||||
|
certificateBytes[i] = certificates[i].getEncoded();
|
||||||
|
}
|
||||||
|
return certificateBytes;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proceed with the specified private key and client certificate chain.
|
* Proceed with the specified private key and client certificate chain.
|
||||||
*/
|
*/
|
||||||
public void proceed(PrivateKey privateKey, X509Certificate[] chain) {
|
public void proceed(PrivateKey privateKey, X509Certificate[] chain) {
|
||||||
try {
|
try {
|
||||||
byte[][] chainBytes = NativeCrypto.encodeCertificates(chain);
|
byte[][] chainBytes = encodeCertificates(chain);
|
||||||
mTable.Allow(mHostAndPort, privateKey, chainBytes);
|
mTable.Allow(mHostAndPort, privateKey, chainBytes);
|
||||||
|
|
||||||
if (privateKey instanceof OpenSSLKeyHolder) {
|
if (privateKey instanceof OpenSSLKeyHolder) {
|
||||||
|
Reference in New Issue
Block a user