From 00dd4d535935ab164709451e962c53c897b47215 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Mon, 20 Nov 2023 11:15:29 +0700 Subject: Implement SetIssuerUniqueId --- crypto/src/x509/X509V2AttributeCertificateGenerator.cs | 18 ++++++------------ crypto/src/x509/X509V3CertificateGenerator.cs | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/crypto/src/x509/X509V2AttributeCertificateGenerator.cs b/crypto/src/x509/X509V2AttributeCertificateGenerator.cs index 6e5343fce..954776b43 100644 --- a/crypto/src/x509/X509V2AttributeCertificateGenerator.cs +++ b/crypto/src/x509/X509V2AttributeCertificateGenerator.cs @@ -1,18 +1,15 @@ using System; using System.Collections.Generic; -using System.IO; using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Math; -using Org.BouncyCastle.Security.Certificates; -using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.X509 { - /// Class to produce an X.509 Version 2 AttributeCertificate. - public class X509V2AttributeCertificateGenerator + /// Class to produce an X.509 Version 2 AttributeCertificate. + public class X509V2AttributeCertificateGenerator { private readonly X509ExtensionsGenerator extGenerator = new X509ExtensionsGenerator(); @@ -70,13 +67,10 @@ namespace Org.BouncyCastle.X509 acInfoGen.AddAttribute(AttributeX509.GetInstance(attribute.ToAsn1Object())); } - public void SetIssuerUniqueId( - bool[] iui) - { - // TODO convert bool array to bit string - //acInfoGen.SetIssuerUniqueID(iui); - throw new NotImplementedException("SetIssuerUniqueId()"); - } + public void SetIssuerUniqueId(bool[] iui) + { + acInfoGen.SetIssuerUniqueID(X509V3CertificateGenerator.BooleanToBitString(iui)); + } /// Add a given extension field for the standard extensions tag. public void AddExtension( diff --git a/crypto/src/x509/X509V3CertificateGenerator.cs b/crypto/src/x509/X509V3CertificateGenerator.cs index 229508e67..ea773bb1b 100644 --- a/crypto/src/x509/X509V3CertificateGenerator.cs +++ b/crypto/src/x509/X509V3CertificateGenerator.cs @@ -315,7 +315,7 @@ namespace Org.BouncyCastle.X509 /// public IEnumerable SignatureAlgNames => X509Utilities.GetAlgNames(); - private static DerBitString BooleanToBitString(bool[] id) + internal static DerBitString BooleanToBitString(bool[] id) { int byteLength = (id.Length + 7) / 8; -- cgit 1.4.1