by Angel Todorov [angel at atodorov dot com] posted on 2004/05/20 |
|
Hello, i am using encryption and transferring data from a java app to a .NET app in C#. On the java side i am using a BufferedOutputStream, and on the .NET side i am using a BufferedStream too, created using a SecureNetworkStream and buffer size of 512.
The code is something like:
wrs.writeXml(bufout); // write the xml to the .NET client, where wrs is a WebRowSet object
on the .NET side:
BufferedStream ns = context.GetNetworkStream;
while (ns.CanRead && !DONE)
{
if (ns.CanRead)
{
DataSet ds = new DataSet();
ds.ReadXml(stream);
stream.Flush(); context.Mediator.AddResultSet(ds);
DONE = true; }
}
------------------
the Exception i get on the .NET's side is:
--------------------------------------
Unhandled Exception: System.IO.IOException: An I/O exception occurred. ---> Org.
Mentalis.Security.SecurityException: An error occurs while communicating with th
e remote host.
Org.Mentalis.Security.Ssl.Shared.SslException: An exception occurred ---> System
.ArgumentException: Value was invalid.
at System.Security.Cryptography.RijndaelManagedTransform.TransformBlock(Byte[
] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[] outputBuffer, Int32 o
utputOffset)
at Org.Mentalis.Security.Ssl.Shared.RecordLayer.InternalEncryptBytes2(Byte[]
buffer, Int32 offset, Int32 size, ContentType type)
--- End of inner exception stack trace ---
at Org.Mentalis.Security.Ssl.Shared.HandshakeLayer.ProcessAlert(RecordMessage
message)
at Org.Mentalis.Security.Ssl.Shared.HandshakeLayer.ProcessMessages(RecordMess
age message)
at Org.Mentalis.Security.Ssl.Shared.RecordLayer.ProcessBytes(Byte[] buffer, I
nt32 offset, Int32 size)
at Org.Mentalis.Security.Ssl.Shared.SocketController.OnReceive(IAsyncResult a
r) ---> Org.Mentalis.Security.Ssl.Shared.SslException: An exception occurred ---
> System.ArgumentException: Value was invalid.
at System.Security.Cryptography.RijndaelManagedTransform.TransformBlock(Byte[
] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[] outputBuffer, Int32 o
utputOffset)
at Org.Mentalis.Security.Ssl.Shared.RecordLayer.InternalEncryptBytes2(Byte[]
buffer, Int32 offset, Int32 size, ContentType type)
--- End of inner exception stack trace ---
at Org.Mentalis.Security.Ssl.Shared.HandshakeLayer.ProcessAlert(RecordMessage
message)
at Org.Mentalis.Security.Ssl.Shared.HandshakeLayer.ProcessMessages(RecordMess
age message)
at Org.Mentalis.Security.Ssl.Shared.RecordLayer.ProcessBytes(Byte[] buffer, I
nt32 offset, Int32 size)
at Org.Mentalis.Security.Ssl.Shared.SocketController.OnReceive(IAsyncResult a
r)
--- End of inner exception stack trace ---
at Org.Mentalis.Security.Ssl.SecureSocket.EndReceive(IAsyncResult asyncResult
)
at Org.Mentalis.Security.Ssl.SecureSocket.Receive(Byte[] buffer, Int32 offset
, Int32 size, SocketFlags socketFlags)
at Org.Mentalis.Security.Ssl.SecureNetworkStream.Read(Byte[] buffer, Int32 of
fset, Int32 size)
--- End of inner exception stack trace ---
at Org.Mentalis.Security.Ssl.SecureNetworkStream.Read(Byte[] buffer, Int32 of
fset, Int32 size)
at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
at System.Xml.XmlStreamReader.Read(Byte[] data, Int32 offset, Int32 length)
at System.Xml.XmlScanner.Read()
at System.Xml.XmlScanner.ScanContent()
at System.Xml.XmlTextReader.ParseBeginTagExpandCharEntities()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlLoader.ReadCurrentNode(XmlDocument doc, XmlReader reader)
at System.Xml.XmlDocument.ReadNode(XmlReader reader)
at System.Data.DataSet.ReadXml(XmlReader reader, Boolean denyResolving)
at System.Data.DataSet.ReadXml(Stream stream)
at Npgsql.NpgsqlReadyState.Query(NpgsqlConnection context, NpgsqlCommand comm
and) in c:\documents and settings\angel todorov.todorov-pc\my documents\visual s
tudio projects\npgsql\npgsql\npgsqlreadystate.cs:line 115
at Npgsql.NpgsqlConnection.Query(NpgsqlCommand queryCommand) in c:\documents
and settings\angel todorov.todorov-pc\my documents\visual studio projects\npgsql
\npgsql\npgsqlconnection.cs:line 674
at Npgsql.NpgsqlCommand.ExecuteCommand() in c:\documents and settings\angel t
odorov.todorov-pc\my documents\visual studio projects\npgsql\npgsql\npgsqlcomman
d.cs:line 897
at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior cb) in c:\documents and
settings\angel todorov.todorov-pc\my documents\visual studio projects\npgsql\np
gsql\npgsqlcommand.cs:line 459
at Npgsql.NpgsqlCommand.ExecuteReader() in c:\documents and settings\angel to
dorov.todorov-pc\my documents\visual studio projects\npgsql\npgsql\npgsqlcommand
.cs:line 436
at NpgsqlTester.Tester..ctor() in c:\documents and settings\angel todorov.tod
orov-pc\my documents\visual studio projects\npgsqltester\tester.cs:line 55
at NpgsqlTester.Tester.Main(String[] args) in c:\documents and settings\angel
todorov.todorov-pc\my documents\visual studio projects\npgsqltester\tester.cs:l
ine 88
--------------------------------------
Do you have any idea what can be the cause for this ? Many thanks in advance.
|