C# Class dlech.SshAgentLib.Util

PageantSharp utility class.
Afficher le fichier Open project: dlech/SshAgentLib

Méthodes publiques

Méthode Description
ClearByteList ( List list ) : void

writes over all values in list with 0 then call list.Clear()

FromBase64 ( byte base64Data ) : byte[]
FromBase64 ( string base64String ) : byte[]
FromHex ( string base16String ) : byte[]

converts string of hexadecimal characters to a byte[] two characters are converted into one byte

FromHex ( string base16String, string delimeter ) : byte[]

converts string of hexadecimal characters to a byte[] two characters are converted into one byte

GetDataType ( this aConstraint ) : Type

Gets the Type of the Data object for a given Agent.KeyConstraintType

ModMinusOne ( PinnedArray a, PinnedArray b ) : PinnedArray

Computes a % (b -1) of 2 large numbers

ToBase64 ( this binaryData ) : byte[]
ToBytes ( this aInt ) : byte[]

Convert 32 bit integer to four bytes in BigEndian order

ToHexString ( this bytes ) : string

Converts array of bytes to a string of hexadecimal digits delimited by':'. Alpha digits will be lower case.

ToHexString ( this bytes, string delimeter ) : string

Converts array of bytes to a string of hexadecimal digits. Alpha digits will be lower case.

ToInt ( this aBytes ) : UInt32

Converts 4 bytes in BigEndian order to 32 bit integer

ToInt ( this aBytes, int aOffset ) : UInt32

Converts 4 bytes in BigEndian order to 32 bit integer

TrimLeadingZero ( PinnedArray array ) : void

removes leading element from array if the value of that element is 0

UnicodeToAnsi ( this unicodeChar ) : byte

Unicode char to to ANSI char.

Based on http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit1252.txt

WriteBlob ( this aStream, BlobBuilder aBuilder ) : void

Writes aBuiler data to aStream at current position of aStream

addConfirmConstraint ( this aKeyCollection ) : void

Adds Agent.KeyConstraintType.SSH_AGENT_CONSTRAIN_CONFIRM constraint to key

addLifetimeConstraint ( this aKeyCollection, uint aLifetime ) : void

Adds Agent.KeyConstraintType.SSH_AGENT_CONSTRAIN_LIFETIME constraint to key

Private Methods

Méthode Description
CompareBigInt ( byte a, byte b, int bShift ) : int

Compares to BigInts

GenericTransform ( ICryptoTransform transform, byte data ) : byte[]
SubtractBigInt ( byte a, byte b, int bShift ) : byte[]

Compute a - b, assumes that a > b<<bShift

Method Details

ClearByteList() public static méthode

writes over all values in list with 0 then call list.Clear()
public static ClearByteList ( List list ) : void
list List list to be cleared
Résultat void

FromBase64() public static méthode

public static FromBase64 ( byte base64Data ) : byte[]
base64Data byte
Résultat byte[]

FromBase64() public static méthode

public static FromBase64 ( string base64String ) : byte[]
base64String string
Résultat byte[]

FromHex() public static méthode

converts string of hexadecimal characters to a byte[] two characters are converted into one byte
thrown if base16String is null or empty thrown if base16String does not contain an even number of characters /// or if the characters are not hexadecimal digits (0-9 and A-F or a-f)
public static FromHex ( string base16String ) : byte[]
base16String string the string to convert
Résultat byte[]

FromHex() public static méthode

converts string of hexadecimal characters to a byte[] two characters are converted into one byte
thrown if base16String is null or empty thrown if base16String does not contain an even number of characters /// or if the characters are not hexadecimal digits (0-9 and A-F or a-f)
public static FromHex ( string base16String, string delimeter ) : byte[]
base16String string the string to convert
delimeter string the delimiter that is present between each pair of digits
Résultat byte[]

GetDataType() public static méthode

Gets the Type of the Data object for a given Agent.KeyConstraintType
public static GetDataType ( this aConstraint ) : Type
aConstraint this
Résultat System.Type

ModMinusOne() public static méthode

Computes a % (b -1) of 2 large numbers
public static ModMinusOne ( PinnedArray a, PinnedArray b ) : PinnedArray
a PinnedArray variable a
b PinnedArray variable b
Résultat PinnedArray

ToBase64() public static méthode

public static ToBase64 ( this binaryData ) : byte[]
binaryData this
Résultat byte[]

ToBytes() public static méthode

Convert 32 bit integer to four bytes in BigEndian order
public static ToBytes ( this aInt ) : byte[]
aInt this integer to convert
Résultat byte[]

ToHexString() public static méthode

Converts array of bytes to a string of hexadecimal digits delimited by':'. Alpha digits will be lower case.
public static ToHexString ( this bytes ) : string
bytes this the byte[] to convert
Résultat string

ToHexString() public static méthode

Converts array of bytes to a string of hexadecimal digits. Alpha digits will be lower case.
public static ToHexString ( this bytes, string delimeter ) : string
bytes this the byte[] to convert
delimeter string a delimiter to insert in-between each pair of digits
Résultat string

ToInt() public static méthode

Converts 4 bytes in BigEndian order to 32 bit integer
public static ToInt ( this aBytes ) : UInt32
aBytes this array of bytes
Résultat System.UInt32

ToInt() public static méthode

Converts 4 bytes in BigEndian order to 32 bit integer
public static ToInt ( this aBytes, int aOffset ) : UInt32
aBytes this array of bytes
aOffset int the offset where to start reading the bytes
Résultat System.UInt32

TrimLeadingZero() public static méthode

removes leading element from array if the value of that element is 0
public static TrimLeadingZero ( PinnedArray array ) : void
array PinnedArray
Résultat void

UnicodeToAnsi() public static méthode

Unicode char to to ANSI char.
Based on http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit1252.txt
public static UnicodeToAnsi ( this unicodeChar ) : byte
unicodeChar this /// Unicode char. ///
Résultat byte

WriteBlob() public static méthode

Writes aBuiler data to aStream at current position of aStream
public static WriteBlob ( this aStream, BlobBuilder aBuilder ) : void
aStream this Stream to write to
aBuilder BlobBuilder BlobBuilder to use
Résultat void

addConfirmConstraint() public static méthode

Adds Agent.KeyConstraintType.SSH_AGENT_CONSTRAIN_CONFIRM constraint to key
public static addConfirmConstraint ( this aKeyCollection ) : void
aKeyCollection this
Résultat void

addLifetimeConstraint() public static méthode

Adds Agent.KeyConstraintType.SSH_AGENT_CONSTRAIN_LIFETIME constraint to key
public static addLifetimeConstraint ( this aKeyCollection, uint aLifetime ) : void
aKeyCollection this
aLifetime uint
Résultat void