Skip to content

Commit

Permalink
chore: Updated to .net 7
Browse files Browse the repository at this point in the history
  • Loading branch information
steffenskov committed Nov 6, 2023
1 parent f0c2a5e commit e439413
Show file tree
Hide file tree
Showing 34 changed files with 1,320 additions and 1,628 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "nuget" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
62 changes: 62 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "Continuous Deployment"

on:
push:
branches: [ main ]

env:
PROJECT_PATH: "src/Ckode.Encryption/Ckode.Encryption.csproj"
SOLUTION_PATH: "Ckode.Encryption.sln"
PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}\output
NUGET_SOURCE_URL: "https://api.nuget.org/v3/index.json"

jobs:
test:
name: "test"
runs-on: "ubuntu-latest"

steps:
- name: "Checkout"
uses: actions/checkout@v3

- name: "Install dotnet"
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.0.x

- name: "Restore packages"
run: dotnet restore ${{ env.SOLUTION_PATH }}

- name: Test
run: dotnet test ${{ env.SOLUTION_PATH }}

deploy:
needs: test
runs-on: "ubuntu-latest"

steps:
- name: "Checkout"
uses: actions/checkout@v3

- name: "Install dotnet"
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.0.x

- name: "Restore packages"
run: dotnet restore ${{ env.SOLUTION_PATH }}

- name: "Build project"
run: dotnet build ${{ env.SOLUTION_PATH }} --no-restore --configuration Release

- name: "Get version"
id: version
uses: bbonkr/get-version-action@v1.2.0
with:
project: ${{ env.PROJECT_PATH }}

- name: "Pack"
run: dotnet pack ${{ env.PROJECT_PATH }} --no-restore --no-build --configuration Release --include-symbols -p:SymbolPackageFormat=snupkg -p:PackageVersion=${{ steps.version.outputs.version }} --output ${{ env.PACKAGE_OUTPUT_DIRECTORY }}

- name: "Push package"
run: dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIRECTORY }}/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s ${{ env.NUGET_SOURCE_URL }} --skip-duplicate
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "Continuous Integration"

on:
push:
branches:
- "**" # matches every branch
- "!main" # excludes main

env:
PROJECT_PATH: "src/Ckode.Encryption/Ckode.Encryption.csproj"
SOLUTION_PATH: "Ckode.Encryption.sln"
PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}\output
NUGET_SOURCE_URL: "https://api.nuget.org/v3/index.json"

jobs:
test:
name: "test"
runs-on: "ubuntu-latest"

steps:
- name: "Checkout"
uses: actions/checkout@v3

- name: "Install dotnet"
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.0.x

- name: "Restore packages"
run: dotnet restore ${{ env.SOLUTION_PATH }}

- name: Test
run: dotnet test ${{ env.SOLUTION_PATH }}
45 changes: 0 additions & 45 deletions .github/workflows/nuget.yml

This file was deleted.

47 changes: 0 additions & 47 deletions Binary/netstandard2.0/Ckode.Encryption.deps.json

This file was deleted.

Binary file removed Binary/netstandard2.0/Ckode.Encryption.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions Source/Ckode.Encryption.sln → Ckode.Encryption.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31025.194
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ckode.Encryption", "Ckode.Encryption\Ckode.Encryption.csproj", "{3917BF7F-C41B-4381-90A4-13F4392B6167}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ckode.Encryption", "src\Ckode.Encryption\Ckode.Encryption.csproj", "{3917BF7F-C41B-4381-90A4-13F4392B6167}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ckode.Encryption.Tests", "Ckode.Encryption.Tests\Ckode.Encryption.Tests.csproj", "{7C0E603E-4834-4B85-AE09-D17D1BB56EAD}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ckode.Encryption.Tests", "tests\Ckode.Encryption.Tests\Ckode.Encryption.Tests.csproj", "{7C0E603E-4834-4B85-AE09-D17D1BB56EAD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
# Ckode.Encryption

Ckode.Encryption is a small collection of simplified wrappers for common encryption algorithms.

Currently supports the following algorithms:

- AES
- AES with a string password used as encryption key
- RSA

All algorithms are from the .NET framework.
All algorithms are from the .NET library.

The AES and RSA classes both offer a GenerateKey or GenerateKeyPair method which should be used to generate new keys (do not roll your own key generator, it'll probably have insecurities)
The AES and RSA classes both offer a GenerateKey or GenerateKeyPair method which should be used to generate new keys (do not roll your own key generator, it'll probably have
insecurities)

## Installation:

I recommend using the NuGet package: https://www.nuget.org/packages/Ckode.Encryption/ however you can also simply clone the repository and use the pre-compiled binaries or compile the project yourself.
I recommend using the NuGet package: https://www.nuget.org/packages/Ckode.Encryption/ however you can also simply clone the repository and use the pre-compiled binaries or compile
the project yourself.
As the project is licensed under MIT you're free to use it for pretty much anything you want.

## Examples:
Expand All @@ -25,7 +29,7 @@ As the project is licensed under MIT you're free to use it for pretty much anyth
var rawBytes = File.ReadAllBytes(filePath);
var encrypted = aes.Encrypt(rawBytes, key);
File.WriteAllBytes(encryptedFilePath, encrypted);

*Encrypt a string with AES, using a password as key:*

var aes = new Ckode.Encryption.AESWithPassword();
Expand All @@ -36,7 +40,7 @@ As the project is licensed under MIT you're free to use it for pretty much anyth

// To decrypt:
var decryptedString = aes.Decrypt(encryptedString, Encoding.UTF8, key);

*Encrypt a file with RSA:*

var rsa = new Ckode.Encryption.RSA();
Expand Down
Loading

0 comments on commit e439413

Please sign in to comment.