Documentation
¶
Overview ¶
Package remote provides remote config fetch with optional RSA decryption.
Index ¶
Constants ¶
const ( // EncryptedContentType is the Content-Type value when response body is RSA+AES encrypted. EncryptedContentType = "application/x-warden-encrypted" // RSAKeySize2048 ciphertext block size in bytes. RSAKeySize2048 = 256 // AESKeySize + IVSize = 32 + 16 = 48 bytes encrypted by RSA. AESKeySize = 32 // IVSize is the AES CTR IV size in bytes. IVSize = 16 )
Variables ¶
This section is empty.
Functions ¶
func FetchDecrypted ¶
func FetchDecrypted(ctx context.Context, url, authHeader string, decryptEnabled bool, rsaKeyPath, rsaKeyPEM string, timeout time.Duration, insecureTLS bool) ([]byte, error)
FetchDecrypted fetches url with optional auth header. If decryptEnabled and rsaKey (file path or PEM) are set, and response Content-Type is EncryptedContentType (or body looks like base64), decrypts with RSA private key. Expected encrypted format: base64( RSA-OAEP_SHA256(aes_key_32 + iv_16) || aes_ctr_ciphertext ). Returns decrypted or raw body and error. rsaKeyPath and rsaKeyPEM: use file when rsaKeyPath is non-empty, else use rsaKeyPEM (inline PEM).
func FetchDecryptedUsers ¶
func FetchDecryptedUsers(ctx context.Context, url, authHeader string, decryptEnabled bool, rsaKeyPath, rsaKeyPEM string, timeout time.Duration, insecureTLS bool) ([]define.AllowListUser, error)
FetchDecryptedUsers fetches remote URL and returns parsed []AllowListUser. If decrypt is enabled and response is encrypted, decrypts then parses JSON. rsaKeyPath and rsaKeyPEM: use file when rsaKeyPath is non-empty, else use rsaKeyPEM.
Types ¶
This section is empty.