]>
git.proxmox.com Git - proxmox-backup.git/blob - pbs-tools/src/auth.rs
6e605dd85b8382d431b54d7898b1e63650031502
1 //! Helpers for authentication used by both client and server.
4 use lazy_static
::lazy_static
;
5 use openssl
::pkey
::{PKey, Private}
;
8 use proxmox
::tools
::fs
::file_get_contents
;
10 use pbs_buildcfg
::configdir
;
12 fn load_private_auth_key() -> Result
<PKey
<Private
>, Error
> {
13 let pem
= file_get_contents(configdir
!("/authkey.key"))?
;
14 let rsa
= Rsa
::private_key_from_pem(&pem
)?
;
15 let key
= PKey
::from_rsa(rsa
)?
;
20 pub fn private_auth_key() -> &'
static PKey
<Private
> {
22 static ref KEY
: PKey
<Private
> = load_private_auth_key().unwrap();