pub fn encrypt_with_key(&self, key: &Path) -> anyhow::Result<()> {
        // Create output file
        let path = self
            .get_filepath()
            .context("Path of password is not set (this should not happen)")?;

        let parent_path = path.parent().context("Get parent folder")?;
        std::fs::create_dir_all(parent_path).context("Creating folders for password")?;

        let mut output = File::create(path)?;

        // Get pgp key
        let cert = Cert::from_file(key).context("Failed to load key from file")?;

        // Get password contents
        let contents = self.to_string()?;

        encrypt(&contents, &mut output, &cert)
    }
/// Encrypt the password using a key contained in the file `key`
Encrypt the password using a key contained in the file `key`
Encrypt the password using a key contained in the file ` key `
pub fn encrypt_with_key(&self, key: &Path) -> anyhow::Result<()> {
        // Create output file
        let path = self
            .get_filepath()
            .context("Path of password is not set (this should not happen)")?;
        let parent_path = path.parent().context("Get parent folder")?;
        std::fs::create_dir_all(parent_path).context("Creating folders for password")?;
        let mut output = File::create(path)?;
        // Get pgp key
        let cert = Cert::from_file(key).context("Failed to load key from file")?;
        // Get password contents
        let contents = self.to_string()?;
        encrypt(&contents, &mut output, &cert)
    }
pub fn encrypt_with_key ( & self , key : & Path ) -> anyhow :: Result < ( ) > { // Create output file let path = self . get_filepath ( ) . context ( " " ) ? ; let parent_path = path . parent ( ) . context ( " " ) ? ; std :: fs :: create_dir_all ( parent_path ) . context ( " " ) ? ; let mut output = File :: create ( path ) ? ; // Get pgp key let cert = Cert :: from_file ( key ) . context ( " " ) ? ; // Get password contents let contents = self . to_string ( ) ? ; encrypt ( & contents , & mut output , & cert ) }
Encrypt the password using a key contained in the file `key`
Encrypt the password using a key contained in the file ` key `
&self
key
&Path
&self
key
&Path