Click or drag to resize

Asn1Type Method

Describe the type of ASN.1 data.

Namespace: CryptoSysPKI
Assembly: diCrSysPKINet (in diCrSysPKINet.dll) Version: 23.0.0.25611 (23.0.0.0)
Syntax
public static string Type(
	string fileOrPEMString
)

Parameters

fileOrPEMString  String
Filename of ASN.1 formatted data file to be analyzed (or a string containing its base64 or PEM representation)

Return Value

String
String containing the name of the type of ASN.1 data or the empty string if not found
Remarks
The output is a string describing the most likely type of the ASN.1-formatted data, or an empty string ("") if the type cannot be determined. The following types are detected:
Output string valueASN.1 object typeReference
EC PRIVATE KEYECPrivateKey[RFC5915]
EC PRIVATE KEYECPrivateKey[RFC5915]
OCSP REQUESTOCSPRequest[RFC6960]
OCSP RESPONSEOCSPResponse[RFC6960]
PKCS1 RSA PRIVATE KEYRSAPrivateKey[RFC3447]
PKCS1 RSA PUBLIC KEYRSAPublicKey[RFC3447]
PKCS10 CERTIFICATE REQUESTCertificationRequest[RFC2986]
PKCS12 PFXPFX[RFC7292]
PKCS7 CERTIFICATE CHAINContentInfo[RFC5652]
PKCS7/CMS COMPRESSED DATAContentInfo[RFC3274]
PKCS7/CMS DATAContentInfo[RFC5652]
PKCS7/CMS ENVELOPED DATAContentInfo[RFC5652]
CMS AUTH ENVELOPED DATAContentInfo[RFC5083]
PKCS7/CMS SIGNED DATAContentInfo[RFC5652]
PKCS8 ENCRYPTED PRIVATE KEYEncryptedPrivateKeyInfo[RFC5208][RFC5958]
PKCS8 PRIVATE KEY INFOPrivateKeyInfo[RFC5208][RFC5958]
PKCS8 ONE ASYMMETRIC KEYOneAsymmetricKey[RFC5958]
PUBLIC KEY INFOSubjectPublicKeyInfo[RFC3279][RFC5480]
X509 CERTIFICATECertificate[RFC5280]
X509 CRLCertificateList[RFC5280]
Note that these descriptions are not necessarily those used as labels for PEM formatted files defined in [RFC7468].
Example
C#
Console.WriteLine("Print type names of various ASN.1 data files...");
string fname, s;
fname = "smallca.cer";
s = Asn1.Type(fname);
Console.WriteLine("Asn1.Type('" + fname + "')=" + s);
// Asn1.Type('smallca.cer')=X509 CERTIFICATE
fname = "AlicePrivRSASign.p8e";
s = Asn1.Type(fname);
Console.WriteLine("Asn1.Type('" + fname + "')=" + s);
// Asn1.Type('AlicePrivRSASign.p8e')=PKCS8 ENCRYPTED PRIVATE KEY
See Also