init commit

This commit is contained in:
2025-10-09 09:57:24 +09:00
commit 4d551bd74f
6636 changed files with 1218703 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
using System;
using Org.BouncyCastle.Asn1;
using Org.BouncyCastle.Asn1.Cms;
using Org.BouncyCastle.Asn1.Crmf;
using Org.BouncyCastle.Cms;
namespace Org.BouncyCastle.Crmf;
public class PkiArchiveControl : IControl
{
public static readonly int encryptedPrivKey = 0;
public static readonly int keyGenParameters = 1;
public static readonly int archiveRemGenPrivKey = 2;
private static readonly DerObjectIdentifier type = CrmfObjectIdentifiers.id_regCtrl_pkiArchiveOptions;
private readonly PkiArchiveOptions pkiArchiveOptions;
public DerObjectIdentifier Type => type;
public Asn1Encodable Value => pkiArchiveOptions;
public int ArchiveType => pkiArchiveOptions.Type;
public bool EnvelopedData
{
get
{
EncryptedKey instance = EncryptedKey.GetInstance(pkiArchiveOptions.Value);
return !instance.IsEncryptedValue;
}
}
public PkiArchiveControl(PkiArchiveOptions pkiArchiveOptions)
{
this.pkiArchiveOptions = pkiArchiveOptions;
}
public CmsEnvelopedData GetEnvelopedData()
{
try
{
EncryptedKey instance = EncryptedKey.GetInstance(pkiArchiveOptions.Value);
EnvelopedData instance2 = Org.BouncyCastle.Asn1.Cms.EnvelopedData.GetInstance(instance.Value);
return new CmsEnvelopedData(new ContentInfo(CmsObjectIdentifiers.EnvelopedData, instance2));
}
catch (CmsException ex)
{
throw new CrmfException("CMS parsing error: " + ex.Message, ex);
}
catch (Exception ex2)
{
throw new CrmfException("CRMF parsing error: " + ex2.Message, ex2);
}
}
}