Пример #1
0
 /// <summary>
 /// Constructor with host attributes
 /// </summary>
 /// <param name="type">The type attribute.</param>
 /// <param name="passwordFormat">The password format attribute.</param>
 /// <param name="authorisationCode">The authorisation code attribute.</param>
 /// <param name="hashcodeType">The hashcode type attribute.</param>
 public EncoderElement(String type, Nequeo.Cryptography.PasswordFormat passwordFormat, String authorisationCode, Nequeo.Cryptography.HashcodeType hashcodeType)
 {
     TypeValue         = type;
     PasswordFormat    = passwordFormat;
     AuthorisationCode = authorisationCode;
     HashcodeType      = hashcodeType;
 }
Пример #2
0
 /// <summary>
 /// Decode the password.
 /// </summary>
 /// <param name="password">The password to decode (must include at the start of the password the encoded salt).</param>
 /// <param name="passwordFormat">The password format type to decode with.</param>
 /// <param name="originalPassword">The original password (used when format is Hashed); can be null.</param>
 /// <param name="hashcodeType">The hash code type (used when format is Hashed).</param>
 /// <returns>The decoded password.</returns>
 public string Decode(SecureString password, Nequeo.Cryptography.PasswordFormat passwordFormat, SecureString originalPassword,
                      Nequeo.Cryptography.HashcodeType hashcodeType = Cryptography.HashcodeType.SHA512)
 {
     return(Decode(
                new Nequeo.Security.SecureText().GetText(password),
                passwordFormat,
                (originalPassword != null ? new Nequeo.Security.SecureText().GetText(originalPassword) : ""),
                hashcodeType));
 }
Пример #3
0
 /// <summary>
 /// Encode the password.
 /// </summary>
 /// <param name="password">The password to encode.</param>
 /// <param name="passwordFormat">The password format type to encode with.</param>
 /// <param name="hashcodeType">The hash code type (used when format is Hashed).</param>
 /// <returns>The encode password (includes at the start of the password the encoded salt).</returns>
 public string Encode(SecureString password, Nequeo.Cryptography.PasswordFormat passwordFormat,
                      Nequeo.Cryptography.HashcodeType hashcodeType = Cryptography.HashcodeType.SHA512)
 {
     return(Encode(new Nequeo.Security.SecureText().GetText(password), passwordFormat, hashcodeType));
 }