Describe the type of ASN.1 data.
Namespace: CryptoSysPKIAssembly: diCrSysPKINet (in diCrSysPKINet.dll) Version: 23.0.0.25611 (23.0.0.0)
Syntaxpublic static string Type(
string fileOrPEMString
)
Public Shared Function Type (
fileOrPEMString As String
) As String
Parameters
- fileOrPEMString String
- Filename of ASN.1 formatted data file to be analyzed (or a string containing its base64 or PEM representation)
Return Value
StringString containing the name of the type of ASN.1 data or the empty string if not found
RemarksThe 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 value | ASN.1 object type | Reference |
|---|
| EC PRIVATE KEY | ECPrivateKey | [RFC5915] |
| EC PRIVATE KEY | ECPrivateKey | [RFC5915] |
| OCSP REQUEST | OCSPRequest | [RFC6960] |
| OCSP RESPONSE | OCSPResponse | [RFC6960] |
| PKCS1 RSA PRIVATE KEY | RSAPrivateKey | [RFC3447] |
| PKCS1 RSA PUBLIC KEY | RSAPublicKey | [RFC3447] |
| PKCS10 CERTIFICATE REQUEST | CertificationRequest | [RFC2986] |
| PKCS12 PFX | PFX | [RFC7292] |
| PKCS7 CERTIFICATE CHAIN | ContentInfo | [RFC5652] |
| PKCS7/CMS COMPRESSED DATA | ContentInfo | [RFC3274] |
| PKCS7/CMS DATA | ContentInfo | [RFC5652] |
| PKCS7/CMS ENVELOPED DATA | ContentInfo | [RFC5652] |
| CMS AUTH ENVELOPED DATA | ContentInfo | [RFC5083] |
| PKCS7/CMS SIGNED DATA | ContentInfo | [RFC5652] |
| PKCS8 ENCRYPTED PRIVATE KEY | EncryptedPrivateKeyInfo | [RFC5208][RFC5958] |
| PKCS8 PRIVATE KEY INFO | PrivateKeyInfo | [RFC5208][RFC5958] |
| PKCS8 ONE ASYMMETRIC KEY | OneAsymmetricKey | [RFC5958] |
| PUBLIC KEY INFO | SubjectPublicKeyInfo | [RFC3279][RFC5480] |
| X509 CERTIFICATE | Certificate | [RFC5280] |
| X509 CRL | CertificateList | [RFC5280] |
Note that these descriptions are not necessarily those used as labels for PEM formatted files defined in [RFC7468].
ExampleConsole.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);
fname = "AlicePrivRSASign.p8e";
s = Asn1.Type(fname);
Console.WriteLine("Asn1.Type('" + fname + "')=" + s);
See Also