Class Asn1Util
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
DecodeIntegerAsBigInteger(Byte[])
Decodes an ASN1 Integer primitive content as BigInteger
Declaration
public static BigInteger DecodeIntegerAsBigInteger(byte[] content)
Parameters
Type |
Name |
Description |
Byte[] |
content |
|
Returns
DecodeIntegerAsInt32(Byte[])
Decodes an ASN1 Integer primitive content as int
Declaration
public static int DecodeIntegerAsInt32(byte[] content)
Parameters
Type |
Name |
Description |
Byte[] |
content |
|
Returns
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
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
DecodePrintableString(Byte[])
Decodes an ASN1 PrintableString primitive content to string
Declaration
public static string DecodePrintableString(byte[] content)
Parameters
Type |
Name |
Description |
Byte[] |
content |
|
Returns
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
DecodeUtcTimeAsDateTime(Byte[])
Decodes an ASN1 UTCTime primitive content as DateTime
Declaration
public static DateTime DecodeUtcTimeAsDateTime(byte[] content)
Parameters
Type |
Name |
Description |
Byte[] |
content |
|
Returns
DecodeUtcTimeAsDateTimeOffset(Byte[])
Decodes an ASN1 UTCTime primitive content as DateTimeOffset
Declaration
public static DateTimeOffset DecodeUtcTimeAsDateTimeOffset(byte[] content)
Parameters
Type |
Name |
Description |
Byte[] |
content |
|
Returns
DecodeUtf8String(Byte[])
Decodes an ASN1 UTF8String primitive content to string
Declaration
public static string DecodeUtf8String(byte[] content)
Parameters
Type |
Name |
Description |
Byte[] |
content |
|
Returns
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
DerEncodeInteger(Int32)
Encodes an int to ASN1 DER Integer
Declaration
public static byte[] DerEncodeInteger(int i)
Parameters
Type |
Name |
Description |
Int32 |
i |
|
Returns
DerEncodeInteger(BigInteger)
Encodes a BigInteger to ASN1 DER Integer
Declaration
public static byte[] DerEncodeInteger(BigInteger i)
Parameters
Returns
DerEncodeObjectIdentifier(String)
Encodes an OID string to ASN1 DER ObjectIdentifier
Declaration
public static byte[] DerEncodeObjectIdentifier(string oid)
Parameters
Type |
Name |
Description |
String |
oid |
|
Returns
DerEncodeOctetString(Byte[])
Encodes a byte array to ASN1 DER OctetString
Declaration
public static byte[] DerEncodeOctetString(byte[] octetString)
Parameters
Type |
Name |
Description |
Byte[] |
octetString |
|
Returns
DerEncodePrintableString(String)
Encodes a string to ASN1 DER PrintableString
Declaration
public static byte[] DerEncodePrintableString(string s)
Parameters
Type |
Name |
Description |
String |
s |
|
Returns
DerEncodeUtcTime(DateTime)
Encodes a DateTime to ASN1 DER UTCTime
Declaration
public static byte[] DerEncodeUtcTime(DateTime time)
Parameters
Returns
DerEncodeUtcTime(DateTimeOffset)
Encodes a DateTimeOffset to ASN1 DER UTCTime
Declaration
public static byte[] DerEncodeUtcTime(DateTimeOffset time)
Parameters
Returns
DerEncodeUtf8String(String)
Encodes a string to ASN1 DER UTF8String
Declaration
public static byte[] DerEncodeUtf8String(string s)
Parameters
Type |
Name |
Description |
String |
s |
|
Returns