summary refs log tree commit diff
path: root/crypto/src/tls/TlsRsaKeyExchange.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-07-14 23:45:24 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-07-14 23:45:24 +0700
commit7abd4af6873142092f5f38f93888a73c0a1bd17a (patch)
tree6039a22223a82fa0ad7194433f753910664a5afd /crypto/src/tls/TlsRsaKeyExchange.cs
parentRefactoring around TlsEncryptor (diff)
downloadBouncyCastle.NET-ed25519-7abd4af6873142092f5f38f93888a73c0a1bd17a.tar.xz
Avoid redundant CheckUsageInRole calls
Diffstat (limited to 'crypto/src/tls/TlsRsaKeyExchange.cs')
-rw-r--r--crypto/src/tls/TlsRsaKeyExchange.cs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto/src/tls/TlsRsaKeyExchange.cs b/crypto/src/tls/TlsRsaKeyExchange.cs
index 5184ca8fa..a2f5559d1 100644
--- a/crypto/src/tls/TlsRsaKeyExchange.cs
+++ b/crypto/src/tls/TlsRsaKeyExchange.cs
@@ -21,7 +21,7 @@ namespace Org.BouncyCastle.Tls
         }
 
         protected TlsCredentialedDecryptor m_serverCredentials = null;
-        protected TlsCertificate m_serverCertificate;
+        protected TlsEncryptor m_serverEncryptor;
         protected TlsSecret m_preMasterSecret;
 
         public TlsRsaKeyExchange(int keyExchange)
@@ -41,7 +41,7 @@ namespace Org.BouncyCastle.Tls
 
         public override void ProcessServerCertificate(Certificate serverCertificate)
         {
-            this.m_serverCertificate = serverCertificate.GetCertificateAt(0).CheckUsageInRole(ConnectionEnd.server,
+            this.m_serverEncryptor = serverCertificate.GetCertificateAt(0).CreateEncryptor(
                 TlsCertificateRole.RsaEncryption);
         }
 
@@ -58,7 +58,7 @@ namespace Org.BouncyCastle.Tls
 
         public override void GenerateClientKeyExchange(Stream output)
         {
-            this.m_preMasterSecret = TlsRsaUtilities.GenerateEncryptedPreMasterSecret(m_context, m_serverCertificate,
+            this.m_preMasterSecret = TlsUtilities.GenerateEncryptedPreMasterSecret(m_context, m_serverEncryptor,
                 output);
         }