Skip to content

Conversation

@stklcode
Copy link
Owner

@stklcode stklcode commented Feb 26, 2025

Introduce new methods to use hashing and de-/encryption with Vault's transit engine1.

Encrypt binary or base64 encoded data

connector.transitEncrypt("my-key", "dGVzdA==");
connector.transitEncrypt("my-key", new byte[]{74, 65, 73, 74});

Decrypt

connector.transitDecrypt("my-key", "vault:v1:oWRLHHjAgjPIrY9cYwIV3BRBO665qVYjSK4roVWFwbG8jgdN")

Hash

connector.transitHash("sha2-512", "dGVzdA==");
connector.transitHash("sha2-512", "dGVzdA==", "hex");  // default
connector.transitHash("sha2-512", "dGVzdA==", "base64");
connector.transitEncrypt("sha2-512", new byte[]{74, 65, 73, 74}, "hex");

Response object (relevant part)

{
  "ciphertext": "...",  // filled on encryption
  "plaintext": "...",   // filled on decryption
  "sum": "..."          // filled on hashing
}

[1] https://developer.hashicorp.com/vault/docs/secrets/transit

@stklcode stklcode self-assigned this Feb 26, 2025
@stklcode stklcode added this to the 1.5 milestone Feb 26, 2025
@stklcode stklcode force-pushed the feat/transit branch 2 times, most recently from 984b53b to e8d1fce Compare February 26, 2025 16:31
Support hashing and de-/encryption using Vault's transit API.
stklcode added a commit that referenced this pull request Mar 28, 2025
Support hashing and de-/encryption using Vault's transit API.
stklcode added a commit that referenced this pull request Mar 28, 2025
Support hashing and de-/encryption using Vault's transit API.
@stklcode stklcode force-pushed the feat/transit branch 2 times, most recently from 1f7fa54 to 0127cf3 Compare March 28, 2025 17:45
@sonarqubecloud
Copy link

@stklcode stklcode marked this pull request as ready for review March 28, 2025 17:48
@stklcode stklcode merged commit 0127cf3 into main Mar 29, 2025
10 checks passed
@stklcode stklcode deleted the feat/transit branch March 29, 2025 07:37
lehelikes pushed a commit to lehelikes/jvaultconnector-fix-98 that referenced this pull request May 28, 2025
…nstead of the lookup which needs extra token policies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants