PublishLicense Klasa

Definicja

Reprezentuje podpisaną licencję publikowania zarządzanego praw.

public ref class PublishLicense
[System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)]
public class PublishLicense
public class PublishLicense
[<System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)>]
type PublishLicense = class
type PublishLicense = class
Public Class PublishLicense
Dziedziczenie
PublishLicense
Atrybuty

Przykłady

W poniższym przykładzie pokazano, jak zainicjować metodę PublishLicenseSign przy użyciu metody .

WriteStatus("   Signing the UnsignedPublishLicense\n" +
            "       to build the PublishLicense.");
UseLicense authorsUseLicense;
PublishLicense publishLicense =
    unsignedLicense.Sign(_secureEnv, out authorsUseLicense);

WriteStatus("   Binding the author's UseLicense and");
WriteStatus("       obtaining the CryptoProvider.");
CryptoProvider cryptoProvider = authorsUseLicense.Bind(_secureEnv);

WriteStatus("   Creating the EncryptedPackage.");
Stream packageStream = File.OpenRead(packageFile);
EncryptedPackageEnvelope ePackage =
    EncryptedPackageEnvelope.CreateFromPackage(encryptedFile,
        packageStream, publishLicense, cryptoProvider);

WriteStatus("   Adding an author's UseLicense.");
RightsManagementInformation rmi =
    ePackage.RightsManagementInformation;
rmi.SaveUseLicense(author, authorsUseLicense);

ePackage.Close();
WriteStatus("   Done - Package encryption complete.");

WriteStatus("Verifying package encryption.");
if (EncryptedPackageEnvelope.IsEncryptedPackageEnvelope(encryptedFile))
{
    WriteStatus("   Confirmed - '" + encryptedFilename +
                "' is encrypted.");
}
else
{
    MessageBox.Show("ERROR: '" + encryptedFilename +
        "' is NOT ENCRYPTED.", "Encryption Error",
        MessageBoxButton.OK, MessageBoxImage.Error);
    WriteStatus("ERROR: '" + encryptedFilename +
                "' is NOT ENCRYPTED.\n");
    return false;
}
WriteStatus("   Signing the UnsignedPublishLicense" & vbLf & "       to build the PublishLicense.")
Dim authorsUseLicense As UseLicense = Nothing
Dim publishLicense As PublishLicense = unsignedLicense.Sign(_secureEnv, authorsUseLicense)

WriteStatus("   Binding the author's UseLicense and")
WriteStatus("       obtaining the CryptoProvider.")
Dim cryptoProvider As CryptoProvider = authorsUseLicense.Bind(_secureEnv)

WriteStatus("   Creating the EncryptedPackage.")
Dim packageStream As Stream = File.OpenRead(packageFile)
Dim ePackage As EncryptedPackageEnvelope = EncryptedPackageEnvelope.CreateFromPackage(encryptedFile, packageStream, publishLicense, cryptoProvider)

WriteStatus("   Adding an author's UseLicense.")
Dim rmi As RightsManagementInformation = ePackage.RightsManagementInformation
rmi.SaveUseLicense(author, authorsUseLicense)

ePackage.Close()
WriteStatus("   Done - Package encryption complete.")

WriteStatus("Verifying package encryption.")
If EncryptedPackageEnvelope.IsEncryptedPackageEnvelope(encryptedFile) Then
    WriteStatus("   Confirmed - '" & encryptedFilename & "' is encrypted.")
Else
    MessageBox.Show("ERROR: '" & encryptedFilename & "' is NOT ENCRYPTED.", "Encryption Error", MessageBoxButton.OK, MessageBoxImage.Error)
    WriteStatus("ERROR: '" & encryptedFilename & "' is NOT ENCRYPTED." & vbLf)
    Return False
End If

Uwagi

PublishLicense definiuje dane zabezpieczeń dotyczące praw, użytkowników i innych informacji związanych z zabezpieczeniami. Licencja określa, w jaki sposób określony użytkownik na określonym komputerze może używać określonej zawartości zarządzanej prawami.

Proces publikowania rozpoczyna się od autora dokumentu, który definiuje informacje o prawach w obiekcie UnsignedPublishLicense. Następnie autor tworzy podpisany znak PublishLicense , wywołując Sign metodę UnsignedPublishLicense. Następnie można podać serializacji formy podpisanego PublishLicense użytkownikom końcowym, którzy mogą go użyć do uzyskania UseLicense obiektu przez wywołanie AcquireUseLicense metody PublishLicense. Zwrócony UseLicense element umożliwia aplikacji klienckiej wykonywanie praw przyznanych użytkownikowi.

Podobnie jak w przypadku innych System.Security.RightsManagement typów, PublishLicense można używać tylko w aplikacjach o pełnym zaufaniu.

Konstruktory

PublishLicense(String)

Inicjuje PublishLicense nowe wystąpienie klasy z określonej serializacji i podpisane .PublishLicense

Właściwości

ContentId

Pobiera identyfikator zawartości utworzony przez wydawcę.

ReferralInfoName

Pobiera nazwę kontaktu dla autora lub wydawcy zawartości.

ReferralInfoUri

Pobiera identyfikator URI kontaktu dla autora lub wydawcy zawartości.

UseLicenseAcquisitionUrl

Pobiera identyfikator URI, który ma być używany do uzyskiwania elementu UseLicense.

Metody

AcquireUseLicense(SecureEnvironment)

Próbuje uzyskać element UseLicense dla użytkownika lub grupy użytkowników w określonym elemecie SecureEnvironment.

AcquireUseLicenseNoUI(SecureEnvironment)

Próbuje uzyskać element UseLicense dla użytkownika lub grupy użytkowników w określonym elemecie SecureEnvironment.

DecryptUnsignedPublishLicense(CryptoProvider)

Zwraca odszyfrowaną UnsignedPublishLicense wersję tego podpisanego PublishLicensepliku .

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()

Type Pobiera bieżące wystąpienie.

(Odziedziczone po Object)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca serializowany ciąg XrML, który został użyty do utworzenia tej licencji.

Dotyczy

Zobacz też