System.Security.Cryptography.X509Certificates.X509Certificate2.GetCertContentType C# (CSharp) Method

GetCertContentType() public static method

public static GetCertContentType ( byte rawData ) : System.Security.Cryptography.X509Certificates.X509ContentType
rawData byte
return System.Security.Cryptography.X509Certificates.X509ContentType
        public static System.Security.Cryptography.X509Certificates.X509ContentType GetCertContentType(byte[] rawData)
        {
            throw null;
        }

Same methods

X509Certificate2::GetCertContentType ( string fileName ) : System.Security.Cryptography.X509Certificates.X509ContentType
X509Certificate2::GetCertContentType ( byte rawData ) : X509ContentType
X509Certificate2::GetCertContentType ( string fileName ) : X509ContentType

Usage Example

        public X509Certificate2ImplMono(byte[] rawData, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
        {
            switch (X509Certificate2.GetCertContentType(rawData))
            {
            case X509ContentType.Pkcs12:
                _cert = ImportPkcs12(rawData, password);
                break;

            case X509ContentType.Cert:
            case X509ContentType.Pkcs7:
                _cert = new MX.X509Certificate(rawData);
                break;

#if !MONOTOUCH_WATCH
            case X509ContentType.Authenticode:
                AuthenticodeDeformatter ad = new AuthenticodeDeformatter(rawData);
                _cert = ad.SigningCertificate;
                if (_cert == null)
                {
                    goto default;
                }
                break;
#endif

            default:
                string msg = Locale.GetText("Unable to decode certificate.");
                throw new CryptographicException(msg);
            }
        }
All Usage Examples Of System.Security.Cryptography.X509Certificates.X509Certificate2::GetCertContentType