@@ -387,6 +387,73 @@ interface
387387
388388 IDECHashPassword = Interface (IDECHash)
389389 [' {B4D8A80C-1F42-46F8-9288-D71ECCFE6F02}' ]
390+ // / <summary>
391+ // / Calculates a passwort hash for the given password and returns it in
392+ // / a BSDCrypt compatible format. This method only works for those hash
393+ // / algorithms implementing the necessary GetBSDCryptID method.
394+ // / </summary>
395+ // / <param name="Password">
396+ // / Entered password for which to calculate the hash. The caller is
397+ // / responsible to ensure the maximum password length is adhered to.
398+ // / Any exceptions raised due to too long passwords are not caught here!
399+ // / </param>
400+ // / <param name="Params">
401+ // / Algorithm specific parameters used for initialization. For details see
402+ // / documentation of the concrete implementation in the algorithm.
403+ // / </param>
404+ // / <param name="Salt">
405+ // / Salt value used by the password hash calculation. Depending on the
406+ // / value of SaltIsRaw, the salt needs to specified in raw encoding or
407+ // / in the encoding used in the Crypt/BSD password storage string.
408+ // / </param>
409+ // / <param name="SaltIsRaw">
410+ // / If true the passed salt value is a raw value. If false it is encoded
411+ // / like in the Crypt/BSD password storage string.
412+ // / </param>
413+ // / <param name="Format">
414+ // / Formatting class used to format the calculated password. Different
415+ // / algorithms in BSDCrypt use different algorithms so one needs to know
416+ // / which one to pass. See description of the hash class used.
417+ // / </param>
418+ // / <returns>
419+ // / Calculated hash value in BSD crypt style format. Returns an empty
420+ // / string if the algorithm is not a Crypt/BSD style password hash algorithm.
421+ // / </returns>
422+ // / <exception cref="EDECHashException">
423+ // / Exception raised if length of <c>Password</c> is higher than
424+ // / <c>MaxPasswordLength</c> or if a salt with a different length than
425+ // / 128 bit has been specified.
426+ // / </exception>
427+ function GetDigestInCryptFormat (const Password : string;
428+ const Params : string;
429+ const Salt : string;
430+ SaltIsRaw : Boolean;
431+ Format : TDECFormatClass):string;
432+
433+ // / <summary>
434+ // / Checks whether a given password is the correct one for a password
435+ // / storage "record"/entry in Crypt/BSD format.
436+ // / </summary>
437+ // / <param name="Password">
438+ // / Password to check for validity
439+ // / </param>
440+ // / <param name="CryptData">
441+ // / The data needed to "compare" the password against in Crypt/BSD like
442+ // / format: $<id>[$<param>=<value>(,<param>=<value>)*][$<salt>[$<hash>]].
443+ // / The exact format depends on the algorithm used.
444+ // / </param>
445+ // / <param name="Format">
446+ // / Must be the right type for the Crypt/BSD encoding used by the
447+ // / algorithm used. This was implemented this way to avoid making the
448+ // / DECHashAuthentication unit dependant on the DECFormat unit not needed
449+ // / otherwise.
450+ // / </param>
451+ // / <returns>
452+ // / True if the password given is correct.
453+ // / </returns>
454+ function IsValidPassword (const Password : string;
455+ const CryptData : string;
456+ Format : TDECFormatClass): Boolean;
390457 // / <summary>
391458 // / Sets the salt value given. Throws an EDECHashException if a salt is
392459 // / passed which is longer than MaxSaltLength.
0 commit comments