diff options
Diffstat (limited to 'crypto/src/cmp/CertificateConfirmationContent.cs')
-rw-r--r-- | crypto/src/cmp/CertificateConfirmationContent.cs | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/crypto/src/cmp/CertificateConfirmationContent.cs b/crypto/src/cmp/CertificateConfirmationContent.cs index 13db89c37..262a28531 100644 --- a/crypto/src/cmp/CertificateConfirmationContent.cs +++ b/crypto/src/cmp/CertificateConfirmationContent.cs @@ -1,44 +1,52 @@ using System; using Org.BouncyCastle.Asn1.Cmp; -using Org.BouncyCastle.Cms; +using Org.BouncyCastle.Operators.Utilities; namespace Org.BouncyCastle.Cmp { public class CertificateConfirmationContent { public static CertificateConfirmationContent FromPkiBody(PkiBody pkiBody) => - FromPkiBody(pkiBody, DefaultDigestAlgorithmIdentifierFinder.Instance); + FromPkiBody(pkiBody, DefaultDigestAlgorithmFinder.Instance); public static CertificateConfirmationContent FromPkiBody(PkiBody pkiBody, - DefaultDigestAlgorithmIdentifierFinder digestAlgFinder) + IDigestAlgorithmFinder digestAlgorithmFinder) { if (!IsCertificateConfirmationContent(pkiBody.Type)) throw new ArgumentException("content of PkiBody wrong type: " + pkiBody.Type); - return new CertificateConfirmationContent(CertConfirmContent.GetInstance(pkiBody.Content), digestAlgFinder); + var content = CertConfirmContent.GetInstance(pkiBody.Content); + + return new CertificateConfirmationContent(content, digestAlgorithmFinder); } public static bool IsCertificateConfirmationContent(int bodyType) => PkiBody.TYPE_CERT_CONFIRM == bodyType; private readonly CertConfirmContent m_content; - private readonly DefaultDigestAlgorithmIdentifierFinder m_digestAlgIDFinder; + private readonly IDigestAlgorithmFinder m_digestAlgorithmFinder; public CertificateConfirmationContent(CertConfirmContent content) - : this(content, DefaultDigestAlgorithmIdentifierFinder.Instance) + : this(content, DefaultDigestAlgorithmFinder.Instance) { } + [Obsolete("Use constructor taking 'IDigestAlgorithmFinder' instead")] public CertificateConfirmationContent(CertConfirmContent content, - DefaultDigestAlgorithmIdentifierFinder digestAlgFinder) + Org.BouncyCastle.Cms.DefaultDigestAlgorithmIdentifierFinder digestAlgFinder) + : this(content, (IDigestAlgorithmFinder)digestAlgFinder) + { + } + + public CertificateConfirmationContent(CertConfirmContent content, IDigestAlgorithmFinder digestAlgorithmFinder) { m_content = content; - m_digestAlgIDFinder = digestAlgFinder; + m_digestAlgorithmFinder = digestAlgorithmFinder; } public CertConfirmContent ToAsn1Structure() => m_content; public CertificateStatus[] GetStatusMessages() => Array.ConvertAll(m_content.ToCertStatusArray(), - element => new CertificateStatus(m_digestAlgIDFinder, element)); + element => new CertificateStatus(m_digestAlgorithmFinder, element)); } } |