A newer version of this documentation is available.

View Latest

C# code examples

The C# code library contains example code to make logging in and to perform tasks in Net iD Portal. The code examples can be modified and compiled depending on the user’s needs. Download the C# library.

All the C# files belong to the same client class. The class is spread over separate files by using the partial class modifier.
Variable names that begins with a lower case s indicates that the variable is a string.
Variable names that begins with an underscore (_) indicates that the variable is an internal variable.
CertificateStore.cs

Contains the code for accessing certificates stored in the windows certificate store, by using the certificate thumbprint.

Client.cs

The definition of the NiP.Client class.

Constructor.cs

The constructor for the NiP.Client class.

Derive.cs

Contains the functions needed to derive the key and IV.

Functions.cs

A collection of exportable example functions which uses the NiP.Client class. For example CreateTask, Search etc.

InvokeLogin.cs

Contains the login functions.

InvokeMessage.cs

Contains the functions for sending SOAP messages. Including the logic for signing, encrypting, and constructing the messages. Uses the RequestClient class to send the SOAP-envelopes to the correct endpoint.

Pkcs7.cs

Contains the cryptographic PKCS #7 standard code. For digital signatures and asymmetric encryption.

RequestClient.cs

Contains the function for sending SOAP requests, call on by the InvokeMessage functions with given SOAP-envelopes.

Utility.cs

A general utility class for things such as BASE64 encoding and decoding etc.