Skip to content

Commit 8bd07a5

Browse files
authored
Merge pull request #14 from Eastrall/azure-pipelines
Set up CI with Azure Pipelines
2 parents 6610725 + 9889c16 commit 8bd07a5

File tree

6 files changed

+40
-48
lines changed

6 files changed

+40
-48
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
pool:
2+
vmImage: 'ubuntu-latest'
3+
4+
steps:
5+
- task: UseDotNet@2
6+
inputs:
7+
packageType: 'sdk'
8+
version: '5.0.x'
9+
10+
- script: |
11+
dotnet build EntityFrameworkCore.DataEncryption.sln --configuration Release
12+
displayName: 'Build'
13+
14+
- script: |
15+
dotnet test EntityFrameworkCore.DataEncryption.sln --configuration Release
16+
displayName: 'Test'

.travis.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

EntityFrameworkCore.DataEncryption.sln

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.28307.421
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30804.86
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3EC10767-1816-46B2-A78E-9856071CCFDB}"
77
EndProject
@@ -15,7 +15,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "global", "global", "{3A8D80
1515
ProjectSection(SolutionItems) = preProject
1616
.gitattributes = .gitattributes
1717
.gitignore = .gitignore
18-
.travis.yml = .travis.yml
1918
README.md = README.md
2019
EndProjectSection
2120
EndProject

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# EntityFrameworkCore.DataEncryption
22

3-
[![Build Status](https://travis-ci.org/Eastrall/EntityFrameworkCore.DataEncryption.svg?branch=master)](https://travis-ci.org/Eastrall/EntityFrameworkCore.DataEncryption)
4-
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2bfb621fd6fc453488d022a3eec8069e)](https://www.codacy.com/app/Eastrall/EntityFrameworkCore.DataEncryption?utm_source=github.com&utm_medium=referral&utm_content=Eastrall/EntityFrameworkCore.DataEncryption&utm_campaign=Badge_Grade)
3+
[![Build Status](https://dev.azure.com/eastrall/EntityFrameworkCore.DataEncryption/_apis/build/status/EntityFrameworkCore.DataEncryption?branchName=refs%2Fpull%2F14%2Fmerge)](https://dev.azure.com/eastrall/EntityFrameworkCore.DataEncryption/_build/latest?definitionId=9&branchName=refs%2Fpull%2F14%2Fmerge)[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2bfb621fd6fc453488d022a3eec8069e)](https://www.codacy.com/app/Eastrall/EntityFrameworkCore.DataEncryption?utm_source=github.com&utm_medium=referral&utm_content=Eastrall/EntityFrameworkCore.DataEncryption&utm_campaign=Badge_Grade)
54
[![codecov](https://codecov.io/gh/Eastrall/EntityFrameworkCore.DataEncryption/branch/master/graph/badge.svg)](https://codecov.io/gh/Eastrall/EntityFrameworkCore.DataEncryption)
65
[![Nuget](https://img.shields.io/nuget/v/EntityFrameworkCore.DataEncryption.svg)](https://www.nuget.org/packages/EntityFrameworkCore.DataEncryption)
76

src/EntityFrameworkCore.DataEncryption/Providers/AesProvider.cs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@ namespace Microsoft.EntityFrameworkCore.DataEncryption.Providers
1010
/// </summary>
1111
public class AesProvider : IEncryptionProvider
1212
{
13-
private const int AesBlockSize = 128;
14-
private const int InitializationVectorSize = 16;
13+
/// <summary>
14+
/// AES block size constant.
15+
/// </summary>
16+
public const int AesBlockSize = 128;
17+
18+
/// <summary>
19+
/// Initialization vector size constant.
20+
/// </summary>
21+
public const int InitializationVectorSize = 16;
1522

1623
private readonly byte[] _key;
1724
private readonly CipherMode _mode;
@@ -59,20 +66,16 @@ public string Encrypt(string dataToEncrypt)
5966

6067
byte[] initializationVector = cryptoServiceProvider.IV;
6168

62-
using (ICryptoTransform encryptor = cryptoServiceProvider.CreateEncryptor(_key, initializationVector))
69+
using ICryptoTransform encryptor = cryptoServiceProvider.CreateEncryptor(_key, initializationVector);
70+
using var memoryStream = new MemoryStream();
71+
using (var cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write))
6372
{
64-
using (var memoryStream = new MemoryStream())
65-
{
66-
using (var cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write))
67-
{
68-
memoryStream.Write(initializationVector, 0, initializationVector.Length);
69-
cryptoStream.Write(input, 0, input.Length);
70-
cryptoStream.FlushFinalBlock();
71-
}
72-
73-
encrypted = memoryStream.ToArray();
74-
}
73+
memoryStream.Write(initializationVector, 0, initializationVector.Length);
74+
cryptoStream.Write(input, 0, input.Length);
75+
cryptoStream.FlushFinalBlock();
7576
}
77+
78+
encrypted = memoryStream.ToArray();
7679
}
7780

7881
return Convert.ToBase64String(encrypted);

test/EntityFrameworkCore.DataEncryption.Test/EntityFrameworkCore.DataEncryption.Test.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.0</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55
<IsPackable>false</IsPackable>
66
<AssemblyName>Microsoft.EntityFrameworkCore.Encryption.Test</AssemblyName>
77
<RootNamespace>Microsoft.EntityFrameworkCore.Encryption.Test</RootNamespace>
@@ -12,9 +12,9 @@
1212
<PrivateAssets>all</PrivateAssets>
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1414
</PackageReference>
15-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
16-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.0" />
17-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
15+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.1" />
16+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.1" />
17+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
1818
<PackageReference Include="xunit" Version="2.4.1" />
1919
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
2020
<PrivateAssets>all</PrivateAssets>

0 commit comments

Comments
 (0)