struct Libcrown::Password
- Libcrown::Password
- Struct
- Value
- Object
Overview
Represents a password line of /etc/shadow
.
Defined in:
password.crConstructors
-
.new(crypto : Encryption = Encryption::PasswordLocked, salt : String? = nil, hash : String? = nil, days_last_change : UInt32? = nil, days_before_change : UInt32? = 0_u32, days_validity : UInt32? = 99999_u32, days_expiration_warning : UInt32? = 7_u32, days_account_disabling_after_expiration : UInt32? = nil, days_since_account_disabling : UInt32? = nil)
Creates a new password.
-
.new(password : String, crypto : Encryption = Encryption::SHA512, salt : String? = Random::Secure.base64.rchop.rchop, days_last_change : UInt32? = (Time.utc - Time::UNIX_EPOCH).days.to_u32)
Create a new encrypted password.
Instance Method Summary
-
#build(user : String, io : IO) : Nil
Build the password to the given
io
. -
#crypto : Encryption
Encryption type.
-
#days_account_disabling_after_expiration : UInt32?
The number of days after a password expires before the account will be disabled.
-
#days_account_disabling_after_expiration=(days_account_disabling_after_expiration : UInt32?)
The number of days after a password expires before the account will be disabled.
-
#days_before_change : UInt32?
The minimum number of days that must pass before the password can be changed.
-
#days_before_change=(days_before_change : UInt32?)
The minimum number of days that must pass before the password can be changed.
-
#days_expiration_warning : UInt32?
The number of days before password expiration during which the user is warned of the impending expiration.
-
#days_expiration_warning=(days_expiration_warning : UInt32?)
The number of days before password expiration during which the user is warned of the impending expiration.
-
#days_last_change : UInt32?
The number of days since January 1, 1970 (also called the epoch) that the password was last changed.
-
#days_since_account_disabling : UInt32?
The date (stored as the number of days since the epoch) since the user account has been disabled.
-
#days_since_account_disabling=(days_since_account_disabling : UInt32?)
The date (stored as the number of days since the epoch) since the user account has been disabled.
-
#days_validity : UInt32?
The number of days that must pass before the password must be changed.
-
#days_validity=(days_validity : UInt32?)
The number of days that must pass before the password must be changed.
-
#encrypt(password : String, crypto : Algorithm = Algorithm::SHA512, salt : String? = Random::Secure.base64.rchop.rchop, days_last_change : UInt32? = (Time.utc - Time::UNIX_EPOCH).days.to_u32) : UInt32
Encrypt a password.
-
#hash : String?
Password's hash.
-
#salt : String?
Password's salt.
-
#verify(password : String) : Bool
The password match the encrypted hash.
Constructor Detail
Creates a new password.
Create a new encrypted password.
Instance Method Detail
The number of days after a password expires before the account will be disabled.
The number of days after a password expires before the account will be disabled.
The minimum number of days that must pass before the password can be changed.
The minimum number of days that must pass before the password can be changed.
The number of days before password expiration during which the user is warned of the impending expiration.
The number of days before password expiration during which the user is warned of the impending expiration.
The number of days since January 1, 1970 (also called the epoch) that the password was last changed.
The date (stored as the number of days since the epoch) since the user account has been disabled.
The date (stored as the number of days since the epoch) since the user account has been disabled.
The number of days that must pass before the password must be changed.
The number of days that must pass before the password must be changed.
Encrypt a password. Can be used to create or update the password.