@Override protected SrpServerKeyExchangeMessage createHandshakeMessage() { return new SrpServerKeyExchangeMessage(); }
private void prepareSalt(SrpServerKeyExchangeMessage msg) { msg.setSalt(msg.getComputations().getSalt()); LOGGER.debug("Salt: " + ArrayConverter.bytesToHexString(msg.getSalt().getValue())); }
private void prepareGeneratorLength(SrpServerKeyExchangeMessage msg) { msg.setGeneratorLength(msg.getGenerator().getValue().length); LOGGER.debug("Generator Length: " + msg.getGeneratorLength().getValue()); }
private void prepareSaltLength(SrpServerKeyExchangeMessage msg) { msg.setSaltLength(msg.getSalt().getValue().length); LOGGER.debug("Salt Length: " + msg.getSaltLength().getValue()); }
private void preparePublicKeyLength(SrpServerKeyExchangeMessage msg) { msg.setPublicKeyLength(msg.getPublicKey().getValue().length); LOGGER.debug("PublicKeyLength: " + msg.getPublicKeyLength().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); }
private void prepareModulusLength(SrpServerKeyExchangeMessage msg) { msg.setModulusLength(msg.getModulus().getValue().length); LOGGER.debug("Modulus Length: " + msg.getModulusLength().getValue()); }
/** * Reads the next bytes as N and writes them in the message * * @param msg * Message to write in */ private void parseModulus(SrpServerKeyExchangeMessage msg) { msg.setModulus(parseByteArrayField(msg.getModulusLength().getValue())); LOGGER.debug("Modulus: " + Arrays.toString(msg.getModulus().getValue())); }
/** * Reads the next bytes as G and writes them in the message * * @param msg * Message to write in */ private void parseGenerator(SrpServerKeyExchangeMessage msg) { msg.setGenerator(parseByteArrayField(msg.getGeneratorLength().getValue())); LOGGER.debug("G: " + Arrays.toString(msg.getGenerator().getValue())); }
/** * Reads the next bytes as Salt and writes them in the message * * @param msg * Message to write in */ private void parseSalt(SrpServerKeyExchangeMessage msg) { msg.setSalt(parseByteArrayField(msg.getSaltLength().getValue())); LOGGER.debug("Salt: " + Arrays.toString(msg.getSalt().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 void prepareModulus(SrpServerKeyExchangeMessage msg) { msg.setModulus(msg.getComputations().getModulus().getByteArray()); LOGGER.debug("Modulus: " + ArrayConverter.bytesToHexString(msg.getModulus().getValue())); }
private void prepareGenerator(SrpServerKeyExchangeMessage msg) { msg.setGenerator(msg.getComputations().getGenerator().getByteArray()); LOGGER.debug("Generator: " + ArrayConverter.bytesToHexString(msg.getGenerator().getValue())); }
if (getPublicKey() != null && getPublicKey().getValue() != null) { sb.append(ArrayConverter.bytesToHexString(getPublicKey().getValue(), false)); } else { sb.append("null"); if (this.getSignatureAndHashAlgorithm() != null && getSignatureAndHashAlgorithm().getValue() != null) { sb.append(ArrayConverter.bytesToHexString(getSignatureAndHashAlgorithm().getValue())); } else { sb.append("null"); if (this.getSignature() != null && getSignature().getValue() != null) { sb.append(ArrayConverter.bytesToHexString(this.getSignature().getValue())); } else { sb.append("null");
@Override public void prepareComputations() { if (getComputations() == null) { computations = new SRPServerComputations(); } }
/** * Reads the next bytes as the gLength and writes them in the message * * @param msg * Message to write in */ private void parseGeneratorLength(SrpServerKeyExchangeMessage msg) { msg.setGeneratorLength(parseIntField(HandshakeByteLength.SRP_GENERATOR_LENGTH)); LOGGER.debug("gLength: " + msg.getGeneratorLength().getValue()); }
private void preparePublicKey(SrpServerKeyExchangeMessage msg) { msg.setPublicKey(publicKey.toByteArray()); LOGGER.debug("PublicKey: " + ArrayConverter.bytesToHexString(msg.getPublicKey().getValue())); }
/** * Reads the next bytes as the nLength and writes them in the message * * @param msg * Message to write in */ private void parseModulusLength(SrpServerKeyExchangeMessage msg) { msg.setModulusLength(parseIntField(HandshakeByteLength.SRP_MODULUS_LENGTH)); LOGGER.debug("Modulus Length: " + msg.getModulusLength().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()); }
/** * Reads the next bytes as the saltLength and writes them in the message * * @param msg * Message to write in */ private void parseSaltLength(SrpServerKeyExchangeMessage msg) { msg.setSaltLength(parseIntField(HandshakeByteLength.SRP_SALT_LENGTH)); LOGGER.debug("Salt Length: " + msg.getSaltLength().getValue()); }