Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/Api/Vault/Models/CipherSSHKeyModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,37 @@ public CipherSSHKeyModel(CipherSSHKeyData data)
PrivateKey = data.PrivateKey;
PublicKey = data.PublicKey;
KeyFingerprint = data.KeyFingerprint;

// Map new optional properties if present
OriginalPrivateKey = data.OriginalPrivateKey;
IsEncrypted = data.IsEncrypted;
SshKeyPassphrase = data.SshKeyPassphrase;
}

[EncryptedString]
[EncryptedStringLength(5000)]
public string PrivateKey { get; set; }

[EncryptedString]
[EncryptedStringLength(5000)]
public string PublicKey { get; set; }

[EncryptedString]
[EncryptedStringLength(1000)]
public string KeyFingerprint { get; set; }

// Preserve original encrypted PEM verbatim
[EncryptedString]
[EncryptedStringLength(5000)]
public string OriginalPrivateKey { get; set; }

// Transported as encrypted string ("true"/"false")
[EncryptedString]
[EncryptedStringLength(10)]
public string IsEncrypted { get; set; }

// Optional stored passphrase (encrypted)
[EncryptedString]
[EncryptedStringLength(5000)]
public string SshKeyPassphrase { get; set; }
}
5 changes: 5 additions & 0 deletions src/Api/Vault/Models/Request/CipherRequestModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ private CipherSSHKeyData ToCipherSSHKeyData()
PrivateKey = SSHKey.PrivateKey,
PublicKey = SSHKey.PublicKey,
KeyFingerprint = SSHKey.KeyFingerprint,

// Preserve original encrypted PEM and optional passphrase; track encryption flag
OriginalPrivateKey = SSHKey.OriginalPrivateKey,
IsEncrypted = SSHKey.IsEncrypted,
SshKeyPassphrase = SSHKey.SshKeyPassphrase,
};
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/Core/Vault/Models/Data/CipherSSHKeyData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ public CipherSSHKeyData() { }
public string PrivateKey { get; set; }
public string PublicKey { get; set; }
public string KeyFingerprint { get; set; }

// New fields to preserve original encrypted key and optional passphrase
public string OriginalPrivateKey { get; set; }
// Booleans are typically transported as encrypted strings ("true"/"false") in Bitwarden models
public string IsEncrypted { get; set; }
public string SshKeyPassphrase { get; set; }
}
Loading