PublishLicense 類別

定義

代表帶正負號的版權管理發行授權。

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
繼承
PublishLicense
屬性

範例

下列範例示範如何使用 方法來初始化 PublishLicenseSign

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

備註

PublishLicense 定義許可權、使用者和其他安全性相關資訊的安全性資料。 授權會定義特定電腦上的特定使用者如何使用指定的版權管理內容。

發佈程式從檔作者開始,該作者會在 中 UnsignedPublishLicense 定義許可權資訊。 接下來,作者會呼叫 Sign 的 方法來建立已簽署 PublishLicenseUnsignedPublishLicense 。 然後,可以將已簽署 PublishLicense 的序列化形式提供給使用者,這些使用者可以使用它來取得 UseLicense ,方法是呼叫 AcquireUseLicensePublishLicense 方法。 接著,傳 UseLicense 回的 可讓用戶端應用程式執行授與使用者的許可權。

如同其他類型的 System.Security.RightsManagementPublishLicense 只能在完全信任應用程式中使用。

建構函式

PublishLicense(String)

從已序列化且已簽署的指定 PublishLicense 初始化 PublishLicense 類別的新執行個體 (Instance)。

屬性

ContentId

取得發行者建立的內容識別項。

ReferralInfoName

取得內容作者或發行者的連絡人姓名。

ReferralInfoUri

取得內容作者或發行者的連絡 URI。

UseLicenseAcquisitionUrl

取得用來取得 UseLicense 的 URI。

方法

AcquireUseLicense(SecureEnvironment)

嘗試取得適用於 UseLicense 中使用者或使用者群組的 SecureEnvironment

AcquireUseLicenseNoUI(SecureEnvironment)

嘗試取得適用於 UseLicense 中使用者或使用者群組的 SecureEnvironment

DecryptUnsignedPublishLicense(CryptoProvider)

傳回這個已簽署 UnsignedPublishLicense 的已解密 PublishLicense 版本。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回用來建立此授權的序列化 XrML 字串。

適用於

另請參閱