Class EncryptionServiceExtensions
An encryption service extensions.
Inheritance
Inherited Members
Namespace: Kephas.Cryptography
Assembly: Kephas.Core.dll
Syntax
public static class EncryptionServiceExtensions
Methods
| Improve this Doc View SourceDecrypt(IEncryptionService, Byte[], IEncryptionContext)
Decrypts the input bytes and returns the decrypted bytes.
Declaration
public static byte[] Decrypt(this IEncryptionService encryptionService, byte[] input, IEncryptionContext context = null)
Parameters
Type | Name | Description |
---|---|---|
IEncryptionService | encryptionService | The encryption service to act on. |
System.Byte[] | input | The input bytes. |
IEncryptionContext | context | The encryption context (optional). |
Returns
Type | Description |
---|---|
System.Byte[] | The decrypted bytes. |
Decrypt(IEncryptionService, String, IEncryptionContext)
Decrypts the input string and returns the decrypted string.
Declaration
public static string Decrypt(this IEncryptionService encryptionService, string input, IEncryptionContext context = null)
Parameters
Type | Name | Description |
---|---|---|
IEncryptionService | encryptionService | The encryption service to act on. |
System.String | input | The Base64 encoded input string. |
IEncryptionContext | context | The encryption context (optional). |
Returns
Type | Description |
---|---|
System.String | A promise of the decrypted string. |
DecryptAsync(IEncryptionService, Byte[], IEncryptionContext, CancellationToken)
Decrypts the input bytes and returns a promise of the decrypted bytes.
Declaration
public static Task<byte[]> DecryptAsync(this IEncryptionService encryptionService, byte[] input, IEncryptionContext context = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IEncryptionService | encryptionService | The encryption service to act on. |
System.Byte[] | input | The input bytes. |
IEncryptionContext | context | The encryption context (optional). |
System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Byte[]> | A promise of a decrypted bytes. |
DecryptAsync(IEncryptionService, String, IEncryptionContext, CancellationToken)
Decrypts the input Base64 encoded string and returns a promise of the decrypted string.
Declaration
public static Task<string> DecryptAsync(this IEncryptionService encryptionService, string input, IEncryptionContext context = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IEncryptionService | encryptionService | The encryption service to act on. |
System.String | input | The Base64 encoded input string. |
IEncryptionContext | context | The encryption context (optional). |
System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> | A promise of a decrypted string. |
Encrypt(IEncryptionService, Byte[], IEncryptionContext)
Encrypts the input bytes and returns the encrypted bytes.
Declaration
public static byte[] Encrypt(this IEncryptionService encryptionService, byte[] input, IEncryptionContext context = null)
Parameters
Type | Name | Description |
---|---|---|
IEncryptionService | encryptionService | The encryption service to act on. |
System.Byte[] | input | The input bytes. |
IEncryptionContext | context | The encryption context (optional). |
Returns
Type | Description |
---|---|
System.Byte[] | The encrypted bytes. |
Encrypt(IEncryptionService, String, IEncryptionContext)
Encrypts the input string and returns the encrypted string (Base64 encoded).
Declaration
public static string Encrypt(this IEncryptionService encryptionService, string input, IEncryptionContext context = null)
Parameters
Type | Name | Description |
---|---|---|
IEncryptionService | encryptionService | The encryption service to act on. |
System.String | input | The input string. |
IEncryptionContext | context | The encryption context (optional). |
Returns
Type | Description |
---|---|
System.String | The Base64 encoded encrypted bytes. |
EncryptAsync(IEncryptionService, Byte[], IEncryptionContext, CancellationToken)
Encrypts the input bytes and returns a promise of the encrypted bytes.
Declaration
public static Task<byte[]> EncryptAsync(this IEncryptionService encryptionService, byte[] input, IEncryptionContext context = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IEncryptionService | encryptionService | The encryption service to act on. |
System.Byte[] | input | The input bytes. |
IEncryptionContext | context | The encryption context (optional). |
System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Byte[]> | A promise of the encrypted bytes. |
EncryptAsync(IEncryptionService, String, IEncryptionContext, CancellationToken)
Encrypts the input string and returns a promise of the encrypted string (Base64 encoded).
Declaration
public static Task<string> EncryptAsync(this IEncryptionService encryptionService, string input, IEncryptionContext context = null, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IEncryptionService | encryptionService | The encryption service to act on. |
System.String | input | The input string. |
IEncryptionContext | context | The encryption context (optional). |
System.Threading.CancellationToken | cancellationToken | The cancellation token (optional). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> | A promise of the encrypted bytes (Base64 encoded). |