public static TryRead ( Microsoft.Win32.SafeHandles.SafeBioHandle fileBio, |
||
fileBio | Microsoft.Win32.SafeHandles.SafeBioHandle | |
pkcs12Reader | ||
리턴 | bool |
public static bool TryRead(SafeBioHandle fileBio, out OpenSslPkcs12Reader pkcs12Reader)
{
SafePkcs12Handle p12 = Interop.Crypto.DecodePkcs12FromBio(fileBio);
if (!p12.IsInvalid)
{
pkcs12Reader = new OpenSslPkcs12Reader(p12);
return true;
}
p12.Dispose();
pkcs12Reader = null;
return false;
}
OpenSslPkcs12Reader::TryRead ( byte data, |
public X509ContentType GetCertContentType(byte[] rawData) { { ICertificatePal certPal; if (OpenSslX509CertificateReader.TryReadX509Der(rawData, out certPal) || OpenSslX509CertificateReader.TryReadX509Pem(rawData, out certPal)) { certPal.Dispose(); return(X509ContentType.Cert); } } if (PkcsFormatReader.IsPkcs7(rawData)) { return(X509ContentType.Pkcs7); } { OpenSslPkcs12Reader pfx; if (OpenSslPkcs12Reader.TryRead(rawData, out pfx)) { pfx.Dispose(); return(X509ContentType.Pkcs12); } } // Unsupported format. // Windows throws new CryptographicException(CRYPT_E_NO_MATCH) throw new CryptographicException(); }