summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2018-10-27 19:09:01 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2018-10-27 19:09:01 +0700
commit6f489324f5ffb2d9d8b64b555f7345265896fbfd (patch)
tree61fd8e0a844064e1e88e60beb3b3d5365bd0028e
parentProvide the option to pass a different RSA engine (diff)
downloadBouncyCastle.NET-ed25519-6f489324f5ffb2d9d8b64b555f7345265896fbfd.tar.xz
Set the acInfoGen signature algorithm from ISignatureFactory
- see https://github.com/bcgit/bc-csharp/pull/64
-rw-r--r--crypto/src/x509/X509V2AttributeCertificateGenerator.cs16
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) {