summary refs log tree commit diff
path: root/crypto/src/cms
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-07-30 13:48:59 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-07-30 13:48:59 +0700
commit3e5ab53725678c662b5d351fb4a9bc2d3c5d8822 (patch)
tree8e492cfabb5965847e46b2a4aeb0430e4a202640 /crypto/src/cms
parentRefactoring around digest calculation (diff)
downloadBouncyCastle.NET-ed25519-3e5ab53725678c662b5d351fb4a9bc2d3c5d8822.tar.xz
Add extra properties on X509Certificate
Diffstat (limited to 'crypto/src/cms')
-rw-r--r--crypto/src/cms/CMSEnvelopedGenerator.cs7
-rw-r--r--crypto/src/cms/CMSUtils.cs5
2 files changed, 4 insertions, 8 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)); } /** diff --git a/crypto/src/cms/CMSUtils.cs b/crypto/src/cms/CMSUtils.cs
index 06d191d6e..7cf0d6153 100644 --- a/crypto/src/cms/CMSUtils.cs +++ b/crypto/src/cms/CMSUtils.cs
@@ -203,12 +203,9 @@ namespace Org.BouncyCastle.Cms return DerSet.FromVector(v); } - internal static TbsCertificateStructure GetTbsCertificateStructure(X509Certificate cert) => - cert.CertificateStructure.TbsCertificate; - internal static IssuerAndSerialNumber GetIssuerAndSerialNumber(X509Certificate cert) { - TbsCertificateStructure tbsCert = GetTbsCertificateStructure(cert); + TbsCertificateStructure tbsCert = cert.TbsCertificate; return new IssuerAndSerialNumber(tbsCert.Issuer, tbsCert.SerialNumber); }