Ejemplo n.º 1
0
        /// <summary>
        /// Saves the Cryptoki object as the given name to the specified store location.
        /// </summary>
        /// <param name="name">Name to save the crypto object as.</param>
        /// <param name="location">Location to store the object.</param>
        /// <param name="level">Secure storage priority level.</param>
        /// <returns>true if the save was successful, false otherwise.</returns>
        public virtual bool Save(string name, string location, SecureStorageLevel level)
        {
            CryptokiAttribute[] attribs = new CryptokiAttribute[]
            {
                new CryptokiAttribute(CryptokiAttribute.CryptokiType.Label, UTF8Encoding.UTF8.GetBytes(location)), 
                new CryptokiAttribute(CryptokiAttribute.CryptokiType.ObjectID, UTF8Encoding.UTF8.GetBytes(name)),
                new CryptokiAttribute(CryptokiAttribute.CryptokiType.Persist, Utility.ConvertToBytes(1)),
            };

            return this.SetAttributeValues(attribs);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Saves the Cryptoki object as the given name to the specified store location.
        /// </summary>
        /// <param name="name">Name to save the crypto object as.</param>
        /// <param name="location">Location to store the object.</param>
        /// <param name="level">Secure storage priority level.</param>
        /// <returns>true if the save was successful, false otherwise.</returns>
        public virtual bool Save(string name, string location, SecureStorageLevel level)
        {
            CryptokiAttribute[] attribs = new CryptokiAttribute[]
            {
                new CryptokiAttribute(CryptokiAttribute.CryptokiType.Label, UTF8Encoding.UTF8.GetBytes(location)),
                new CryptokiAttribute(CryptokiAttribute.CryptokiType.ObjectID, UTF8Encoding.UTF8.GetBytes(name)),
                new CryptokiAttribute(CryptokiAttribute.CryptokiType.Persist, Utility.ConvertToBytes(1)),
            };

            return(this.SetAttributeValues(attribs));
        }