Page 1 of 1

connection to oracle from mono on linux

Posted: Wed 20 May 2009 15:48
by crazyminsc
hello we are considering to buy this product because of the actual state of default mono oracle client but we are experiencing some dificulties with both OCI and direct connection mode.

when using direct mode it burns up on:

Code: Select all

Unhandled Exception: System.Security.Cryptography.CryptographicException: This is a known weak, or semi-weak, key.
  at System.Security.Cryptography.DESTransform..ctor (System.Security.Cryptography.SymmetricAlgorithm symmAlgo, Boolean encryption, System.Byte[] key, System.Byte[] iv) [0x00000]
  at System.Security.Cryptography.DESCryptoServiceProvider.CreateEncryptor (System.Byte[] rgbKey, System.Byte[] rgbIV) [0x00000]
we havent' found much info about this issue on the net.




the OCI mode fails at:

Code: Select all

Unhandled Exception: System.InvalidOperationException: Can not obtain Oracle client information from registry. Make sure that Oracle Client Software is installed, or use Direct mode of connecting to server.
  at Devart.Data.Oracle.OracleHomeCollection.a () [0x00000]
  at Devart.Data.Oracle.OracleInternalConnection..ctor (Devart.Data.Oracle.x connectionOptions, Devart.Data.Oracle.OracleInternalConnection proxyConnection) [0x00000]
we have tried to create some mono registry keys but the error is the same.

note: when using the mono implementation of System.Data.OracleClient was just fair enough to export oracle variables and everything worked.

any ideas what are we doing wrong ?

thank you

Posted: Thu 21 May 2009 09:36
by Shalex
We will investigate the problems and notify you about the results as soon as possible.

Posted: Fri 22 May 2009 13:27
by Shalex
We support only the Direct mode under Mono (the OCI mode is not available).
1. Could you please tell us the Mono version, the Linux distribution type and its version you use?
2. Please post here more full call stack you obtain when the error occurs.

Posted: Mon 25 May 2009 08:01
by crazyminsc
oh sorry i pasted only one part of this message. the full format looks like this

Code: Select all

Unhandled Exception: System.Security.Cryptography.CryptographicException: This is a known weak, or semi-weak, k  .
  at System.Security.Cryptography.DESTransform..ctor (System.Security.Cryptography.SymmetricAlgorithm symmAlgo,  oolean encryption, System.Byte[] key, System.Byte[] iv) [0x00000]
  at System.Security.Cryptography.DESCryptoServiceProvider.CreateEncryptor (System.Byte[] rgbKey, System.Byte[]  gbIV) [0x00000]
  at xc.r.b (System.Byte[] A_0) [0x00000]
  at xc.r.b (System.String A_0, System.String A_1) [0x00000]
  at xc.r.a () [0x00000]
  at xc.i.a () [0x00000]
  at Devart.Data.Oracle.ac.a (Devart.Data.Oracle.x A_0, Devart.Data.Oracle.at A_1) [0x00000]
  at Devart.Data.Oracle.OracleInternalConnection..ctor (Devart.Data.Oracle.x connectionOptions, Devart.Data.Ora  e.OracleInternalConnection proxyConnection) [0x00000]
we are using it on mono 2.4 build from source (just the released version, not svn) on CentOS 4/ RHEL 4 , but we are pretty sure it will it will do on other distributions as well. But i will test it for sure.

Posted: Thu 28 May 2009 00:29
by crazyminsc
i have tried the opensuse 11.1 distribution with latest official mono packages and the error remains the same.

it throws the error:

Code: Select all

Unhandled Exception: System.Security.Cryptography.CryptographicException: This is a known weak, or semi-weak, key.
  at System.Security.Cryptography.DESTransform..ctor (System.Security.Cryptography.SymmetricAlgorithm symmAlgo, Boolean encryption, System.Byte[] key, System.Byte[] iv) [0x00000]
  at System.Security.Cryptography.DESCryptoServiceProvider.CreateEncryptor (System.Byte[] rgbKey, System.Byte[] rgbIV) [0x00000]
  at xc.r.b (System.Byte[] A_0) [0x00000]
  at xc.r.b (System.String A_0, System.String A_1) [0x00000]
  at xc.r.a () [0x00000]
  at xc.i.a () [0x00000]
  at Devart.Data.Oracle.ac.a (Devart.Data.Oracle.x A_0, Devart.Data.Oracle.at A_1) [0x00000]
  at Devart.Data.Oracle.OracleInternalConnection..ctor (Devart.Data.Oracle.x connectionOptions, Devart.Data.Oracle.OracleInternalConnection proxyConnection) [0x00000]
somewhere after it connects to the oracle database.

Thank you for any suggerstions

Posted: Thu 28 May 2009 09:56
by Shalex
It seems like mono considers the Oracle key as a weak key. Could you please execute the following code?

Code: Select all

      DES des = new DESCryptoServiceProvider();
      des.Mode = CipherMode.CBC;
      des.IV = new byte[8];
      des.Padding = PaddingMode.Zeros;
      byte[] knownKey = new byte[]{1, 35, 69, 103, 137, 171, 205, 239};
      ICryptoTransform cryptoTransform = des.CreateEncryptor(knownKey, new byte[8]);
Please notify us about the results.

Posted: Thu 28 May 2009 12:52
by crazyminsc
this code works without error.

Posted: Fri 29 May 2009 13:33
by Shalex
We cannot reproduce the problem. Please try the sample we have sent you at your e-mail. Please notify us about the results.

Posted: Mon 01 Jun 2009 15:28
by crazyminsc
solved. your program worked.

the problem was because of empty password in the configuration of our application. So the framework was encrypting empty passsword.

Thank you very for your time.

(yes i look like a complete fool :) )