From b290b56d91ab7ee85198b2be77925fca9f037ac8 Mon Sep 17 00:00:00 2001 From: mw Date: Tue, 27 Oct 2020 16:31:51 +1100 Subject: Finished NewTspTests --- crypto/src/cms/CMSSignedData.cs | 11 ++++++++--- crypto/src/cms/CMSSignedHelper.cs | 20 ++++++++++++++++++-- 2 files changed, 26 insertions(+), 5 deletions(-) (limited to 'crypto/src/cms') diff --git a/crypto/src/cms/CMSSignedData.cs b/crypto/src/cms/CMSSignedData.cs index 8634b2b3a..6028de709 100644 --- a/crypto/src/cms/CMSSignedData.cs +++ b/crypto/src/cms/CMSSignedData.cs @@ -150,11 +150,16 @@ namespace Org.BouncyCastle.Cms get { return signedData.Version.IntValueExact; } } - /** + internal IX509Store GetCertificates() + { + return Helper.GetCertificates(signedData.Certificates); + } + + /** * return the collection of signers that are associated with the * signatures for the message. */ - public SignerInformationStore GetSignerInfos() + public SignerInformationStore GetSignerInfos() { if (signerInfoStore == null) { @@ -217,7 +222,7 @@ namespace Org.BouncyCastle.Cms string type) { if (certificateStore == null) - { + { certificateStore = Helper.CreateCertificateStore(type, signedData.Certificates); } diff --git a/crypto/src/cms/CMSSignedHelper.cs b/crypto/src/cms/CMSSignedHelper.cs index 6d49a5513..d59b8f39d 100644 --- a/crypto/src/cms/CMSSignedHelper.cs +++ b/crypto/src/cms/CMSSignedHelper.cs @@ -20,6 +20,7 @@ using Org.BouncyCastle.X509; using Org.BouncyCastle.X509.Store; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Utilities.Collections; +using Org.BouncyCastle.Crypto.Tls; namespace Org.BouncyCastle.Cms { @@ -127,7 +128,9 @@ namespace Org.BouncyCastle.Cms ecAlgorithms.Add(CmsSignedGenerator.DigestSha512, EncryptionECDsaWithSha512); } - /** + + + /** * Return the digest algorithm using one of the standard JCA string * representations rather than the algorithm identifier (if possible). */ @@ -422,5 +425,18 @@ namespace Org.BouncyCastle.Cms return encOID; } - } + + public IX509Store GetCertificates(Asn1Set certificates) + { + ArrayList certList = new ArrayList(); + if (certificates != null) + { + foreach (Asn1Encodable enc in certificates) + { + certList.Add(X509CertificateStructure.GetInstance(enc)); + } + } + return new X509CollectionStore(certList); + } + } } -- cgit 1.4.1