The message isn't a tripple wrapped message

Jan 30, 2011 at 8:05 AM

Hello,

I am trying to unseal a message with the .Net End-To-End encryption library.
I get the error message : The message isn't a tripple wrapped message
I use two P12 certificates (original P12 certifcate splitted - encryption / authentication)

I have tried with 2 messages. (with the same error) 
- A message encrypted with the .Net End-To-End encryption library to myself.
- A message send by a colleague using another encryption library.

I am able to decrypt both messages using another encryption library. (so I guess theyt are correct messages)

Thanks for your help.
Philippe

Coordinator
Jan 30, 2011 at 8:44 AM

Hello,

Please provide the detailed info of the exception.  This you can get with the "toString()" method.

Kind regards,
Bryan. 

Jan 30, 2011 at 11:30 AM

Hello Bryan,

Here is the full exception

Siemens.EHealth.Etee.Crypto.InvalidMessageException was unhandled
  Message=The message isn't a tripple wrapped message
  Source=Siemens.EHealth.Etee.Crypto
  StackTrace:
       at Siemens.EHealth.Etee.Crypto.Decrypt.TripleUnwrapper.Verify(Stream verifiedContent, Stream signed, Boolean optimize, Boolean wait) in C:\Projects2007\.net\eHealth\ETEE\SourceCode\etee-crypto-core\Decrypt\TripleUnwrapper.cs:line 381
       at Siemens.EHealth.Etee.Crypto.Decrypt.TripleUnwrapper.UnsealSemiOptimized(ITempStreamFactory factory, Stream sealedData, SecretKey key) in C:\Projects2007\.net\eHealth\ETEE\SourceCode\etee-crypto-core\Decrypt\TripleUnwrapper.cs:line 174
       at Siemens.EHealth.Etee.Crypto.Decrypt.TripleUnwrapper.Unseal(Stream sealedData) in C:\Projects2007\.net\eHealth\ETEE\SourceCode\etee-crypto-core\Decrypt\TripleUnwrapper.cs:line 108
       at MyQuickTest.ETEE_QuickTest.btUnseal_Click(Object sender, EventArgs e) in C:\Projects2007\.net\eHealth\ETEE\SourceCode\MyQuickTest\Form1.cs:line 85
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at MyQuickTest.Program.Main() in C:\Projects2007\.net\eHealth\ETEE\SourceCode\MyQuickTest\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: Org.BouncyCastle.Cms.CmsException
       Message=IOException reading content.
       Source=BouncyCastle.Crypto
       StackTrace:
            at Org.BouncyCastle.Cms.CmsContentInfoParser..ctor(Stream data)
            at Org.BouncyCastle.Cms.CmsSignedDataParser..ctor(CmsTypedStream signedContent, Stream sigData)
            at Org.BouncyCastle.Cms.CmsSignedDataParser..ctor(Stream sigData)
            at Siemens.EHealth.Etee.Crypto.Decrypt.TripleUnwrapper.Verify(Stream verifiedContent, Stream signed, Boolean optimize, Boolean wait) in C:\Projects2007\.net\eHealth\ETEE\SourceCode\etee-crypto-core\Decrypt\TripleUnwrapper.cs:line 371
       InnerException: System.IO.EndOfStreamException
            Message=DEF length 104 object truncated by 63
            Source=BouncyCastle.Crypto
            StackTrace:
                 at Org.BouncyCastle.Asn1.DefiniteLengthInputStream.ToArray()
                 at Org.BouncyCastle.Asn1.Asn1StreamParser.ReadObject()
                 at Org.BouncyCastle.Cms.CmsContentInfoParser..ctor(Stream data)
            InnerException:

Thanks.
Philippe

Coordinator
Jan 30, 2011 at 11:50 AM

Hello,

Can you send the messages to my e-mail?  No need for the private key, the problem is with the outer signature which is publicly available.

Bryan.

Coordinator
Jan 30, 2011 at 1:17 PM

Hello,

It doesn't seem to be a strait forward problem.  I'm working on it, but it might take a little while.

The only think I can tell you so far is that you did use the encryption certificate instead of the authentication certificate to sign the message.  When you encrypt you should only provide your authentication certificate, encryption is done with the recipient certificate (in form of the ETK).

Would it be possible for you to send me your code?  The entire VS project would be great.

Kind regards,
Bryan.