Redigera

Dela via


PublisherIdentityPermission Constructors

Definition

Initializes a new instance of the PublisherIdentityPermission class.

Overloads

PublisherIdentityPermission(X509Certificate)

Initializes a new instance of the PublisherIdentityPermission class with the specified Authenticode X.509v3 certificate.

PublisherIdentityPermission(PermissionState)

Initializes a new instance of the PublisherIdentityPermission class with the specified PermissionState.

PublisherIdentityPermission(X509Certificate)

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

Initializes a new instance of the PublisherIdentityPermission class with the specified Authenticode X.509v3 certificate.

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)

Parameters

certificate
X509Certificate

An X.509 certificate representing the software publisher's identity.

Exceptions

The certificate parameter is null.

The certificate parameter is not a valid certificate.

Remarks

The X.509 certificate defines the identity of the specified software publisher, as established by Authenticode code signing.

Applies to

PublisherIdentityPermission(PermissionState)

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

Initializes a new instance of the PublisherIdentityPermission class with the specified 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)

Parameters

state
PermissionState

One of the PermissionState values.

Exceptions

The state parameter is not a valid value of PermissionState.

Examples

The following example shows how to use the PublisherIdentityPermission.PublisherIdentityPermission(PermissionState) constructor.

// 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

Remarks

Creates either a fully restricted (None) or Unrestricted permission.

Note

In the .NET Framework versions 1.0 and 1.1, identity permissions cannot have an Unrestricted permission state value. Starting with the .NET Framework version 2.0, identity permissions can have any permission state value. This means that in 2.0 and later versions, identity permissions have the same behavior as permissions that implement the IUnrestrictedPermission interface. That is, a demand for an identity always succeeds, regardless of the identity of the assembly, if the assembly has been granted full trust.

In the .NET Framework versions 1.0 and 1.1, demands on the identity permissions are effective, even when the calling assembly is fully trusted. That is, although the calling assembly has full trust, a demand for an identity permission fails if the assembly does not meet the demanded criteria. Starting with the .NET Framework version 2.0, demands for identity permissions are ineffective if the calling assembly has full trust. This assures consistency for all permissions, eliminating the treatment of identity permissions as a special case.

Applies to