I'm attempting to encrypt/decrypt a single buffer using the CryptoAPI.
I've been successful in encrypting/decrypting a key and Importing/Exporting the key BLOB. I've also (only in the apparent sense) been successful with the Encryption (only) of data.
The following code sucessfully Encrypts the data. On decryption, it successfully decrypts the data, but reports "NTE_BAD_DATA".
globals in header:
HCRYPTPROV cryptprov;
HCRYPTKEY pubenckey;
HCRYPTKEY cryptprivkey;
LPVOID keystore;
Creating a session key:
DWORD ret = 0;
ZeroMemory(&cryptprov,sizeof(cryptprov));
CString cwinver("Windows 7";);
string winver = cwinver.GetBuffer();
wstring provname;
wstring contname = L"Container";
if (winver.compare("Windows XP") == 0) { provname.assign(L"Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)"); } else { provname.assign(L"Microsoft Enhanced RSA and AES Cryptographic Provider"); }
ret = CryptAcquireContextW(&cryptprov,contname.c_str(),provname.c_str(),PROV_RSA_AES,CRYPT_SILENT);
if (ret == FALSE) { ret = CryptAcquireContextW(&cryptprov,contname.c_str(),provname.c_str(),PROV_RSA_AES,CRYPT_SILENT|CRYPT_NEWKEYSET); }
if (ret == FALSE) {
return -1;
}
HCRYPTHASH hashobj;
CStringW cpass("testpass");
wstring pass = cpass.GetBuffer();
ret = CryptCreateHash(cryptprov,CALG_MD5,NULL,NULL,&hashobj);
if (ret == FALSE) {
return -1;
}
ret = CryptHashData(hashobj,(LPBYTE)pass.c_str(),pass.size(),0);
if (ret == FALSE) {
return -1;
}
ret = CryptDeriveKey(cryptprov,CALG_AES_256,hashobj,0x01000000|CRYPT_EXPORTABLE,&cryptprivkey);
if (ret == FALSE) {
return -1;
}
CryptDestroyHash(hashobj);
return ret;
Generating a key, exporting the blob, encrypting it with the session key, and writing to file:
DWORD ret = 0;
int buflen;
ret = CryptGenKey(cryptprov,CALG_AES_256,0x01000000|CRYPT_EXPORTABLE,&pubenckey);
if (ret == FALSE) {
return -1;
}
DWORD count;
ret = CryptExportKey(pubenckey,0,PLAINTEXTKEYBLOB,0,NULL,&count);
if (ret == FALSE) {
return -1;
}
buflen = count + 100;
keystore = VirtualAlloc(NULL,buflen,MEM_COMMIT|MEM_RESERVE,PAGE_EXECUTE_READWRITE);
ret = CryptExportKey(pubenckey,0,PLAINTEXTKEYBLOB,0,(BYTE *)keystore,&count);
if (ret == FALSE) {
return -1;
}
DWORD origkeyblocksize = count;
ret = CryptEncrypt(cryptprivkey,NULL,TRUE,0,NULL,&count,buflen);
if (ret == FALSE) {
return -1;
}
ret = CryptEncrypt(cryptprivkey,NULL,TRUE,0,(BYTE *)keystore,&count,buflen);
if (ret == FALSE) {
return -1;
}
memcpy((void *)((LONG)keystore+count),(void *)&origkeyblocksize,4);
string filen = "C:\\testenc.enc";
if (filen.compare("") != 0) {
HANDLE fileh = CreateFile(filen.c_str(),GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
if (fileh != INVALID_HANDLE_VALUE) {
ret = WriteFile(fileh, keystore, count+4, &count, NULL);
} else { ret = -1; }
CloseHandle(fileh);
} else { ret = -1; }
if (ret != -1 && ret != FALSE) { ret = (LONG)keystore; }
return ret;
Another application reads the file and imports the key:
DWORD ret = 0;
DWORD datalen;
DWORD bufsize = 0;
DWORD origkeysize = 0;
string filen = "c:\\testenc.enc";
if (filen.compare("") != 0) {
HANDLE fileh = CreateFile(filen.c_str(),GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if (fileh != INVALID_HANDLE_VALUE) {
DWORD fsize = GetFileSize(fileh,0);
bufsize = fsize-4;
keystore = VirtualAlloc(NULL,bufsize,MEM_COMMIT|MEM_RESERVE,PAGE_EXECUTE_READWRITE);
ret = ReadFile(fileh, keystore, fsize-4, &datalen, NULL);
ret = ReadFile(fileh, &origkeysize, 4, &datalen, NULL);
CloseHandle(fileh);
if (ret == FALSE) { ret = -1; }
} else { ret = -1; }
} else { ret = -1; }
if (ret == FALSE || ret == -1) {
return -1;
}
datalen = bufsize;
ret = CryptDecrypt(cryptprivkey,NULL,TRUE,0,(BYTE *)keystore,&datalen);
if (ret == FALSE) {
return -1;
}
ret = CryptImportKey(cryptprov,(BYTE *)keystore,origkeysize,0,0,&pubenckey);
if (ret == FALSE) { ret = -1; } else { ret = (LONG)keystore; }
return ret;
Encryption of buffer (buffer pointer is passed in as a LONG and the first twelve bytes are used for encrypted/unencrypted data lengths):
DWORD ret = 0;
DWORD buflen;
DWORD count;
memcpy((void *)&count,(void *)((LONG)passedbufferptr),4);
count-=12;
buflen = count + 32;
ret = CryptEncrypt(pubenckey,NULL,TRUE,0,NULL,&count,buflen);
if (ret == FALSE) {
return -1;
}
ret = CryptEncrypt(pubenckey,NULL,TRUE,0,(BYTE *)((LONG)passedbufferptr+12),&count,buflen);
if (ret == FALSE) {
return -1;
}
memcpy((void *)((LONG)passedbufferptr+8),(void *)&count,4);
return ret;
Decryption of data:
DWORD ret = 0;
DWORD count;
memcpy((void *)&count,(void *)((LONG)passedbufferptr+8),4);
ret = CryptDecrypt(pubenckey,NULL,TRUE,0,(BYTE *)((LONG)passedbufferptr+12),&count);
if (ret == FALSE) {
return GetLastError();
}
return ret;
The last code block consistently returns -2146893819 (NTE_BAD_DATA). Upon inspection of the buffer, however, it is decrypted.
It is important to note, that I pass in buffers with data amounts that are multiples of 32, and that doesn't change the result.
Thanks for any help you may have!
Related
i want to run my 3 axes gantry(stm32) in sequence similar to the sequence of serial data sent from the pc but this is not happening. no data is lost as all the axes perform their task but in wrong sequence.
this is the recieve complete callback loop
`void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
if(r != ',')
{
Rx[i++] = r;
}
else
{
strncpy(s1,Rx,i);
Home = strrchr(s1, 'H');
StringX = strrchr(s1, 'X');
StringY = strrchr(s1, 'Y');
StringZ = strrchr(s1, 'Z');
StringW = strrchr(s1, 'W');
if(Home[0] == 'H' && Home[1] == 'O' && Home[2] == 'M' && Home[3] == 'E')
{
homeValue = 1;
}
if(StringX[0] == 'X')
{
MoveX= substr(StringX,1,8);
MoveXvalue = (atol(MoveX))/100;
SpeedX = substr(StringX,8,12);
SpeedXvalue = atol(SpeedX);
insertintoQueue_X(MoveXvalue, SpeedXvalue);
insertintoSequenceQueue (1);
}
if(StringY[0] == 'Y')
{
MoveY= substr(StringY,1,8);
MoveYvalue = (atol(MoveY))/100;
SpeedY = substr(StringY,8,12);
SpeedYvalue = atol(SpeedY);
insertintoQueue_Y(MoveYvalue, SpeedYvalue);
insertintoSequenceQueue (2);
///goes on for other axes
/
i = 0;
}
}`
i tried sequencing these received cmds with below loop(posting only for one axis)
`void insertintoQueue_X (int j, int l)
{
uint8_t queuefull[] = "XFULL";
if(countXmove == 256 || countXspeed == 256 )
{
HAL_UART_Transmit_IT (&huart1, queuefull, sizeof (queuefull));
}
Xmovequeue[countXmove] = j ;
countXmove++;
Xspeedqueue[countXspeed] = l;
countXspeed++;
}
void removefromQueue_X()
{
//uint8_t queueEmpty[] = "XEMPTY";
/*if(countXmove == 0 || countXspeed == 0)
{
HAL_UART_Transmit_IT (&huart2, queueEmpty, sizeof (queueEmpty));
}*/
currentXmoveelement = Xmovequeue[0];
currentXspeedelement = Xspeedqueue[0];
for(int i = 0; i < countXmove - 1; i++)
{
Xmovequeue[i] = Xmovequeue[i+1];
Xspeedqueue[i] = Xspeedqueue[i+1];
}
}`
while loop is as below
` removefromSequenceQueue();//only called once in while loop
for(int p = 0; p < countXmove ; p++)
{
if(currentSequence == 1)
{
removefromQueue_X();
if(currentXmoveelement >0)
{
//uint8_t Xmovvestatus[] = "XMMM";
if(CurrentXposition != currentXmoveelement)
{
if(CurrentXposition > currentXmoveelement )
{
currentmoveX = CurrentXposition - currentXmoveelement;
motorMoveTo(currentmoveX,0,currentXspeedelement,20,SMSPR_X,SMS_X,SMDPR_X,SMD_X);
}
else if(CurrentXposition < currentXmoveelement )
{
// HAL_UART_Transmit_IT (&huart1, Xmovvestatus, sizeof (Xmovvestatus));
currentmoveX = currentXmoveelement - CurrentXposition ;
motorMoveTo(currentmoveX,1,currentXspeedelement,20,SMSPR_X,SMS_X,SMDPR_X,SMD_X);
}
CurrentXposition = currentXmoveelement;
currentXmoveelement = 0;
currentmoveX = 0;
MoveXvalue=0;
}
}
}
}
Can Someone explain what is wrong in this code ?
It is failing on testcase s = "aa" and p = "*".
I have followed recursion and dynamic programming code here
Leetcode 44 Wildcard Matching
class Solution {
public boolean isMatch(String s, String p) {
int n = s.length();
int m = p.length();
int[][] dp = new int[n][m];
for(int[] it : dp)
Arrays.fill(it, -1);
return solve(n-1 , m-1, s ,p , dp);
}
public boolean solve(int i, int j, String s, String p, int[][] dp){
if(i < 0 && j < 0) return true;
if(i < 0 && j >=0){
while(j>=0){
if(p.charAt(j) + "" == "*") j--;
else return false;
}
return true;
}
if(j < 0 && i >=0) return false;
if(dp[i][j] != -1){
if(dp[i][j]==1) return true;
return false;
}
if(s.charAt(i) == p.charAt(j) || p.charAt(j) + "" == "?"){
boolean temp = solve(i-1,j-1,s,p,dp);
if(temp == false) dp[i][j] = 0;
else
dp[i][j] = 1;
return temp;
}
if(p.charAt(j) + "" == "*"){
boolean temp = solve(i-1,j,s,p,dp) || solve(i,j-1,s,p,dp);
if(temp == false)
dp[i][j] = 0;
else
dp[i][j] = 1;
return temp;
}
dp[i][j] = 0;
return false;
}
}
I'm working on the project where all 3 devices are running in QNX
2 Socket Client (non blocking) running in One CPU., remaining 2 CPU are running as Server.
When I test run, I see some issues with Client don't receive reply from the Server for certain time, then I have to drop the connection and re-establish.
I have doubt that there are any restriction under the same process, 2 client socket thread can not be running? esp in QNX. If so how to create the process and create the thread on the process for each client.
// Client Side Code
int CNoseCapUnitECUCLient::iStartTCPIPHandler(eNCUOption eOption)
{
printf("Start %s NCU TCPIP Handler handler \n",(meNCUOption == NCU_FREE_AREA) ? "Local":"Remote" );
meNCUOption = eOption;
if(mbTCPHandThreadAlive)
{
iStopTCPIPHandler();
}
else
{
iCreateMutex(mpMainMutex, "TCPIPMutex");
}
// Create new handler thread
mpHandThread = CMNcreateThread();
if(mpHandThread == nullptr)
{
return 1;
}
// Thread priority should at least be equal to LTA application (21)
bool bResult = mpHandThread->create("TCP_HeartbeatThread", 0, 0, 0, &heartBeatThread, this);
if(bResult == false)
{
return 1;
}
mbHandling = true;
mbTCPHandThreadAlive = true;
return EOK;
}
void CNoseCapUnitECUCLient::TCP_HeartbeatThread()
{
int iRecvLen = 0;
unsigned char buf = 55;
strcpy( (char*) Sendbuf, " ECU->NCU Heartbeat\n " );
while(1)
{
CMNOSSleep(1);
mpMainMutex->take(200);
if(!ConnectedToServer)
{
CMNOSSleep(1000); // delay after the connection.
if(connectToNCU())
{
LastRecvTime = localClock_t::now();
ConnectedToServer = true;
}
}
else if(ConnectedToServer)
{
if(std::chrono::duration_cast<std::chrono::milliseconds>(localClock_t::now() - LastSendTime).count() > 50) // HeartBeat
{
SendNCUCommand(msgSetTimerHeartbeat,MSG_NONE, &buf , 1);
}
else
{
strcpy((char*)ucRecvBuf,"");
iRecvLen = recvResponse(ucRecvBuf);
if( iRecvLen > 0)
{
if(strlen((char*)ucRecvBuf) > 0)
{
iRecvError = 0;
if(commState == false)
{
iSetBrightness(LCD_BRIGHTNESS_100PERCENT);
onCommunication(true);
}
ClientRxChar((char*)ucRecvBuf, iRecvLen);
}
}
else if(iRecvLen == 0)
{
iRecvError++;
if(iRecvError >= 5)
{
iRecvError = 0;
}
}
else if(iRecvLen == -1)
{
printf(" ****client Recv Function return false ***** \n" );
iRecvError = 0;
ConnectedToServer = false;
disconnect();
onCommunication(false);
}
}
if(std::chrono::duration_cast<std::chrono::milliseconds>(localClock_t::now() - LastRecvTime).count() > 5000) //
{
printf(" **** NO Comm for 7 seconds ***** \n" );
iRecvError = 0;
ConnectedToServer = false;
disconnect();
onCommunication(false);
}
else
{
//printf(" recv time %s %d %d \n " ,(meNCUOption == NCU_FREE_AREA) ? "Local":"Remote",
// std::chrono::duration_cast<std::chrono::milliseconds>(localClock_t::now() - LastRecvTime).count(), (localClock_t::now() - LastRecvTime).count());
}
ScanReceivedData(); // scan and call the corresponding function
}
mpMainMutex->release();
}
}
Server Side Code
void CNosecapTCPIPServer::ServerInit(int port)
{
portno = port;
listenfd = socket(AF_INET, SOCK_STREAM, 0);
if(listenfd < 0)
{
printf("ERROR opening socket \n");
}
optval = 1;
setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR,
&optval , sizeof(int));
bzero((char *) &serveraddr, sizeof(serveraddr));
serveraddr.sin_family = AF_INET;
serveraddr.sin_addr.s_addr = htonl(INADDR_ANY);
serveraddr.sin_port = htons((unsigned short)portno);
if (bind(listenfd, (struct sockaddr *) &serveraddr, sizeof(serveraddr)) < 0)
{
m_errorCode = errno;
snprintf(m_errorMsg, 128, "%s", strerror(m_errorCode));
printf("ERROR on binding : %s \n", m_errorMsg );
}
printf("listen \n");
if (listen(listenfd, 5) < 0)
{
m_errorCode = errno;
snprintf(m_errorMsg, 128, "%s", strerror(m_errorCode));
printf("ERROR on listen %s \n", m_errorMsg);
}
clientlen = sizeof(clientaddr);
//fcntl(listenfd, F_SETFL, O_NONBLOCK);
}
void CNosecapTCPIPServer::TCP_HeartbeatThread()
{
while(1)
{
usleep(1000);
//takeMutex(50);
if(!ConnectedToClient)
{
//fcntl(listenfd, F_SETFL, O_NONBLOCK);
// accept: wait for a connection request
connfd = accept(listenfd, (struct sockaddr *) &clientaddr, &clientlen);
if (connfd < 0)
{
}
else
{
lockMutex();
//fcntl(connfd, F_SETFL, O_NONBLOCK); // blocking mode
ConnectedToClient = true;
LastRecvTime = localClock_t::now();
printCurenttime();
sprintf(printBuf, "Server established connection (log) \n ");
onLogMessage(printBuf);
unlockMutex();
}
}
else if(ConnectedToClient)
{
//// accept: wait for a connection request
if(connfd > 0)
{
strcpy((char*)buf,"");
n = recv(connfd, buf, ***5000***,0 ); // used recv instead of read.
//printf("recv connfd %d n = %d errno = %d \n", connfd, n, errno);
if (n <= 0)
{
if( n < 0 && errno != 11)
{
//disconnect();
//continue;
sprintf(printBuf, "Read Error n (%d) socket (%d) error (%d)\n",n, connfd , errno);
onLogMessage(printBuf);
}
if(n == 0)
{
//LastRecvTime = localClock_t::now();
}
}
else
{
lockMutex();
LastRecvTime = localClock_t::now();
ServerRxChar(buf, n); // Update to the serialNessageQ
SendECUCommand(msgSetTimerHeartbeat,MSG_NONE, (unsigned char*)buf+8, 1);
if(commState == false)
{
updateCommunicationStatus(true);
}
unlockMutex();
}
}
}
//unlockMutex();
}
}
void CNosecapTCPIPServer::TCP_BufferHandleThread()
{
while(1)
{
takeMutex(30);
ScanReceivedData(); // scan and call the corresponding function
if(ConnectedToClient)
{
if(std::chrono::duration_cast<std::chrono::milliseconds>(localClock_t::now() - LastRecvTime).count() > 8000) //
{
sprintf(printBuf, " \t\t (1) Not Reveived more than 10 secs : %d (%d) \n", (localClock_t::now() - LastRecvTime).count(),
std::chrono::duration_cast<std::chrono::milliseconds>(localClock_t::now() - LastRecvTime).count());
onLogMessage(printBuf);
LastRecvTime = localClock_t::now();
if(setTimeCommand == false)
disconnect();
}
else
{
//printf("\t\t (1)last recv %d (%d) \n",std::chrono::duration_cast<std::chrono::milliseconds>(localClock_t::now() - LastRecvTime).count(),
// (localClock_t::now() - LastRecvTime).count());
if(setTimeCommand)
setTimeCommand = false;
}
}
unlockMutex();
usleep(1000);
}
}
bool CNosecapTCPIPServer::SendCommand(void *pucCommand, int iLength)
{
int n;
unsigned char tp[200];
memcpy(tp, pucCommand, 200);
if(connfd)
{
n = write(connfd, pucCommand, iLength);
if (n < 0)
{
printf(" ERROR writing to socket (%d) error (%d) \n", connfd , errno);
sprintf(printBuf , " ERROR writing to socket (%d) error (%d) \n", connfd , errno);
onLogMessage(printBuf);
//disconnect();
//continue;
}
}
return true;
}
I want to measure the time of transferring a file from the send to the recv by the PGM/UDP protocol. Actually , I try to use clock() function to measure the execution time of both the send and recv program ,but it seems to be incorrect. What should I do to measure the time of transferring a file ?
Here is the code :
clock_t t = clock();
do
{
struct timeval tv;
size_t len;
int timeout;
pgm_error_t *pgm_err = NULL;
const int status = pgm_recv (rx_sock,
buf,
sizeof(buf),
0,
&len,
&pgm_err);
switch (status)
{
case PGM_IO_STATUS_NORMAL:
/* receive file */
if (len < 30)
{
strncpy(newFile, buf, len);
if (0 == strncmp(newFile, testNewFile, len))
{
flag = 1;
continue;
}
strncpy(endFile, buf, len);
if (0 == strncmp(endFile, testEndFile, len))
{
//g_quit = 1;
t = clock() -t;
printf("%s takes time: %f\n", fileName, ((float)t) / CLOCKS_PER_SEC);
continue;
}
}
if (flag == 1)
{
strncpy(fileName, buf, len);
// puts(fileName);
fp = fopen(fileName, "wb");
g_assert(fp);
flag = 0;
}
else
num_read = fwrite (buf, sizeof(char), len, fp);
break;
case PGM_IO_STATUS_TIMER_PENDING:
{
socklen_t optlen = sizeof (tv);
pgm_getsockopt (rx_sock, IPPROTO_PGM, PGM_TIME_REMAIN, &tv, &optlen);
}
goto block;
case PGM_IO_STATUS_RATE_LIMITED:
{
socklen_t optlen = sizeof (tv);
pgm_getsockopt (rx_sock, IPPROTO_PGM, PGM_RATE_REMAIN, &tv, &optlen);
}
case PGM_IO_STATUS_WOULD_BLOCK:
block:
timeout = PGM_IO_STATUS_WOULD_BLOCK == status ? -1 : ((tv.tv_sec * 1000) + (tv.tv_usec / 1000));
memset (fds, 0, sizeof(fds));
fds[0].fd = g_quit_pipe[0];
fds[0].events = POLLIN;
pgm_poll_info (rx_sock, &fds[1], &n_fds, POLLIN);
poll (fds, 1 + n_fds, timeout);
break;
default:
if (pgm_err)
{
g_warning ("%s", pgm_err->message);
pgm_error_free (pgm_err);
pgm_err = NULL;
}
if (PGM_IO_STATUS_ERROR == status)
break;
}
}while (!g_quit);
fclose (fp);
return NULL;
What really happens to the currently executing request in IIS during a file upload, when the upload length exceed configured maxRequestLength.
Tried hard to find a decent article that talks about that, but there are none!!
Thanks
This is what exactly happens:
In class HttpRequest and in method GetEntireRawContent this condition is checked and will throw an exception:
if (length > maxRequestLengthBytes)
{
throw new HttpException(System.Web.SR.GetString("Max_request_length_exceeded"), null, 0xbbc);
}
Here is the whole of the method if you find useful:
private HttpRawUploadedContent GetEntireRawContent()
{
if (this._wr == null)
{
return null;
}
if (this._rawContent == null)
{
HttpRuntimeSection httpRuntime = RuntimeConfig.GetConfig(this._context).HttpRuntime;
int maxRequestLengthBytes = httpRuntime.MaxRequestLengthBytes;
if (this.ContentLength > maxRequestLengthBytes)
{
if (!(this._wr is IIS7WorkerRequest))
{
this.Response.CloseConnectionAfterError();
}
throw new HttpException(System.Web.SR.GetString("Max_request_length_exceeded"), null, 0xbbc);
}
int requestLengthDiskThresholdBytes = httpRuntime.RequestLengthDiskThresholdBytes;
HttpRawUploadedContent data = new HttpRawUploadedContent(requestLengthDiskThresholdBytes, this.ContentLength);
byte[] preloadedEntityBody = this._wr.GetPreloadedEntityBody();
if (preloadedEntityBody != null)
{
this._wr.UpdateRequestCounters(preloadedEntityBody.Length);
data.AddBytes(preloadedEntityBody, 0, preloadedEntityBody.Length);
}
if (!this._wr.IsEntireEntityBodyIsPreloaded())
{
int num3 = (this.ContentLength > 0) ? (this.ContentLength - data.Length) : 0x7fffffff;
HttpApplication applicationInstance = this._context.ApplicationInstance;
byte[] buffer = (applicationInstance != null) ? applicationInstance.EntityBuffer : new byte[0x2000];
int length = data.Length;
while (num3 > 0)
{
int size = buffer.Length;
if (size > num3)
{
size = num3;
}
int bytesIn = this._wr.ReadEntityBody(buffer, size);
if (bytesIn <= 0)
{
break;
}
this._wr.UpdateRequestCounters(bytesIn);
this.NeedToInsertEntityBody = true;
data.AddBytes(buffer, 0, bytesIn);
num3 -= bytesIn;
length += bytesIn;
if (length > maxRequestLengthBytes)
{
throw new HttpException(System.Web.SR.GetString("Max_request_length_exceeded"), null, 0xbbc);
}
}
}
data.DoneAddingBytes();
if ((this._installedFilter != null) && (data.Length > 0))
{
try
{
try
{
this._filterSource.SetContent(data);
HttpRawUploadedContent content2 = new HttpRawUploadedContent(requestLengthDiskThresholdBytes, data.Length);
HttpApplication application2 = this._context.ApplicationInstance;
byte[] buffer3 = (application2 != null) ? application2.EntityBuffer : new byte[0x2000];
while (true)
{
int num7 = this._installedFilter.Read(buffer3, 0, buffer3.Length);
if (num7 == 0)
{
break;
}
content2.AddBytes(buffer3, 0, num7);
}
content2.DoneAddingBytes();
data = content2;
}
finally
{
this._filterSource.SetContent(null);
}
}
catch
{
throw;
}
}
this._rawContent = data;
}
return this._rawContent;
}