diff options
author | Tim Vilgot Mikael Fredenberg <[email protected]> | 2023-04-23 11:24:27 +0200 |
---|---|---|
committer | Tim Vilgot Mikael Fredenberg <[email protected]> | 2023-04-23 21:34:26 +0200 |
commit | 55c1b6e8d5860cded720b079de25e5de52cad026 (patch) | |
tree | 1847aa165d54f94dcf798b92bbc8ab357c6161a1 /src/auth.rs | |
parent | 3d7e80a7aa54b74dbbcffb013bac3149ba2bf139 (diff) | |
download | vaultwarden-55c1b6e8d5860cded720b079de25e5de52cad026.tar.gz vaultwarden-55c1b6e8d5860cded720b079de25e5de52cad026.zip |
inline static rsa keys
Diffstat (limited to 'src/auth.rs')
-rw-r--r-- | src/auth.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/auth.rs b/src/auth.rs index b1b68af5..78224e08 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -24,17 +24,14 @@ static JWT_VERIFYEMAIL_ISSUER: Lazy<String> = Lazy::new(|| format!("{}|verifyema static JWT_ADMIN_ISSUER: Lazy<String> = Lazy::new(|| format!("{}|admin", CONFIG.domain_origin())); static JWT_SEND_ISSUER: Lazy<String> = Lazy::new(|| format!("{}|send", CONFIG.domain_origin())); -static PRIVATE_RSA_KEY_VEC: Lazy<Vec<u8>> = Lazy::new(|| { - std::fs::read(CONFIG.private_rsa_key()).unwrap_or_else(|e| panic!("Error loading private RSA Key.\n{e}")) -}); static PRIVATE_RSA_KEY: Lazy<EncodingKey> = Lazy::new(|| { - EncodingKey::from_rsa_pem(&PRIVATE_RSA_KEY_VEC).unwrap_or_else(|e| panic!("Error decoding private RSA Key.\n{e}")) -}); -static PUBLIC_RSA_KEY_VEC: Lazy<Vec<u8>> = Lazy::new(|| { - std::fs::read(CONFIG.public_rsa_key()).unwrap_or_else(|e| panic!("Error loading public RSA Key.\n{e}")) + let key = + std::fs::read(CONFIG.private_rsa_key()).unwrap_or_else(|e| panic!("Error loading private RSA Key. \n{e}")); + EncodingKey::from_rsa_pem(&key).unwrap_or_else(|e| panic!("Error decoding private RSA Key.\n{e}")) }); static PUBLIC_RSA_KEY: Lazy<DecodingKey> = Lazy::new(|| { - DecodingKey::from_rsa_pem(&PUBLIC_RSA_KEY_VEC).unwrap_or_else(|e| panic!("Error decoding public RSA Key.\n{e}")) + let key = std::fs::read(CONFIG.public_rsa_key()).unwrap_or_else(|e| panic!("Error loading public RSA Key. \n{e}")); + DecodingKey::from_rsa_pem(&key).unwrap_or_else(|e| panic!("Error decoding public RSA Key.\n{e}")) }); pub fn load_keys() { |