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 4 years ago committed by GitHub
commit dabac26911
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -43,9 +43,9 @@ All encryption operations are included in `IStringEncryptionService`. You can in
```csharp
public class MyService : DomainService
{
public IStringEncryptionService StringEncryptionService { get; }
protected IStringEncryptionService StringEncryptionService { get; }
public MyAppService(IStringEncryptionService stringEncryptionService)
public MyService(IStringEncryptionService 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.
```csharp
StringEncryptionService.Encrypt(value); // Default Pass Phrase
StringEncryptionService.Encrypt(value, "MyCustomPassPhrase"); // Custom Pass Phrase
// Default Pass Phrase
var encryptedValue = StringEncryptionService.Encrypt(value);
// Custom Pass Phrase
var encryptedValue = StringEncryptionService.Encrypt(value, "MyCustomPassPhrase");
// Encrypt & Decrypt have same parameters.
StringEncryptionService.Decrypt(value, "MyCustomPassPhrase");
var decryptedValue = StringEncryptionService.Decrypt(value, "MyCustomPassPhrase");
```
### 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.
```csharp
StringEncryptionService.Encrypt(value); // Default Salt
StringEncryptionService.Encrypt(value, salt: Encoding.UTF8.GetBytes("MyCustomSalt")); // Custom Salt
// Default Salt
var encryptedValue = StringEncryptionService.Encrypt(value);
// Custom Salt
var encryptedValue = StringEncryptionService.Encrypt(value, salt: Encoding.UTF8.GetBytes("MyCustomSalt"));
// 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.
Default value: `256`
Default value: `256`
Loading…
Cancel
Save