Net.Pkcs11Interop.HighLevelAPI81.Session.SetOperationState C# (CSharp) Method

SetOperationState() public method

Restores the cryptographic operations state of a session from an array of bytes obtained with GetOperationState
public SetOperationState ( byte state, ObjectHandle encryptionKey, ObjectHandle authenticationKey ) : void
state byte Array of bytes obtained with GetOperationState
encryptionKey ObjectHandle CK_INVALID_HANDLE or handle to the key which will be used for an ongoing encryption or decryption operation in the restored session
authenticationKey ObjectHandle CK_INVALID_HANDLE or handle to the key which will be used for an ongoing signature, MACing, or verification operation in the restored session
return void
        public void SetOperationState(byte[] state, ObjectHandle encryptionKey, ObjectHandle authenticationKey)
        {
            if (this._disposed)
                throw new ObjectDisposedException(this.GetType().FullName);

            if (state == null)
                throw new ArgumentNullException("state");

            if (encryptionKey == null)
                throw new ArgumentNullException("encryptionKey");

            if (authenticationKey == null)
                throw new ArgumentNullException("authenticationKey");

            CKR rv = _p11.C_SetOperationState(_sessionId, state, Convert.ToUInt64(state.Length), encryptionKey.ObjectId, authenticationKey.ObjectId);
            if (rv != CKR.CKR_OK)
                throw new Pkcs11Exception("C_SetOperationState", rv);
        }