|
NanoXLSX.Core 3.0.0-rc.3
|
Class implementing a legacy password, based on the proprietary hashing algorithm of Excel. More...
Public Types | |
| enum | PasswordType { WorkbookProtection , WorksheetProtection } |
| Target type of the password. More... | |
Public Member Functions | |
| LegacyPassword (PasswordType type) | |
| Default constructor with parameter. | |
| string | GetPassword () |
| Gets the pain text password. | |
| void | SetPassword (string plainText) |
| Sets the current password and calculates the hash. | |
| void | UnsetPassword () |
| Removes the password form the current instance. | |
| bool | PasswordIsSet () |
| Gets whether a password was set. | |
| void | CopyFrom (IPassword passwordInstance) |
| Copes all data from another class instance. | |
| override bool | Equals (object obj) |
| Returns whether two instances are the same. | |
| override int | GetHashCode () |
| Gets the hash code of the password instance. Note that this is not the actual password hash. | |
Static Public Member Functions | |
| static string | GenerateLegacyPasswordHash (string password) |
| Method to generate a legacy (Excel internal) password hash, to protect workbooks or worksheets This method is derived from the c++ implementation by Kohei Yoshida (http://kohei.us/2008/01/18/excel-sheet-protection-password-hash/). | |
Properties | |
| PasswordType | Type [get, set] |
| Current target type of the password instance. | |
| string | PasswordHash [get, set] |
| Gets or sets the hashed password. | |
Class implementing a legacy password, based on the proprietary hashing algorithm of Excel.
Definition at line 20 of file LegacyPassword.cs.
Target type of the password.
| Enumerator | |
|---|---|
| WorkbookProtection | Password is used to protect a workbook. |
| WorksheetProtection | Password is used to protect a worksheet. |
Definition at line 25 of file LegacyPassword.cs.
| NanoXLSX.LegacyPassword.LegacyPassword | ( | PasswordType | type | ) |
Default constructor with parameter.
| type | Current target type of the password instance |
Definition at line 54 of file LegacyPassword.cs.
| void NanoXLSX.LegacyPassword.CopyFrom | ( | IPassword | passwordInstance | ) |
Copes all data from another class instance.
| passwordInstance | Other instance (source) |
Implements NanoXLSX.Interfaces.IPassword.
Definition at line 116 of file LegacyPassword.cs.
| override bool NanoXLSX.LegacyPassword.Equals | ( | object | obj | ) |
Returns whether two instances are the same.
| obj | Object to compare |
Definition at line 200 of file LegacyPassword.cs.
|
static |
Method to generate a legacy (Excel internal) password hash, to protect workbooks or worksheets
This method is derived from the c++ implementation by Kohei Yoshida (http://kohei.us/2008/01/18/excel-sheet-protection-password-hash/).
| password | Password string in UTF-8 to encrypt. Null or an empty string (even technical valid) are not allowed, since they cannot be inserted in a password field in Excel |
Definition at line 132 of file LegacyPassword.cs.
| override int NanoXLSX.LegacyPassword.GetHashCode | ( | ) |
Gets the hash code of the password instance. Note that this is not the actual password hash.
Definition at line 213 of file LegacyPassword.cs.
| string NanoXLSX.LegacyPassword.GetPassword | ( | ) |
Gets the pain text password.
Implements NanoXLSX.Interfaces.IPassword.
Definition at line 64 of file LegacyPassword.cs.
| bool NanoXLSX.LegacyPassword.PasswordIsSet | ( | ) |
Gets whether a password was set.
Implements NanoXLSX.Interfaces.IPassword.
Definition at line 107 of file LegacyPassword.cs.
| void NanoXLSX.LegacyPassword.SetPassword | ( | string | plainText | ) |
Sets the current password and calculates the hash.
| plainText | Plain text password. If null or empty, the password will be unset |
Implements NanoXLSX.Interfaces.IPassword.
Definition at line 77 of file LegacyPassword.cs.
| void NanoXLSX.LegacyPassword.UnsetPassword | ( | ) |
Removes the password form the current instance.
Implements NanoXLSX.Interfaces.IPassword.
Definition at line 94 of file LegacyPassword.cs.
|
getset |
Gets or sets the hashed password.
Implements NanoXLSX.Interfaces.IPassword.
Definition at line 48 of file LegacyPassword.cs.
|
getset |
Current target type of the password instance.
Definition at line 42 of file LegacyPassword.cs.