summary refs log tree commit diff
path: root/crypto/src/cms/CMSEnvelopedGenerator.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/cms/CMSEnvelopedGenerator.cs')
-rw-r--r--crypto/src/cms/CMSEnvelopedGenerator.cs7
1 files changed, 3 insertions, 4 deletions
diff --git a/crypto/src/cms/CMSEnvelopedGenerator.cs b/crypto/src/cms/CMSEnvelopedGenerator.cs
index 3a7ef8f3f..89a7f4576 100644
--- a/crypto/src/cms/CMSEnvelopedGenerator.cs
+++ b/crypto/src/cms/CMSEnvelopedGenerator.cs
@@ -154,10 +154,9 @@ namespace Org.BouncyCastle.Cms
 		 */
 		public void AddKeyTransRecipient(X509Certificate cert)
 		{
-			TbsCertificateStructure recipientTbsCert = CmsUtilities.GetTbsCertificateStructure(cert);
-			SubjectPublicKeyInfo info = recipientTbsCert.SubjectPublicKeyInfo;
-			AddRecipientInfoGenerator(
-				new KeyTransRecipientInfoGenerator(cert, new Asn1KeyWrapper(info.Algorithm, cert)));
+			var algorithm = cert.SubjectPublicKeyInfo.Algorithm;
+			var keyWrapper = new Asn1KeyWrapper(algorithm, cert);
+            AddRecipientInfoGenerator(new KeyTransRecipientInfoGenerator(cert, keyWrapper));
 		}
 
 		/**