private void writeEncryptedKeyData(SSL2ClientMasterKeyMessage msg) { byte[] encryptedKeyData = msg.getEncryptedKeyData().getValue(); appendBytes(encryptedKeyData); LOGGER.debug("EncryptedKey: " + ArrayConverter.bytesToHexString(encryptedKeyData)); }
protected void prepareEncryptedKeyData(SSL2ClientMasterKeyMessage msg) { msg.setEncryptedKeyData(encryptedPremasterSecret); LOGGER.debug("SerializedPublicKey: " + ArrayConverter.bytesToHexString(msg.getEncryptedKeyData().getValue())); }
protected void prepareEncryptedKeyDataLength(SSL2ClientMasterKeyMessage msg) { msg.setEncryptedKeyLength(msg.getEncryptedKeyData().getValue().length); LOGGER.debug("SerializedPublicKeyLength: " + msg.getEncryptedKeyLength().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); }