• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SafeHandles.SafeBioHandle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: SSL_set_bio

 internal static extern void SSL_set_bio(SafeSslHandle ssl, SafeBioHandle rbio, SafeBioHandle wbio);
开发者ID:shrutigarg,项目名称:corefx,代码行数:1,代码来源:Interop.libssl.cs


示例17: BIO_write

 internal static extern int BIO_write(SafeBioHandle bio, IntPtr buf, int num);
开发者ID:shrutigarg,项目名称:corefx,代码行数:1,代码来源:Interop.libssl.cs


示例18: DecodePkcs12FromBio

 internal static extern SafePkcs12Handle DecodePkcs12FromBio(SafeBioHandle bio);
开发者ID:jemmy655,项目名称:corefx,代码行数:1,代码来源:Interop.Pkcs12.cs


示例19: X509_NAME_print_ex

 internal static extern int X509_NAME_print_ex(SafeBioHandle @out, SafeX509NameHandle nm, int indent, NativeULong flags);
开发者ID:niaomingjian,项目名称:corefx,代码行数:1,代码来源:Interop.X509.cs


示例20: PemReadBioX509Crl

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SafeHandles.SafeFileHandle类代码示例发布时间:2022-05-26
下一篇:
C# Win32.Win32Native类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap