Defines an hardware object. The hardware restriction tie the license to a particular hardware represented by a key string. This class cannot be inherited.
// Creates an XML license for a specific hardware var license =newXmlLicense();// Add the hardware key// The hardware key can be generated using the // Babel.Licensing.HardwareId classHardwareRestriction hardware =newHardwareRestriction();hardware.HardwareKey="EFP76-XAJXI-655MU-JAQVX-LGYL6";license.Restrictions.Add(hardware);var signer =XmlDigitalSignature.CreateFromKeyFile("Keys.snk");string licenseXML =license.SignWith(signer) .ToReadableString();// The same license can be generated using fluent APIvar signer =XmlDigitalSignature.CreateFromKeyFile("Keys.snk");string licenseXML =newXmlLicense().WithHardwareKey("EFP76-XAJXI-655MU-JAQVX-LGYL6") .SignWith(signer) .ToReadableString();//<Licenses xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">// <License>// <Restrictions>// <Restriction xsi:type="Hardware">// <HardwareKey>EFP76-XAJXI-655MU-JAQVX-LGYL6</HardwareKey>// </Restriction>// </Restrictions>// </License>// <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">// <SignedInfo>// <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />// <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />// <Reference URI="">// <Transforms>// <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />// </Transforms>// <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />// <DigestValue>vBCBlHCwDoJuU8+hZ5k9b2jRKfk=</DigestValue>// </Reference>// </SignedInfo>// <SignatureValue>CnSM...</SignatureValue>// </Signature>//</Licenses>
' Creates an XML license for a specific hardware
Dim license = New XmlLicense()
' Add the hardware key
' The hardware key can be generated using the
' Babel.Licensing.HardwareId class
Dim hardware As New HardwareRestriction()
hardware.HardwareKey = "EFP76-XAJXI-655MU-JAQVX-LGYL6"
license.Restrictions.Add(hardware)
Dim signer = XmlDigitalSignature.CreateFromKeyFile("Keys.snk")
Dim licenseXML As String = license.SignWith(signer).ToReadableString()
' The same license can be generated using fluent API
Dim signer = XmlDigitalSignature.CreateFromKeyFile("Keys.snk")
Dim licenseXML As String = New XmlLicense() _
.WithHardwareKey("EFP76-XAJXI-655MU-JAQVX-LGYL6") _
.SignWith(signer) _
.ToReadableString()
'<Licenses xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
' <License>
' <Restrictions>
' <Restriction xsi:type="Hardware">
' <HardwareKey>EFP76-XAJXI-655MU-JAQVX-LGYL6</HardwareKey>
' </Restriction>
' </Restrictions>
' </License>
' <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
' <SignedInfo>
' <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
' <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
' <Reference URI="">
' <Transforms>
' <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
' </Transforms>
' <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
' <DigestValue>vBCBlHCwDoJuU8+hZ5k9b2jRKfk=</DigestValue>
' </Reference>
' </SignedInfo>
' <SignatureValue>CnSM...</SignatureValue>
' </Signature>
'</Licenses>