当前位置: 首页>>代码示例>>C#>>正文


C# SafeHandles.SafeBioHandle类代码示例

本文整理汇总了C#中Microsoft.Win32.SafeHandles.SafeBioHandle的典型用法代码示例。如果您正苦于以下问题:C# SafeBioHandle类的具体用法?C# SafeBioHandle怎么用?C# SafeBioHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SafeBioHandle类属于Microsoft.Win32.SafeHandles命名空间,在下文中一共展示了SafeBioHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsPkcs7Pem

 internal static bool IsPkcs7Pem(SafeBioHandle fileBio)
 {
     using (SafePkcs7Handle pkcs7 = Interop.Crypto.PemReadBioPkcs7(fileBio))
     {
         return !pkcs7.IsInvalid;
     }
 }
开发者ID:Rayislandstyle,项目名称:corefx,代码行数:7,代码来源:PkcsFormatReader.cs

示例2: IsPkcs7Der

 internal static bool IsPkcs7Der(SafeBioHandle fileBio)
 {
     using (SafePkcs7Handle pkcs7 = Interop.Crypto.D2IPkcs7Bio(fileBio))
     {
         return !pkcs7.IsInvalid;
     }
 }
开发者ID:Rayislandstyle,项目名称:corefx,代码行数:7,代码来源:PkcsFormatReader.cs

示例3: FromBio

        private static IStorePal FromBio(SafeBioHandle bio, string password)
        {
            int bioPosition = Interop.Crypto.BioTell(bio);
            Debug.Assert(bioPosition >= 0);

            ICertificatePal singleCert;

            if (CertificatePal.TryReadX509Pem(bio, out singleCert))
            {
                return SingleCertToStorePal(singleCert);
            }

            // Rewind, try again.
            CertificatePal.RewindBio(bio, bioPosition);

            if (CertificatePal.TryReadX509Der(bio, out singleCert))
            {
                return SingleCertToStorePal(singleCert);
            }

            // Rewind, try again.
            CertificatePal.RewindBio(bio, bioPosition);

            List<ICertificatePal> certPals;

            if (PkcsFormatReader.TryReadPkcs7Pem(bio, out certPals))
            {
                return ListToStorePal(certPals);
            }

            // Rewind, try again.
            CertificatePal.RewindBio(bio, bioPosition);

            if (PkcsFormatReader.TryReadPkcs7Der(bio, out certPals))
            {
                return ListToStorePal(certPals);
            }

            // Rewind, try again.
            CertificatePal.RewindBio(bio, bioPosition);

            if (PkcsFormatReader.TryReadPkcs12(bio, password, out certPals))
            {
                return ListToStorePal(certPals);
            }

            // Since we aren't going to finish reading, leaving the buffer where it was when we got
            // it seems better than leaving it in some arbitrary other position.
            // 
            // But, before seeking back to start, save the Exception representing the last reported
            // OpenSSL error in case the last BioSeek would change it.
            Exception openSslException = Interop.Crypto.CreateOpenSslCryptographicException();

            // Use BioSeek directly for the last seek attempt, because any failure here should instead
            // report the already created (but not yet thrown) exception.
            Interop.Crypto.BioSeek(bio, bioPosition);

            throw openSslException;
        }
开发者ID:rajeevkb,项目名称:corefx,代码行数:59,代码来源:StorePal.cs

示例4: RewindBio

        internal static void RewindBio(SafeBioHandle bio, int bioPosition)
        {
            int ret = Interop.Crypto.BioSeek(bio, bioPosition);

            if (ret < 0)
            {
                throw Interop.Crypto.CreateOpenSslCryptographicException();
            }
        }
开发者ID:dotnet,项目名称:corefx,代码行数:9,代码来源:CertificatePal.cs

示例5: TryRead

        public static bool TryRead(SafeBioHandle fileBio, out OpenSslPkcs12Reader pkcs12Reader)
        {
            SafePkcs12Handle p12 = Interop.Crypto.DecodePkcs12FromBio(fileBio);

            if (!p12.IsInvalid)
            {
                pkcs12Reader = new OpenSslPkcs12Reader(p12);
                return true;
            }

            pkcs12Reader = null;
            return false;
        }
开发者ID:denizduncan,项目名称:corefx,代码行数:13,代码来源:OpenSslPkcs12Reader.cs

示例6: TryRead

        public static bool TryRead(SafeBioHandle fileBio, out OpenSslPkcs12Reader pkcs12Reader)
        {
            SafePkcs12Handle p12 = Interop.libcrypto.d2i_PKCS12_bio(fileBio, IntPtr.Zero);

            if (!p12.IsInvalid)
            {
                pkcs12Reader = new OpenSslPkcs12Reader(p12);
                return true;
            }

            pkcs12Reader = null;
            return false;
        }
开发者ID:jmhardison,项目名称:corefx,代码行数:13,代码来源:OpenSslPkcs12Reader.cs

示例7: TryReadPkcs7Der

        private static bool TryReadPkcs7Der(
            SafeBioHandle bio,
            bool single,
            out ICertificatePal certPal,
            out List<ICertificatePal> certPals)
        {
            using (SafePkcs7Handle pkcs7 = Interop.Crypto.D2IPkcs7Bio(bio))
            {
                if (pkcs7.IsInvalid)
                {
                    certPal = null;
                    certPals = null;
                    return false;
                }

                return TryReadPkcs7(pkcs7, single, out certPal, out certPals);
            }
        }
开发者ID:JonHanna,项目名称:corefx,代码行数:18,代码来源:PkcsFormatReader.cs

示例8: TryReadPkcs7Der

        private static bool TryReadPkcs7Der(
            SafeBioHandle bio,
            bool single,
            out ICertificatePal certPal,
            out List<ICertificatePal> certPals)
        {
            SafePkcs7Handle pkcs7 = Interop.libcrypto.d2i_PKCS7_bio(bio, IntPtr.Zero);

            if (pkcs7.IsInvalid)
            {
                certPal = null;
                certPals = null;
                return false;
            }

            using (pkcs7)
            {
                return TryReadPkcs7(pkcs7, single, out certPal, out certPals);
            }
        }
开发者ID:AdityaTulasi,项目名称:corefx,代码行数:20,代码来源:PkcsFormatReader.cs

示例9: TryReadPkcs12

        internal static bool TryReadPkcs12(SafeBioHandle bio, string password, out ICertificatePal certPal)
        {
            List<ICertificatePal> ignored;

            return TryReadPkcs12(bio, password, true, out certPal, out ignored);
        }
开发者ID:JonHanna,项目名称:corefx,代码行数:6,代码来源:PkcsFormatReader.cs

示例10: BioWrite

 internal static unsafe extern int BioWrite(SafeBioHandle b, byte* data, int len);
开发者ID:devgopher,项目名称:corefx,代码行数:1,代码来源:Interop.Ssl.cs

示例11: PEM_read_bio_X509_AUX

 internal static extern SafeX509Handle PEM_read_bio_X509_AUX(SafeBioHandle bio, IntPtr zero, IntPtr zero1, IntPtr zero2);
开发者ID:niaomingjian,项目名称:corefx,代码行数:1,代码来源:Interop.X509.cs

示例12: BioRead

        private static int BioRead(SafeBioHandle bio, byte[] buffer, int count)
        {
            Debug.Assert(buffer != null);
            Debug.Assert(count >= 0);
            Debug.Assert(buffer.Length >= count);

            int bytes = Crypto.BioRead(bio, buffer, count);
            if (bytes != count)
            {
                throw CreateSslException(SR.net_ssl_read_bio_failed_error);
            }
            return bytes;
        }
开发者ID:kkurni,项目名称:corefx,代码行数:13,代码来源:Interop.OpenSsl.cs

示例13: TryReadX509Pem

        internal static bool TryReadX509Pem(SafeBioHandle bio, out ICertificatePal certPal)
        {
            SafeX509Handle cert = Interop.Crypto.PemReadX509FromBio(bio);

            if (cert.IsInvalid)
            {
                cert.Dispose();
                certPal = null;
                return false;
            }

            certPal = new OpenSslX509CertificateReader(cert);
            return true;
        }
开发者ID:Corillian,项目名称:corefx,代码行数:14,代码来源:CertificatePal.cs

示例14: TryReadPkcs7Pem

        internal static bool TryReadPkcs7Pem(SafeBioHandle bio, out List<ICertificatePal> certPals)
        {
            ICertificatePal ignored;

            return TryReadPkcs7Pem(bio, false, out ignored, out certPals);
        }
开发者ID:JonHanna,项目名称:corefx,代码行数:6,代码来源:PkcsFormatReader.cs

示例15: PemWriteBioX509Crl

 internal static extern int PemWriteBioX509Crl(SafeBioHandle bio, SafeX509CrlHandle crl);
开发者ID:er0dr1guez,项目名称:corefx,代码行数:1,代码来源:Interop.X509.cs


注:本文中的Microsoft.Win32.SafeHandles.SafeBioHandle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。