/** * Writes the SerializedPublicKeyLength of the SrpServerKeyExchangeMessage * into the final byte[] */ private void writeSerializedPublicKeyLength(SrpServerKeyExchangeMessage msg) { appendInt(msg.getPublicKeyLength().getValue(), HandshakeByteLength.SRP_PUBLICKEY_LENGTH); LOGGER.debug("SerializedPublicKeyLength: " + msg.getPublicKeyLength().getValue()); }
/** * Reads the next bytes as the SerializedPublicKeyLength and writes them in * the message * * @param msg * Message to write in */ private void parseSerializedPublicKeyLength(SrpServerKeyExchangeMessage msg) { msg.setPublicKeyLength(parseIntField(HandshakeByteLength.SRP_PUBLICKEY_LENGTH)); LOGGER.debug("SerializedPublicKeyLength: " + msg.getPublicKeyLength().getValue()); }
private void preparePublicKeyLength(SrpServerKeyExchangeMessage msg) { msg.setPublicKeyLength(msg.getPublicKey().getValue().length); LOGGER.debug("PublicKeyLength: " + msg.getPublicKeyLength().getValue()); }
/** * Reads the next bytes as the SerializedPublicKey and writes them in the * message * * @param msg * Message to write in */ private void parseSerializedPublicKey(SrpServerKeyExchangeMessage msg) { msg.setPublicKey(parseByteArrayField(msg.getPublicKeyLength().getValue())); LOGGER.debug("SerializedPublicKey: " + ArrayConverter.bytesToHexString(msg.getPublicKey().getValue())); }
private byte[] generateToBeSigned() { byte[] srpParams = ArrayConverter.concatenate(ArrayConverter.intToBytes(msg.getModulusLength().getValue(), HandshakeByteLength.SRP_MODULUS_LENGTH), msg.getModulus().getValue(), ArrayConverter.intToBytes(msg .getGeneratorLength().getValue(), HandshakeByteLength.SRP_GENERATOR_LENGTH), msg.getGenerator() .getValue(), ArrayConverter.intToBytes(msg.getSaltLength().getValue(), HandshakeByteLength.SRP_SALT_LENGTH), msg.getSalt().getValue(), ArrayConverter.intToBytes(msg .getPublicKeyLength().getValue(), HandshakeByteLength.SRP_PUBLICKEY_LENGTH), msg.getPublicKey() .getValue()); return ArrayConverter.concatenate(msg.getComputations().getClientServerRandom().getValue(), srpParams); }