private void writeCipherKind(SSL2ClientMasterKeyMessage msg) { byte[] cipherKindValue = msg.getCipherKind().getValue(); appendBytes(cipherKindValue); LOGGER.debug("CipherKind: " + Arrays.toString(cipherKindValue)); } }
private void prepareCipherKind(SSL2ClientMasterKeyMessage message) { // by default we currently just try export RC4 message.setCipherKind(ArrayConverter.hexStringToByteArray("020080")); LOGGER.debug("CipherKind: " + ArrayConverter.bytesToHexString(message.getCipherKind().getValue())); }
@Override public String toString() { StringBuilder sb = new StringBuilder(super.toString()); if (getCipherKind() != null && getCipherKind().getValue() != null) { sb.append("\n Cipher Kind: ").append(getCipherKind().getValue()); } if (getClearKeyData() != null && getClearKeyData().getValue() != null) { sb.append("\n Clear Key Data: ").append(ArrayConverter.bytesToHexString(getClearKeyData().getValue())); } if (getEncryptedKeyData() != null && getEncryptedKeyData().getValue() != null) { sb.append("\n Encrypted Key Data: ").append( ArrayConverter.bytesToHexString(getEncryptedKeyData().getValue())); } if (getKeyArgData() != null && getKeyArgData().getValue() != null) { sb.append("\n Key Arg Data: ").append(ArrayConverter.bytesToHexString(getKeyArgData().getValue())); } return sb.toString(); } }
@Override protected void prepareProtocolMessageContents() { LOGGER.debug("Prepare SSL2ClientMasterKey"); prepareType(message); prepareCipherKind(message); prepareClearKey(message); prepareClearKeyLength(message); prepareKeyArgLength(message); // TODO: Add keyArgData if we want to also support block ciphers. LOGGER.debug("RSA Modulus: " + chooser.getServerRsaModulus().toString()); prepareRSACiphertext(message); final int lengthFieldLength = 2; int length = SSL2ByteLength.MESSAGE_TYPE; length += message.getCipherKind().getValue().length; length += message.getClearKeyData().getValue().length + lengthFieldLength; length += message.getEncryptedKeyData().getValue().length + lengthFieldLength; length += lengthFieldLength; // for keyArgLength prepareMessageLength(message, length); }