Browse Source

Merge pull request #8976 from abpframework/enisn/rel-4.3/string-encryption-improvements

Docs - Improve Readability of String-Encryption.md
pull/9003/head
Halil İbrahim Kalkan 5 years ago
committed by GitHub
parent
commit
dabac26911
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      docs/en/String-Encryption.md

24
docs/en/String-Encryption.md

@ -43,9 +43,9 @@ All encryption operations are included in `IStringEncryptionService`. You can in
```csharp ```csharp
public class MyService : DomainService public class MyService : DomainService
{ {
public IStringEncryptionService StringEncryptionService { get; } protected IStringEncryptionService StringEncryptionService { get; }
public MyAppService(IStringEncryptionService stringEncryptionService) public MyService(IStringEncryptionService stringEncryptionService)
{ {
StringEncryptionService = stringEncryptionService; StringEncryptionService = stringEncryptionService;
} }
@ -69,11 +69,14 @@ All encryption operations are included in `IStringEncryptionService`. You can in
`IStringEncryptionService` methods has **passPharase** parameter with default value and it uses default PassPhrase when you don't pass passPhrase parameter. `IStringEncryptionService` methods has **passPharase** parameter with default value and it uses default PassPhrase when you don't pass passPhrase parameter.
```csharp ```csharp
StringEncryptionService.Encrypt(value); // Default Pass Phrase // Default Pass Phrase
StringEncryptionService.Encrypt(value, "MyCustomPassPhrase"); // Custom Pass Phrase var encryptedValue = StringEncryptionService.Encrypt(value);
// Custom Pass Phrase
var encryptedValue = StringEncryptionService.Encrypt(value, "MyCustomPassPhrase");
// Encrypt & Decrypt have same parameters. // Encrypt & Decrypt have same parameters.
StringEncryptionService.Decrypt(value, "MyCustomPassPhrase"); var decryptedValue = StringEncryptionService.Decrypt(value, "MyCustomPassPhrase");
``` ```
### Using Custom Salt ### Using Custom Salt
@ -81,11 +84,14 @@ StringEncryptionService.Decrypt(value, "MyCustomPassPhrase");
`IStringEncryptionService` methods has **salt** parameter with default value and it uses default Salt when you don't pass the parameter. `IStringEncryptionService` methods has **salt** parameter with default value and it uses default Salt when you don't pass the parameter.
```csharp ```csharp
StringEncryptionService.Encrypt(value); // Default Salt // Default Salt
StringEncryptionService.Encrypt(value, salt: Encoding.UTF8.GetBytes("MyCustomSalt")); // Custom Salt var encryptedValue = StringEncryptionService.Encrypt(value);
// Custom Salt
var encryptedValue = StringEncryptionService.Encrypt(value, salt: Encoding.UTF8.GetBytes("MyCustomSalt"));
// Encrypt & Decrypt have same parameters. // Encrypt & Decrypt have same parameters.
StringEncryptionService.Decrypt(value, salt: Encoding.UTF8.GetBytes("MyCustomSalt")); var decryptedValue = StringEncryptionService.Decrypt(value, salt: Encoding.UTF8.GetBytes("MyCustomSalt"));
``` ```
*** ***
@ -116,4 +122,4 @@ Configure<AbpStringEncryptionOptions>(opts =>
- **Keysize:** This constant is used to determine the keysize of the encryption algorithm. - **Keysize:** This constant is used to determine the keysize of the encryption algorithm.
Default value: `256` Default value: `256`
Loading…
Cancel
Save