rskey uses two distinct key file formats depending on the target product. Connect and Package Manager share a 512-byte random key stored as hex, while Workbench accepts any opaque byte sequence of at least 32 bytes — traditionally a UUID.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/rstudio/rskey/llms.txt
Use this file to discover all available pages before exploring further.
Connect & Package Manager key format
Connect and Package Manager keys are 512 bytes of cryptographically secure random data. On disk, the key is stored as 1024 hex characters — each byte encoded as two lowercase hexadecimal characters. This is exactly equivalent to the output of:NewKeyFromBytes and NewKeyFromReader accept both hex and base64-encoded key files. The function first attempts hex decoding; if that fails it falls back to standard base64. In both cases the decoded output must be exactly 512 bytes or ErrInvalidKeyLength is returned.
Writing keys: (*Key).HexString() always produces hex output. Use this when writing a key to disk to ensure compatibility with Connect and Package Manager.
Generating a key:
crypt.KeyLength = 512 (bytes, not encoded characters).
Workbench key format
Workbench keys are 32 or more opaque bytes. Theworkbench package imposes no structure on the content beyond the minimum length: minKeyLength = 32.
Traditionally, Workbench keys are a UUID literal generated by the uuid command:
550e8400-e29b-41d4-a716-446655440000\n is 37 bytes (including the trailing newline), which satisfies the 32-byte minimum.
rskey-generated keys (512 bytes of hex) also satisfy the minimum length requirement and are accepted by workbench.NewKeyFromBytes. You can therefore use a single key file for both Workbench and Connect/Package Manager if needed:
rstudio-server encrypt-password.
Key rotation
Rotating a key requires re-encrypting every secret that was encrypted with the old key before replacing the key file.Identify the current key in use
Use the
rskey fingerprint command to record the fingerprint of the current key. Posit products log this fingerprint, which helps you confirm which key was active when a secret was encrypted.Re-encrypt all secrets
Decrypt each secret with the old key, then encrypt with the new key.Update all product configuration files with the newly encrypted values.
The old key file should be securely deleted after confirming the new key works correctly. Until that point, keep it in a safe location in case a rollback is needed.