Skip to content

Commit 69298e0

Browse files
authored
Merge pull request #10 from Advanced-Systems/project_setup
Project Setup
2 parents 58ba89b + 2ab3114 commit 69298e0

33 files changed

+584
-260
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
*.txt text eol=crlf
3636
*.md text eol=crlf diff=markdown
3737
*.mdx text eol=crlf diff=markdown
38+
*.yml text eol=crlf
3839
.editorconfig text eol=crlf
40+
.gitattributes text eol=crlf
41+
.gitignore text eol=crlf
3942

4043
###############################################################################
4144
# Text files without extensions

.github/workflows/codeql.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: "CodeQL"
1+
name: CodeQL
22

33
on:
44
push:
5-
branches: [ "master" ]
5+
branches: [ master ]
66
pull_request:
7-
branches: [ "master" ]
7+
branches: [ master ]
88

99
jobs:
1010
analyze:
@@ -26,9 +26,9 @@ jobs:
2626
include:
2727
- language: csharp
2828
build-mode: none
29-
29+
3030
steps:
31-
- name: Checkout repository
31+
- name: Checkout
3232
uses: actions/checkout@v4
3333
- name: Initialize CodeQL
3434
uses: github/codeql-action/init@v3

.github/workflows/docs.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
workflow_dispatch:
7+
8+
env:
9+
DOTNET_VERSION: '8.0.x'
10+
11+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12+
permissions:
13+
actions: read
14+
pages: write
15+
id-token: write
16+
17+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
18+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
19+
concurrency:
20+
group: pages
21+
cancel-in-progress: false
22+
23+
jobs:
24+
publish-docs:
25+
environment:
26+
name: github-pages
27+
url: ${{ steps.deployment.outputs.page_url }}
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
- name: Dotnet Setup
33+
uses: actions/setup-dotnet@v4
34+
with:
35+
dotnet-version: ${{ env.DOTNET_VERSION }}
36+
37+
- run: dotnet tool update -g docfx
38+
- run: docfx docs/docfx.json
39+
40+
- name: Upload Artifact
41+
uses: actions/[email protected]
42+
with:
43+
path: docs/_site
44+
- name: Deploy to GitHub Pages
45+
id: deployment
46+
uses: actions/deploy-pages@v4
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish AdvancedSystems.Security.Abstractions
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version Number'
8+
required: true
9+
10+
env:
11+
DOTNET_VERSION: '8.0.x'
12+
PROJECT_PATH: 'AdvancedSystems.Security.Abstractions\AdvancedSystems.Security.Abstractions.csproj'
13+
RELEASE_DIRECTORY: '${{ github.workspace }}\output'
14+
RELEASE_VERSION: ${{ github.event.inputs.version }}
15+
NUGET_SOURCE: 'https://api.nuget.org/v3/index.json'
16+
17+
jobs:
18+
deploy:
19+
name: Deployment
20+
runs-on: windows-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup .NET
26+
uses: actions/setup-dotnet@v4
27+
with:
28+
dotnet-version: ${{ env.DOTNET_VERSION }}
29+
30+
- name: Set Version from Dispatch Input
31+
run: |
32+
$File = Resolve-Path ${{ env.PROJECT_PATH }}
33+
$Xml = [Xml]::new()
34+
$Xml.Load($File)
35+
$Xml.Project.PropertyGroup.Version = '${{ env.RELEASE_VERSION }}'
36+
$Xml.Save($File)
37+
shell: powershell
38+
39+
- name: Restore Dependencies
40+
run: dotnet restore ${{ env.PROJECT_PATH }} --configfile nuget.config
41+
42+
- name: Build Project
43+
run: dotnet build ${{ env.PROJECT_PATH }} --nologo --no-restore --configuration Release
44+
45+
- name: Pack Project
46+
run: dotnet pack ${{ env.PROJECT_PATH }} --nologo --no-restore --no-build --configuration Release --output ${{ env.RELEASE_DIRECTORY }}
47+
48+
- name: Deploy Package
49+
run: dotnet nuget push '${{ env.RELEASE_DIRECTORY }}\*.nupkg' --skip-duplicate --api-key ${{ secrets.NUGET_AUTH_TOKEN_PUSH }} --source ${{ env.NUGET_SOURCE }}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish AdvancedSystems.Security
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version Number'
8+
required: true
9+
10+
env:
11+
DOTNET_VERSION: '8.0.x'
12+
PROJECT_PATH: 'AdvancedSystems.Security\AdvancedSystems.Security.csproj'
13+
RELEASE_DIRECTORY: '${{ github.workspace }}\output'
14+
RELEASE_VERSION: ${{ github.event.inputs.version }}
15+
NUGET_SOURCE: 'https://api.nuget.org/v3/index.json'
16+
17+
jobs:
18+
deploy:
19+
name: Deployment
20+
runs-on: windows-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup .NET
26+
uses: actions/setup-dotnet@v4
27+
with:
28+
dotnet-version: ${{ env.DOTNET_VERSION }}
29+
30+
- name: Set Version from Dispatch Input
31+
run: |
32+
$File = Resolve-Path ${{ env.PROJECT_PATH }}
33+
$Xml = [Xml]::new()
34+
$Xml.Load($File)
35+
$Xml.Project.PropertyGroup.Version = '${{ env.RELEASE_VERSION }}'
36+
$Xml.Save($File)
37+
shell: powershell
38+
39+
- name: Restore Dependencies
40+
run: dotnet restore ${{ env.PROJECT_PATH }} --configfile nuget.config
41+
42+
- name: Build Project
43+
run: dotnet build ${{ env.PROJECT_PATH }} --nologo --no-restore --configuration Release
44+
45+
- name: Pack Project
46+
run: dotnet pack ${{ env.PROJECT_PATH }} --nologo --no-restore --no-build --configuration Release --output ${{ env.RELEASE_DIRECTORY }}
47+
48+
- name: Deploy Package
49+
run: dotnet nuget push '${{ env.RELEASE_DIRECTORY }}\*.nupkg' --skip-duplicate --api-key ${{ secrets.NUGET_AUTH_TOKEN_PUSH }} --source ${{ env.NUGET_SOURCE }}

.github/workflows/dotnet-tests.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
name: "Unit Tests"
1+
name: Unit Tests
22

33
on:
44
push:
5-
branches: [ "master" ]
5+
branches: [ master ]
66
pull_request:
7-
branches: [ "master" ]
7+
branches: [ master ]
8+
9+
env:
10+
DOTNET_VERSION: '8.0.x'
811

912
jobs:
1013
build:
@@ -14,14 +17,19 @@ jobs:
1417
matrix:
1518
os: [ ubuntu-latest, macOS-latest, windows-latest ]
1619
steps:
17-
- uses: actions/checkout@v4
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
1823
- name: Setup .NET
1924
uses: actions/setup-dotnet@v4
2025
with:
21-
dotnet-version: 8.0.x
22-
- name: Restore dependencies
26+
dotnet-version: ${{ env.DOTNET_VERSION }}
27+
28+
- name: Restore Dependencies
2329
run: dotnet restore
30+
2431
- name: Build
2532
run: dotnet build --no-restore
33+
2634
- name: Test
2735
run: dotnet test --no-build --verbosity normal
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFramework>netstandard2.1</TargetFramework>
5-
<Nullable>enable</Nullable>
6-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Version>0.0.0-alpha</Version>
6+
<Description>Abstractions for AdvancedSystems.Security.</Description>
7+
<PackageId>AdvancedSystems.Security.Abstractions</PackageId>
8+
<RootNamespace>AdvancedSystems.Security.Abstractions</RootNamespace>
9+
<Title>Advanced Systems Security Abstractions Library</Title>
10+
</PropertyGroup>
711

812
</Project>
Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,42 @@
11
using System;
22

3-
namespace AdvancedSystems.Security.Abstractions.Exceptions
3+
namespace AdvancedSystems.Security.Abstractions.Exceptions;
4+
5+
/// <summary>
6+
/// Represents errors that occur because a specified certificate could not be located.
7+
/// </summary>
8+
/// <remarks>
9+
/// This exception is typically thrown when an attempt to retrieve a certificate by its
10+
/// identifier, such as a thumbprint or subject name, fails. It indicates that the required
11+
/// certificate is not present in the specified certificate store or location.
12+
/// </remarks>
13+
public class CertificateNotFoundException : Exception
414
{
515
/// <summary>
6-
/// Represents errors that occur because a specified certificate could not be located.
16+
/// Initializes a new instance of the <seealso cref="CertificateNotFoundException"/> class.
717
/// </summary>
8-
/// <remarks>
9-
/// This exception is typically thrown when an attempt to retrieve a certificate by its
10-
/// identifier, such as a thumbprint or subject name, fails. It indicates that the required
11-
/// certificate is not present in the specified certificate store or location.
12-
/// </remarks>
13-
public class CertificateNotFoundException : Exception
18+
public CertificateNotFoundException()
1419
{
15-
/// <summary>
16-
/// Initializes a new instance of the <seealso cref="CertificateNotFoundException"/> class.
17-
/// </summary>
18-
public CertificateNotFoundException()
19-
{
2020

21-
}
21+
}
2222

23-
/// <summary>
24-
/// Initializes a new instance of the <seealso cref="CertificateNotFoundException"/> class with a specified error <paramref name="message"/>.
25-
/// </summary>
26-
/// <param name="message">The error message that explains the reason for the exception.</param>
27-
public CertificateNotFoundException(string message) : base(message)
28-
{
23+
/// <summary>
24+
/// Initializes a new instance of the <seealso cref="CertificateNotFoundException"/> class with a specified error <paramref name="message"/>.
25+
/// </summary>
26+
/// <param name="message">The error message that explains the reason for the exception.</param>
27+
public CertificateNotFoundException(string message) : base(message)
28+
{
2929

30-
}
30+
}
3131

32-
/// <summary>
33-
/// Initializes a new instance of the <seealso cref="CertificateNotFoundException"/> class with a specified error
34-
/// <paramref name="message"/> a reference to the <paramref name="inner"/> exception that is the cause of this exception.
35-
/// </summary>
36-
/// <param name="message">The error message that explains the reason for the exception.</param>
37-
/// <param name="inner">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param>
38-
public CertificateNotFoundException(string message, Exception inner) : base(message, inner)
39-
{
32+
/// <summary>
33+
/// Initializes a new instance of the <seealso cref="CertificateNotFoundException"/> class with a specified error
34+
/// <paramref name="message"/> a reference to the <paramref name="inner"/> exception that is the cause of this exception.
35+
/// </summary>
36+
/// <param name="message">The error message that explains the reason for the exception.</param>
37+
/// <param name="inner">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param>
38+
public CertificateNotFoundException(string message, Exception inner) : base(message, inner)
39+
{
4040

41-
}
4241
}
4342
}

AdvancedSystems.Security.Abstractions/ICertificateService.cs

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,30 @@
22

33
using System.Security.Cryptography.X509Certificates;
44

5-
namespace AdvancedSystems.Security.Abstractions
5+
namespace AdvancedSystems.Security.Abstractions;
6+
7+
/// <summary>
8+
/// Defines a service for managing and retrieving X.509 certificates.
9+
/// </summary>
10+
public interface ICertificateService
611
{
12+
#region Methods
13+
714
/// <summary>
8-
/// Defines a service for managing and retrieving X.509 certificates.
15+
/// Retrieves an X.509 certificate from the specified store using the provided <paramref name="thumbprint"/>.
916
/// </summary>
10-
public interface ICertificateService
11-
{
12-
#region Methods
13-
14-
/// <summary>
15-
/// Retrieves an X.509 certificate from the specified store using the provided <paramref name="thumbprint"/>.
16-
/// </summary>
17-
/// <param name="thumbprint">The thumbprint of the certificate to locate.</param>
18-
/// <param name="storeName">The certificate store from which to retrieve the certificate.</param>
19-
/// <param name="storeLocation">The location of the certificate store, such as <see cref="StoreLocation.CurrentUser"/> or <see cref="StoreLocation.LocalMachine"/>.</param>
20-
/// <returns>The <see cref="X509Certificate2"/> object if the certificate is found, else <c>null</c>.</returns>
21-
/// <exception cref="CertificateNotFoundException">Thrown when no certificate with the specified thumbprint is found in the store.</exception>
22-
X509Certificate2? GetStoreCertificate(string thumbprint, StoreName storeName, StoreLocation storeLocation);
17+
/// <param name="thumbprint">The thumbprint of the certificate to locate.</param>
18+
/// <param name="storeName">The certificate store from which to retrieve the certificate.</param>
19+
/// <param name="storeLocation">The location of the certificate store, such as <see cref="StoreLocation.CurrentUser"/> or <see cref="StoreLocation.LocalMachine"/>.</param>
20+
/// <returns>The <see cref="X509Certificate2"/> object if the certificate is found, else <c>null</c>.</returns>
21+
/// <exception cref="CertificateNotFoundException">Thrown when no certificate with the specified thumbprint is found in the store.</exception>
22+
X509Certificate2? GetStoreCertificate(string thumbprint, StoreName storeName, StoreLocation storeLocation);
2323

24-
/// <summary>
25-
/// Retrieves an application-configured X.509 certificate.
26-
/// </summary>
27-
/// <returns>The <see cref="X509Certificate2"/> object if the certificate is found, else <c>null</c>.</returns>
28-
X509Certificate2? GetConfiguredCertificate();
24+
/// <summary>
25+
/// Retrieves an application-configured X.509 certificate.
26+
/// </summary>
27+
/// <returns>The <see cref="X509Certificate2"/> object if the certificate is found, else <c>null</c>.</returns>
28+
X509Certificate2? GetConfiguredCertificate();
2929

30-
#endregion
31-
}
30+
#endregion
3231
}

0 commit comments

Comments
 (0)