PublisherIdentityPermission 构造函数

定义

初始化 PublisherIdentityPermission 类的新实例。

重载

PublisherIdentityPermission(X509Certificate)

使用指定的验证码 X.509v3 证书初始化 PublisherIdentityPermission 类的新实例。

PublisherIdentityPermission(PermissionState)

使用指定的 PublisherIdentityPermission 初始化 PermissionState 类的新实例。

PublisherIdentityPermission(X509Certificate)

Source:
PublisherIdentityPermission.cs
Source:
PublisherIdentityPermission.cs
Source:
PublisherIdentityPermission.cs
Source:
PublisherIdentityPermission.cs

使用指定的验证码 X.509v3 证书初始化 PublisherIdentityPermission 类的新实例。

public:
 PublisherIdentityPermission(System::Security::Cryptography::X509Certificates::X509Certificate ^ certificate);
public PublisherIdentityPermission (System.Security.Cryptography.X509Certificates.X509Certificate certificate);
new System.Security.Permissions.PublisherIdentityPermission : System.Security.Cryptography.X509Certificates.X509Certificate -> System.Security.Permissions.PublisherIdentityPermission
Public Sub New (certificate As X509Certificate)

参数

certificate
X509Certificate

表示软件发布者的身份的 X.509 证书。

例外

certificate 参数为 null

certificate 参数不是有效的证书。

注解

X.509 证书定义由 Authenticode 代码签名建立的指定软件发布者的标识。

适用于

PublisherIdentityPermission(PermissionState)

Source:
PublisherIdentityPermission.cs
Source:
PublisherIdentityPermission.cs
Source:
PublisherIdentityPermission.cs
Source:
PublisherIdentityPermission.cs

使用指定的 PublisherIdentityPermission 初始化 PermissionState 类的新实例。

public:
 PublisherIdentityPermission(System::Security::Permissions::PermissionState state);
public PublisherIdentityPermission (System.Security.Permissions.PermissionState state);
new System.Security.Permissions.PublisherIdentityPermission : System.Security.Permissions.PermissionState -> System.Security.Permissions.PublisherIdentityPermission
Public Sub New (state As PermissionState)

参数

state
PermissionState

PermissionState 值之一。

例外

state 参数不是 PermissionState 的有效值。

示例

下面的示例演示如何使用 PublisherIdentityPermission.PublisherIdentityPermission(PermissionState) 构造函数。

// Create an empty PublisherIdentityPermission to serve as the target of the copy.
publisherPerm2 = gcnew PublisherIdentityPermission(PermissionState::None);
publisherPerm2 = (PublisherIdentityPermission^)publisherPerm1->Copy();
Console::WriteLine("Result of copy = " + publisherPerm2);
// Create an empty PublisherIdentityPermission to serve as the target of the copy.
publisherPerm2 = new PublisherIdentityPermission(PermissionState.None);
publisherPerm2 = (PublisherIdentityPermission)publisherPerm1.Copy();
Console.WriteLine("Result of copy = " + publisherPerm2.ToString());
    ' Create an empty PublisherIdentityPermission to serve as the target of the copy.
    publisherPerm2 = New PublisherIdentityPermission(PermissionState.None)
    publisherPerm2 = CType(publisherPerm1.Copy(), PublisherIdentityPermission)
    Console.WriteLine("Result of copy = " + publisherPerm2.ToString())

End Sub

注解

创建完全受限 (None) 或 Unrestricted 权限。

注意

在 .NET Framework版本 1.0 和 1.1 中,标识权限不能具有Unrestricted权限状态值。 从 .NET Framework 版本 2.0 开始,标识权限可以具有任何权限状态值。 这意味着在 2.0 及更高版本中,标识权限的行为与实现 IUnrestrictedPermission 接口的权限的行为相同。 也就是说,如果已向程序集授予完全信任,则无论程序集的标识如何,对标识的要求始终会成功。

在 .NET Framework版本 1.0 和 1.1 中,即使调用程序集完全受信任,对标识权限的要求也有效。 也就是说,尽管调用程序集具有完全信任,但如果程序集不符合所需的条件,则对标识权限的要求会失败。 从 .NET Framework 版本 2.0 开始,如果调用程序集具有完全信任,则对标识权限的要求无效。 这可确保所有权限的一致性,避免将标识权限视为特殊情况。

适用于