From 5513e11b4c26ac64dc73ef25b7d691dd7e962f59 Mon Sep 17 00:00:00 2001 From: David Hook Date: Sat, 19 Jan 2019 15:57:28 +1100 Subject: rename --- crypto/src/crmf/PKIArchiveControlBuilder.cs | 58 ----------------------------- crypto/src/crmf/PkiArchiveControlBuilder.cs | 58 +++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 58 deletions(-) delete mode 100644 crypto/src/crmf/PKIArchiveControlBuilder.cs create mode 100644 crypto/src/crmf/PkiArchiveControlBuilder.cs (limited to 'crypto/src') diff --git a/crypto/src/crmf/PKIArchiveControlBuilder.cs b/crypto/src/crmf/PKIArchiveControlBuilder.cs deleted file mode 100644 index 2677e4e0d..000000000 --- a/crypto/src/crmf/PKIArchiveControlBuilder.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.IO; -using Org.BouncyCastle.Asn1.Cms; -using Org.BouncyCastle.Asn1.Crmf; -using Org.BouncyCastle.Asn1.Pkcs; -using Org.BouncyCastle.Asn1.X509; -using Org.BouncyCastle.Cms; -using Org.BouncyCastle.Crypto; - -namespace Org.BouncyCastle.Crmf -{ - public class PkiArchiveControlBuilder - { - private CmsEnvelopedDataGenerator envGen; - private CmsProcessableByteArray keyContent; - - /// - ///Basic constructor - specify the contents of the PKIArchiveControl structure. - /// - /// the private key to be archived. - /// the general name to be associated with the private key. - /// - public PkiArchiveControlBuilder(PrivateKeyInfo privateKeyInfo, GeneralName generalName) - { - EncKeyWithID encKeyWithID = new EncKeyWithID(privateKeyInfo, generalName); - - try - { - this.keyContent = new CmsProcessableByteArray(CrmfObjectIdentifiers.id_ct_encKeyWithID, encKeyWithID.GetEncoded()); - } - catch (IOException e) - { - throw new InvalidOperationException("unable to encode key and general name info"); - } - - this.envGen = new CmsEnvelopedDataGenerator(); - } - - ///Add a recipient generator to this control. - /// recipient generator created for a specific recipient. - ///this builder object. - public PkiArchiveControlBuilder AddRecipientGenerator(RecipientInfoGenerator recipientGen) - { - envGen.AddRecipientInfoGenerator(recipientGen); - return this; - } - - /// Build the PKIArchiveControl using the passed in encryptor to encrypt its contents. - /// a suitable content encryptor. - /// a PKIArchiveControl object. - public PkiArchiveControl Build(ICipherBuilderWithKey contentEncryptor) - { - CmsEnvelopedData envContent = envGen.Generate(keyContent, contentEncryptor); - EnvelopedData envD = EnvelopedData.GetInstance(envContent.ContentInfo.Content); - return new PkiArchiveControl(new PkiArchiveOptions(new EncryptedKey(envD))); - } - } -} \ No newline at end of file diff --git a/crypto/src/crmf/PkiArchiveControlBuilder.cs b/crypto/src/crmf/PkiArchiveControlBuilder.cs new file mode 100644 index 000000000..2677e4e0d --- /dev/null +++ b/crypto/src/crmf/PkiArchiveControlBuilder.cs @@ -0,0 +1,58 @@ +using System; +using System.IO; +using Org.BouncyCastle.Asn1.Cms; +using Org.BouncyCastle.Asn1.Crmf; +using Org.BouncyCastle.Asn1.Pkcs; +using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Cms; +using Org.BouncyCastle.Crypto; + +namespace Org.BouncyCastle.Crmf +{ + public class PkiArchiveControlBuilder + { + private CmsEnvelopedDataGenerator envGen; + private CmsProcessableByteArray keyContent; + + /// + ///Basic constructor - specify the contents of the PKIArchiveControl structure. + /// + /// the private key to be archived. + /// the general name to be associated with the private key. + /// + public PkiArchiveControlBuilder(PrivateKeyInfo privateKeyInfo, GeneralName generalName) + { + EncKeyWithID encKeyWithID = new EncKeyWithID(privateKeyInfo, generalName); + + try + { + this.keyContent = new CmsProcessableByteArray(CrmfObjectIdentifiers.id_ct_encKeyWithID, encKeyWithID.GetEncoded()); + } + catch (IOException e) + { + throw new InvalidOperationException("unable to encode key and general name info"); + } + + this.envGen = new CmsEnvelopedDataGenerator(); + } + + ///Add a recipient generator to this control. + /// recipient generator created for a specific recipient. + ///this builder object. + public PkiArchiveControlBuilder AddRecipientGenerator(RecipientInfoGenerator recipientGen) + { + envGen.AddRecipientInfoGenerator(recipientGen); + return this; + } + + /// Build the PKIArchiveControl using the passed in encryptor to encrypt its contents. + /// a suitable content encryptor. + /// a PKIArchiveControl object. + public PkiArchiveControl Build(ICipherBuilderWithKey contentEncryptor) + { + CmsEnvelopedData envContent = envGen.Generate(keyContent, contentEncryptor); + EnvelopedData envD = EnvelopedData.GetInstance(envContent.ContentInfo.Content); + return new PkiArchiveControl(new PkiArchiveOptions(new EncryptedKey(envD))); + } + } +} \ No newline at end of file -- cgit 1.5.1