UnsignedPublishLicense.Sign(SecureEnvironment, UseLicense) 메서드

정의

서명된 PublishLicense를 만들고 문서 작성자에 대한 UseLicense를 반환합니다.

public:
 System::Security::RightsManagement::PublishLicense ^ Sign(System::Security::RightsManagement::SecureEnvironment ^ secureEnvironment, [Runtime::InteropServices::Out] System::Security::RightsManagement::UseLicense ^ % authorUseLicense);
public System.Security.RightsManagement.PublishLicense Sign (System.Security.RightsManagement.SecureEnvironment secureEnvironment, out System.Security.RightsManagement.UseLicense authorUseLicense);
member this.Sign : System.Security.RightsManagement.SecureEnvironment * UseLicense -> System.Security.RightsManagement.PublishLicense
Public Function Sign (secureEnvironment As SecureEnvironment, ByRef authorUseLicense As UseLicense) As PublishLicense

매개 변수

secureEnvironment
SecureEnvironment

라이선스 활성화 및 바인딩을 위한 보안 환경입니다.

authorUseLicense
UseLicense

문서 작성자에 대해 반환된 UseLicense입니다.

반환

PublishLicense에 서명하여 만들어진 서명된 UnsignedPublishLicense입니다.

예제

다음 예제에서는이 클래스를 사용 하 여 초기화 하는 방법을 보여 줍니다는 PublishLicense합니다.

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

적용 대상