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,52 @@
using System;
using Org.BouncyCastle.Utilities;
namespace Org.BouncyCastle.Asn1.Misc;
public class Cast5CbcParameters : Asn1Encodable
{
private readonly DerInteger keyLength;
private readonly Asn1OctetString iv;
public int KeyLength => keyLength.Value.IntValue;
public static Cast5CbcParameters GetInstance(object o)
{
if (o is Cast5CbcParameters)
{
return (Cast5CbcParameters)o;
}
if (o is Asn1Sequence)
{
return new Cast5CbcParameters((Asn1Sequence)o);
}
throw new ArgumentException("unknown object in Cast5CbcParameters factory");
}
public Cast5CbcParameters(byte[] iv, int keyLength)
{
this.iv = new DerOctetString(iv);
this.keyLength = new DerInteger(keyLength);
}
private Cast5CbcParameters(Asn1Sequence seq)
{
if (seq.Count != 2)
{
throw new ArgumentException("Wrong number of elements in sequence", "seq");
}
iv = (Asn1OctetString)seq[0];
keyLength = (DerInteger)seq[1];
}
public byte[] GetIV()
{
return Arrays.Clone(iv.GetOctets());
}
public override Asn1Object ToAsn1Object()
{
return new DerSequence(iv, keyLength);
}
}

View File

@@ -0,0 +1,53 @@
using System;
namespace Org.BouncyCastle.Asn1.Misc;
public class IdeaCbcPar : Asn1Encodable
{
internal Asn1OctetString iv;
public static IdeaCbcPar GetInstance(object o)
{
if (o is IdeaCbcPar)
{
return (IdeaCbcPar)o;
}
if (o is Asn1Sequence)
{
return new IdeaCbcPar((Asn1Sequence)o);
}
throw new ArgumentException("unknown object in IDEACBCPar factory");
}
public IdeaCbcPar(byte[] iv)
{
this.iv = new DerOctetString(iv);
}
private IdeaCbcPar(Asn1Sequence seq)
{
if (seq.Count == 1)
{
iv = (Asn1OctetString)seq[0];
}
}
public byte[] GetIV()
{
if (iv != null)
{
return iv.GetOctets();
}
return null;
}
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector();
if (iv != null)
{
asn1EncodableVector.Add(iv);
}
return new DerSequence(asn1EncodableVector);
}
}

View File

@@ -0,0 +1,80 @@
namespace Org.BouncyCastle.Asn1.Misc;
public abstract class MiscObjectIdentifiers
{
public static readonly DerObjectIdentifier Netscape = new DerObjectIdentifier("2.16.840.1.113730.1");
public static readonly DerObjectIdentifier NetscapeCertType = Netscape.Branch("1");
public static readonly DerObjectIdentifier NetscapeBaseUrl = Netscape.Branch("2");
public static readonly DerObjectIdentifier NetscapeRevocationUrl = Netscape.Branch("3");
public static readonly DerObjectIdentifier NetscapeCARevocationUrl = Netscape.Branch("4");
public static readonly DerObjectIdentifier NetscapeRenewalUrl = Netscape.Branch("7");
public static readonly DerObjectIdentifier NetscapeCAPolicyUrl = Netscape.Branch("8");
public static readonly DerObjectIdentifier NetscapeSslServerName = Netscape.Branch("12");
public static readonly DerObjectIdentifier NetscapeCertComment = Netscape.Branch("13");
public static readonly DerObjectIdentifier Verisign = new DerObjectIdentifier("2.16.840.1.113733.1");
public static readonly DerObjectIdentifier VerisignCzagExtension = Verisign.Branch("6.3");
public static readonly DerObjectIdentifier VerisignPrivate_6_9 = Verisign.Branch("6.9");
public static readonly DerObjectIdentifier VerisignOnSiteJurisdictionHash = Verisign.Branch("6.11");
public static readonly DerObjectIdentifier VerisignBitString_6_13 = Verisign.Branch("6.13");
public static readonly DerObjectIdentifier VerisignDnbDunsNumber = Verisign.Branch("6.15");
public static readonly DerObjectIdentifier VerisignIssStrongCrypto = Verisign.Branch("8.1");
public static readonly string Novell = "2.16.840.1.113719";
public static readonly DerObjectIdentifier NovellSecurityAttribs = new DerObjectIdentifier(Novell + ".1.9.4.1");
public static readonly string Entrust = "1.2.840.113533.7";
public static readonly DerObjectIdentifier EntrustVersionExtension = new DerObjectIdentifier(Entrust + ".65.0");
public static readonly DerObjectIdentifier cast5CBC = new DerObjectIdentifier(Entrust + ".66.10");
public static readonly DerObjectIdentifier as_sys_sec_alg_ideaCBC = new DerObjectIdentifier("1.3.6.1.4.1.188.7.1.1.2");
public static readonly DerObjectIdentifier cryptlib = new DerObjectIdentifier("1.3.6.1.4.1.3029");
public static readonly DerObjectIdentifier cryptlib_algorithm = cryptlib.Branch("1");
public static readonly DerObjectIdentifier cryptlib_algorithm_blowfish_ECB = cryptlib_algorithm.Branch("1.1");
public static readonly DerObjectIdentifier cryptlib_algorithm_blowfish_CBC = cryptlib_algorithm.Branch("1.2");
public static readonly DerObjectIdentifier cryptlib_algorithm_blowfish_CFB = cryptlib_algorithm.Branch("1.3");
public static readonly DerObjectIdentifier cryptlib_algorithm_blowfish_OFB = cryptlib_algorithm.Branch("1.4");
public static readonly DerObjectIdentifier blake2 = new DerObjectIdentifier("1.3.6.1.4.1.1722.12.2");
public static readonly DerObjectIdentifier id_blake2b160 = blake2.Branch("1.5");
public static readonly DerObjectIdentifier id_blake2b256 = blake2.Branch("1.8");
public static readonly DerObjectIdentifier id_blake2b384 = blake2.Branch("1.12");
public static readonly DerObjectIdentifier id_blake2b512 = blake2.Branch("1.16");
public static readonly DerObjectIdentifier id_blake2s128 = blake2.Branch("2.4");
public static readonly DerObjectIdentifier id_blake2s160 = blake2.Branch("2.5");
public static readonly DerObjectIdentifier id_blake2s224 = blake2.Branch("2.7");
public static readonly DerObjectIdentifier id_blake2s256 = blake2.Branch("2.8");
public static readonly DerObjectIdentifier id_scrypt = new DerObjectIdentifier("1.3.6.1.4.1.11591.4.11");
}

View File

@@ -0,0 +1,36 @@
namespace Org.BouncyCastle.Asn1.Misc;
public class NetscapeCertType : DerBitString
{
public const int SslClient = 128;
public const int SslServer = 64;
public const int Smime = 32;
public const int ObjectSigning = 16;
public const int Reserved = 8;
public const int SslCA = 4;
public const int SmimeCA = 2;
public const int ObjectSigningCA = 1;
public NetscapeCertType(int usage)
: base(usage)
{
}
public NetscapeCertType(DerBitString usage)
: base(usage.GetBytes(), usage.PadBits)
{
}
public override string ToString()
{
byte[] bytes = GetBytes();
return "NetscapeCertType: 0x" + (bytes[0] & 0xFF).ToString("X");
}
}

View File

@@ -0,0 +1,14 @@
namespace Org.BouncyCastle.Asn1.Misc;
public class NetscapeRevocationUrl : DerIA5String
{
public NetscapeRevocationUrl(DerIA5String str)
: base(str.GetString())
{
}
public override string ToString()
{
return "NetscapeRevocationUrl: " + GetString();
}
}

View File

@@ -0,0 +1,14 @@
namespace Org.BouncyCastle.Asn1.Misc;
public class VerisignCzagExtension : DerIA5String
{
public VerisignCzagExtension(DerIA5String str)
: base(str.GetString())
{
}
public override string ToString()
{
return "VerisignCzagExtension: " + GetString();
}
}