Skip to main content

change_passphrase

Function change_passphrase 

Source
pub fn change_passphrase(
    path: &Path,
    old: Option<&Zeroizing<String>>,
    new: Option<&Zeroizing<String>>,
) -> Result<(), GitwayError>
Expand description

Changes (or adds, or removes) the passphrase on an existing OpenSSH private key.

  • old: the current passphrase, or None if the key is unencrypted.
  • new: the target passphrase, or None to remove encryption.

ยงErrors

Returns GitwayError if the old passphrase is wrong, the key cannot be read, or the new key cannot be written.