Net.Pkcs11Interop.HighLevelAPI81.ObjectAttribute.GetValueAsUlong C# (CSharp) Method

GetValueAsUlong() public method

Reads value of attribute and returns it as ulong
public GetValueAsUlong ( ) : ulong
return ulong
        public ulong GetValueAsUlong()
        {
            if (this._disposed)
                throw new ObjectDisposedException(this.GetType().FullName);

            ulong value = 0;
            CkaUtils.ConvertValue(ref _ckAttribute, out value);
            return value;
        }

Usage Example

        public void _03_UintAttributeTest()
        {
            if (Platform.UnmanagedLongSize != 8 || Platform.StructPackingSize != 1)
                Assert.Inconclusive("Test cannot be executed on this platform");

            ulong value = (ulong)CKO.CKO_DATA;

            // Create attribute with ulong value
            using (ObjectAttribute attr = new ObjectAttribute(CKA.CKA_CLASS, value))
            {
                Assert.IsTrue(attr.Type == (ulong)CKA.CKA_CLASS);
                Assert.IsTrue(attr.GetValueAsUlong() == value);
            }
        }