C# Class Pdelvo.Minecraft.Network.AsnKeyBuilder

Mostra file Open project: pdelvo/Pdelvo.Minecraft

Public Methods

Method Description
PublicKeyToX509 ( RSAParameters publicKey ) : AsnMessage

Returns the AsnMessage representing the X.509 PublicKeyInfo.

Private Methods

Method Description
Compliment1s ( byte value ) : byte[]
Compliment2s ( byte value ) : byte[]
Concatenate ( AsnType values ) : byte[]
Concatenate ( byte values ) : byte[]
Concatenate ( byte first, byte second ) : byte[]
CreateBitString ( AsnType value ) : AsnType

An ordered sequence of zero, one or more bits. Returns the AsnType representing an ASN.1 encoded bit string. If value is null, an empty (0 length) bit string is returned.

CreateBitString ( String value ) : AsnType

An ordered sequence of zero, one or more bits. Returns the AsnType representing an ASN.1 encoded bit string.

If octets is null or length is 0, an empty (0 length) bit string is returned.

If conversion fails, the bit string returned is a partial bit string. The partial bit string ends at the octet before the point of failure (it does not include the octet which could not be parsed, or subsequent octets).

CreateBitString ( byte octets ) : AsnType

An ordered sequence of zero, one or more bits. Returns the AsnType representing an ASN.1 encoded bit string.

If octets is null or length is 0, an empty (0 length) bit string is returned.

CreateBitString ( byte octets, uint unusedBits ) : AsnType

An ordered sequence of zero, one or more bits. Returns the AsnType representing an ASN.1 encoded bit string.

unusedBits is applied to the end of the bit string, not the start of the bit string. unusedBits must be less than 8 (the size of an octet). Refer to ITU X.680, Section 32.

If octets is null or length is 0, an empty (0 length) bit string is returned.

CreateInteger ( byte value ) : AsnType

Returns the AsnType representing a ASN.1 encoded integer. The octets pass through this method are not modified.

If octets is null or zero length, the method returns an AsnType equivalent to CreateInteger(byte[]{0})..

CreateIntegerNeg ( byte value ) : AsnType

Returns the negative ASN.1 encoded integer. If the high bit of most significant byte is set, the integer is already considered negative.

If the high bit of most significant byte is not set, the integer will be 2's complimented to form a negative integer.

If octets is null or zero length, the method returns an AsnType equivalent to CreateInteger(byte[]{0})..

CreateIntegerPos ( byte value ) : AsnType

Returns the AsnType representing a positive ASN.1 encoded integer. If the high bit of most significant byte is set, the method prepends a 0x00 to octets before assigning the value to ensure the resulting integer is interpreted as positive in the application.

If octets is null or zero length, the method returns an AsnType equivalent to CreateInteger(byte[]{0})..

CreateNull ( ) : AsnType

Returns the AsnType representing an ASN.1 encoded null.

CreateOctetString ( AsnType value ) : AsnType

An ordered sequence of zero, one or more octets. Returns the byte[] representing an ASN.1 encoded octet string. If octets is null or length is 0, an empty (0 length) o ctet string is returned.

CreateOctetString ( String value ) : AsnType

An ordered sequence of zero, one or more bits. Returns the AsnType representing an ASN.1 encoded octet string.

If octets is null or length is 0, an empty (0 length) octet string is returned.

If conversion fails, the bit string returned is a partial bit string. The partial octet string ends at the octet before the point of failure (it does not include the octet which could not be parsed, or subsequent octets).

CreateOctetString ( byte value ) : AsnType

An ordered sequence of zero, one or more octets. Returns the ASN.1 encoded octet string. If octets is null or length is 0, an empty (0 length) octet string is returned.

CreateOid ( String value ) : AsnType

Returns the AsnType representing an ASN.1 encoded OID. If conversion fails, the result is a partial conversion up to the point of failure. If the oid string is null or not well formed, an empty byte[] is returned.

CreateOid ( byte value ) : AsnType

Returns the AsnType representing an ASN.1 encoded OID. If conversion fails, the result is a partial conversion (up to the point of failure). If octets is null, an empty byte[] is returned.

CreateSequence ( AsnType value ) : AsnType

An ordered collection of one or more types. Returns the AsnType representing an ASN.1 encoded sequence.

If the AsnType is null, an empty sequence (length 0) is returned.

CreateSequenceOf ( AsnType value ) : AsnType

An ordered collection zero, one or more types. Returns the AsnType representing an ASN.1 encoded sequence.

If the AsnType value is null,an empty sequence (length 0) is returned.

Duplicate ( byte b ) : byte[]
IsEmpty ( AsnType value ) : bool
IsEmpty ( String s ) : bool
IsEmpty ( byte octets ) : bool
IsZero ( byte octets ) : bool
PrivateKeyToPKCS8 ( DSAParameters privateKey ) : AsnMessage

Returns AsnMessage representing the unencrypted PKCS #8 PrivateKeyInfo.

PrivateKeyToPKCS8 ( RSAParameters privateKey ) : AsnMessage

Returns AsnMessage representing the unencrypted PKCS #8 PrivateKeyInfo.

PublicKeyToX509 ( DSAParameters publicKey ) : AsnMessage

Returns the AsnMessage representing the X.509 PublicKeyInfo.

TrimEnd ( byte octets ) : byte[]

Removes trailing 0x00 octets from the byte[] octets. This method may return an empty byte array (0 length).

TrimStart ( byte octets ) : byte[]

Removes leading 0x00 octets from the byte[] octets. This method may return an empty byte array (0 length).

Method Details

PublicKeyToX509() public static method

Returns the AsnMessage representing the X.509 PublicKeyInfo.
public static PublicKeyToX509 ( RSAParameters publicKey ) : AsnMessage
publicKey System.Security.Cryptography.RSAParameters The RSA key to be encoded.
return AsnMessage