Show / Hide Table of Contents

Class Asn1Util

Inheritance
Object
Asn1Util
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: Lacuna.Pki.Asn1
Assembly: Lacuna.Pki.dll
Syntax
public static class Asn1Util

Methods

DecodeAs<T>(Byte[])

Decodes a byte array to an instance of a ASN1 decorated class

Declaration
public static T DecodeAs<T>(byte[] content)
Parameters
Type Name Description
Byte[] content

The ASN1 encoded content

Returns
Type Description
T

An instance of T decoded

Type Parameters
Name Description
T

The ASN1 attribute decorated class type to instantiate

DecodeIA5String(Byte[])

Decodes an ASN1 IA5String primitive content to string

Declaration
public static string DecodeIA5String(byte[] content)
Parameters
Type Name Description
Byte[] content
Returns
Type Description
String

DecodeIntegerAsBigInteger(Byte[])

Decodes an ASN1 Integer primitive content as BigInteger

Declaration
public static BigInteger DecodeIntegerAsBigInteger(byte[] content)
Parameters
Type Name Description
Byte[] content
Returns
Type Description
BigInteger

DecodeIntegerAsInt32(Byte[])

Decodes an ASN1 Integer primitive content as int

Declaration
public static int DecodeIntegerAsInt32(byte[] content)
Parameters
Type Name Description
Byte[] content
Returns
Type Description
Int32

DecodeObjectIdentifier(Byte[])

Decodes an ASN1 ObjectIdentifier primitive content to OID string

Declaration
public static string DecodeObjectIdentifier(byte[] content)
Parameters
Type Name Description
Byte[] content
Returns
Type Description
String

DecodeOctetString(Byte[])

Decodes an ASN1 OctetString primitive content to byte array

Declaration
public static byte[] DecodeOctetString(byte[] content)
Parameters
Type Name Description
Byte[] content
Returns
Type Description
Byte[]

DecodePrintableString(Byte[])

Decodes an ASN1 PrintableString primitive content to string

Declaration
public static string DecodePrintableString(byte[] content)
Parameters
Type Name Description
Byte[] content
Returns
Type Description
String

DecodeString(Byte[])

Decodes any of ASN1 string primitives content to string

Declaration
public static string DecodeString(byte[] content)
Parameters
Type Name Description
Byte[] content
Returns
Type Description
String

DecodeUtcTimeAsDateTime(Byte[])

Decodes an ASN1 UTCTime primitive content as DateTime

Declaration
public static DateTime DecodeUtcTimeAsDateTime(byte[] content)
Parameters
Type Name Description
Byte[] content
Returns
Type Description
DateTime

DecodeUtcTimeAsDateTimeOffset(Byte[])

Decodes an ASN1 UTCTime primitive content as DateTimeOffset

Declaration
public static DateTimeOffset DecodeUtcTimeAsDateTimeOffset(byte[] content)
Parameters
Type Name Description
Byte[] content
Returns
Type Description
DateTimeOffset

DecodeUtf8String(Byte[])

Decodes an ASN1 UTF8String primitive content to string

Declaration
public static string DecodeUtf8String(byte[] content)
Parameters
Type Name Description
Byte[] content
Returns
Type Description
String

DerEncode(Object)

Encodes an ASN1 attribute decorated class instance to DER

Declaration
public static byte[] DerEncode(object obj)
Parameters
Type Name Description
Object obj

The instance of a ASN1 class

Returns
Type Description
Byte[]

The DER encoded content

DerEncodeIA5String(String)

Encodes a string to ASN1 DER IA5String

Declaration
public static byte[] DerEncodeIA5String(string s)
Parameters
Type Name Description
String s
Returns
Type Description
Byte[]

DerEncodeInteger(Int32)

Encodes an int to ASN1 DER Integer

Declaration
public static byte[] DerEncodeInteger(int i)
Parameters
Type Name Description
Int32 i
Returns
Type Description
Byte[]

DerEncodeInteger(BigInteger)

Encodes a BigInteger to ASN1 DER Integer

Declaration
public static byte[] DerEncodeInteger(BigInteger i)
Parameters
Type Name Description
BigInteger i
Returns
Type Description
Byte[]

DerEncodeObjectIdentifier(String)

Encodes an OID string to ASN1 DER ObjectIdentifier

Declaration
public static byte[] DerEncodeObjectIdentifier(string oid)
Parameters
Type Name Description
String oid
Returns
Type Description
Byte[]

DerEncodeOctetString(Byte[])

Encodes a byte array to ASN1 DER OctetString

Declaration
public static byte[] DerEncodeOctetString(byte[] octetString)
Parameters
Type Name Description
Byte[] octetString
Returns
Type Description
Byte[]

DerEncodePrintableString(String)

Encodes a string to ASN1 DER PrintableString

Declaration
public static byte[] DerEncodePrintableString(string s)
Parameters
Type Name Description
String s
Returns
Type Description
Byte[]

DerEncodeUtcTime(DateTime)

Encodes a DateTime to ASN1 DER UTCTime

Declaration
public static byte[] DerEncodeUtcTime(DateTime time)
Parameters
Type Name Description
DateTime time
Returns
Type Description
Byte[]

DerEncodeUtcTime(DateTimeOffset)

Encodes a DateTimeOffset to ASN1 DER UTCTime

Declaration
public static byte[] DerEncodeUtcTime(DateTimeOffset time)
Parameters
Type Name Description
DateTimeOffset time
Returns
Type Description
Byte[]

DerEncodeUtf8String(String)

Encodes a string to ASN1 DER UTF8String

Declaration
public static byte[] DerEncodeUtf8String(string s)
Parameters
Type Name Description
String s
Returns
Type Description
Byte[]
Back to top Copyright © 2015-2020 Lacuna Software