RightsManagementInformation Property

EncryptedPackageEnvelope.RightsManagementInformation Property


Gets the rights management information stored in the EncryptedPackageEnvelope; specifically, the PublishLicense and the UseLicenses stored in the OLE compound file that embodies the rights-management protected package

Namespace:   System.IO.Packaging
Assembly:  WindowsBase (in WindowsBase.dll)

public RightsManagementInformation RightsManagementInformation { get; }

The following example shows how to obtain RightsManagementInformation for an encrypted package by use the RightsManagementInformation property.

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 =
        packageStream, publishLicense, cryptoProvider);

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

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

WriteStatus("Verifying package encryption.");
if (EncryptedPackageEnvelope.IsEncryptedPackageEnvelope(encryptedFile))
    WriteStatus("   Confirmed - '" + encryptedFilename +
                "' is encrypted.");
    MessageBox.Show("ERROR: '" + encryptedFilename +
        "' is NOT ENCRYPTED.", "Encryption Error",
        MessageBoxButton.OK, MessageBoxImage.Error);
    WriteStatus("ERROR: '" + encryptedFilename +
                "' is NOT ENCRYPTED.\n");
    return false;

.NET Framework
Available since 3.0
Return to top
© 2015 Microsoft