/// <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) { if (Platform.UnmanagedLongSize == 4) { if (Platform.StructPackingSize == 0) { _objectAttribute40 = new HighLevelAPI40.ObjectAttribute(type, ConvertToHighLevelAPI40List(value)); } else { _objectAttribute41 = new HighLevelAPI41.ObjectAttribute(type, ConvertToHighLevelAPI41List(value)); } } else { if (Platform.StructPackingSize == 0) { _objectAttribute80 = new HighLevelAPI80.ObjectAttribute(type, ConvertToHighLevelAPI80List(value)); } else { _objectAttribute81 = new HighLevelAPI81.ObjectAttribute(type, ConvertToHighLevelAPI81List(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> public ObjectAttribute(CKA type, DateTime 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); } } }
/// <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(ulong type, byte[] value) { if (Platform.UnmanagedLongSize == 4) { if (Platform.StructPackingSize == 0) { _objectAttribute40 = new HighLevelAPI40.ObjectAttribute(Convert.ToUInt32(type), value); } else { _objectAttribute41 = new HighLevelAPI41.ObjectAttribute(Convert.ToUInt32(type), value); } } else { if (Platform.StructPackingSize == 0) { _objectAttribute80 = new HighLevelAPI80.ObjectAttribute(type, value); } else { _objectAttribute81 = new HighLevelAPI81.ObjectAttribute(type, value); } } }
/// <summary> /// Converts platform specific ObjectAttribute to platfrom neutral ObjectAttribute /// </summary> /// <param name="objectAttribute">Platform specific ObjectAttribute</param> internal ObjectAttribute(HighLevelAPI41.ObjectAttribute objectAttribute) { if (objectAttribute == null) { throw new ArgumentNullException("objectAttribute"); } _objectAttribute41 = objectAttribute; }
/// <summary> /// Disposes object /// </summary> /// <param name="disposing">Flag indicating whether managed resources should be disposed</param> protected virtual void Dispose(bool disposing) { if (!this._disposed) { if (disposing) { // Dispose managed objects if (_objectAttribute40 != null) { _objectAttribute40.Dispose(); _objectAttribute40 = null; } if (_objectAttribute41 != null) { _objectAttribute41.Dispose(); _objectAttribute41 = null; } if (_objectAttribute80 != null) { _objectAttribute80.Dispose(); _objectAttribute80 = null; } if (_objectAttribute81 != null) { _objectAttribute81.Dispose(); _objectAttribute81 = null; } } // Dispose unmanaged objects _disposed = true; } }
/// <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 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); } }
/// <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 attribute array value /// </summary> /// <param name="type">Attribute type</param> /// <param name="value">Attribute value</param> public ObjectAttribute(ulong type, List<ObjectAttribute> value) { if (Platform.UnmanagedLongSize == 4) { if (Platform.StructPackingSize == 0) _objectAttribute40 = new HighLevelAPI40.ObjectAttribute(Convert.ToUInt32(type), ConvertToHighLevelAPI40List(value)); else _objectAttribute41 = new HighLevelAPI41.ObjectAttribute(Convert.ToUInt32(type), ConvertToHighLevelAPI41List(value)); } else { if (Platform.StructPackingSize == 0) _objectAttribute80 = new HighLevelAPI80.ObjectAttribute(type, ConvertToHighLevelAPI80List(value)); else _objectAttribute81 = new HighLevelAPI81.ObjectAttribute(type, ConvertToHighLevelAPI81List(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> public ObjectAttribute(ulong type, DateTime value) { if (Platform.UnmanagedLongSize == 4) { if (Platform.StructPackingSize == 0) _objectAttribute40 = new HighLevelAPI40.ObjectAttribute(Convert.ToUInt32(type), value); else _objectAttribute41 = new HighLevelAPI41.ObjectAttribute(Convert.ToUInt32(type), value); } else { if (Platform.StructPackingSize == 0) _objectAttribute80 = new HighLevelAPI80.ObjectAttribute(type, value); else _objectAttribute81 = new HighLevelAPI81.ObjectAttribute(type, value); } }
/// <summary> /// Converts platform specific ObjectAttribute to platfrom neutral ObjectAttribute /// </summary> /// <param name="objectAttribute">Platform specific ObjectAttribute</param> internal ObjectAttribute(HighLevelAPI41.ObjectAttribute objectAttribute) { if (objectAttribute == null) throw new ArgumentNullException("objectAttribute"); _objectAttribute41 = objectAttribute; }
/// <summary> /// Disposes object /// </summary> /// <param name="disposing">Flag indicating whether managed resources should be disposed</param> protected virtual void Dispose(bool disposing) { if (!this._disposed) { if (disposing) { // Dispose managed objects if (_objectAttribute40 != null) { _objectAttribute40.Dispose(); _objectAttribute40 = null; } if (_objectAttribute41 != null) { _objectAttribute41.Dispose(); _objectAttribute41 = null; } if (_objectAttribute80 != null) { _objectAttribute80.Dispose(); _objectAttribute80 = null; } if (_objectAttribute81 != null) { _objectAttribute81.Dispose(); _objectAttribute81 = null; } } // Dispose unmanaged objects _disposed = true; } }