Initial Commit
This commit is contained in:
47
iTechSharp/srcbc/asn1/oiw/ElGamalParameter.cs
Normal file
47
iTechSharp/srcbc/asn1/oiw/ElGamalParameter.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
using Org.BouncyCastle.Asn1;
|
||||
using Org.BouncyCastle.Math;
|
||||
|
||||
namespace Org.BouncyCastle.Asn1.Oiw
|
||||
{
|
||||
public class ElGamalParameter
|
||||
: Asn1Encodable
|
||||
{
|
||||
internal DerInteger p, g;
|
||||
|
||||
public ElGamalParameter(
|
||||
BigInteger p,
|
||||
BigInteger g)
|
||||
{
|
||||
this.p = new DerInteger(p);
|
||||
this.g = new DerInteger(g);
|
||||
}
|
||||
|
||||
public ElGamalParameter(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2)
|
||||
throw new ArgumentException("Wrong number of elements in sequence", "seq");
|
||||
|
||||
p = DerInteger.GetInstance(seq[0]);
|
||||
g = DerInteger.GetInstance(seq[1]);
|
||||
}
|
||||
|
||||
public BigInteger P
|
||||
{
|
||||
get { return p.PositiveValue; }
|
||||
}
|
||||
|
||||
public BigInteger G
|
||||
{
|
||||
get { return g.PositiveValue; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(p, g);
|
||||
}
|
||||
}
|
||||
}
|
24
iTechSharp/srcbc/asn1/oiw/OIWObjectIdentifiers.cs
Normal file
24
iTechSharp/srcbc/asn1/oiw/OIWObjectIdentifiers.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace Org.BouncyCastle.Asn1.Oiw
|
||||
{
|
||||
public abstract class OiwObjectIdentifiers
|
||||
{
|
||||
public static readonly DerObjectIdentifier MD4WithRsa = new DerObjectIdentifier("1.3.14.3.2.2");
|
||||
public static readonly DerObjectIdentifier MD5WithRsa = new DerObjectIdentifier("1.3.14.3.2.3");
|
||||
public static readonly DerObjectIdentifier MD4WithRsaEncryption = new DerObjectIdentifier("1.3.14.3.2.4");
|
||||
|
||||
public static readonly DerObjectIdentifier DesCbc = new DerObjectIdentifier("1.3.14.3.2.7");
|
||||
|
||||
// id-SHA1 OBJECT IDENTIFIER ::=
|
||||
// {iso(1) identified-organization(3) oiw(14) secsig(3) algorithms(2) 26 } //
|
||||
public static readonly DerObjectIdentifier IdSha1 = new DerObjectIdentifier("1.3.14.3.2.26");
|
||||
|
||||
public static readonly DerObjectIdentifier DsaWithSha1 = new DerObjectIdentifier("1.3.14.3.2.27");
|
||||
|
||||
public static readonly DerObjectIdentifier Sha1WithRsa = new DerObjectIdentifier("1.3.14.3.2.29");
|
||||
|
||||
// ElGamal Algorithm OBJECT IDENTIFIER ::=
|
||||
// {iso(1) identified-organization(3) oiw(14) dirservsig(7) algorithm(2) encryption(1) 1 }
|
||||
//
|
||||
public static readonly DerObjectIdentifier ElGamalAlgorithm = new DerObjectIdentifier("1.3.14.7.2.1.1");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user