public String getSessionPublicKey()

in src/main/java/org/openvasp/client/model/SessionRequest.java [30:48]


    public String getSessionPublicKey() {
        checkState(handshake != null, "handshake must not be null");
        checkState(StringUtils.isNotEmpty(handshake.sessionPublicKey), "handshake.ecdhpk must not be empty");

        val sessionPublicKey = Numeric.cleanHexPrefix(handshake.sessionPublicKey);

        if (sessionPublicKey.length() == ECDHPK_LENGTH) {
            return handshake.sessionPublicKey;
        }

        if (sessionPublicKey.length() == ECDHPK_LENGTH - 2) {
            return "0x04" + sessionPublicKey;
        }

        throw new VaspValidationException(this,
                "The field 'ecdhpk' is invalid - must be a hexadecimal string of length %d, but is: %s",
                ECDHPK_LENGTH,
                sessionPublicKey);
    }