Table of Contents

Class Sec

Namespace
Tripous
Assembly
Tripous.dll

Provides security helper functions for password hashing, key derivation and encryption.

public static class Sec
Inheritance
Sec
Inherited Members

Methods

CreateSalt()

Creates a cryptographically secure random salt value.

public static string CreateSalt()

Returns

string

Decrypt(string, string, string, int)

Decrypts a Base64 encoded encrypted string and returns the original plain text.

public static string Decrypt(string CipherTextBase64, string PasswordPlainText, string SaltBase64, int Iterations)

Parameters

CipherTextBase64 string
PasswordPlainText string
SaltBase64 string
Iterations int

Returns

string

DeriveKey(string, string, int)

Derives an encryption key from a password.

public static byte[] DeriveKey(string PasswordPlainText, string SaltBase64, int Iterations)

Parameters

PasswordPlainText string
SaltBase64 string
Iterations int

Returns

byte[]

Encrypt(string, string, string, int)

Encrypts a plain text string and returns a Base64 encoded result.

public static string Encrypt(string PlainText, string PasswordPlainText, string SaltBase64, int Iterations)

Parameters

PlainText string
PasswordPlainText string
SaltBase64 string
Iterations int

Returns

string

HashPassword(string, string, int)

Creates a password hash using PBKDF2.

public static string HashPassword(string PasswordPlainText, string SaltBase64, int Iterations)

Parameters

PasswordPlainText string
SaltBase64 string
Iterations int

Returns

string

VerifyPassword(string, string, string, int)

Verifies that a password matches a stored hash.

public static bool VerifyPassword(string PasswordPlainText, string PasswordHashBase64, string SaltBase64, int Iterations)

Parameters

PasswordPlainText string
PasswordHashBase64 string
SaltBase64 string
Iterations int

Returns

bool