/// <summary> /// Creates attribute of given type with DateTime (CK_DATE) value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of given type with DateTime value</returns> public static CK_ATTRIBUTE CreateAttribute(CKA type, DateTime value) { // Possible TODO - Implement with nullable DateTime return(CreateAttribute(Convert.ToUInt64((uint)type), value)); }
/// <summary> /// Creates attribute of given type with no value /// </summary> /// <param name="type">Attribute type</param> public ObjectAttribute(CKA type) { _ckAttribute = CkaUtils.CreateAttribute(type); }
/// <summary> /// Creates attribute of given type with no value /// </summary> /// <param name="type">Attribute type</param> public ObjectAttribute(CKA type) { _ckAttribute = LowLevelAPI.CkaUtils.CreateAttribute(type); }
/// <summary> /// Creates attribute of given type with NativeULong value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of given type with NativeULong value</returns> public static CK_ATTRIBUTE CreateAttribute(CKA type, NativeULong value) { return(CreateAttribute(ConvertUtils.UInt32FromCKA(type), value)); }
/// <summary> /// Creates attribute of given type with CKO value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of given type with CKO value</returns> public static CK_ATTRIBUTE CreateAttribute(CKA type, CKO value) { return CreateAttribute(Convert.ToUInt64((uint)type), Convert.ToUInt64((uint)value)); }
/// <summary> /// Creates attribute of given type with CKO value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of given type with CKO value</returns> public static CK_ATTRIBUTE CreateAttribute(CKA type, CKO value) { return CreateAttribute((uint)type, (uint)value); }
internal MechanismTypeAttribute(CKA type) : base((uint)type) { }
/// <summary> /// Creates attribute of given type with ulong array value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> public ObjectAttribute(CKA type, List<ulong> value) { ulong[] ulongs = null; if (value != null) ulongs = value.ToArray(); _ckAttribute = CkaUtils.CreateAttribute(type, ulongs); }
public static CK_ATTRIBUTE createAttribute(CKA type, int size) { return(createAttribute((uint)type, new byte[size])); }
/// <summary> /// Converts CKA to NativeULong /// </summary> /// <param name="value">CKA that should be converted</param> /// <returns>NativeULong with value from CKA</returns> public static NativeULong ConvertFromCKA(CKA value) { return(Convert.ToUInt32(value)); }
/// <summary> /// Creates attribute of given type with CKO value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of given type with CKO value</returns> public static CK_ATTRIBUTE CreateAttribute(CKA type, CKO value) { return(CreateAttribute(NativeLongUtils.ConvertFromCKA(type), NativeLongUtils.ConvertFromCKO(value))); }
public ByteArrayAttribute(CKA type) : base((uint)type) { }
/// <summary> /// Creates attribute of given type with DateTime (CK_DATE) value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> public ObjectAttribute(CKA type, DateTime value) { _ckAttribute = LowLevelAPI.CkaUtils.CreateAttribute(type, value); }
public MechanismTypeAttribute(CKA type, CKM mechanismType) : base((uint)type) { MechanismType = mechanismType; }
/// <summary> /// Creates attribute of given type with DateTime (CK_DATE) value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> public ObjectAttribute(CKA type, DateTime value) { _ckAttribute = CkaUtils.CreateAttribute(type, value); }
/// <summary> /// Creates attribute of given type with uint array value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> public ObjectAttribute(CKA type, List<uint> value) { uint[] uints = null; if (value != null) uints = value.ToArray(); _ckAttribute = CkaUtils.CreateAttribute(type, uints); }
/// <summary> /// Creates attribute of given type with ulong array value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of given type with ulong array value</returns> public static CK_ATTRIBUTE CreateAttribute(CKA type, ulong[] value) { return CreateAttribute(Convert.ToUInt64((uint)type), value); }
/// <summary> /// Creates attribute of given type with NativeULong value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> public ObjectAttribute(CKA type, NativeULong value) { _ckAttribute = CkaUtils.CreateAttribute(type, value); }
/// <summary> /// Creates attribute of given type with DateTime (CK_DATE) value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of given type with DateTime value</returns> public static CK_ATTRIBUTE CreateAttribute(CKA type, DateTime value) { // Possible TODO - Implement with nullable DateTime return CreateAttribute((uint)type, value); }
/// <summary> /// Creates attribute of given type with byte array value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of cryptoki object</returns> public IObjectAttribute Create(CKA type, byte[] value) { return(new ObjectAttribute(type, value)); }
/// <summary> /// Creates attribute of given type with ulong array value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> public ObjectAttribute(CKA type, List<ulong> value) { if (Platform.UnmanagedLongSize == 4) { List<uint> uintList = null; if (value != null) { uintList = new List<uint>(); for (int i = 0; i < value.Count; i++) uintList.Add(Convert.ToUInt32(value[i])); } if (Platform.StructPackingSize == 0) _objectAttribute40 = new HighLevelAPI40.ObjectAttribute(type, uintList); else _objectAttribute41 = new HighLevelAPI41.ObjectAttribute(type, uintList); } else { if (Platform.StructPackingSize == 0) _objectAttribute80 = new HighLevelAPI80.ObjectAttribute(type, value); else _objectAttribute81 = new HighLevelAPI81.ObjectAttribute(type, value); } }
/// <summary> /// Creates attribute of given type with DateTime (CK_DATE) value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of cryptoki object</returns> public IObjectAttribute Create(CKA type, DateTime value) { return(new ObjectAttribute(type, value)); }
/// <summary> /// Creates attribute of given type with DateTime (CK_DATE) value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of given type with DateTime value</returns> public static CK_ATTRIBUTE CreateAttribute(CKA type, DateTime value) { // Possible TODO - Implement with nullable DateTime return(CreateAttribute(ConvertUtils.UInt32FromCKA(type), value)); }
/// <summary> /// Creates attribute of given type with no value /// </summary> /// <param name="type">Attribute type</param> /// <returns>Attribute of cryptoki object</returns> public IObjectAttribute Create(CKA type) { return(new ObjectAttribute(type)); }
/// <summary> /// Creates attribute of given type with CKO value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of given type with CKO value</returns> public static CK_ATTRIBUTE CreateAttribute(CKA type, CKO value) { return(CreateAttribute(ConvertUtils.UInt32FromCKA(type), ConvertUtils.UInt32FromCKO(value))); }
/// <summary> /// Creates attribute of given type with mechanism array value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of cryptoki object</returns> public IObjectAttribute CreateObjectAttribute(CKA type, List <CKM> value) { return(new ObjectAttribute(type, value)); }
/// <summary> /// Creates attribute of given type with CKO value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of given type with CKO value</returns> public static CK_ATTRIBUTE CreateAttribute(CKA type, CKO value) { return(CreateAttribute(Convert.ToUInt64((uint)type), Convert.ToUInt64((uint)value))); }
/// <summary> /// Creates attribute of given type with CKK value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of cryptoki object</returns> public IObjectAttribute CreateObjectAttribute(CKA type, CKK value) { return(new ObjectAttribute(type, value)); }
/// <summary> /// Creates attribute of given type with uint value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> public ObjectAttribute(CKA type, uint value) { _ckAttribute = CkaUtils.CreateAttribute(type, value); }
/// <summary> /// Creates attribute of given type with ulong value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> public ObjectAttribute(CKA type, ulong value) { _ckAttribute = CkaUtils.CreateAttribute(type, ConvertUtils.UInt32FromUInt64(value)); }
/// <summary> /// Creates attribute of given type with byte array value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> public ObjectAttribute(CKA type, byte[] value) { _ckAttribute = CkaUtils.CreateAttribute(type, value); }
/// <summary> /// Converts CKA to UInt32 /// </summary> /// <param name="value">CKA that should be converted</param> /// <returns>UInt32 with value from CKA</returns> public static UInt32 UInt32FromCKA(CKA value) { return(Convert.ToUInt32(value)); }
/// <summary> /// Creates attribute of given type with attribute array value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> public ObjectAttribute(CKA type, List<ObjectAttribute> value) { CK_ATTRIBUTE[] attributes = null; if (value != null) { attributes = new CK_ATTRIBUTE[value.Count]; for (int i = 0; i < value.Count; i++) attributes[i] = value[i].CkAttribute; } // Note: Each attribute in the input list still owns unmanaged memory used by its value and will free it when disposed. _ckAttribute = CkaUtils.CreateAttribute(type, attributes); }
/// <summary> /// Converts CKA to UInt64 /// </summary> /// <param name="value">CKA that should be converted</param> /// <returns>UInt64 with value from CKA</returns> public static UInt64 UInt64FromCKA(CKA value) { return(Convert.ToUInt64(value)); }
/// <summary> /// Creates attribute of given type with mechanism array value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> public ObjectAttribute(CKA type, List<CKM> value) { CKM[] mechanisms = null; if (value != null) mechanisms = value.ToArray(); _ckAttribute = CkaUtils.CreateAttribute(type, mechanisms); }
/// <summary> /// Initializes new instance of AttributeValueException class /// </summary> /// <param name="attribute">Attribute whose value could not be read or converted</param> public AttributeValueException(CKA attribute) : base(string.Format("Value of attribute {0} could not be read", attribute.ToString())) { _attribute = attribute; }
/// <summary> /// Creates attribute of given type with mechanism array value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of given type with mechanism array value</returns> public static CK_ATTRIBUTE CreateAttribute(CKA type, CKM[] value) { ulong[] ulongArray = null; if (value != null) { ulongArray = new ulong[value.Length]; for (int i = 0; i < value.Length; i++) ulongArray[i] = Convert.ToUInt64((uint)value[i]); } return CreateAttribute(type, ulongArray); }
/// <summary> /// Initializes a new instance of AttributeValueException class with a reference to the inner exception that is the cause of this exception /// </summary> /// <param name="attribute">Attribute whose value could not be read or converted</param> /// <param name="innerException">The exception that is the cause of the current exception</param> public AttributeValueException(CKA attribute, Exception innerException) : base(string.Format("Value of attribute {0} could not be converted", attribute.ToString()), innerException) { _attribute = attribute; }
/// <summary> /// Creates attribute of given type with byte array value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of given type with byte array value</returns> public static CK_ATTRIBUTE CreateAttribute(CKA type, byte[] value) { return CreateAttribute((uint)type, value); }
/// <summary> /// Creates attribute of given type with no value /// </summary> /// <param name="type">Attribute type</param> /// <returns>Attribute of given type structure with no value</returns> public static CK_ATTRIBUTE CreateAttribute(CKA type) { return(CreateAttribute(ConvertUtils.UInt64FromCKA(type))); }
/// <summary> /// Creates attribute of given type with mechanism array value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of given type with mechanism array value</returns> public static CK_ATTRIBUTE CreateAttribute(CKA type, CKM[] value) { uint[] uintArray = null; if (value != null) { uintArray = new uint[value.Length]; for (int i = 0; i < value.Length; i++) uintArray[i] = (uint)value[i]; } return CreateAttribute(type, uintArray); }
/// <summary> /// Creates attribute of given type with byte array value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of given type with byte array value</returns> public static CK_ATTRIBUTE CreateAttribute(CKA type, byte[] value) { return(CreateAttribute((uint)type, value)); }
/// <summary> /// Creates attribute of given type with ulong value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> public ObjectAttribute(CKA type, ulong value) { if (Platform.UnmanagedLongSize == 4) { if (Platform.StructPackingSize == 0) _objectAttribute40 = new HighLevelAPI40.ObjectAttribute(Convert.ToUInt32(type), Convert.ToUInt32(value)); else _objectAttribute41 = new HighLevelAPI41.ObjectAttribute(Convert.ToUInt32(type), Convert.ToUInt32(value)); } else { if (Platform.StructPackingSize == 0) _objectAttribute80 = new HighLevelAPI80.ObjectAttribute(type, value); else _objectAttribute81 = new HighLevelAPI81.ObjectAttribute(type, value); } }
/// <summary> /// Creates attribute of given type with CKO value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> /// <returns>Attribute of given type with CKO value</returns> public static CK_ATTRIBUTE CreateAttribute(CKA type, CKO value) { return(CreateAttribute((uint)type, (uint)value)); }
/// <summary> /// Creates attribute of given type with mechanism array value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> public ObjectAttribute(CKA type, List<CKM> value) { if (Platform.UnmanagedLongSize == 4) { if (Platform.StructPackingSize == 0) _objectAttribute40 = new HighLevelAPI40.ObjectAttribute(type, value); else _objectAttribute41 = new HighLevelAPI41.ObjectAttribute(type, value); } else { if (Platform.StructPackingSize == 0) _objectAttribute80 = new HighLevelAPI80.ObjectAttribute(type, value); else _objectAttribute81 = new HighLevelAPI81.ObjectAttribute(type, value); } }
public CharArrayAttribute(CKA type) : base((uint)type) { }