XmlLicenseManager
Namespace: Babel.Licensing Assembly: Babel.Licensing.dll
This class is used to validate XML license and get object from XML.
Inheritance
Implements
ICreateCustomRestriction, ICreateCustomSignatureProvider
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
XmlLicenseManager()
Properties
CurrentContext
Gets or sets the license context.
Property Value
LicenseFactory
Gets or sets the license factory.
Property Value
SignatureProvider
Gets or sets the signature provider.
Property Value
Methods
IsValid(string, Type, object)
Determines whether the given XML string is a valid license.
Parameters
The XML license string.
The type associated with the license.
The object instance associated with the license.
Returns
true if the given XML license is valid; otherwise, false.
Remarks
To successfully validate a license, the license must be signed and the signature must carry enough information to reconstruct the object valid for validating signatures. For instance, if you have signed the license with an object, the signature must include the public key. If the public key is not available inside the signature element, it will be extracted from the assembly strong name information. If the assembly is not signed and the public key is not embedded into the signature element the validation will fails. For signature generated by the provider, the public key cannot be extracted from the assembly strong name as ECDsa signatures are not based on RSA algorithm used to strong name the assembly. In this scenario the ECDsa signature must carry the public key information to validate the signature. If the signature does not embed the public key information, you should provide the XmlLicenseManager with an instance of the provider generated from the ECDsa public key before calling any validation method. To embed into the signature the key information required for the validation, the signature provider must implement the interface and the property must be set to true.
OnCreateCustomRestriction(CreateCustomRestrictionEventArgs)
Raises the CreateCustomRestriction event.
Parameters
Event information to send to registered event handlers.
OnCreateCustomSignatureProvider(CreateCustomSignatureProviderEventArgs)
Raises the CreateCustomSignatureProvider event.
Parameters
Event information to send to registered event handlers.
Validate(string, Type, object)
Validates the XML license.
Parameters
The XML license string.
The type associated with the license.
The object instance associated with the license.
Returns
An XmlLicense object that has been validated.
Remarks
To successfully validate a license, the license must be signed and the signature must carry enough information to reconstruct the object valid for validating signatures. For instance, if you have signed the license with an object, the signature must include the public key. If the public key is not available inside the signature element, it will be extracted from the assembly strong name information. If the assembly is not signed and the public key is not embedded into the signature element the validation will fails. For signature generated by the provider, the public key cannot be extracted from the assembly strong name as ECDsa signatures are not based on RSA algorithm used to strong name the assembly. In this scenario the ECDsa signature must carry the public key information to validate the signature. If the signature does not embed the public key information, you should provide the XmlLicenseManager with an instance of the provider generated from the ECDsa public key before calling any validation method. To embed into the signature the key information required for the validation, the signature provider must implement the interface and the property must be set to true.
Exceptions
Thrown when one or more required arguments are null.
Thrown when a Babel License error condition occurs.
CreateCustomRestriction
Event queue for all listeners interested in CreateCustomRestriction events.
Event Type
EventHandler<CreateCustomRestrictionEventArgs>
CreateCustomSignatureProvider
Event queue for all listeners interested in CreateCustomSignatureProvider events.
Event Type
Last updated