The PLUSManaged samples, which lack integration with PLUSManagedGui (which you should consider using if you are protecting a traditional form/dialog based application), show you how you can integrate the PLUSManaged API with any of your .NET applications. Even though most of these samples use Windows Forms, it is simple to re-use most of this sample code with nearly any type of interface (as shown with the ASP.NET samples that are included). These samples are especially useful when your application (such as web applications, services, etc...) cannot use a traditional dialog/form based interface.
Here are some of the features and highlights to note about the PLUSManaged sample applications:
To see additional licensing features in action, check out the PLUSManagedGui samples!
The %PUBLIC%\Documents\SoftwareKey\Protection PLUS 5\Samples directory can be opened by running Protection PLUS 5 SDK from your start menu/screen, and clicking on the Protection PLUS 5 SDK Samples link. This directory contains all of the files and folders listed below, as well as several solution files (one for each supported version of Visual Studio). Each solution is configured with the sample projects that are designed for the corresponding version of Visual Studio, and the projects are organized by the underlying framework and language used to develop each sample application. For example, any C# applications that use System.Windows.Forms dialogs are located in the CSharp\Windows.Forms directory (in the Solution Explorer pane/tab).
Many of the source code comments begin with TODO and IMPORTANT. It is very important that you review each of these comments in any and all files you copy into your application. Each of these comments indicates an area where you need to make an informed decision about how the application should behave and react in certain scenarios. Disregarding these comments can lead to undesirable behaviors in your application.
Each project listed below is contained in its own directory, and each of these directories is prefixed with "PLUSManaged_" in order to distinguish them from the PLUSManagedGuisamples. When you open the sample solutions however, these samples are isolated under a PLUSManaged solution folder (under the solutions folders for the respective language and presentation/GUI framework).
Type | Sample Projects | Description | Supported Platforms/Frameworks |
---|---|---|---|
Read-Only License Files | ReadOnlyLicense SimpleTextEditorReadOnly |
Shows how you can use a read-only license file for the highest level of security. These samples do not include evaluation licensing, though this is possible to add. | .NET, ASP.NET |
Mixed Read-Only and Self-Signed License Files | SelfSignedTrial SimpleTextEditorSelfSignedTrial |
Although these samples are a little more complex, they provide a great middle-ground for security and flexibility by automatically creating their own, self-issued evaluation licenses (using a writable license file), while using the more secure read-only license files for activated copies. | .NET |
Self-Signed (Writable) License Files | SelfSignedLicense SimpleTextEditorSelfSigned |
These samples always use a self-signed/writable license file for all licenses. These types of license files provide the highest level of flexibility, as they allow your application to freely modify the license file (even without Internet connectivity). However, using writable/self-signed licenses means the protected application uses key data fully known to it when encrypting license files, which is less secure than read-only licenses (which use key data only partially known to the protected application). | .NET |
Network Floating via Semaphores | NetworkFloatingSemaphore | Shows how you can use semaphore files (or files locked to a running instance of your application) on a Windows (SMB) share to limit the number of users or instances of your application on a network. | .NET |
Cloud-Controlled Network Floating Licensing using SOLO Server | CloudContolledNetworkFloatingSOLOServer (contact us for details) |
Shows how you can leverage SOLO Server to limit the number of concurrent users or instances of your application. This requires Internet connectivity (at least initially), and includes advanced features not easily achieved via semaphore files (such as checking-out a seat for later use when offline/disconnected). | .NET |
The PLUSManaged samples use a variety of source code files that are common amongst many or all of the sample applications. The source files are summarized below, and each source file contains commenting which documents the source code in great detail. A summary of the shared source code files is provided below.
Class/Type | File Locations | Description |
---|---|---|
AboutForm | AboutForm.cs, AboutForm.Designer.cs, AboutForm.vb, AboutForm.Designer.vb, AboutForm.resx |
Used only in the SimpleTextEditor samples, this form displays the status of the application's license, and allows the user to activate, deactivate, and refresh his or her license. |
Feature, Features, LicenseFeatures |
Feature.cs, Feature.vb, Features.cs, Features.vb |
Used only in the SimpleTextEditor samples, these include the classes and methods necessary to define and validate individual application features. |
FindAndReplaceForm | FindAndReplaceForm.cs, FindAndReplaceForm.Designer.cs, FindAndReplaceForm.vb, FindAndReplaceForm.Designer.vb, FindAndReplaceForm.resx |
Used only in the SimpleTextEditor samples, this form allows the user to search for and optionally replace text that resides in the MainForm. |
LicenseConfiguration | LicenseConfiguration.cs
LicenseConfiguration.vb |
Contains licensing configuration properties, including settings required for encryption, and settings which define how the application should behave and react in various circumstances. It is very important to review all of the TODO and IMPORTANT comments throughout this source file. This file contains code that requires changes before using it with your application. |
MainForm | MainForm.cs, MainForm.Designer.cs, MainForm.vb, MainForm.Designer.vb, MainForm.resx |
Contains the main form or dialog implementation for the sample applications. This dialog is designed to provide a simple way of showing how your applications can interact with the licensing objects. |
ManualActivationForm | ManualActivationForm.cs
ManualActivationForm.vb (Has other supporting files.) |
Contains the form or dialog implementation that allows the protected application to be activated manually. This gives your application's users a means to activate a computer that does not have a direct Internet connection. This does, however, require the user to use another device that does have Internet connectivity. If your application needs to support activation without any Internet connectivity at all, then you should consider using trigger codes, which are supported in the PLUSManagedGui samples. |
OnlineActivationForm | OnlineActivationForm.cs, OnlineActivationForm.Designer.cs, OnlineActivationForm.vb, OnlineActivationForm.Designer.vb, OnlineActivationForm.resx |
Contains the form or dialog implementation that allows the protected application to be activated using a direct Internet connection via SOLO Server. |
ProxyCredentialsForm | ProxyCredentialsForm.cs, ProxyCredentialsForm.Designer.cs, ProxyCredentialsForm.vb, ProxyCredentialsForm.Designer.vb, ProxyCredentialsForm.resx |
Contains the form or dialog implementation that prompts the user to enter his or her proxy server authentication credentials. This prompt is only displayed when proxy server authentication is required, and the protected application is attempting to contact SOLO Server using an Internet connection for the first time. (The credentials are automatically cached by WebServiceHelper as long as the protected application is running.) |
SampleLicense | SampleLicense.cs
SampleLicense.vb |
Implements the License class or the WritableLicense class as appropriate for the given sample (for read-only, or writable license files, respectively). In the self-signed trial samples, this is an interface that allows the sample to perform actions on either type of license file. |
SampleReadOnlyLicense | SampleReadOnlyLicense.cs
SampleReadOnlyLicense.vb |
Implements the License class in PLUSManaged and provides an implementation that only uses read-only license files. This implementation is used for activated licenses in the Self-Signed Trial samples. |
SampleSelfSignedLicense | SampleSelfSignedLicense.cs
SampleSelfSignedLicense.vb |
Implements the WritableLicense class in PLUSManaged and provides an implementation that only uses writable/self-signed license files. This implementation is used for evaluation/trial licenses in the Self-Signed Trial samples. |
SplashScreenForm | SplashScreen.cs, SplashScreenForm.cs, SplashScreenForm.Designer.cs, SplashScreen.vb, SplashScreenForm.vb, SplashScreenFormDesigner.vb, SplashScreenForm.resx |
Used only in the SimpleTextEditor samples, this contains the form or dialog implementation that shows a splash screen is loading. This example dialog uses System.Threading.Thread.Sleep to create an artificial delay to simulate what it would look like if your application ran a large amount of initialization logic while displaying the splash screen. It also initializes the features that are enabled and disabled in the SimpleTextEditor sample application. |
WebServiceHelper | WebServiceHelper.cs
WebServiceHelper.vb |
Used in the sample Windows Forms applications, this class simplifies calling web services. It contains the default SOLO Server URLs used by the protected application, and is also what handles proxy server support (and proxy server authentication) in the sample applications. |
The LicenseConfiguration class contains a variety of settings, many of which are extremely important to change before re-using the sample source code in your applications. As noted earlier, many of the source code comments in this file begin with TODO and IMPORTANT. These comments indicate an area of code or a setting that you need to review and, in many cases, update. These settings are outlined in the table below.
Setting Name(s) | Description |
---|---|
Encryption Settings | |
EncryptionKey |
This contains the encryption key data, which usually comes from your SOLO Server account. It is very important that you update this to use your account's data before distributing your application! If you are evaluating Protection PLUS 5 SDK, also make sure you update the Encryption Key to a non-expiring key which will no longer have the "_EVALUATION_EXPIRES_2013-10-05_" expiration date at the beginning (the actual date will be different). If you distribute your application with an evaluation key, it will expire and your customers won't be able to use the software. If you have purchased a license for Protection PLUS 5 SDK but your Encryption Key still has an expiration date, please contact us. Additionally, it is important to use the correct key store in this property. In most cases, your desktop applications should use the user key store, while other types of applications, such as services and web applications/services, should typically use the machine key store. |
Application & Product Settings | |
Application Directory | Gets the absolute path to the directory in which the application (executable file) is located. This property is present as a convenience, and is used by other properties when storing other files (such as the license file, aliases, etc...) in the same directory as the sample application. |
ThisProductID | Gets the application's Product ID. This value is typically issued when configuring a product in SOLO Server. However, if you are not using SOLO Server, this should contain a value that is unique to each application you protect. |
ThisProductVersion | Gets the application's version number. By default, this uses the assembly version of the protected application. This value must contain 4 parts, no longer than 5-digits each (e.g. N.N.N.N, where each N is at least 0, and no larger than 99999). |
License File & Alias Settings | |
PATH_REGISTRY_LOCATION | This constant specifies the Windows registry key value (stored under HKEY_CURRENT_USER) that will be used to store the license file path specified with the NetworkFloatingSemaphore samples. When implementing network floating, it is very important to change this key location to something that is unique to each application you protect. |
Aliases | Gets a list of aliases used with any samples that use writable license files. By default, this stores the aliases in the same directory as the application or license file for convenience. (This makes it easier for you to simulate running your application on a computer for the first time since its easier to delete the license file and aliases this way.) However, it is very important that you pick better locations to hide/obscure these files for your protected applications. Additionally, it is also very important to make sure the locations selected are unique to each application you protect. |
LicenseFilePath | Gets the path to the application's license file. By default, this file is stored in the application directory for convenience. |
ManualActionSessionStatePath | When using PLUSManagedGui, you can configure the component (at design time or run time) to allow one or more actions (such as activation, deactivation, and refresh) to be done manually. This enables your customers to leverage another device's Internet connection to manually activate a system which is not connected to the Internet. This property gets the path to the manual action session state file, which is what stores a manual request so it can be completed at a later time. |
PathRegistryValue | When using the NetworkFloatingSemaphore samples, this gets or sets the registry value that contains the path to the license file and semaphore files. The registry location is defined in the PATH_REGISTRY_LOCATION constant described above. |
NetworkSemaphorePrefix | When using the NetworkFloatingSemaphore samples, this sets the prefix used for the semaphore file names. So for example, with the default prefix of "sema", the semaphore files created will be named like "sema123.net". |
Licensing Restrictions & Settings | |
FreshEvaluationDuration | When using samples that use a writable license file, this specifies the number of days in which a new evaluation period will last. |
RefreshLicenseAlwaysRequired | Specifies whether or not the protected application will attempt to validate and refresh its license with SOLO Server every time it starts or validates the license. |
RefreshLicenseAttemptFrequency | Specifies the number of days to wait before attempting to validate and refresh the license with SOLO Server. |
RefreshLicenseEnabled | This property is present for convenience, and evaluates RefreshLicenseAlwaysRequired, RefreshLicenseAttemptFrequency, and RefreshLicenseRequireFrequency to determine whether or not license refreshes are enabled at all. |
RefreshLicenseRequireFrequency | Specifies the number of days to wait before requiring the protected application to validate and refresh its license with SOLO Server. |
SystemIdentifierAlgorithms | The system identifier algorithms to use to uniquely identify and authorize a system. The identifiers generated by these algorithms are pivotal for adding copy protection to your applications. |
The LicenseConfiguration class will also contain other settings that are not mentioned here because they only apply to the PLUSManagedGui samples.