diff options
author | Tor Brede Vekterli <vekterli@yahooinc.com> | 2022-10-26 11:44:37 +0200 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@yahooinc.com> | 2022-10-27 13:57:40 +0200 |
commit | a1187ccd114037ffa033cb95165c94a5352849cc (patch) | |
tree | 7e591c596482c337162d31a2f331f42b4f2c69ae /vespaclient-java/src/main/java/com/yahoo/vespa/security/tool/CliUtils.java | |
parent | 15719d50be8f37fdf78f4e6855af26c7d47d0ad8 (diff) |
Add basic tooling for public key encryption and decryption
Adds support for:
* X25519 key pair generation
* HPKE stream encryption with public key and token generation
* HPKE stream decryption with private key
Diffstat (limited to 'vespaclient-java/src/main/java/com/yahoo/vespa/security/tool/CliUtils.java')
-rw-r--r-- | vespaclient-java/src/main/java/com/yahoo/vespa/security/tool/CliUtils.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/vespaclient-java/src/main/java/com/yahoo/vespa/security/tool/CliUtils.java b/vespaclient-java/src/main/java/com/yahoo/vespa/security/tool/CliUtils.java new file mode 100644 index 00000000000..e9b348ab2a2 --- /dev/null +++ b/vespaclient-java/src/main/java/com/yahoo/vespa/security/tool/CliUtils.java @@ -0,0 +1,19 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.security.tool; + +import org.apache.commons.cli.CommandLine; + +/** + * @author vekterli + */ +public class CliUtils { + + public static String optionOrThrow(CommandLine arguments, String option) { + var value = arguments.getOptionValue(option); + if (value == null) { + throw new IllegalArgumentException("Required argument '--%s' must be provided".formatted(option)); + } + return value; + } + +} |