CryptoProvider.CanDecrypt Eigenschaft

Definition

Ruft einen Wert ab, der angibt, ob der Benutzer über Entschlüsselungsrechte verfügt.

public:
 property bool CanDecrypt { bool get(); };
public bool CanDecrypt { get; }
member this.CanDecrypt : bool
Public ReadOnly Property CanDecrypt As Boolean

Eigenschaftswert

Boolean

true wenn der UseLicense Benutzer Die Entschlüsselungsrechte gewährt; andernfalls false.

Beispiele

Im folgenden Beispiel wird gezeigt, wie Sie die Eigenschaft verwenden, um festzustellen, ob die CanDecrypt Entschlüsselung zulässig ist.

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

Hinweise

CanDecrypt gibt zurück true , wenn die UseLicense Bindung an dies CryptoProvider den Benutzer Leserechte gewährt, z. B. "Ansicht", "Bearbeiten", "Drucken" oder "Besitzer".

Gilt für

Siehe auch