public boolean isCertificateParseable() { try { Certificate cert = Certificate.parse(new ByteArrayInputStream(certificateBytes)); return true; } catch (Exception E) { return false; } }
@Override public Certificate unmarshal(String v) throws Exception { Certificate cert = Certificate.parse(new ByteArrayInputStream(ArrayConverter.hexStringToByteArray(v.replaceAll( "\\s+", "")))); return cert; }
protected void processClientCertificate(ServerHandshakeState state, byte[] body) throws IOException { ByteArrayInputStream buf = new ByteArrayInputStream(body); Certificate clientCertificate = Certificate.parse(buf); TlsProtocol.assertEmpty(buf); notifyClientCertificate(state, clientCertificate); }
protected void processClientCertificate(ServerHandshakeState state, byte[] body) throws IOException { ByteArrayInputStream buf = new ByteArrayInputStream(body); Certificate clientCertificate = Certificate.parse(buf); TlsProtocol.assertEmpty(buf); notifyClientCertificate(state, clientCertificate); }
private Certificate parseCertificate(int lengthBytes, byte[] bytesToParse) { try { ByteArrayInputStream stream = new ByteArrayInputStream(ArrayConverter.concatenate( ArrayConverter.intToBytes(lengthBytes, HandshakeByteLength.CERTIFICATES_LENGTH), bytesToParse)); return Certificate.parse(stream); } catch (Exception E) { // This could really be anything. From classCast exception to // Arrayindexoutofbounds LOGGER.warn( "Could not parse Certificate bytes into Certificate object:" + ArrayConverter.bytesToHexString(bytesToParse, false), E); LOGGER.debug(E); return null; } }
protected void receiveCertificateMessage(ByteArrayInputStream buf) throws IOException { Certificate clientCertificate = Certificate.parse(buf); assertEmpty(buf); notifyClientCertificate(clientCertificate); }
protected void receiveCertificateMessage(ByteArrayInputStream buf) throws IOException { Certificate clientCertificate = Certificate.parse(buf); assertEmpty(buf); notifyClientCertificate(clientCertificate); }
private Certificate parseCertificate(int lengthBytes, byte[] bytesToParse) { LOGGER.debug("SSL2 lengthBytes:" + lengthBytes); LOGGER.debug("SSL2 bytesToParse:" + ArrayConverter.bytesToHexString(bytesToParse, false)); try { byte[] concatenated = ArrayConverter.concatenate(ArrayConverter.intToBytes(lengthBytes + HandshakeByteLength.CERTIFICATES_LENGTH, HandshakeByteLength.CERTIFICATES_LENGTH), ArrayConverter .intToBytes(lengthBytes, HandshakeByteLength.CERTIFICATES_LENGTH), bytesToParse); LOGGER.debug("SSL2 concatenated:" + ArrayConverter.bytesToHexString(concatenated, false)); ByteArrayInputStream stream = new ByteArrayInputStream(concatenated); return Certificate.parse(stream); } catch (IOException | IllegalArgumentException E) { LOGGER.warn("Could not parse Certificate bytes into Certificate object:\n" + ArrayConverter.bytesToHexString(bytesToParse, false)); LOGGER.debug(E); return null; } }
protected Certificate processServerCertificate(ClientHandshakeState state, byte[] body) throws IOException { ByteArrayInputStream buf = new ByteArrayInputStream(body); Certificate serverCertificate = Certificate.parse(buf); TlsProtocol.assertEmpty(buf); state.keyExchange.processServerCertificate(serverCertificate); state.authentication = state.client.getAuthentication(); state.authentication.notifyServerCertificate(serverCertificate); return serverCertificate; }
protected Certificate processServerCertificate(ClientHandshakeState state, byte[] body) throws IOException { ByteArrayInputStream buf = new ByteArrayInputStream(body); Certificate serverCertificate = Certificate.parse(buf); TlsProtocol.assertEmpty(buf); state.keyExchange.processServerCertificate(serverCertificate); state.authentication = state.client.getAuthentication(); state.authentication.notifyServerCertificate(serverCertificate); return serverCertificate; }
try { cert = Certificate .parse(new ByteArrayInputStream( ArrayConverter .hexStringToByteArray("0003970003943082039030820278A003020102020900A650C00794049FCD300D06092A864886F70D01010B0500305C310B30090603550406130241553113301106035504080C0A536F6D652D53746174653121301F060355040A0C18496E7465726E6574205769646769747320507479204C74643115301306035504030C0C544C532D41747461636B65723020170D3137303731333132353331385A180F32313137303631393132353331385A305C310B30090603550406130241553113301106035504080C0A536F6D652D53746174653121301F060355040A0C18496E7465726E6574205769646769747320507479204C74643115301306035504030C0C544C532D41747461636B657230820122300D06092A864886F70D01010105000382010F003082010A0282010100C8820D6C3CE84C8430F6835ABFC7D7A912E1664F44578751F376501A8C68476C3072D919C5D39BD0DBE080E71DB83BD4AB2F2F9BDE3DFFB0080F510A5F6929C196551F2B3C369BE051054C877573195558FD282035934DC86EDAB8D4B1B7F555E5B2FEE7275384A756EF86CB86793B5D1333F0973203CB96966766E655CD2CCCAE1940E4494B8E9FB5279593B75AFD0B378243E51A88F6EB88DEF522A8CD5C6C082286A04269A2879760FCBA45005D7F2672DD228809D47274F0FE0EA5531C2BD95366C05BF69EDC0F3C3189866EDCA0C57ADCCA93250AE78D9EACA0393A95FF9952FC47FB7679DD3803E6A7A6FA771861E3D99E4B551A4084668B111B7EEF7D0203010001A3533051301D0603551D0E04160414E7A92FE5543AEE2FF7592F800AC6E66541E3268B301F0603551D23041830168014E7A92FE5543AEE2FF7592F800AC6E66541E3268B300F0603551D130101FF040530030101FF300D06092A864886F70D01010B050003820101000D5C11E28CF19D1BC17E4FF543695168570AA7DB85B3ECB85405392A0EDAFE4F097EE4685B7285E3D9B869D23257161CA65E20B5E6A585D33DA5CD653AF81243318132C9F64A476EC08BA80486B3E439F765635A7EA8A969B3ABD8650036D74C5FC4A04589E9AC8DC3BE2708743A6CFE3B451E3740F735F156D6DC7FFC8A2C852CD4E397B942461C2FCA884C7AFB7EBEF7918D6AAEF1F0D257E959754C4665779FA0E3253EF2BEDBBD5BE5DA600A0A68E51D2D1C125C4E198669A6BC715E8F3884E9C3EFF39D40838ADA4B1F38313F6286AA395DC6DEA9DAF49396CF12EC47EFA7A0D3882F8B84D9AEEFFB252C6B81A566609605FBFD3F0D17E5B12401492A1A")));
pairList = new LinkedList<>(); try { Certificate cert = Certificate.parse(new ByteArrayInputStream(certBytes)); for (org.bouncycastle.asn1.x509.Certificate subCert : cert.getCertificateList()) { pairList.add(new CertificatePair(subCert.getEncoded()));
this.peerCertificate = Certificate.parse(buf);
this.peerCertificate = Certificate.parse(buf);