UA Bundle SDK .NET  2.2.3.276
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Groups Pages
UnifiedAutomation.UaBase.SecurityUtils Class Reference

Provides various security related functions. More...

Static Public Member Functions

static ICertificateStore CreateStore (string storePath)
 Creates a new certificate store object. More...
 
static ICertificateStore CreateStore (string storePath, bool noPrivateKeys)
 Creates a new certificate store object. More...
 
static ICertificateStore CreateStore (string storeType, string storePath, bool noPrivateKeys)
 Creates a new certificate store object. More...
 
static bool IsWindowStorePath (string storePath)
 Determines whether the store path points to a windows certificate store. More...
 
static ICertificate LoadCertificate (byte[] bytes)
 Initializes a certificate with the DER encoded bytes. More...
 
static ICertificate LoadCertificate (string storeType, string storePath, string subjectName, string thumbprint, bool needPrivateKey)
 Initializes a certificate with the DER encoded bytes. More...
 
static byte[] GetNonce (int length)
 Returns a new nonce. More...
 
static byte[] Concat (params byte[][] arrays)
 Concatinates a list of byte arrays. More...
 
static byte[] PSHA1 (byte[] secret, string label, byte[] data, int offset, int length)
 Generates a Pseudo random sequence of bits using the P_SHA1 alhorithm. More...
 
static List< string > ParseDistinguishedName (string name)
 Parses a distingushed name. More...
 
static bool FindStringIgnoreCase (IList< string > strings, string target)
 Checks if the target is in the list. Comparisons ignore case. More...
 
static bool AreDomainsEqual (string domain1, string domain2)
 Checks if the domains are equal. More...
 
static IList< string > GetDomainsFromCertficate (X509Certificate2 certificate)
 Extracts the the DNS names specified in the certificate. More...
 
static string GetApplicationUriFromCertficate (X509Certificate2 certificate)
 Extracts the the application URI specified in the certificate. More...
 
static bool DoesUrlMatchCertificate (X509Certificate2 certificate, Uri endpointUrl)
 Checks that the domain in the URL provided matches one of the domains in the certificate. More...
 
static bool CompareDistinguishedName (string name1, string name2)
 Compares two distinguished names. More...
 
static bool CompareDistinguishedName (X509Certificate2 certificate, List< string > parsedName)
 Compares two distinguished names. More...
 
static string ChangeSubjectNameDelimiter (string name, char delimiter)
 Changes the delimiter used to seperate fields in a subject name. More...
 
static EncryptedData Encrypt (X509Certificate2 certificate, string securityPolicyUri, byte[] plainText)
 Encrypts the text using the SecurityPolicyUri and returns the result. More...
 
static byte[] Decrypt (X509Certificate2 certificate, string securityPolicyUri, EncryptedData dataToDecrypt)
 Decrypts the CipherText using the SecurityPolicyUri and returns the PlainTetx. More...
 
static SignatureData Sign (X509Certificate2 certificate, string securityPolicyUri, byte[] dataToSign)
 Signs the data using the SecurityPolicyUri and returns the signature. More...
 
static bool Verify (X509Certificate2 certificate, string securityPolicyUri, byte[] dataToVerify, SignatureData signature)
 Verifies the signature using the SecurityPolicyUri and return true if valid. More...
 
static bool CheckIfProcessHasAdminRights ()
 Checks if the process has admin rights. More...
 

Detailed Description

Provides various security related functions.

Member Function Documentation

static bool UnifiedAutomation.UaBase.SecurityUtils.AreDomainsEqual ( string  domain1,
string  domain2 
)
inlinestatic

Checks if the domains are equal.

Parameters
domain1The first domain to compare.
domain2The second domain to compare.
Returns
True if they are equal.
static string UnifiedAutomation.UaBase.SecurityUtils.ChangeSubjectNameDelimiter ( string  name,
char  delimiter 
)
inlinestatic

Changes the delimiter used to seperate fields in a subject name.

static bool UnifiedAutomation.UaBase.SecurityUtils.CheckIfProcessHasAdminRights ( )
inlinestatic

Checks if the process has admin rights.

static bool UnifiedAutomation.UaBase.SecurityUtils.CompareDistinguishedName ( string  name1,
string  name2 
)
inlinestatic

Compares two distinguished names.

static bool UnifiedAutomation.UaBase.SecurityUtils.CompareDistinguishedName ( X509Certificate2  certificate,
List< string >  parsedName 
)
inlinestatic

Compares two distinguished names.

static byte [] UnifiedAutomation.UaBase.SecurityUtils.Concat ( params byte  arrays[][])
inlinestatic

Concatinates a list of byte arrays.

Parameters
arraysThe arrays.
Returns
The new array.
static ICertificateStore UnifiedAutomation.UaBase.SecurityUtils.CreateStore ( string  storePath)
inlinestatic

Creates a new certificate store object.

Parameters
storePathThe store path.
Returns
An object that can be used to access the store.
static ICertificateStore UnifiedAutomation.UaBase.SecurityUtils.CreateStore ( string  storePath,
bool  noPrivateKeys 
)
inlinestatic

Creates a new certificate store object.

Parameters
storePathThe store path.
noPrivateKeysif set to true then optimize performance by ignoring the private keys.
Returns
An object that can be used to access the store.
static ICertificateStore UnifiedAutomation.UaBase.SecurityUtils.CreateStore ( string  storeType,
string  storePath,
bool  noPrivateKeys 
)
inlinestatic

Creates a new certificate store object.

Parameters
storeTypeType of the store.
storePathThe store path.
noPrivateKeysif set to true then optimize performance by ignoring the private keys.
Returns
An object that can be used to access the store.
static byte [] UnifiedAutomation.UaBase.SecurityUtils.Decrypt ( X509Certificate2  certificate,
string  securityPolicyUri,
EncryptedData  dataToDecrypt 
)
inlinestatic

Decrypts the CipherText using the SecurityPolicyUri and returns the PlainTetx.

static bool UnifiedAutomation.UaBase.SecurityUtils.DoesUrlMatchCertificate ( X509Certificate2  certificate,
Uri  endpointUrl 
)
inlinestatic

Checks that the domain in the URL provided matches one of the domains in the certificate.

Parameters
certificateThe certificate.
endpointUrlThe endpoint url to verify.
Returns
True if the certificate matches the url.
static EncryptedData UnifiedAutomation.UaBase.SecurityUtils.Encrypt ( X509Certificate2  certificate,
string  securityPolicyUri,
byte[]  plainText 
)
inlinestatic

Encrypts the text using the SecurityPolicyUri and returns the result.

static bool UnifiedAutomation.UaBase.SecurityUtils.FindStringIgnoreCase ( IList< string >  strings,
string  target 
)
inlinestatic

Checks if the target is in the list. Comparisons ignore case.

static string UnifiedAutomation.UaBase.SecurityUtils.GetApplicationUriFromCertficate ( X509Certificate2  certificate)
inlinestatic

Extracts the the application URI specified in the certificate.

Parameters
certificateThe certificate.
Returns
The application URI.
static IList<string> UnifiedAutomation.UaBase.SecurityUtils.GetDomainsFromCertficate ( X509Certificate2  certificate)
inlinestatic

Extracts the the DNS names specified in the certificate.

Parameters
certificateThe certificate.
Returns
The DNS names.
static byte [] UnifiedAutomation.UaBase.SecurityUtils.GetNonce ( int  length)
inlinestatic

Returns a new nonce.

Parameters
lengthThe length of the nonce.
Returns
The new nonce.
static bool UnifiedAutomation.UaBase.SecurityUtils.IsWindowStorePath ( string  storePath)
inlinestatic

Determines whether the store path points to a windows certificate store.

Parameters
storePathThe store path.
Returns
true if the store path points to a windows certificate store; otherwise, false.
static ICertificate UnifiedAutomation.UaBase.SecurityUtils.LoadCertificate ( byte[]  bytes)
inlinestatic

Initializes a certificate with the DER encoded bytes.

Parameters
bytesThe bytes.
Returns
The certificate object.
static ICertificate UnifiedAutomation.UaBase.SecurityUtils.LoadCertificate ( string  storeType,
string  storePath,
string  subjectName,
string  thumbprint,
bool  needPrivateKey 
)
inlinestatic

Initializes a certificate with the DER encoded bytes.

Parameters
storeTypeType of the store.
storePathThe store path.
subjectNameName of the subject.
thumbprintThe thumbprint.
needPrivateKeyif set to true [need private key].
Returns
The certificate object.
static List<string> UnifiedAutomation.UaBase.SecurityUtils.ParseDistinguishedName ( string  name)
inlinestatic

Parses a distingushed name.

static byte [] UnifiedAutomation.UaBase.SecurityUtils.PSHA1 ( byte[]  secret,
string  label,
byte[]  data,
int  offset,
int  length 
)
inlinestatic

Generates a Pseudo random sequence of bits using the P_SHA1 alhorithm.

static SignatureData UnifiedAutomation.UaBase.SecurityUtils.Sign ( X509Certificate2  certificate,
string  securityPolicyUri,
byte[]  dataToSign 
)
inlinestatic

Signs the data using the SecurityPolicyUri and returns the signature.

static bool UnifiedAutomation.UaBase.SecurityUtils.Verify ( X509Certificate2  certificate,
string  securityPolicyUri,
byte[]  dataToVerify,
SignatureData  signature 
)
inlinestatic

Verifies the signature using the SecurityPolicyUri and return true if valid.


The documentation for this class was generated from the following file: