Package io.toro.martini
Class VaultMethods
- java.lang.Object
-
- io.toro.martini.VaultMethods
-
public final class VaultMethods extends Object
Methods for Hashicorp Vault
-
-
Field Summary
Fields Modifier and Type Field Description static String
CIPHERTEXT
static String
ENCRYPTION_KEY
static String
PLAINTEXT
static String
PLAINTEXT_AS_BYTE_ARRAY
static String
PLAINTEXT_AS_STRING
static String
SIGNATURE
-
Constructor Summary
Constructors Constructor Description VaultMethods(io.toro.martini.vault.VaultProvider provider)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static GloopModel
decrypt(String packageName, GloopModel task)
Decrypt a ciphertext using transit secret enginestatic void
delete(String packageName, GloopModel task)
Deletes data from the kv engine version 1static void
deleteVersioned(String packageName, GloopModel task)
Deletes data from the kv engine version 2static void
destroyVersioned(String packageName, GloopModel task)
Permanently removes a version of the data in the kv engine version 2static GloopModel
encryptByteArray(String packageName, GloopModel task)
Encrypt a byte array plaintext using transit secret enginestatic GloopModel
encryptString(String packageName, GloopModel task)
Encrypt a string plaintext using transit secret enginestatic GloopModel
read(String packageName, GloopModel task)
Reads data from the kv engine version 1static String
readData(String packageName, GloopModel task, String fieldKey)
Read a specific field of the data to the kv engine version 1static GloopModel
readVersioned(String packageName, GloopModel task)
Reads data from the kv engine version 2static String
readVersionedData(String packageName, GloopModel task, String fieldKey)
Read a specific field of the data to the kv engine version 2static String
rewrap(String packageName, GloopModel task)
Update the ciphertext to the latest version of the encryption keystatic void
rotate(String packageName, GloopModel task)
Rotates the version of the named key.static GloopModel
signByteArray(String packageName, GloopModel task)
Sign a byte array plaintext.static GloopModel
signString(String packageName, GloopModel task)
Sign a string plaintext.static void
undeleteVersioned(String packageName, GloopModel task)
Restores a version of the data in the kv engine version 2static boolean
verifyByteArray(String packageName, GloopModel task)
static boolean
verifyString(String packageName, GloopModel task)
Verify the signature of a string plaintext.static GloopModel
write(String packageName, GloopModel task)
Writes data to the kv engine version 1static GloopModel
writeVersioned(String packageName, GloopModel task)
Writes data to the kv engine version 2
-
-
-
Field Detail
-
ENCRYPTION_KEY
public static final String ENCRYPTION_KEY
- See Also:
- Constant Field Values
-
PLAINTEXT_AS_STRING
public static final String PLAINTEXT_AS_STRING
- See Also:
- Constant Field Values
-
CIPHERTEXT
public static final String CIPHERTEXT
- See Also:
- Constant Field Values
-
SIGNATURE
public static final String SIGNATURE
- See Also:
- Constant Field Values
-
PLAINTEXT_AS_BYTE_ARRAY
public static final String PLAINTEXT_AS_BYTE_ARRAY
- See Also:
- Constant Field Values
-
PLAINTEXT
public static final String PLAINTEXT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
VaultMethods
@Autowired public VaultMethods(io.toro.martini.vault.VaultProvider provider)
-
-
Method Detail
-
read
@GloopObjectParameter("output{\n vaultResponse#io.toro.martini.vault.VaultResponse{\n }\n}") public static final GloopModel read(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task)
Reads data from the kv engine version 1- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The secret's path must be specified in pathToKey.- Since:
- 2.0
-
readVersioned
@GloopObjectParameter("output{\n versionedResponse#io.toro.martini.vault.Versioned{\n }\n}") public static final GloopModel readVersioned(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task)
Reads data from the kv engine version 2- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The path where kv v2 (versioned) engine is mounted should be specified in mountPath. The secret's path must be specified in pathToKey as well. To access a specific version, specify the version number.- Since:
- 2.0
-
readData
public static String readData(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task, String fieldKey)
Read a specific field of the data to the kv engine version 1- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The path where kv v2 (versioned) engine is mounted should be specified in mountPath. The secret's path must be specified in pathToKey as well. To specify key-values, add element/s to values.fieldKey
- the name of the field to be fetched from the data- Since:
- 2
-
readVersionedData
public static String readVersionedData(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task, String fieldKey)
Read a specific field of the data to the kv engine version 2- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The path where kv v2 (versioned) engine is mounted should be specified in mountPath. The secret's path must be specified in pathToKey as well. To specify key-values, add element/s to values.fieldKey
- the name of the field to be fetched from the data- Since:
- 2.0
-
write
@GloopObjectParameter("output{\n vaultResponse#io.toro.martini.vault.VaultResponse{\n }\n}") public static final GloopModel write(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task)
Writes data to the kv engine version 1- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The secret's path must be specified in pathToKey. To specify key-values, add element/s to values.- Since:
- 2.0
-
writeVersioned
@GloopObjectParameter("output{\n versionedResponse#io.toro.martini.vault.Versioned{\n }\n}") public static final GloopModel writeVersioned(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task)
Writes data to the kv engine version 2- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The path where kv v2 (versioned) engine is mounted should be specified in mountPath. The secret's path must be specified in pathToKey as well. To specify key-values, add element/s to values.- Since:
- 2.0
-
delete
public static final void delete(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task)
Deletes data from the kv engine version 1- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The secret's path must be specified in pathToKey.- Since:
- 2.0
-
deleteVersioned
public static final void deleteVersioned(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task)
Deletes data from the kv engine version 2- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The path where kv v2 (versioned) engine is mounted should be specified in mountPath. The secret's path must be specified in pathToKey as well. To delete a specific version, specify the version number.- Since:
- 2.0
-
undeleteVersioned
public static final void undeleteVersioned(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task)
Restores a version of the data in the kv engine version 2- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The path where kv v2 (versioned) engine is mounted should be specified in mountPath. The secret's path must be specified in pathToKey and the version number should be appropriately set as well.- Since:
- 2.0
-
destroyVersioned
public static final void destroyVersioned(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task)
Permanently removes a version of the data in the kv engine version 2- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The path where kv v2 (versioned) engine is mounted should be specified in mountPath. The secret's path must be specified in pathToKey and the version number should be appropriately set as well.- Since:
- 2.0
-
encryptString
@GloopObjectParameter("output{\n ciphertext#io.toro.martini.vault.Ciphertext{\n }\n}") public static final GloopModel encryptString(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task)
Encrypt a string plaintext using transit secret engine- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The path where transit secrets engine is mounted should be specified in mountPath. The encryption key must be existing in Vault and should be specified in transitOpts.encryptionKey. The plaintext to encrypt should be specified in transitOpts.plaintextAsString.- Returns:
-
encryptByteArray
@GloopObjectParameter("output{\n ciphertext#io.toro.martini.vault.Ciphertext{\n }\n}") public static final GloopModel encryptByteArray(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task)
Encrypt a byte array plaintext using transit secret engine- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The path where transit secrets engine is mounted should be specified in mountPath. The encryption key must be existing in Vault and should be specified in transitOpts.encryptionKey. The plaintext to encrypt should be specified in transitOpts.plaintextAsByteArray.- Returns:
-
decrypt
@GloopObjectParameter("output{\n plaintext#io.toro.martini.vault.Plaintext{\n }\n}") public static final GloopModel decrypt(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task)
Decrypt a ciphertext using transit secret engine- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The path where transit secrets engine is mounted should be specified in mountPath. The encryption key must be existing in Vault and should be specified in transitOpts.encryptionKey. The ciphertext to decrypt should be specified in transitOpts.ciphertext.- Returns:
-
rewrap
public static final String rewrap(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task)
Update the ciphertext to the latest version of the encryption key- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The path where transit secrets engine is mounted should be specified in mountPath. The encryption key must be existing in Vault and should be specified in transitOpts.encryptionKey. The ciphertext to rewrap should be specified in transitOpts.ciphertext.- Returns:
-
rotate
public static final void rotate(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task)
Rotates the version of the named key.- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The path where kv v2 (versioned) engine is mounted should be specified in mountPath. The secret's path must be specified in pathToKey and the version number should be appropriately set as well.- Since:
- 2.0
-
signString
@GloopObjectParameter("output{\n signature#io.toro.martini.vault.Signature{\n }\n}") public static final GloopModel signString(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task)
Sign a string plaintext. The key used must support signing.- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The path where transit secrets engine is mounted should be specified in mountPath. The encryption key must be existing in Vault and should be specified in transitOpts.encryptionKey. The string plaintext to sign should be specified in transitOpts.plaintextAsString.- Returns:
-
signByteArray
@GloopObjectParameter("output{\n signature#io.toro.martini.vault.Signature{\n }\n}") public static final GloopModel signByteArray(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task)
Sign a byte array plaintext. The key used must support signing.- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The path where transit secrets engine is mounted should be specified in mountPath. The encryption key must be existing in Vault and should be specified in transitOpts.encryptionKey. The byte array plaintext to sign should be specified in transitOpts.plaintextAsByteArray.- Returns:
-
verifyString
public static final boolean verifyString(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task)
Verify the signature of a string plaintext.- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The path where transit secrets engine is mounted should be specified in mountPath. The encryption key must be existing in Vault and should be specified in transitOpts.encryptionKey. The signature to verify should be specified in transitOpts.signature and the string plaintext in transitOpts.plaintextAsString.- Returns:
-
verifyByteArray
public static final boolean verifyByteArray(@GloopParameter(allowNull=true) String packageName, @GloopObjectParameter("task#io.toro.martini.vault.Task{\n }\n") GloopModel task)
- Parameters:
packageName
- the name of the package where Vault instance residestask
- the gloop model containing data to be sent to Vault. The path where transit secrets engine is mounted should be specified in mountPath. The encryption key must be existing in Vault and should be specified in transitOpts.encryptionKey. The signature to verify should be specified in transitOpts.signature and the byte array plaintext in transitOpts.plaintextAsByteArray.- Returns:
-
-