-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed default secrets for the string encryption service. (#49)
- Loading branch information
Showing
32 changed files
with
254 additions
and
102 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
src/Fluxera.Extensions.Caching.Abstractions/Fluxera.Extensions.Caching.Abstractions.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Fluxera.Extensions.Common.Abstractions/Fluxera.Extensions.Common.Abstractions.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/Fluxera.Extensions.Common/StringEncryptionOptionsValidator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
namespace Fluxera.Extensions.Common | ||
{ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Microsoft.Extensions.Options; | ||
|
||
internal sealed class StringEncryptionOptionsValidator : IValidateOptions<StringEncryptionOptions> | ||
{ | ||
public ValidateOptionsResult Validate(string name, StringEncryptionOptions options) | ||
{ | ||
IList<string> failures = new List<string>(); | ||
|
||
if(options.KeySize % 8 != 0) | ||
{ | ||
failures.Add("The key size must be a multiple of 8"); | ||
} | ||
|
||
if(string.IsNullOrEmpty(options.DefaultPassPhrase)) | ||
{ | ||
failures.Add("A default pass phrase must be configured"); | ||
} | ||
|
||
if(options.InitVectorBytes is null || !options.InitVectorBytes.Any()) | ||
{ | ||
failures.Add("The init vector bytes must be configured"); | ||
} | ||
else | ||
{ | ||
if(options.InitVectorBytes.Length != options.KeySize / 16) | ||
{ | ||
failures.Add("The init vector must be of length key-size / 8"); | ||
} | ||
} | ||
|
||
if(options.DefaultSalt is null || !options.DefaultSalt.Any()) | ||
{ | ||
failures.Add("The default salt must be configured"); | ||
} | ||
|
||
return failures.Any() | ||
? ValidateOptionsResult.Fail(failures) | ||
: ValidateOptionsResult.Success; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Fluxera.Extensions.DataManagement/Fluxera.Extensions.DataManagement.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.