diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2018-10-27 19:09:01 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2018-10-27 19:09:01 +0700 |
commit | 6f489324f5ffb2d9d8b64b555f7345265896fbfd (patch) | |
tree | 61fd8e0a844064e1e88e60beb3b3d5365bd0028e /crypto/src/x509/X509V2AttributeCertificateGenerator.cs | |
parent | Provide the option to pass a different RSA engine (diff) | |
download | BouncyCastle.NET-ed25519-6f489324f5ffb2d9d8b64b555f7345265896fbfd.tar.xz |
Set the acInfoGen signature algorithm from ISignatureFactory
- see https://github.com/bcgit/bc-csharp/pull/64
Diffstat (limited to 'crypto/src/x509/X509V2AttributeCertificateGenerator.cs')
-rw-r--r-- | crypto/src/x509/X509V2AttributeCertificateGenerator.cs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crypto/src/x509/X509V2AttributeCertificateGenerator.cs b/crypto/src/x509/X509V2AttributeCertificateGenerator.cs index bf046cd1e..18a4959dd 100644 --- a/crypto/src/x509/X509V2AttributeCertificateGenerator.cs +++ b/crypto/src/x509/X509V2AttributeCertificateGenerator.cs @@ -164,7 +164,11 @@ namespace Org.BouncyCastle.X509 acInfoGen.SetExtensions(extGenerator.Generate()); } - AttributeCertificateInfo acInfo = acInfoGen.GenerateAttributeCertificateInfo(); + AlgorithmIdentifier sigAlgID = (AlgorithmIdentifier)signatureCalculatorFactory.AlgorithmDetails; + + acInfoGen.SetSignature(sigAlgID); + + AttributeCertificateInfo acInfo = acInfoGen.GenerateAttributeCertificateInfo(); byte[] encoded = acInfo.GetDerEncoded(); @@ -174,15 +178,11 @@ namespace Org.BouncyCastle.X509 Platform.Dispose(streamCalculator.Stream); - Asn1EncodableVector v = new Asn1EncodableVector(); - - v.Add(acInfo, (AlgorithmIdentifier)signatureCalculatorFactory.AlgorithmDetails); - - try + try { - v.Add(new DerBitString(((IBlockResult)streamCalculator.GetResult()).Collect())); + DerBitString signatureValue = new DerBitString(((IBlockResult)streamCalculator.GetResult()).Collect()); - return new X509V2AttributeCertificate(AttributeCertificate.GetInstance(new DerSequence(v))); + return new X509V2AttributeCertificate(new AttributeCertificate(acInfo, sigAlgID, signatureValue)); } catch (Exception e) { |