From 21bfdd9eb9683fcad861a5b528729d6afcbe6863 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Wed, 26 Jul 2023 17:58:23 +0700 Subject: CMP updates from bc-java --- crypto/src/x509/X509Certificate.cs | 4 ++++ crypto/src/x509/X509V3CertificateGenerator.cs | 23 ++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) (limited to 'crypto/src/x509') diff --git a/crypto/src/x509/X509Certificate.cs b/crypto/src/x509/X509Certificate.cs index b1307d90e..944b627b0 100644 --- a/crypto/src/x509/X509Certificate.cs +++ b/crypto/src/x509/X509Certificate.cs @@ -312,6 +312,9 @@ namespace Org.BouncyCastle.X509 return Arrays.Clone(sigAlgParams); } + /// The signature algorithm. + public virtual AlgorithmIdentifier SignatureAlgorithm => c.SignatureAlgorithm; + /// /// Get the issuers UID. /// @@ -629,6 +632,7 @@ namespace Org.BouncyCastle.X509 return buf.ToString(); } + // TODO[api] Rename 'key' to 'publicKey' public virtual bool IsSignatureValid(AsymmetricKeyParameter key) { return CheckSignatureValid(new Asn1VerifierFactory(c.SignatureAlgorithm, key)); diff --git a/crypto/src/x509/X509V3CertificateGenerator.cs b/crypto/src/x509/X509V3CertificateGenerator.cs index 1dd1776be..2df8d5409 100644 --- a/crypto/src/x509/X509V3CertificateGenerator.cs +++ b/crypto/src/x509/X509V3CertificateGenerator.cs @@ -156,13 +156,22 @@ namespace Org.BouncyCastle.X509 tbsGen.SetIssuerUniqueID(BooleanToBitString(uniqueID)); } - /// - /// Add a given extension field for the standard extensions tag (tag 3). - /// - /// string containing a dotted decimal Object Identifier. - /// Is it critical. - /// The value. - public void AddExtension( + /// + /// Set the SubjectPublicKeyInfo for the public key that this certificate identifies. + /// + /// + public void SetSubjectPublicKeyInfo(SubjectPublicKeyInfo subjectPublicKeyInfo) + { + tbsGen.SetSubjectPublicKeyInfo(subjectPublicKeyInfo); + } + + /// + /// Add a given extension field for the standard extensions tag (tag 3). + /// + /// string containing a dotted decimal Object Identifier. + /// Is it critical. + /// The value. + public void AddExtension( string oid, bool critical, Asn1Encodable extensionValue) -- cgit 1.5.1