CryptoProvider.BoundGrants Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a collection listing the rights that passed verification and that are granted to the user.
public:
property System::Collections::ObjectModel::ReadOnlyCollection<System::Security::RightsManagement::ContentGrant ^> ^ BoundGrants { System::Collections::ObjectModel::ReadOnlyCollection<System::Security::RightsManagement::ContentGrant ^> ^ get(); };
public System.Collections.ObjectModel.ReadOnlyCollection<System.Security.RightsManagement.ContentGrant> BoundGrants { get; }
member this.BoundGrants : System.Collections.ObjectModel.ReadOnlyCollection<System.Security.RightsManagement.ContentGrant>
Public ReadOnly Property BoundGrants As ReadOnlyCollection(Of ContentGrant)
A collection enumerating the rights that passed verification and that are granted to the user.
The following example shows how to use the BoundGrants property to obtain a list rights granted through a UseLicense.
ShowStatus(" Binding UseLicense with the SecureEnvironment" +
"\n to obtain the CryptoProvider.");
CryptoProvider cryptoProvider = useLicense.Bind(_secureEnv);
ShowStatus(" Obtaining BoundGrants.");
ReadOnlyCollection<ContentGrant> grants =
cryptoProvider.BoundGrants;
rightsBlockTitle.Text = "Rights - " + Filename(useLicenseFile);
rightsBlock.Text = "GRANTS LIST\n-----------------\n";
foreach (ContentGrant grant in grants)
{
rightsBlock.Text += "USER: " + grant.User.Name + " [" +
grant.User.AuthenticationType + "]\n";
rightsBlock.Text += "RIGHT: " + grant.Right.ToString() + "\n";
rightsBlock.Text += " From: " + grant.ValidFrom + "\n";
rightsBlock.Text += " Until: " + grant.ValidUntil + "\n";
}
if (cryptoProvider.CanDecrypt == true)
ShowStatus(" Decryption granted.");
else
ShowStatus(" CANNOT DECRYPT!");
ShowStatus(" Binding UseLicense with the SecureEnvironment" & vbLf & " to obtain the CryptoProvider.")
Dim cryptoProvider As CryptoProvider = useLicense.Bind(_secureEnv)
ShowStatus(" Obtaining BoundGrants.")
Dim grants As ReadOnlyCollection(Of ContentGrant) = cryptoProvider.BoundGrants
rightsBlockTitle.Text = "Rights - " & Filename(useLicenseFile)
rightsBlock.Text = "GRANTS LIST" & vbLf & "-----------------" & vbLf
For Each grant As ContentGrant In grants
rightsBlock.Text &= "USER: " & grant.User.Name & " [" & grant.User.AuthenticationType & "]" & vbLf
rightsBlock.Text &= "RIGHT: " & grant.Right.ToString() & vbLf
rightsBlock.Text &= " From: " & grant.ValidFrom & vbLf
rightsBlock.Text &= " Until: " & grant.ValidUntil & vbLf
Next grant
If cryptoProvider.CanDecrypt = True Then
ShowStatus(" Decryption granted.")
Else
ShowStatus(" CANNOT DECRYPT!")
End If
Produto | Versões |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
Comentários do .NET
O .NET é um projeto código aberto. Selecione um link para fornecer comentários: