Skip to content

A CPR-nummer (plural: CPR-numre) is a Danish government citizien ID number. This library implements the CPR-nummer semantics.

License

Notifications You must be signed in to change notification settings

mjul/cprnumre-dotnet

Repository files navigation

CPR-nummer library for .NET Standard 2.0

A CPR-nummer (plural: CPR-numre) is a Danish government citizen ID number assigned by "Det Centrale Personregister" (CPR). It is also known as personnummer ("person number").

The CPR-nummer is used for a number of purposes such as e.g. tax reporting, identifying people in legal documents and in NemID, the government-provided Danish two-factor authentication system. It is also used for NemKonto where you can transfer money to an account by the owners' CPR-nummer without knowing the account details.

This library makes using it simple and supports the often-missed edge cases such as modulus checksums and valid variants such as erstatningspersonnumer ("substitute CPR-nummer").

Handles Date of Birth, Gender

These numbers encode the date of birth and gender. This library implement their semantics. It correctly determines the year of birth based on the two (least significant) year digits in the CPR-nummer and extra information encoded in the control digits.

Handles Validation

The CPR-nummer is encoded to enable validation of correct entry (modulus control). This is implemented by the library.

GDPR Friendly: Protects Personal Information

The CPR-nummer is considered personal information. Therefore the library defaults to not printing the number in .ToString() to reduce the risk of accidentally leaking sensitive personal information into e.g. log files.

Notes for Implementers

Citizens May Change CPR-numbers

Note that citizens might obtain a new CPR-number, for example when they try to change their gender surgically. Hence it is a good idea to model it as a temporal attribute on a person. Do not use it as a key.

Legal Information

The CPR-number is classified as sensitive in GDPR (da.: "personfølsom oplysning").

Private companies may use of the CPR-nummer as regulated by Danish law:

Private virksomheders anvendelse af personnummer er reguleret i § 11, stk. 2 i lov om behandling af personoplysninger (persondataloven).

Source: CPR.dk FAQ

You can read the legislation in Retsinformation: Lov om behandling af personoplysninger LOV nr 429 af 31/05/2000.

License

Copyright (c) 2020 Martin Jul. This library is licensed under the MIT License. See the LICENSE file for details.

About

A CPR-nummer (plural: CPR-numre) is a Danish government citizien ID number. This library implements the CPR-nummer semantics.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages