本文整理汇总了VB.NET中System.IO.Packaging.RightsManagementInformation类的典型用法代码示例。如果您正苦于以下问题:VB.NET RightsManagementInformation类的具体用法?VB.NET RightsManagementInformation怎么用?VB.NET RightsManagementInformation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RightsManagementInformation类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: WriteStatus
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
示例2: ContentUser
ShowStatus(" Opening the encrypted Package.")
Dim ePackage As EncryptedPackageEnvelope = EncryptedPackageEnvelope.Open(xpsFile, FileAccess.ReadWrite)
Dim rmi As RightsManagementInformation = ePackage.RightsManagementInformation
ShowStatus(" Looking for an embedded UseLicense for user:" & vbLf & " " & currentUserId & " [" & _authentication & "]")
Dim useLicense As UseLicense = rmi.LoadUseLicense(New ContentUser(currentUserId, _authentication))
Dim grants As ReadOnlyCollection(Of ContentGrant)
If useLicense Is Nothing Then
ShowStatus(" No Embedded UseLicense found." & vbLf & " " & "Attempting to acqure UseLicnese" & vbLf & " " & "from the PublishLicense.")
Dim pubLicense As PublishLicense = rmi.LoadPublishLicense()
ShowStatus(" Referral information:")
If pubLicense.ReferralInfoName Is Nothing Then
ShowStatus(" Name: (null)")
Else
ShowStatus(" Name: " & pubLicense.ReferralInfoName)
End If
If pubLicense.ReferralInfoUri Is Nothing Then
ShowStatus(" Uri: (null)")
Else
ShowStatus(" Uri: " & pubLicense.ReferralInfoUri.ToString())
End If
useLicense = pubLicense.AcquireUseLicense(_secureEnv)
If useLicense Is Nothing Then
ShowStatus(" User DOES NOT HAVE RIGHTS" & vbLf & " " & "to access this document!")
Return False
End If
End If ' end:if (useLicense == null)
ShowStatus(" UseLicense acquired.")