Bad Data - CryptographicException


Author
Message
Tim D Clothier
Tim D Clothier
StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)
Group: Forum Members
Posts: 2, Visits: 1.7K
We have installed the ES on an IIS 7 server in a subdirectory. We have configured the Datasources and web.config files and are getting the following error when we run client code. We have a second server configured in the root of www on another server that functions correctly from same client code. Are there any special configurations that we need to do to run from a directory on the server(wwwroot/ES)? Web.config ?




CryptographicException
  Bad Data.



Source     : mscorlib

Stack Trace: 
   at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)
   at System.Security.Cryptography.Utils._DecryptData(SafeKeyHandle hKey, Byte[] data, Int32 ib, Int32 cb, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode PaddingMode, Boolean fDone)
   at System.Security.Cryptography.CryptoAPITransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
   at System.Security.Cryptography.CryptoStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.Compression.DeflateStream.Read(Byte[] array, Int32 offset, Int32 count)
   at System.IO.Stream.ReadByte()
   at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
   at System.IO.BinaryReader.ReadBoolean()
   at MicroFour.StrataFrame.Data.Enterprise.BaseResults.ReadDataFromStream(BinaryReader Reader)
   at MicroFour.StrataFrame.Data.Enterprise.ExecuteDataTableResults.ReadDataFromStream(BinaryReader Reader)
   at MicroFour.StrataFrame.Data.Enterprise.EnterpriseDataSourceItem.SendRequestCore(BaseParams Params, RemoteDataSourceCommand Command)
   at MicroFour.StrataFrame.Data.Enterprise.EnterpriseDataSourceItem.ᜀ(DbCommand A_0, Boolean A_1, String A_2)
   at MicroFour.StrataFrame.Data.Enterprise.EnterpriseDataSourceItem.GetDataTable(DbCommand Command, OnChangeEventHandler CallBack)
   at MicroFour.StrataFrame.Data.DataLayer.GetDataTable(DbCommand Command, Boolean RegisterNotification)
   at MicroFour.StrataFrame.Business.BusinessLayer.FillDataTable(DbCommand CommandToExecute)
   at MicroFour.StrataFrame.Security.BusinessObjects.SFSPreferencesBO.FillAll(Int32 ProjectPK)
   at MicroFour.StrataFrame.Security.BusinessObjects.SFSPreferencesBO.RetrieveSecurityPreferences()
   at CADApplication.AppMain.InitApplication(InitializingApplicationEventArgs e) in C:\EZ911NET\CADApplication\CADApplication\AppMain.vb:line 267
   at MicroFour.StrataFrame.Application.StrataFrameApplication.Raise_InitializingApplication(InitializingApplicationEventArgs e)
   at MicroFour.StrataFrame.Application.StrataFrameApplication.RunApplication()
   at CADApplication.AppMain.Main() in C:\EZ911NET\CADApplication\CADApplication\AppMain.vb:line 41
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
   at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
   at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
   at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
   at System.Activator.CreateInstance(ActivationContext activationContext)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
   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()

StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The "Bad data" exception always comes from having mismatched encryption keys and vectors on the 2 ends of the connection.  The byte arrays for the IVs and the keys have to match exactly.  Check your configuration file and the client side code where you set the values and make sure they line up.
Tim D Clothier
Tim D Clothier
StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)StrataFrame Beginner (10 reputation)
Group: Forum Members
Posts: 2, Visits: 1.7K
Ben,

Thanks for the quick reply

    I have not changed the default values as yet , I have included the code to verify that they are the same. Is there any other reason you can think of for this problem. This is the SDK version of the ES server that we are having problems with. Like I said, we are running this from a subfolder on IIS(wwwroot\ES).

Thanks in Advance

Client Side Code



  '-- Configure the compression and encryption (optional)   
                dsComm.IsCompressed = True 
                dsComm.IsEncrypted = True 
                dsComm.EncryptionKey = New Byte() {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4} 
                dsComm.EncryptionVector = New Byte() {1, 2, 3, 4, 5, 6, 7, 8}






Server Side Code



<IsEncrypted>True</IsEncrypted>
  <IsCompressed>True</IsCompressed>
  <EncryptionKey>1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4</EncryptionKey>
  <EncryptionVector>1,2,3,4,5,6,7,8</EncryptionVector>
  <TransactionTimeout>3600</TransactionTimeout>



Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Tim.

Try checking if the MicroFour StrataFrame Enterprise DLLs on the client are on the same version as the ones installed on the server.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search