Generate API docs as markdown
This commit is contained in:
parent
ab7b83abbb
commit
85e90f7bd5
120 changed files with 14227 additions and 76482 deletions
|
|
@ -2,11 +2,11 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Class SecurityHelper | CapyKit Documentation </title>
|
||||
<title> Class SecurityHelper | CapyKit Documentation </title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="title" content="Class SecurityHelper | CapyKit Documentation ">
|
||||
<meta name="title" content=" Class SecurityHelper | CapyKit Documentation ">
|
||||
|
||||
|
||||
<meta name="description" content="A class that contains methods for managing secure data processing and cryptography.">
|
||||
<link rel="icon" href="../favicon.ico">
|
||||
<link rel="stylesheet" href="../public/docfx.min.css">
|
||||
<link rel="stylesheet" href="../public/main.css">
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
</head>
|
||||
|
||||
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
|
||||
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
|
||||
<header class="bg-body border-bottom">
|
||||
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
|
||||
<div class="container-xxl flex-nowrap">
|
||||
|
|
@ -70,626 +70,217 @@
|
|||
<nav id="breadcrumb"></nav>
|
||||
</div>
|
||||
|
||||
<article data-uid="CapyKit.Helpers.SecurityHelper">
|
||||
<article data-uid="">
|
||||
<h1 id="CapyKit_Helpers_SecurityHelper"> Class SecurityHelper</h1>
|
||||
|
||||
|
||||
|
||||
<h1 id="CapyKit_Helpers_SecurityHelper" data-uid="CapyKit.Helpers.SecurityHelper" class="text-break">
|
||||
Class SecurityHelper
|
||||
</h1>
|
||||
|
||||
<div class="facts text-secondary">
|
||||
<dl><dt>Namespace</dt><dd><a class="xref" href="CapyKit.html">CapyKit</a>.<a class="xref" href="CapyKit.Helpers.html">Helpers</a></dd></dl>
|
||||
<dl><dt>Assembly</dt><dd>CapyKit.dll</dd></dl>
|
||||
</div>
|
||||
|
||||
<div class="markdown summary"><p>A class that contains methods for managing secure data processing and cryptography.</p>
|
||||
</div>
|
||||
<div class="markdown conceptual"></div>
|
||||
|
||||
<div class="codewrapper">
|
||||
<pre><code class="lang-csharp hljs">public class SecurityHelper</code></pre>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="typelist inheritance">
|
||||
<dt>Inheritance</dt>
|
||||
<dd>
|
||||
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
|
||||
<div><span class="xref">SecurityHelper</span></div>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
<dl class="typelist inheritedMembers">
|
||||
<dt>Inherited Members</dt>
|
||||
<dd>
|
||||
<div>
|
||||
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
|
||||
</div>
|
||||
<div>
|
||||
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
|
||||
</div>
|
||||
<div>
|
||||
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
|
||||
</div>
|
||||
<div>
|
||||
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
|
||||
</div>
|
||||
<div>
|
||||
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
|
||||
</div>
|
||||
<div>
|
||||
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
|
||||
</div>
|
||||
<div>
|
||||
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
|
||||
</div>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="typelist extensionMethods">
|
||||
<dt>Extension Methods</dt>
|
||||
<dd>
|
||||
<div>
|
||||
<a class="xref" href="CapyKit.Extensions.ObjectExtensions.html#CapyKit_Extensions_ObjectExtensions_UpdateProperties__1___0___0_">ObjectExtensions.UpdateProperties<T>(T, T)</a>
|
||||
</div>
|
||||
<div>
|
||||
<a class="xref" href="CapyKit.Extensions.ObjectExtensions.html#CapyKit_Extensions_ObjectExtensions_UpdateProperties_System_Object_System_Object_">ObjectExtensions.UpdateProperties(object, object)</a>
|
||||
</div>
|
||||
</dd></dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2 class="section" id="methods">Methods
|
||||
</h2>
|
||||
|
||||
|
||||
<a id="CapyKit_Helpers_SecurityHelper_CompareHashedPassword_" data-uid="CapyKit.Helpers.SecurityHelper.CompareHashedPassword*"></a>
|
||||
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_CompareHashedPassword_CapyKit_Password_System_String_System_Byte___CapyKit_IPasswordAlgorithm_System_Object___" data-uid="CapyKit.Helpers.SecurityHelper.CompareHashedPassword(CapyKit.Password,System.String,System.Byte[],CapyKit.IPasswordAlgorithm,System.Object[])">
|
||||
CompareHashedPassword(Password, string, byte[], IPasswordAlgorithm, params object[])
|
||||
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Compares an unencrypted <code class="paramref">password</code> with a stored, encrypted <code class="paramref">existingPassword</code>.
|
||||
This method uses the specified <code class="paramref">algorithm</code> to retrieve the hashed version
|
||||
of the <code class="paramref">password</code> and then compares it with the <code class="paramref">existingPassword</code>.</p>
|
||||
</div>
|
||||
<div class="markdown level1 conceptual"></div>
|
||||
|
||||
<div class="codewrapper">
|
||||
<pre><code class="lang-csharp hljs">public static bool CompareHashedPassword(Password existingPassword, string password, byte[] salt, IPasswordAlgorithm algorithm, params object[] args)</code></pre>
|
||||
</div>
|
||||
|
||||
<h4 class="section">Parameters</h4>
|
||||
<dl class="parameters">
|
||||
<dt><code>existingPassword</code> <a class="xref" href="CapyKit.Password.html">Password</a></dt>
|
||||
<dd><p>The existing, encrypted password.</p>
|
||||
</dd>
|
||||
<dt><code>password</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||
<dd><p>The unencrypted password to be compared.</p>
|
||||
</dd>
|
||||
<dt><code>salt</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.byte">byte</a>[]</dt>
|
||||
<dd><p>The salt value used in password hashing.</p>
|
||||
</dd>
|
||||
<dt><code>algorithm</code> <a class="xref" href="CapyKit.IPasswordAlgorithm.html">IPasswordAlgorithm</a></dt>
|
||||
<dd><p>The password hashing algorithm.</p>
|
||||
</dd>
|
||||
<dt><code>args</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a>[]</dt>
|
||||
<dd><p>Additional arguments required for constructing the password algorithm instance.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4 class="section">Returns</h4>
|
||||
<dl class="parameters">
|
||||
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></dt>
|
||||
<dd><p><a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a> if hash comparison succeeds, <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a> if it fails.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a id="CapyKit_Helpers_SecurityHelper_CompareHashedPassword_" data-uid="CapyKit.Helpers.SecurityHelper.CompareHashedPassword*"></a>
|
||||
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_CompareHashedPassword__1_CapyKit_Password_System_String_System_Byte___System_Object___" data-uid="CapyKit.Helpers.SecurityHelper.CompareHashedPassword``1(CapyKit.Password,System.String,System.Byte[],System.Object[])">
|
||||
CompareHashedPassword<T>(Password, string, byte[], params object[])
|
||||
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Compares an unencrypted <code class="paramref">password</code> with a stored, encrypted <code class="paramref">existingPassword</code>.
|
||||
<p>Namespace: <a href="CapyKit.Helpers.html">CapyKit.Helpers</a><br>
|
||||
Assembly: CapyKit.dll</p>
|
||||
<p>A class that contains methods for managing secure data processing and cryptography.</p>
|
||||
<pre><code class="lang-csharp">public class SecurityHelper
|
||||
</code></pre>
|
||||
<h4 id="inheritance">Inheritance</h4>
|
||||
<p><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ←
|
||||
<a href="CapyKit.Helpers.SecurityHelper.html">SecurityHelper</a></p>
|
||||
<h4 id="inherited-members">Inherited Members</h4>
|
||||
<p><a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>,
|
||||
<a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>,
|
||||
<a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>,
|
||||
<a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>,
|
||||
<a href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>,
|
||||
<a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>,
|
||||
<a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a></p>
|
||||
<h4 id="extension-methods">Extension Methods</h4>
|
||||
<p><a href="CapyKit.Extensions.ObjectExtensions.html#CapyKit_Extensions_ObjectExtensions_UpdateProperties__1___0___0_">ObjectExtensions.UpdateProperties<SecurityHelper>(SecurityHelper, SecurityHelper)</a>,
|
||||
<a href="CapyKit.Extensions.ObjectExtensions.html#CapyKit_Extensions_ObjectExtensions_UpdateProperties_System_Object_System_Object_">ObjectExtensions.UpdateProperties(object, object)</a></p>
|
||||
<h2 id="methods">Methods</h2>
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_CompareHashedPassword__1_CapyKit_Password_System_String_System_Byte___System_Object___"> CompareHashedPassword<T>(Password, string, byte[], params object[])</h3>
|
||||
<p>Compares an unencrypted <code class="paramref">password</code> with a stored, encrypted <code class="paramref">existingPassword</code>.
|
||||
This method uses the specified password algorithm type <code class="typeparamref">T</code> to retrieve the hashed version
|
||||
of the <code class="paramref">password</code> and then compares it with the <code class="paramref">existingPassword</code>.</p>
|
||||
</div>
|
||||
<div class="markdown level1 conceptual"></div>
|
||||
|
||||
<div class="codewrapper">
|
||||
<pre><code class="lang-csharp hljs">public static bool CompareHashedPassword<T>(Password existingPassword, string password, byte[] salt, params object[] args)</code></pre>
|
||||
</div>
|
||||
|
||||
<h4 class="section">Parameters</h4>
|
||||
<dl class="parameters">
|
||||
<dt><code>existingPassword</code> <a class="xref" href="CapyKit.Password.html">Password</a></dt>
|
||||
<dd><p>The existing, encrypted password.</p>
|
||||
</dd>
|
||||
<dt><code>password</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||
<dd><p>The unencrypted password to be compared.</p>
|
||||
</dd>
|
||||
<dt><code>salt</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.byte">byte</a>[]</dt>
|
||||
<dd><p>The salt value used in password hashing.</p>
|
||||
</dd>
|
||||
<dt><code>args</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a>[]</dt>
|
||||
<dd><p>Additional arguments required for constructing the password algorithm instance.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4 class="section">Returns</h4>
|
||||
<dl class="parameters">
|
||||
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></dt>
|
||||
<dd><p><a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a> if hash comparison succeeds, <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a> if it fails.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4 class="section">Type Parameters</h4>
|
||||
<dl class="parameters">
|
||||
<dt><code>T</code></dt>
|
||||
<dd><p>The type of the password hashing algorithm.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a id="CapyKit_Helpers_SecurityHelper_CompareSessionID_" data-uid="CapyKit.Helpers.SecurityHelper.CompareSessionID*"></a>
|
||||
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_CompareSessionID_System_String_System_String_" data-uid="CapyKit.Helpers.SecurityHelper.CompareSessionID(System.String,System.String)">
|
||||
CompareSessionID(string, string)
|
||||
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Compares two session identifiers.</p>
|
||||
</div>
|
||||
<div class="markdown level1 conceptual"></div>
|
||||
|
||||
<div class="codewrapper">
|
||||
<pre><code class="lang-csharp hljs">public static bool CompareSessionID(string first, string second)</code></pre>
|
||||
</div>
|
||||
|
||||
<h4 class="section">Parameters</h4>
|
||||
<dl class="parameters">
|
||||
<dt><code>first</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||
<dd><p>The first session identifier.</p>
|
||||
</dd>
|
||||
<dt><code>second</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||
<dd><p>The second session identifier.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4 class="section">Returns</h4>
|
||||
<dl class="parameters">
|
||||
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></dt>
|
||||
<dd><p><a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a> if comparison succeeds, <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a> if not.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a id="CapyKit_Helpers_SecurityHelper_GetPassword_" data-uid="CapyKit.Helpers.SecurityHelper.GetPassword*"></a>
|
||||
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_GetPassword__1_System_String_System_Byte___System_Object___" data-uid="CapyKit.Helpers.SecurityHelper.GetPassword``1(System.String,System.Byte[],System.Object[])">
|
||||
GetPassword<T>(string, byte[], params object[])
|
||||
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Retrieves a <a class="xref" href="CapyKit.Password.html">Password</a> object using the specified password, salt, and optional
|
||||
<pre><code class="lang-csharp">public static bool CompareHashedPassword<T>(Password existingPassword, string password, byte[] salt, params object[] args)
|
||||
</code></pre>
|
||||
<h4 id="parameters">Parameters</h4>
|
||||
<p><code>existingPassword</code> <a href="CapyKit.Password.html">Password</a></p>
|
||||
<p>The existing, encrypted password.</p>
|
||||
<p><code>password</code> <a href="https://learn.microsoft.com/dotnet/api/system.string">string</a></p>
|
||||
<p>The unencrypted password to be compared.</p>
|
||||
<p><code>salt</code> <a href="https://learn.microsoft.com/dotnet/api/system.byte">byte</a>[]</p>
|
||||
<p>The salt value used in password hashing.</p>
|
||||
<p><code>args</code> <a href="https://learn.microsoft.com/dotnet/api/system.object">object</a>[]</p>
|
||||
<p>Additional arguments required for constructing the password algorithm instance.</p>
|
||||
<h4 id="returns">Returns</h4>
|
||||
<p><a href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></p>
|
||||
<p><a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a> if hash comparison succeeds, <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a> if it fails.</p>
|
||||
<h4 id="type-parameters">Type Parameters</h4>
|
||||
<p><code>T</code></p>
|
||||
<p>The type of the password hashing algorithm.</p>
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_CompareHashedPassword_CapyKit_Password_System_String_System_Byte___CapyKit_IPasswordAlgorithm_System_Object___"> CompareHashedPassword(Password, string, byte[], IPasswordAlgorithm, params object[])</h3>
|
||||
<p>Compares an unencrypted <code class="paramref">password</code> with a stored, encrypted <code class="paramref">existingPassword</code>.
|
||||
This method uses the specified <code class="paramref">algorithm</code> to retrieve the hashed version
|
||||
of the <code class="paramref">password</code> and then compares it with the <code class="paramref">existingPassword</code>.</p>
|
||||
<pre><code class="lang-csharp">public static bool CompareHashedPassword(Password existingPassword, string password, byte[] salt, IPasswordAlgorithm algorithm, params object[] args)
|
||||
</code></pre>
|
||||
<h4 id="parameters-1">Parameters</h4>
|
||||
<p><code>existingPassword</code> <a href="CapyKit.Password.html">Password</a></p>
|
||||
<p>The existing, encrypted password.</p>
|
||||
<p><code>password</code> <a href="https://learn.microsoft.com/dotnet/api/system.string">string</a></p>
|
||||
<p>The unencrypted password to be compared.</p>
|
||||
<p><code>salt</code> <a href="https://learn.microsoft.com/dotnet/api/system.byte">byte</a>[]</p>
|
||||
<p>The salt value used in password hashing.</p>
|
||||
<p><code>algorithm</code> <a href="CapyKit.IPasswordAlgorithm.html">IPasswordAlgorithm</a></p>
|
||||
<p>The password hashing algorithm.</p>
|
||||
<p><code>args</code> <a href="https://learn.microsoft.com/dotnet/api/system.object">object</a>[]</p>
|
||||
<p>Additional arguments required for constructing the password algorithm instance.</p>
|
||||
<h4 id="returns-1">Returns</h4>
|
||||
<p><a href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></p>
|
||||
<p><a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a> if hash comparison succeeds, <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a> if it fails.</p>
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_CompareSessionID_System_String_System_String_"> CompareSessionID(string, string)</h3>
|
||||
<p>Compares two session identifiers.</p>
|
||||
<pre><code class="lang-csharp">public static bool CompareSessionID(string first, string second)
|
||||
</code></pre>
|
||||
<h4 id="parameters-2">Parameters</h4>
|
||||
<p><code>first</code> <a href="https://learn.microsoft.com/dotnet/api/system.string">string</a></p>
|
||||
<p>The first session identifier.</p>
|
||||
<p><code>second</code> <a href="https://learn.microsoft.com/dotnet/api/system.string">string</a></p>
|
||||
<p>The second session identifier.</p>
|
||||
<h4 id="returns-2">Returns</h4>
|
||||
<p><a href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></p>
|
||||
<p><a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a> if comparison succeeds, <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a> if not.</p>
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_GetPassword__1_System_String_System_Object___"> GetPassword<T>(string, params object[])</h3>
|
||||
<p>Retrieves a <span class="xref">CapyKit.Password</span> object using the specified password and generates a random salt value.
|
||||
Then it uses that salt to call the overloaded <span class="xref">CapyKit.Helpers.SecurityHelper.GetPassword``1(System.String,System.Byte[],System.Object[])</span> method with the given password and
|
||||
the generated salt as arguments.</p>
|
||||
<pre><code class="lang-csharp">public static Password GetPassword<T>(string password, params object[] args)
|
||||
</code></pre>
|
||||
<h4 id="parameters-3">Parameters</h4>
|
||||
<p><code>password</code> <a href="https://learn.microsoft.com/dotnet/api/system.string">string</a></p>
|
||||
<p>The plaintext password to be hashed.</p>
|
||||
<p><code>args</code> <a href="https://learn.microsoft.com/dotnet/api/system.object">object</a>[]</p>
|
||||
<p>Optional constructor arguments for the <span class="xref">CapyKit.IPasswordAlgorithm</span> implementation
|
||||
instance.</p>
|
||||
<h4 id="returns-3">Returns</h4>
|
||||
<p><a href="CapyKit.Password.html">Password</a></p>
|
||||
<p>A new <span class="xref">CapyKit.Password</span> object with the given password and a randomly generated salt, as well as an
|
||||
instance of <code class="typeparamref">T</code> created using any optional constructor arguments provided.</p>
|
||||
<h4 id="type-parameters-1">Type Parameters</h4>
|
||||
<p><code>T</code></p>
|
||||
<p>The type of <span class="xref">CapyKit.IPasswordAlgorithm</span> implementation to use.</p>
|
||||
<h4 id="see-also">See Also</h4>
|
||||
<p><a href="CapyKit.Helpers.SecurityHelper.html">SecurityHelper</a>.SALT_SIZE</p>
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_GetPassword__1_System_String_System_Byte___System_Object___"> GetPassword<T>(string, byte[], params object[])</h3>
|
||||
<p>Retrieves a <span class="xref">CapyKit.Password</span> object using the specified password, salt, and optional
|
||||
constructor arguments.</p>
|
||||
</div>
|
||||
<div class="markdown level1 conceptual"></div>
|
||||
|
||||
<div class="codewrapper">
|
||||
<pre><code class="lang-csharp hljs">public static Password GetPassword<T>(string password, byte[] salt, params object[] args) where T : IPasswordAlgorithm</code></pre>
|
||||
</div>
|
||||
|
||||
<h4 class="section">Parameters</h4>
|
||||
<dl class="parameters">
|
||||
<dt><code>password</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||
<dd><p>The plaintext password to be hashed.</p>
|
||||
</dd>
|
||||
<dt><code>salt</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.byte">byte</a>[]</dt>
|
||||
<dd><p>A random value used as an additional input to the one-way function that hashes data, a
|
||||
<pre><code class="lang-csharp">public static Password GetPassword<T>(string password, byte[] salt, params object[] args) where T : IPasswordAlgorithm
|
||||
</code></pre>
|
||||
<h4 id="parameters-4">Parameters</h4>
|
||||
<p><code>password</code> <a href="https://learn.microsoft.com/dotnet/api/system.string">string</a></p>
|
||||
<p>The plaintext password to be hashed.</p>
|
||||
<p><code>salt</code> <a href="https://learn.microsoft.com/dotnet/api/system.byte">byte</a>[]</p>
|
||||
<p>A random value used as an additional input to the one-way function that hashes data, a
|
||||
password or passphrase. This is used to make each output different for the same input
|
||||
thus adding security.</p>
|
||||
</dd>
|
||||
<dt><code>args</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a>[]</dt>
|
||||
<dd><p>Optional constructor arguments for the <a class="xref" href="CapyKit.IPasswordAlgorithm.html">IPasswordAlgorithm</a> implementation
|
||||
<p><code>args</code> <a href="https://learn.microsoft.com/dotnet/api/system.object">object</a>[]</p>
|
||||
<p>Optional constructor arguments for the <span class="xref">CapyKit.IPasswordAlgorithm</span> implementation
|
||||
instance.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4 class="section">Returns</h4>
|
||||
<dl class="parameters">
|
||||
<dt><a class="xref" href="CapyKit.Password.html">Password</a></dt>
|
||||
<dd><p>A new <a class="xref" href="CapyKit.Password.html">Password</a> object with the given password and salt, as well as an instance
|
||||
<h4 id="returns-4">Returns</h4>
|
||||
<p><a href="CapyKit.Password.html">Password</a></p>
|
||||
<p>A new <span class="xref">CapyKit.Password</span> object with the given password and salt, as well as an instance
|
||||
of <code class="typeparamref">T</code> created using the provided constructor arguments.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4 class="section">Type Parameters</h4>
|
||||
<dl class="parameters">
|
||||
<dt><code>T</code></dt>
|
||||
<dd><p>The type of <a class="xref" href="CapyKit.IPasswordAlgorithm.html">IPasswordAlgorithm</a> implementation to use.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="section" id="CapyKit_Helpers_SecurityHelper_GetPassword__1_System_String_System_Byte___System_Object____remarks">Remarks</h4>
|
||||
<div class="markdown level1 remarks"><p>This method uses reflection to find a constructor for the specified password algorithm type (<code class="typeparamref">T</code>).
|
||||
<h4 id="type-parameters-2">Type Parameters</h4>
|
||||
<p><code>T</code></p>
|
||||
<p>The type of <span class="xref">CapyKit.IPasswordAlgorithm</span> implementation to use.</p>
|
||||
<h4 id="remarks">Remarks</h4>
|
||||
<p>This method uses reflection to find a constructor for the specified password algorithm type (<code class="typeparamref">T</code>).
|
||||
It emits an error event if a suitable constructor is not found or if there is an error invoking the constructor.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<a id="CapyKit_Helpers_SecurityHelper_GetPassword_" data-uid="CapyKit.Helpers.SecurityHelper.GetPassword*"></a>
|
||||
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_GetPassword__1_System_String_System_Object___" data-uid="CapyKit.Helpers.SecurityHelper.GetPassword``1(System.String,System.Object[])">
|
||||
GetPassword<T>(string, params object[])
|
||||
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Retrieves a <a class="xref" href="CapyKit.Password.html">Password</a> object using the specified password and generates a random salt value.
|
||||
Then it uses that salt to call the overloaded <a class="xref" href="CapyKit.Helpers.SecurityHelper.html#CapyKit_Helpers_SecurityHelper_GetPassword__1_System_String_System_Byte___System_Object___">GetPassword<T>(string, byte[], params object[])</a> method with the given password and
|
||||
the generated salt as arguments.</p>
|
||||
</div>
|
||||
<div class="markdown level1 conceptual"></div>
|
||||
|
||||
<div class="codewrapper">
|
||||
<pre><code class="lang-csharp hljs">public static Password GetPassword<T>(string password, params object[] args)</code></pre>
|
||||
</div>
|
||||
|
||||
<h4 class="section">Parameters</h4>
|
||||
<dl class="parameters">
|
||||
<dt><code>password</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||
<dd><p>The plaintext password to be hashed.</p>
|
||||
</dd>
|
||||
<dt><code>args</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a>[]</dt>
|
||||
<dd><p>Optional constructor arguments for the <a class="xref" href="CapyKit.IPasswordAlgorithm.html">IPasswordAlgorithm</a> implementation
|
||||
instance.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4 class="section">Returns</h4>
|
||||
<dl class="parameters">
|
||||
<dt><a class="xref" href="CapyKit.Password.html">Password</a></dt>
|
||||
<dd><p>A new <a class="xref" href="CapyKit.Password.html">Password</a> object with the given password and a randomly generated salt, as well as an
|
||||
instance of <code class="typeparamref">T</code> created using any optional constructor arguments provided.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4 class="section">Type Parameters</h4>
|
||||
<dl class="parameters">
|
||||
<dt><code>T</code></dt>
|
||||
<dd><p>The type of <a class="xref" href="CapyKit.IPasswordAlgorithm.html">IPasswordAlgorithm</a> implementation to use.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="typelist seealso">
|
||||
<dt>See Also</dt>
|
||||
<dd>
|
||||
<div><span class="xref">SALT_SIZE</span></div>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
<a id="CapyKit_Helpers_SecurityHelper_GetRandomPassword_" data-uid="CapyKit.Helpers.SecurityHelper.GetRandomPassword*"></a>
|
||||
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_GetRandomPassword_System_Int32_CapyKit_Helpers_ValidCharacterCollection___" data-uid="CapyKit.Helpers.SecurityHelper.GetRandomPassword(System.Int32,CapyKit.Helpers.ValidCharacterCollection[])">
|
||||
GetRandomPassword(int, params ValidCharacterCollection[])
|
||||
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Gets a cryptographically strong random password.</p>
|
||||
</div>
|
||||
<div class="markdown level1 conceptual"></div>
|
||||
|
||||
<div class="codewrapper">
|
||||
<pre><code class="lang-csharp hljs">public static string GetRandomPassword(int length, params ValidCharacterCollection[] validCharacters)</code></pre>
|
||||
</div>
|
||||
|
||||
<h4 class="section">Parameters</h4>
|
||||
<dl class="parameters">
|
||||
<dt><code>length</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
||||
<dd><p>The length of the password to generate.</p>
|
||||
</dd>
|
||||
<dt><code>validCharacters</code> <a class="xref" href="CapyKit.Helpers.ValidCharacterCollection.html">ValidCharacterCollection</a>[]</dt>
|
||||
<dd><p>An array of <a class="xref" href="CapyKit.Helpers.ValidCharacterCollection.html">ValidCharacterCollection</a> enumeration values representing the desired
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_GetRandomPassword_System_Int32_CapyKit_Helpers_ValidCharacterCollection___"> GetRandomPassword(int, params ValidCharacterCollection[])</h3>
|
||||
<p>Gets a cryptographically strong random password.</p>
|
||||
<pre><code class="lang-csharp">public static string GetRandomPassword(int length, params ValidCharacterCollection[] validCharacters)
|
||||
</code></pre>
|
||||
<h4 id="parameters-5">Parameters</h4>
|
||||
<p><code>length</code> <a href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></p>
|
||||
<p>The length of the password to generate.</p>
|
||||
<p><code>validCharacters</code> <a href="CapyKit.Helpers.ValidCharacterCollection.html">ValidCharacterCollection</a>[]</p>
|
||||
<p>An array of <span class="xref">CapyKit.Helpers.ValidCharacterCollection</span> enumeration values representing the desired
|
||||
character sets.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4 class="section">Returns</h4>
|
||||
<dl class="parameters">
|
||||
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||
<dd><p>The password.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a id="CapyKit_Helpers_SecurityHelper_GetRandomString_" data-uid="CapyKit.Helpers.SecurityHelper.GetRandomString*"></a>
|
||||
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_GetRandomString_System_Int32_" data-uid="CapyKit.Helpers.SecurityHelper.GetRandomString(System.Int32)">
|
||||
GetRandomString(int)
|
||||
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>A convenience method to generate a random string of the specified length using all character sets.</p>
|
||||
</div>
|
||||
<div class="markdown level1 conceptual"></div>
|
||||
|
||||
<div class="codewrapper">
|
||||
<pre><code class="lang-csharp hljs">public static string GetRandomString(int length)</code></pre>
|
||||
</div>
|
||||
|
||||
<h4 class="section">Parameters</h4>
|
||||
<dl class="parameters">
|
||||
<dt><code>length</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
||||
<dd><p>The desired length of the generated random string.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4 class="section">Returns</h4>
|
||||
<dl class="parameters">
|
||||
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="typelist seealso">
|
||||
<dt>See Also</dt>
|
||||
<dd>
|
||||
<div><a class="xref" href="CapyKit.Helpers.ValidCharacterCollection.html">ValidCharacterCollection</a></div>
|
||||
<div><a class="xref" href="CapyKit.Helpers.SecurityHelper.html#CapyKit_Helpers_SecurityHelper_GetRandomString_System_Int32_CapyKit_Helpers_ValidCharacterCollection___">GetRandomString(int, params ValidCharacterCollection[])</a></div>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
<a id="CapyKit_Helpers_SecurityHelper_GetRandomString_" data-uid="CapyKit.Helpers.SecurityHelper.GetRandomString*"></a>
|
||||
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_GetRandomString_System_Int32_CapyKit_Helpers_ValidCharacterCollection___" data-uid="CapyKit.Helpers.SecurityHelper.GetRandomString(System.Int32,CapyKit.Helpers.ValidCharacterCollection[])">
|
||||
GetRandomString(int, params ValidCharacterCollection[])
|
||||
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Gets a cryptographically strong random string using the character values found in VALID_CHARACTERS.</p>
|
||||
</div>
|
||||
<div class="markdown level1 conceptual"></div>
|
||||
|
||||
<div class="codewrapper">
|
||||
<pre><code class="lang-csharp hljs">public static string GetRandomString(int length, params ValidCharacterCollection[] validChars)</code></pre>
|
||||
</div>
|
||||
|
||||
<h4 class="section">Parameters</h4>
|
||||
<dl class="parameters">
|
||||
<dt><code>length</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
||||
<dd><p>The length of the string to create.</p>
|
||||
</dd>
|
||||
<dt><code>validChars</code> <a class="xref" href="CapyKit.Helpers.ValidCharacterCollection.html">ValidCharacterCollection</a>[]</dt>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
|
||||
<h4 class="section">Returns</h4>
|
||||
<dl class="parameters">
|
||||
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||
<dd><p>The random string.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a id="CapyKit_Helpers_SecurityHelper_GetSalt_" data-uid="CapyKit.Helpers.SecurityHelper.GetSalt*"></a>
|
||||
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_GetSalt_System_Int32_" data-uid="CapyKit.Helpers.SecurityHelper.GetSalt(System.Int32)">
|
||||
GetSalt(int)
|
||||
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Generates a random byte array that can act as a salt.</p>
|
||||
</div>
|
||||
<div class="markdown level1 conceptual"></div>
|
||||
|
||||
<div class="codewrapper">
|
||||
<pre><code class="lang-csharp hljs">public static byte[] GetSalt(int length = 32)</code></pre>
|
||||
</div>
|
||||
|
||||
<h4 class="section">Parameters</h4>
|
||||
<dl class="parameters">
|
||||
<dt><code>length</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
|
||||
<dd><p>(Optional) The desired length of the generated byte array.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4 class="section">Returns</h4>
|
||||
<dl class="parameters">
|
||||
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.byte">byte</a>[]</dt>
|
||||
<dd><p>An array of byte.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="section" id="CapyKit_Helpers_SecurityHelper_GetSalt_System_Int32__remarks">Remarks</h4>
|
||||
<div class="markdown level1 remarks"><p>A default length of <span class="xref">CapyKit.Helpers.SecurityHelper.SALT_SIZE</span> is provided as a sane default. Larger values can be used for increased
|
||||
<h4 id="returns-5">Returns</h4>
|
||||
<p><a href="https://learn.microsoft.com/dotnet/api/system.string">string</a></p>
|
||||
<p>The password.</p>
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_GetRandomString_System_Int32_"> GetRandomString(int)</h3>
|
||||
<p>A convenience method to generate a random string of the specified length using all character sets.</p>
|
||||
<pre><code class="lang-csharp">public static string GetRandomString(int length)
|
||||
</code></pre>
|
||||
<h4 id="parameters-6">Parameters</h4>
|
||||
<p><code>length</code> <a href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></p>
|
||||
<p>The desired length of the generated random string.</p>
|
||||
<h4 id="returns-6">Returns</h4>
|
||||
<p><a href="https://learn.microsoft.com/dotnet/api/system.string">string</a></p>
|
||||
<h4 id="see-also-1">See Also</h4>
|
||||
<p><a href="CapyKit.Helpers.ValidCharacterCollection.html">ValidCharacterCollection</a>,
|
||||
<a href="CapyKit.Helpers.SecurityHelper.html">SecurityHelper</a>.<a href="CapyKit.Helpers.SecurityHelper.html#CapyKit_Helpers_SecurityHelper_GetRandomString_System_Int32_CapyKit_Helpers_ValidCharacterCollection___">GetRandomString</a>(<a href="https://learn.microsoft.com/dotnet/api/system.int32">int</a>, params <a href="CapyKit.Helpers.ValidCharacterCollection.html">ValidCharacterCollection</a>[])</p>
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_GetRandomString_System_Int32_CapyKit_Helpers_ValidCharacterCollection___"> GetRandomString(int, params ValidCharacterCollection[])</h3>
|
||||
<p>Gets a cryptographically strong random string using the character values found in VALID_CHARACTERS.</p>
|
||||
<pre><code class="lang-csharp">public static string GetRandomString(int length, params ValidCharacterCollection[] validChars)
|
||||
</code></pre>
|
||||
<h4 id="parameters-7">Parameters</h4>
|
||||
<p><code>length</code> <a href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></p>
|
||||
<p>The length of the string to create.</p>
|
||||
<p><code>validChars</code> <a href="CapyKit.Helpers.ValidCharacterCollection.html">ValidCharacterCollection</a>[]</p>
|
||||
<h4 id="returns-7">Returns</h4>
|
||||
<p><a href="https://learn.microsoft.com/dotnet/api/system.string">string</a></p>
|
||||
<p>The random string.</p>
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_GetSalt_System_Int32_"> GetSalt(int)</h3>
|
||||
<p>Generates a random byte array that can act as a salt.</p>
|
||||
<pre><code class="lang-csharp">public static byte[] GetSalt(int length = 32)
|
||||
</code></pre>
|
||||
<h4 id="parameters-8">Parameters</h4>
|
||||
<p><code>length</code> <a href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></p>
|
||||
<p>(Optional) The desired length of the generated byte array.</p>
|
||||
<h4 id="returns-8">Returns</h4>
|
||||
<p><a href="https://learn.microsoft.com/dotnet/api/system.byte">byte</a>[]</p>
|
||||
<p>An array of byte.</p>
|
||||
<h4 id="remarks-1">Remarks</h4>
|
||||
<p>A default length of <span class="xref">CapyKit.Helpers.SecurityHelper.SALT_SIZE</span> is provided as a sane default. Larger values can be used for increased
|
||||
entropy.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<a id="CapyKit_Helpers_SecurityHelper_Pbkdf2_" data-uid="CapyKit.Helpers.SecurityHelper.Pbkdf2*"></a>
|
||||
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_Pbkdf2_System_String_" data-uid="CapyKit.Helpers.SecurityHelper.Pbkdf2(System.String)">
|
||||
Pbkdf2(string)
|
||||
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Generates a new <a class="xref" href="CapyKit.Password.html">Password</a> object using the PBKDF2 algorithm with the provided <code class="paramref">password</code>.
|
||||
This overload of the method generates a random salt value for added security.</p>
|
||||
</div>
|
||||
<div class="markdown level1 conceptual"></div>
|
||||
|
||||
<div class="codewrapper">
|
||||
<pre><code class="lang-csharp hljs">public static Password Pbkdf2(string password)</code></pre>
|
||||
</div>
|
||||
|
||||
<h4 class="section">Parameters</h4>
|
||||
<dl class="parameters">
|
||||
<dt><code>password</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||
<dd><p>The clear text password to be hashed.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4 class="section">Returns</h4>
|
||||
<dl class="parameters">
|
||||
<dt><a class="xref" href="CapyKit.Password.html">Password</a></dt>
|
||||
<dd><p>A new <a class="xref" href="CapyKit.Password.html">Password</a> object containing the hashed password and a randomly generated salt.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="section" id="CapyKit_Helpers_SecurityHelper_Pbkdf2_System_String__remarks">Remarks</h4>
|
||||
<div class="markdown level1 remarks"><p>This method uses the PBKDF2 (Password-Based Key Derivation Function 2) algorithm to generate
|
||||
a new password hash. The algorithm iteratively applies a pseudorandom function to the
|
||||
password and salt, which increases the security of the resulting hash. In this overload,
|
||||
a random salt value is generated using <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">GetRandomBytes(int)</a> method.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<a id="CapyKit_Helpers_SecurityHelper_Pbkdf2_" data-uid="CapyKit.Helpers.SecurityHelper.Pbkdf2*"></a>
|
||||
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_Pbkdf2_System_String_System_Byte___" data-uid="CapyKit.Helpers.SecurityHelper.Pbkdf2(System.String,System.Byte[])">
|
||||
Pbkdf2(string, byte[])
|
||||
|
||||
</h3>
|
||||
|
||||
<div class="markdown level1 summary"><p>Generates a new <a class="xref" href="CapyKit.Password.html">Password</a> object using the PBKDF2 algorithm with the provided <code class="paramref">password</code>
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_Pbkdf2_System_String_System_Byte___"> Pbkdf2(string, byte[])</h3>
|
||||
<p>Generates a new <span class="xref">CapyKit.Password</span> object using the PBKDF2 algorithm with the provided <code class="paramref">password</code>
|
||||
and <code class="paramref">salt</code>.</p>
|
||||
</div>
|
||||
<div class="markdown level1 conceptual"></div>
|
||||
|
||||
<div class="codewrapper">
|
||||
<pre><code class="lang-csharp hljs">public static Password Pbkdf2(string password, byte[] salt)</code></pre>
|
||||
</div>
|
||||
|
||||
<h4 class="section">Parameters</h4>
|
||||
<dl class="parameters">
|
||||
<dt><code>password</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
|
||||
<dd><p>The clear text password to be hashed.</p>
|
||||
</dd>
|
||||
<dt><code>salt</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.byte">byte</a>[]</dt>
|
||||
<dd><p>A random value used to add an additional layer of security to the generated hash.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4 class="section">Returns</h4>
|
||||
<dl class="parameters">
|
||||
<dt><a class="xref" href="CapyKit.Password.html">Password</a></dt>
|
||||
<dd><p>A new <a class="xref" href="CapyKit.Password.html">Password</a> object containing the hashed password and salt.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4 class="section" id="CapyKit_Helpers_SecurityHelper_Pbkdf2_System_String_System_Byte____remarks">Remarks</h4>
|
||||
<div class="markdown level1 remarks"><p>This method uses the PBKDF2 (Password-Based Key Derivation Function 2) algorithm to generate
|
||||
<pre><code class="lang-csharp">public static Password Pbkdf2(string password, byte[] salt)
|
||||
</code></pre>
|
||||
<h4 id="parameters-9">Parameters</h4>
|
||||
<p><code>password</code> <a href="https://learn.microsoft.com/dotnet/api/system.string">string</a></p>
|
||||
<p>The clear text password to be hashed.</p>
|
||||
<p><code>salt</code> <a href="https://learn.microsoft.com/dotnet/api/system.byte">byte</a>[]</p>
|
||||
<p>A random value used to add an additional layer of security to the generated hash.</p>
|
||||
<h4 id="returns-9">Returns</h4>
|
||||
<p><a href="CapyKit.Password.html">Password</a></p>
|
||||
<p>A new <span class="xref">CapyKit.Password</span> object containing the hashed password and salt.</p>
|
||||
<h4 id="remarks-2">Remarks</h4>
|
||||
<p>This method uses the PBKDF2 (Password-Based Key Derivation Function 2) algorithm to generate
|
||||
a new password hash. The algorithm iteratively applies a pseudorandom function to the
|
||||
password and salt, which increases the security of the resulting hash.</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3 id="CapyKit_Helpers_SecurityHelper_Pbkdf2_System_String_"> Pbkdf2(string)</h3>
|
||||
<p>Generates a new <span class="xref">CapyKit.Password</span> object using the PBKDF2 algorithm with the provided <code class="paramref">password</code>.
|
||||
This overload of the method generates a random salt value for added security.</p>
|
||||
<pre><code class="lang-csharp">public static Password Pbkdf2(string password)
|
||||
</code></pre>
|
||||
<h4 id="parameters-10">Parameters</h4>
|
||||
<p><code>password</code> <a href="https://learn.microsoft.com/dotnet/api/system.string">string</a></p>
|
||||
<p>The clear text password to be hashed.</p>
|
||||
<h4 id="returns-10">Returns</h4>
|
||||
<p><a href="CapyKit.Password.html">Password</a></p>
|
||||
<p>A new <span class="xref">CapyKit.Password</span> object containing the hashed password and a randomly generated salt.</p>
|
||||
<h4 id="remarks-3">Remarks</h4>
|
||||
<p>This method uses the PBKDF2 (Password-Based Key Derivation Function 2) algorithm to generate
|
||||
a new password hash. The algorithm iteratively applies a pseudorandom function to the
|
||||
password and salt, which increases the security of the resulting hash. In this overload,
|
||||
a random salt value is generated using <span class="xref">CapyKit.Helpers.SecurityHelper.GetRandomBytes(System.Int32)</span> method.</p>
|
||||
|
||||
</article>
|
||||
|
||||
<div class="contribution d-print-none">
|
||||
</div>
|
||||
|
||||
<div class="next-article d-print-none border-top" id="nextArticle"></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue