Update of /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source
In directory sc8-pr-cvs1:/tmp/cvs-serv26961
Modified Files:
TlsCipherSuite.cs TlsSession.cs
Log Message:
Changes on handling of RSA keys
Index: TlsCipherSuite.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/TlsCipherSuite.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TlsCipherSuite.cs 20 Aug 2003 11:48:20 -0000 1.1
--- TlsCipherSuite.cs 20 Aug 2003 15:44:47 -0000 1.2
***************
*** 40,45 ****
private byte effectiveKeyBits;
private byte ivSize;
! private byte blockSize;
! private RSA rsa;
private TlsSessionState sessionState;
--- 40,44 ----
private byte effectiveKeyBits;
private byte ivSize;
! private byte blockSize;
private TlsSessionState sessionState;
***************
*** 103,111 ****
}
- public RSA RSA
- {
- get { return rsa; }
- }
-
public TlsSessionState SessionState
{
--- 102,105 ----
***************
*** 140,144 ****
#region METHODS
! public void CreateRSA(X509Certificate certificate)
{
// This code is from Mono.Security.X509Certificate class.
--- 134,138 ----
#region METHODS
! public RSACryptoServiceProvider CreateRSA(X509Certificate certificate)
{
// This code is from Mono.Security.X509Certificate class.
***************
*** 152,163 ****
if ((modulus == null) || (modulus.Tag != 0x02))
{
! this.rsa = null;
! return;
}
ASN1 exponent = pubkey [1];
if (exponent.Tag != 0x02)
{
! this.rsa = null;
! return;
}
--- 146,155 ----
if ((modulus == null) || (modulus.Tag != 0x02))
{
! return null;
}
ASN1 exponent = pubkey [1];
if (exponent.Tag != 0x02)
{
! return null;
}
***************
*** 165,172 ****
rsaParams.Exponent = exponent.Value;
! CreateRSA(rsaParams);
}
! public void CreateRSA(RSAParameters rsaParams)
{
// BUG: MS BCL 1.0 can't import a key which
--- 157,164 ----
rsaParams.Exponent = exponent.Value;
! return CreateRSA(rsaParams);
}
! public RSACryptoServiceProvider CreateRSA(RSAParameters rsaParams)
{
// BUG: MS BCL 1.0 can't import a key which
***************
*** 174,179 ****
// the container.
int keySize = (rsaParams.Modulus.Length << 3);
! this.rsa = new RSACryptoServiceProvider(keySize);
! this.rsa.ImportParameters(rsaParams);
}
--- 166,173 ----
// the container.
int keySize = (rsaParams.Modulus.Length << 3);
! RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(keySize);
! rsa.ImportParameters(rsaParams);
!
! return rsa;
}
Index: TlsSession.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PgSqlClient.Security.Tls/source/TlsSession.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TlsSession.cs 20 Aug 2003 11:48:20 -0000 1.1
--- TlsSession.cs 20 Aug 2003 15:44:47 -0000 1.2
***************
*** 158,172 ****
reader.ReadRecord();
}
-
- // Generate encryption algorithms based on information
- // sent by the server
- if (state.ServerSettings.ServerKeyExchange)
- {
- State.Cipher.CreateRSA(State.ServerSettings.RsaParameters);
- }
- else
- {
- State.Cipher.CreateRSA(State.ServerSettings.ServerCertificates[0]);
- }
// Send client certificate if requested
--- 158,161 ----
|