On Android, I use TLS with mutual authentication with a client certificate created using this code.
private static X509Certificate generateX509V1Certificate(KeyPair pair, SecureRandom sr) { String dn="CN="+sUuid.toString(); final Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.HOUR, -1); final Date startDate = new Date(calendar.getTimeInMillis()); calendar.add(Calendar.YEAR, 1); final Date expiryDate = new Date(calendar.getTimeInMillis()); final BigInteger serialNumber = BigInteger.valueOf(Math.abs(System.currentTimeMillis())); X509V1CertificateGenerator certGen = new X509V1CertificateGenerator(); X500Principal dnName = new X500Principal(dn); certGen.setSerialNumber(serialNumber); certGen.setIssuerDN(dnName); certGen.setNotBefore(startDate); certGen.setNotAfter(expiryDate); certGen.setSubjectDN(dnName);
The key pair algorithm is "RSA". The encryption algorithm is "RSA / ECB / PKCS1Padding".
It works great up to the Jelly Bean version.
With jelly bean, I get an error when called
socket.getSession().getPeerCertificates()
The process was killed in the log:
E/NativeCrypto(1133): error:140C10F7:SSL routines:SSL_SET_PKEY:unknown certificate type A/libc(1133): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 1233 (AsyncTask
I have no idea how I can solve this error.
Could you help me?
source share