C# Class Net.Pkcs11Interop.Common.Pkcs11UriBuilder

PKCS#11 URI builder

Implementation note: As recommended by PKCS#11 URI specification Pkcs11UriBuilder class percent-encodes the whole value of the "id" attribute which is supposed to be handled as arbitrary binary data. Therefore it is not possible to construct URIs with arbitrary string value of the "id" attribute.

Implementation note: Validation of each individual attribute value is performed by the setter of corresponding Pkcs11UriBuilder class property with the exception to UnknownPathAttributes and UnknownQueryAttributes properties whose values are validated when ToString() or ToPkcs11Uri() method is called.

显示文件 Open project: Pkcs11Interop/Pkcs11Interop Class Usage Examples

Public Methods

Method Description
Pkcs11UriBuilder ( ) : System

Intializes new instance of Pkcs11UriBuilder class that checks max lengths of path attribute values

Pkcs11UriBuilder ( Pkcs11Uri pkcs11Uri ) : System

Intializes new instance of Pkcs11UriBuilder class with specified PKCS#11 URI whose ChecksLengths property specifies whether max lengths of path attribute values should be checked

Pkcs11UriBuilder ( Pkcs11Uri pkcs11Uri, bool checkLengths ) : System

Intializes new instance of Pkcs11UriBuilder class with specified PKCS#11 URI

Pkcs11UriBuilder ( bool checkLengths ) : System

Intializes new instance of Pkcs11UriBuilder class

ToPkcs11Uri ( ) : Pkcs11Uri

Converts Pkcs11UriBuilder instance to Pkcs11Uri instance

ToString ( ) : string

Generates PKCS#11 URI representing contents of Pkcs11UriBuilder instance

Private Methods

Method Description
ConstructFromPkcs11Uri ( Pkcs11Uri pkcs11Uri, bool checkLengths ) : void

Sets properties of Pkcs11UriBuilder class with default values specified by PKCS#11 URI

EncodePk11String ( string attributeName, string pk11String, char allowedChars, bool usePctEncoding ) : string

Checks whether Pk11String contains invalid characters and optionaly percent encodes invalid characters

EncodeUnknownPathAttributes ( ) : List

Encodes collection of unknown vendor specific path attributes for PKCS#11 URI

EncodeUnknownQueryAttributes ( ) : List

Encodes collection of unknown vendor specific query attributes for PKCS#11 URI

PctEncodeByteArray ( byte byteArray ) : string

Percent encodes provided byte array

PctEncodeCharacter ( char character ) : string

Percent encodes provided character

Method Details

Pkcs11UriBuilder() public method

Intializes new instance of Pkcs11UriBuilder class that checks max lengths of path attribute values
public Pkcs11UriBuilder ( ) : System
return System

Pkcs11UriBuilder() public method

Intializes new instance of Pkcs11UriBuilder class with specified PKCS#11 URI whose ChecksLengths property specifies whether max lengths of path attribute values should be checked
public Pkcs11UriBuilder ( Pkcs11Uri pkcs11Uri ) : System
pkcs11Uri Pkcs11Uri PKCS#11 URI with default values
return System

Pkcs11UriBuilder() public method

Intializes new instance of Pkcs11UriBuilder class with specified PKCS#11 URI
public Pkcs11UriBuilder ( Pkcs11Uri pkcs11Uri, bool checkLengths ) : System
pkcs11Uri Pkcs11Uri PKCS#11 URI with default values
checkLengths bool Flag indicating whether max lengths of path attribute values should be checked
return System

Pkcs11UriBuilder() public method

Intializes new instance of Pkcs11UriBuilder class
public Pkcs11UriBuilder ( bool checkLengths ) : System
checkLengths bool Flag indicating whether max lengths of path attribute values should be checked
return System

ToPkcs11Uri() public method

Converts Pkcs11UriBuilder instance to Pkcs11Uri instance
public ToPkcs11Uri ( ) : Pkcs11Uri
return Pkcs11Uri

ToString() public method

Generates PKCS#11 URI representing contents of Pkcs11UriBuilder instance
public ToString ( ) : string
return string