Translation. Original: auth/testowe-certyfikaty-i-podpisy-xades.md
Test certificates and XAdES signatures
This guide shows how to quickly run the console demonstration application KSeF.Client.Tests.CertTestApp to:
- generate a test (self-signed) certificate for the KSeF test environment,
- build and sign a XAdES
AuthTokenRequestdocument, - send the signed document to KSeF and obtain access tokens (JWT).
Note
- Self-signed certificates are allowed only in the test environment.
- Data in examples (NIP, reference number, tokens) are fictitious and serve demonstration purposes only.
Prerequisites
- .NET 10 SDK
- Git
- Windows or Linux
What does the application do?
- Retrieves a challenge from KSeF.
- Builds the
AuthTokenRequestXML document. - Signs the
AuthTokenRequestdocument in XAdES format. - Sends the signed document to KSeF and receives
referenceNumber+authenticationToken. - Polls the status of the authentication operation until completion.
- Upon success, retrieves the token pair:
accessTokenandrefreshToken(JWT). - Saves artifacts (including test certificate and signed XML) to files if
fileoutput is selected.
Windows
Install .NET 10 SDK:
powershellwinget install Microsoft.DotNet.SDK.10Alternatively: download the installer from the .NET website.
Open a new terminal window (PowerShell/CMD).
Verify installation:
powershelldotnet --versionExpected version number:
10.x.x.Clone the repository and navigate to the project:
powershellgit clone https://github.com/CIRFMF/ksef-client-csharp.git cd ksef-client-csharp/KSeF.Client.Tests.CertTestAppRun (default random NIP, output to screen):
powershelldotnet run --framework net10.0Run with parameters:
--output–screen(default) orfile(save results to files),--nip{nip_number} - e.g.--nip 8976111986,- optionally:
--no-startup-warnings.
powershelldotnet run --framework net10.0 --output file --nip 8976111986 --no-startup-warnings
Linux (Ubuntu/Debian)
Add Microsoft repository and update packages:
bashwget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb sudo apt-get updateInstall .NET 10 SDK:
bashsudo apt-get install -y dotnet-sdk-10.0Refresh shell environment or open a new terminal:
bashsource ~/.bashrcVerify installation:
bashdotnet --versionExpected version number:
10.x.x.Clone the repository and navigate to the project:
bashgit clone https://github.com/CIRFMF/ksef-client-csharp.git cd ksef-client-csharp/KSeF.Client.Tests.CertTestAppRun (output to screen, random NIP):
bashdotnet run --framework net10.0Run with parameters:
--output–screen(default) orfile(save results to files),--nip{nip_number} - e.g.--nip 8976111986,- optionally:
--no-startup-warnings.
bashdotnet run --framework net10.0 --output file --nip 8976111986 --no-startup-warnings
Related documents: