public static int SealMessage( SSPIInterface SecModule, ref long context, int QOP, SecurityBufferClass[] input, int sequenceNumber) { GCHandle[] handleIn = PinBuffers(input); SecurityBufferDescriptor sdcInOut = new SecurityBufferDescriptor(input); int errorCode = SecModule.SealMessage(ref context, QOP, ref sdcInOut, sequenceNumber); SecurityBufferClass[] result = sdcInOut.marshall(); for (int k = 0; k < input.Length; k++) { input[k] = result[k]; } sdcInOut.FreeAllBuffers(0); FreeGCHandles(handleIn); return(errorCode); }