NetworkStream.Read() and SSL
===

chaps,

Was just wondering if anybody can look at the following code and explain to me why the length variable returns 0:

    textToBeEncrypted = Encoding.ASCII.GetString(buffer);
    txtEncryptedText = AESEncryption(textToBeEncrypted, key, true);
    byte[] encText = Encoding.ASCII.GetBytes(txtEncryptedText);
    
    NetworkStream stream = s.GetStream();
    stream.Write(encText, 0, PACKET_SIZE);
                    
    s.ReceiveTimeout = Timeout;

    int length = stream.Read(buffer, 0, PACKET_SIZE);
    if (length == PACKET_SIZE)
    {
        string decText = Encoding.ASCII.GetString(encText);
        txtDecryptedText = AESDecryption(decText, key, true);
        buffer = Encoding.ASCII.GetBytes(txtDecryptedText);
        retval = Decode();
    }            

After I've encoded everything using AES, I'm writing out 1366 bytes of data in encText (PACKET_SIZE is 1036). I get no complaints regarding the Send; the data is sent out happily. When it tries to read it back in, however, length is always 0, meaning I don't get to enter the decode statement bracket. Any ideas? (retval is a string, before anyone asks)