class InlineKeypair implements ConfigKeyPair {

    @Override
    @NotNull
    @Size(min = 1)
    @ValidBase64(message = "Invalid Base64 key provided")
    @Pattern(regexp = "^((?!NACL_FAILURE).)*$", message = "Could not decrypt the private key with the provided password, please double check the passwords provided")
    public String getPrivateKey() {
        final PrivateKeyData pkd = privateKeyConfig.getPrivateKeyData();

        if (privateKeyConfig.getType() == UNLOCKED) {
            return privateKeyConfig.getValue();
        }

        if (this.cachedValue == null || !Objects.equals(this.cachedPassword, this.password)) {
            if (password != null) {
                try {
                    this.cachedValue = keyEncryptor.decryptPrivateKey(pkd, password).encodeToBase64();
                } catch (final EncryptorException ex) {
                    this.cachedValue = "NACL_FAILURE";
                }
            }
        }

        this.cachedPassword = this.password;

        return this.cachedValue;
    }

    public  InlineKeypair(final String publicKey, final KeyDataConfig privateKeyConfig, KeyEncryptor keyEncryptor);

}