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


C# Session.AddSessionObject方法代码示例

本文整理汇总了C#中Microsoft.SPOT.Cryptoki.Session.AddSessionObject方法的典型用法代码示例。如果您正苦于以下问题:C# Session.AddSessionObject方法的具体用法?C# Session.AddSessionObject怎么用?C# Session.AddSessionObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.SPOT.Cryptoki.Session的用法示例。


在下文中一共展示了Session.AddSessionObject方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateObject

        /// <summary>
        /// Creates a object in the given Cryptoki session context with specified object atrributes.
        /// </summary>
        /// <param name="session">The Cryptoki session context.</param>
        /// <param name="template">The object attribute template.</param>
        /// <returns>The cryptoki object created.</returns>
        public static CryptokiObject CreateObject(Session session, CryptokiAttribute[] template)
        {
            CryptokiObject ret = CreateObjectInternal(session, template);

            session.AddSessionObject(ret);

            return ret;
        }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:14,代码来源:Object.cs

示例2: SessionContainer

        /// <summary>
        /// Creates a session container object with the specified session context.
        /// </summary>
        /// <param name="session">The Cryptoki session context.</param>
        /// <param name="ownsSession">Determines if the container disposes the session object.</param>
        protected SessionContainer(Session session, bool ownsSession)
        {
            m_ownsSession = ownsSession;
            m_session = session;

            if (!ownsSession)
            {
                session.AddSessionObject(this);
            }
        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:15,代码来源:Session.cs

示例3: CreateCertificate

        /// <summary>
        /// Creates a Cryptoki certificate object with the specified attribute array template and session context.
        /// </summary>
        /// <param name="session">The Cryptoki session context.</param>
        /// <param name="template">The attribute template that defines the certificate properties.</param>
        /// <returns>The created cryptoki certificate object</returns>
        public static CryptokiCertificate CreateCertificate(Session session, CryptokiAttribute[] template)
        {
            CryptokiCertificate ret = CreateObject(session, template) as CryptokiCertificate;

            ret.m_propertyBag = new Hashtable();

            session.AddSessionObject(ret);

            return ret;
        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:16,代码来源:Certificate.cs

示例4: ImportKey

        /// <summary>
        /// Imports a key of specifed type given the raw key bytes and key class.
        /// </summary>
        /// <param name="session">The Cryptoki session context.</param>
        /// <param name="keyData">The raw key data bytes.</param>
        /// <param name="keyClass">The class of key represented by the raw bytes.</param>
        /// <param name="keyType">The type of key represented by the raw bytes.</param>
        /// <param name="canBeExported">true if the key can be exported, false other wise.</param>
        /// <returns>The key created from the specified bytes.</returns>
        public static CryptoKey ImportKey(Session session, byte[] keyData, KeyClass keyClass, KeyType keyType, bool canBeExported)
        {
            CryptokiAttribute[] keyImport = new CryptokiAttribute[]
            {
                new CryptokiAttribute(CryptokiAttribute.CryptokiType.Class  , Utility.ConvertToBytes((int)keyClass)),
                new CryptokiAttribute(CryptokiAttribute.CryptokiType.KeyType, Utility.ConvertToBytes((int)keyType)),
                new CryptokiAttribute(CryptokiAttribute.CryptokiType.Value, keyData),
                new CryptokiAttribute(CryptokiAttribute.CryptokiType.Extractable, Utility.ConvertToBytes(canBeExported ? 1 : 0)),
            };

            CryptoKey ret = LoadKey(session, keyImport);

            session.AddSessionObject(ret);

            return ret;
        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:25,代码来源:Key.cs

示例5: UnwrapKey

        /// <summary>
        /// Unwraps the specified key data with the given wrapping key and mechanism.
        /// </summary>
        /// <param name="session">The Cryptoki session context.</param>
        /// <param name="mechanism">The key wrapping mechanism or algorithm.</param>
        /// <param name="wrappingKey">The key that will be used to unwrap the specifed keyData.</param>
        /// <param name="keyData">The encrypted key data.</param>
        /// <param name="keyTemplate">The key attribute template.</param>
        /// <returns>The unwrapped key object.</returns>
        public static CryptoKey UnwrapKey(Session session, Mechanism mechanism, CryptoKey wrappingKey, byte[] keyData, CryptokiAttribute[] keyTemplate)
        {
            CryptoKey ret = UnwrapKeyInternal(session, mechanism, wrappingKey, keyData, keyTemplate);

            if (ret != null)
            {
                session.AddSessionObject(ret);
            }

            return ret;
        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:20,代码来源:Key.cs

示例6: GenerateKeyPair

        /// <summary>
        /// Generates a new CryptoKey object that represents a public/private key pair.
        /// </summary>
        /// <param name="session">The Cryptoki session context.</param>
        /// <param name="mechanism">The key algorithm and parameters.</param>
        /// <param name="publicKeyTemplate">The public key attribute template.</param>
        /// <param name="privateKeyTemplate">The private key attribute template.</param>
        /// <returns></returns>
        public static CryptoKey GenerateKeyPair(Session session, Mechanism mechanism, CryptokiAttribute[] publicKeyTemplate, CryptokiAttribute[] privateKeyTemplate)
        {
            CryptoKey ret = GenerateKeyPairInternal(session, mechanism, publicKeyTemplate, privateKeyTemplate);

            session.AddSessionObject(ret);

            return ret;
        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:16,代码来源:Key.cs

示例7: GenerateKey

        /// <summary>
        /// Generates a new CryptoKey within the specified session context with the specified key mechanism and key template.
        /// </summary>
        /// <param name="session">The Cryptoki session context.</param>
        /// <param name="mechanism">The key algorithm and parameters.</param>
        /// <param name="template">The key attribute template that defines the resulting key's properties.</param>
        /// <returns></returns>
        public static CryptoKey GenerateKey(Session session, Mechanism mechanism, CryptokiAttribute[] template)
        {
            CryptoKey ret = GenerateKeyInternal(session, mechanism, template);

            session.AddSessionObject(ret);

            return ret;
        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:15,代码来源:Key.cs


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