C# Class Opc.Ua.WindowsCertificateStore

Provides access to a simple file based certificate store.
Inheritance: ICertificateStore
ファイルを表示 Open project: OPCFoundation/Misc-Tools Class Usage Examples

Public Methods

Method Description
Add ( X509Certificate2 certificate ) : void
AddCRL ( X509CRL crl ) : void

Adds a CRL to the store.

Close ( ) : void
Delete ( string thumbprint ) : bool
DeleteCRL ( X509CRL crl ) : bool

Removes a CRL from the store.

Dispose ( ) : void

May be called by the application to clean up resources.

Enumerate ( ) : X509Certificate2Collection
EnumerateCRLs ( ) : List

Returns the CRLs in the store.

EnumerateCRLs ( X509Certificate2 issuer ) : List

Returns the CRLs for the issuer.

EnumerateStores ( WindowsStoreType storeType, string hostName, string serviceNameOrUserSid ) : IList

Enumerates the available windows certificate store.

FindByThumbprint ( string thumbprint ) : X509Certificate2
Format ( ) : string

Returns the string representation of the store.

GetAccessRules ( ) : IList
GetAccessRules ( string thumbprint ) : IList
GetPrivateKeyFilePath ( string thumbprint ) : string
IsRevoked ( X509Certificate2 issuer, X509Certificate2 certificate ) : Opc.Ua.StatusCode

Checks if issuer has revoked the certificate.

Open ( string location ) : void Syntax (items enclosed in [] are optional): [\\HostName\]StoreType[\(ServiceName | UserSid)]\SymbolicName HostName - the name of the machine where the store resides. SymbolicName - one of LocalMachine, CurrentUser, User or Service ServiceName - the name of an NT service. UserSid - the SID for a user account. SymbolicName - the symbolic name of the store (e.g. My, Root, Trust, CA, etc.). Examples: \\MYPC\LocalMachine\My CurrentUser\Trust \\MYPC\Service\My UA Server\UA Applications User\S-1-5-25\Root
PermanentlyDeleteStore ( ) : void

Deletes the store and all certificates contained within it.

SetAccessRules ( IList rules, bool replaceExisting ) : void
SetAccessRules ( string thumbprint, IList rules, bool replaceExisting ) : void
WindowsCertificateStore ( ) : System

Initializes a store.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Cleans up all resources held by the object.

Private Methods

Method Description
Copy ( byte bytes ) : IntPtr

Makes an unmanaged copy of an array.

DuplicateString ( string text ) : IntPtr

converts a managed string to an unmanaged string (allocated with malloc).

EnumStoreCallback ( IntPtr pvSystemStore, uint dwFlags, IntPtr pStoreInfo, IntPtr pvReserved, IntPtr pvArg ) : int
FindCertificate ( IntPtr hStore, string thumbprint ) : IntPtr

Finds a certificate in the store.

GetCspKeyContainerInfo ( IntPtr hStore, string thumbprint, string symbolicName, WindowsStoreType storeType ) : CspKeyContainerInfo

returns the information for the key container associated with the certificate.

GetFlags ( WindowsStoreType storeType ) : uint

maps the store type onto a set of flags that can be passed to the various crypto functions.

GetKeyFileInfo ( string uniqueId, WindowsStoreType storeType, string userSid ) : FileInfo

finds the key file.

GetStoreDisplayName ( WindowsStoreType storeType, string serviceNameOrUserSid, string storeName ) : string

Returns the display name for the certificate store.

GetThumbprint ( IntPtr pCertContext ) : string

Gets the thumbprint from the certificate context.

OpenStore ( bool readOnly, bool createAlways, bool throwIfNotExist ) : IntPtr

Opens the certificate store.

Parse ( string location ) : void

Parses the a string representing the store location.

Method Details

Add() public method

public Add ( X509Certificate2 certificate ) : void
certificate System.Security.Cryptography.X509Certificates.X509Certificate2
return void

AddCRL() public method

Adds a CRL to the store.
public AddCRL ( X509CRL crl ) : void
crl X509CRL
return void

Close() public method

public Close ( ) : void
return void

Delete() public method

public Delete ( string thumbprint ) : bool
thumbprint string
return bool

DeleteCRL() public method

Removes a CRL from the store.
public DeleteCRL ( X509CRL crl ) : bool
crl X509CRL
return bool

Dispose() public method

May be called by the application to clean up resources.
public Dispose ( ) : void
return void

Dispose() protected method

Cleans up all resources held by the object.
protected Dispose ( bool disposing ) : void
disposing bool
return void

Enumerate() public method

public Enumerate ( ) : X509Certificate2Collection
return System.Security.Cryptography.X509Certificates.X509Certificate2Collection

EnumerateCRLs() public method

Returns the CRLs in the store.
public EnumerateCRLs ( ) : List
return List

EnumerateCRLs() public method

Returns the CRLs for the issuer.
public EnumerateCRLs ( X509Certificate2 issuer ) : List
issuer System.Security.Cryptography.X509Certificates.X509Certificate2
return List

EnumerateStores() public static method

Enumerates the available windows certificate store.
public static EnumerateStores ( WindowsStoreType storeType, string hostName, string serviceNameOrUserSid ) : IList
storeType WindowsStoreType
hostName string
serviceNameOrUserSid string
return IList

FindByThumbprint() public method

public FindByThumbprint ( string thumbprint ) : X509Certificate2
thumbprint string
return System.Security.Cryptography.X509Certificates.X509Certificate2

Format() public method

Returns the string representation of the store.
public Format ( ) : string
return string

GetAccessRules() public method

public GetAccessRules ( ) : IList
return IList

GetAccessRules() public method

public GetAccessRules ( string thumbprint ) : IList
thumbprint string
return IList

GetPrivateKeyFilePath() public method

public GetPrivateKeyFilePath ( string thumbprint ) : string
thumbprint string
return string

IsRevoked() public method

Checks if issuer has revoked the certificate.
public IsRevoked ( X509Certificate2 issuer, X509Certificate2 certificate ) : Opc.Ua.StatusCode
issuer System.Security.Cryptography.X509Certificates.X509Certificate2
certificate System.Security.Cryptography.X509Certificates.X509Certificate2
return Opc.Ua.StatusCode

Open() public method

Syntax (items enclosed in [] are optional): [\\HostName\]StoreType[\(ServiceName | UserSid)]\SymbolicName HostName - the name of the machine where the store resides. SymbolicName - one of LocalMachine, CurrentUser, User or Service ServiceName - the name of an NT service. UserSid - the SID for a user account. SymbolicName - the symbolic name of the store (e.g. My, Root, Trust, CA, etc.). Examples: \\MYPC\LocalMachine\My CurrentUser\Trust \\MYPC\Service\My UA Server\UA Applications User\S-1-5-25\Root
public Open ( string location ) : void
location string
return void

PermanentlyDeleteStore() public method

Deletes the store and all certificates contained within it.
public PermanentlyDeleteStore ( ) : void
return void

SetAccessRules() public method

public SetAccessRules ( IList rules, bool replaceExisting ) : void
rules IList
replaceExisting bool
return void

SetAccessRules() public method

public SetAccessRules ( string thumbprint, IList rules, bool replaceExisting ) : void
thumbprint string
rules IList
replaceExisting bool
return void

WindowsCertificateStore() public method

Initializes a store.
public WindowsCertificateStore ( ) : System
return System