<commit_before># Documentation #

----------

## About Portable.Licensing ##

Portable.Licensing is a portable solution to implement a licensing component into your application or library.

## Features ##

- runs on .NET >= 4.0.3, Silverlight >= 4, Withdows Phone >= 7.5, Windows Store Apps, Mono, XBox 360
- easy creation and validation of your licenses
- trial licenses
- cryptographic signed licenses, no alteration possible


----------


## Gettings started ##
### Create a private and public key for your product ###

Portable.Licensing uses asymmetric(public-key) encryption to ensure the license cannot be altered after creation.

First you need to create a new public/private key pair for your product:

`var keyGenerator = Portable.Licensing.Security.Cryptography.KeyGenerator.Create();  
privateKey = keyGenerator.ToXmlString(true);  
publicKey = keyGenerator.ToXmlString(false);`

Store the private key securely and distribute the public key with your product.


### Create the license generator ###


Now we need something to generate licenses. This could be easily done with the *LicenseFactory*:

`var license = LicenseFactory.New()  
    .WithUniqueIdentifier(Guid.NewGuid())  
    .As(LicenseType.Trial)  
    .ExpiresAt(DateTime.Now.AddDays(30))  
    .WithMaximumUtilization(5)  
    .WithProductFeatures(new Dictionary<string, string>  
                                      {  
                                          {"Sales Module", "yes"},  
                                          {"Purchase Module", "yes"},  
                                          {"Maximum Transactions", "10000"}  
                                      })  
    .LicensedTo("<NAME>", "<EMAIL>")  
    .CreateAndSignWithPrivateKey(privateKey);`

You can now take the license and save it to an file for example:

`File.WriteAllText("License.lic", license.ToString(), Encoding.UTF8);`


### Validate the license in your application ###<commit_msg>Corrected misspelling<commit_after># Documentation #

----------

## About Portable.Licensing ##

Portable.Licensing is a portable solution to implement a licensing component into your application or library.

## Features ##

- runs on .NET >= 4.0.3, Silverlight >= 4, Windows Phone >= 7.5, Windows Store Apps, Mono, XBox 360
- easy creation and validation of your licenses
- trial licenses
- cryptographic signed licenses, no alteration possible


----------


## Getting started ##
### Create a private and public key for your product ###

Portable.Licensing uses asymmetric (public-key) encryption to ensure the license cannot be altered after creation.

First you need to create a new public/private key pair for your product:

`var keyGenerator = Portable.Licensing.Security.Cryptography.KeyGenerator.Create();  
privateKey = keyGenerator.ToXmlString(true);  
publicKey = keyGenerator.ToXmlString(false);`

Store the private key securely and distribute the public key with your product.


### Create the license generator ###


Now we need something to generate licenses. This could be easily done with the *LicenseFactory*:

`var license = LicenseFactory.New()  
    .WithUniqueIdentifier(Guid.NewGuid())  
    .As(LicenseType.Trial)  
    .ExpiresAt(DateTime.Now.AddDays(30))  
    .WithMaximumUtilization(5)  
    .WithProductFeatures(new Dictionary<string, string>  
                                      {  
                                          {"Sales Module", "yes"},  
                                          {"Purchase Module", "yes"},  
                                          {"Maximum Transactions", "10000"}  
                                      })  
    .LicensedTo("<NAME>", "<EMAIL>")  
    .CreateAndSignWithPrivateKey(privateKey);`

You can now take the license and save it to a file for example:

`File.WriteAllText("License.lic", license.ToString(), Encoding.UTF8);`


### Validate the license in your application ###
{'fraction_non_alphanumeric': 0.10256410256410256, 'fraction_numerical': 0.009230769230769232, 'mean_word_length': 2.6153846153846154, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1237981', 'n_tokens_mistral': 1013, 'n_tokens_neox': 953, 'n_words': 346}