private boolean stepFour(final int i) { boolean result = false; if (m.length == 1 && m[0].lower.compareTo(m[0].upper) == 0) { solution = s0.modInverse(publicKey.getModulus()); solution = solution.multiply(m[0].upper).mod(publicKey.getModulus()); LOGGER.info("====> Solution found!\n {}", ArrayConverter.bytesToHexString(solution.toByteArray())); result = true; } return result; }
private static byte[] getEK_NullByteInPkcsPadding(int rsaKeyLength, byte[] symmetricKey) { byte[] key = getPaddedKey(rsaKeyLength, symmetricKey); key[3] = 0x00; LOGGER.debug("Generated a PKCS1 padded message with a 0x00 byte in the PKCS1 padding: {}", ArrayConverter.bytesToHexString(key)); return key; }
private static byte[] getEK_NullByteInPadding(int rsaKeyLength, byte[] symmetricKey) { byte[] key = getPaddedKey(rsaKeyLength, symmetricKey); key[11] = 0x00; LOGGER.debug("Generated a PKCS1 padded message with a 0x00 byte in padding: {}", ArrayConverter.bytesToHexString(key)); return key; }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("ApplicationMessage:"); sb.append("\n Data: "); if (data != null && data.getValue() != null) { sb.append(ArrayConverter.bytesToHexString(data.getValue())); } else { sb.append("null"); } return sb.toString(); }
/** * Reads the next bytes as the SignatureHashAlgorithm and writes them in the * message * * @param msg * Message to write in */ private void parseSignatureHashAlgorithm(CertificateVerifyMessage msg) { msg.setSignatureHashAlgorithm(parseByteArrayField(HandshakeByteLength.SIGNATURE_HASH_ALGORITHM)); LOGGER.debug("SignatureHashAlgorithm: " + ArrayConverter.bytesToHexString(msg.getSignatureHashAlgorithm().getValue())); }
/** * Reads the next bytes as a ProtocolVersion and writes them in the message * * @param message * Message to write in */ protected void parseProtocolVersion(HelloMessage message) { message.setProtocolVersion(parseByteArrayField(HandshakeByteLength.VERSION)); LOGGER.debug("ProtocolVersion:" + ArrayConverter.bytesToHexString(message.getProtocolVersion().getValue())); }
public void adjustPremasterSecret(ClientKeyExchangeMessage message) { if (message.getComputations().getPremasterSecret() != null) { byte[] premasterSecret = message.getComputations().getPremasterSecret().getValue(); tlsContext.setPreMasterSecret(premasterSecret); LOGGER.debug("Set PremasterSecret in Context to " + ArrayConverter.bytesToHexString(premasterSecret)); } else { LOGGER.debug("Did not set in Context PremasterSecret"); } }
private void adjustProtocolVersion(ClientHelloMessage message) { ProtocolVersion version = ProtocolVersion.getProtocolVersion(message.getProtocolVersion().getValue()); if (version != null) { tlsContext.setHighestClientProtocolVersion(version); LOGGER.debug("Set HighestClientProtocolVersion in Context to " + version.name()); } else { LOGGER.warn("Did not Adjust ProtocolVersion since version is undefined " + ArrayConverter.bytesToHexString(message.getProtocolVersion().getValue())); } }
/** * Reads the next bytes as the CypherSuites and writes them in the message * * @param msg * Message to write in */ private void parseCipherSuites(ClientHelloMessage msg) { msg.setCipherSuites(parseByteArrayField(msg.getCipherSuiteLength().getValue())); LOGGER.debug("CipherSuites: " + ArrayConverter.bytesToHexString(msg.getCipherSuites().getValue())); }
/** * Reads the next bytes as the Compression and writes them in the message * * @param msg * Message to write in */ private void parseCompressions(ClientHelloMessage message) { message.setCompressions(parseByteArrayField(message.getCompressionLength().getValue())); LOGGER.debug("Compressions: " + ArrayConverter.bytesToHexString(message.getCompressions().getValue())); } }
/** * Reads the next bytes as the PSKIdentity and writes them in the message * * @param msg * Message to write in */ private void parsePskIdentity(PskEcDhClientKeyExchangeMessage msg) { msg.setIdentity(parseByteArrayField(msg.getIdentityLength().getValue())); LOGGER.debug("SerializedPSK-Identity: " + ArrayConverter.bytesToHexString(msg.getIdentity().getValue())); } }
/** * Reads the next bytes as the PSKIdentityHint and writes them in the * message * * @param msg * Message to write in */ private void parsePskIdentityHint(PskDheServerKeyExchangeMessage msg) { msg.setIdentityHint(parseByteArrayField(msg.getIdentityHintLength().getValue())); LOGGER.debug("SerializedPSK-Identity: " + ArrayConverter.bytesToHexString(msg.getIdentityHint().getValue())); } }
/** * Reads the next bytes as the Signature and writes them in the message * * @param msg * Message to write in */ private void parseSignature(DHEServerKeyExchangeMessage msg) { msg.setSignature(parseByteArrayField(msg.getSignatureLength().getValue())); LOGGER.debug("Signature: " + ArrayConverter.bytesToHexString(msg.getSignature().getValue())); } }
/** * Reads the next bytes as the VerifyData and writes them in the message * * @param msg * Message to write in */ private void parseVerifyData(FinishedMessage msg) { msg.setVerifyData(parseByteArrayField(msg.getLength().getValue())); LOGGER.debug("VerifiyData: " + ArrayConverter.bytesToHexString(msg.getVerifyData().getValue())); }
/** * Reads the next bytes as the Signature and writes them in the message * * @param msg * Message to write in */ private void parseSignature(ECDHEServerKeyExchangeMessage msg) { msg.setSignature(parseByteArrayField(msg.getSignatureLength().getValue())); LOGGER.debug("Signature: " + ArrayConverter.bytesToHexString(msg.getSignature().getValue())); } }
/** * Reads the next bytes as the SerializedPublicKey and writes them in the * message * * @param msg * Message to write in */ private void parseSerializedPublicKey(T message) { message.setPublicKey(parseByteArrayField(message.getPublicKeyLength().getValue())); LOGGER.debug("SerializedPublicKey: " + ArrayConverter.bytesToHexString(message.getPublicKey().getValue())); } }
/** * Reads the next bytes as the PSKIdentityHint and writes them in the * message * * @param msg * Message to write in */ private void parsePskIdentityHint(PskServerKeyExchangeMessage msg) { msg.setIdentityHint(parseByteArrayField(msg.getIdentityHintLength().getValue())); LOGGER.debug("SerializedPSK-Identity: " + ArrayConverter.bytesToHexString(msg.getIdentityHint().getValue())); } }
/** * Reads the next bytes as the Certificate and writes them in the message * * @param message * Message to write in */ private void parseCertificate(SSL2ServerHelloMessage message) { message.setCertificate(parseByteArrayField(message.getCertificateLength().getValue())); LOGGER.debug("Certificate: " + ArrayConverter.bytesToHexString(message.getCertificate().getValue())); }
/** * Reads the next bytes as the SerializedPublicKey and writes them in the * message * * @param msg * Message to write in */ private void parseSerializedPublicKey(T msg) { msg.setPublicKey(parseByteArrayField(msg.getPublicKeyLength().getValue())); LOGGER.debug("SerializedPublicKey: " + ArrayConverter.bytesToHexString(msg.getPublicKey().getValue())); }
/** * Reads the next bytes as the PSKIdentityHint and writes them in the * message * * @param msg * Message to write in */ private void parsePskIdentityHint(PskEcDheServerKeyExchangeMessage msg) { msg.setIdentityHint(parseByteArrayField(msg.getIdentityHintLength().getValue())); LOGGER.debug("SerializedPSK-Identity: " + ArrayConverter.bytesToHexString(msg.getIdentityHint().getValue())); } }