Net.Pkcs11Interop.HighLevelAPI81.MechanismParams.CkWtlsMasterKeyDeriveParams.CkWtlsMasterKeyDeriveParams C# (CSharp) Method

CkWtlsMasterKeyDeriveParams() public method

Initializes a new instance of the CkWtlsMasterKeyDeriveParams class.
public CkWtlsMasterKeyDeriveParams ( ulong digestMechanism, CkWtlsRandomData randomInfo, bool dh ) : System
digestMechanism ulong Digest mechanism to be used (CKM)
randomInfo CkWtlsRandomData Client's and server's random data information
dh bool Set to false for CKM_WTLS_MASTER_KEY_DERIVE mechanism and to true for CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC mechanism
return System
        public CkWtlsMasterKeyDeriveParams(ulong digestMechanism, CkWtlsRandomData randomInfo, bool dh)
        {
            if (randomInfo == null)
                throw new ArgumentNullException("randomInfo");
            
            // Keep reference to randomInfo so GC will not free it while this object exists
            _randomInfo = randomInfo;

            _lowLevelStruct.DigestMechanism = digestMechanism;
            _lowLevelStruct.RandomInfo = (CK_WTLS_RANDOM_DATA)_randomInfo.ToMarshalableStructure();
            _lowLevelStruct.Version = (dh) ? IntPtr.Zero : UnmanagedMemory.Allocate(UnmanagedMemory.SizeOf(typeof(CK_VERSION)));
        }