Pbmac1Params
using Org.BouncyCastle.Asn1.X509;
using System;
namespace Org.BouncyCastle.Asn1.Pkcs
{
public sealed class Pbmac1Params : Asn1Encodable
{
private readonly AlgorithmIdentifier m_keyDerivationFunc;
private readonly AlgorithmIdentifier m_messageAuthScheme;
public AlgorithmIdentifier KeyDerivationFunc => m_keyDerivationFunc;
public AlgorithmIdentifier MessageAuthScheme => m_messageAuthScheme;
public static Pbmac1Params GetInstance(object obj)
{
if (obj == null)
return null;
Pbmac1Params pbmac1Params = obj as Pbmac1Params;
if (pbmac1Params != null)
return pbmac1Params;
return new Pbmac1Params(Asn1Sequence.GetInstance(obj));
}
public static Pbmac1Params GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
{
return new Pbmac1Params(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
}
public static Pbmac1Params GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit)
{
return new Pbmac1Params(Asn1Sequence.GetTagged(taggedObject, declaredExplicit));
}
private Pbmac1Params(Asn1Sequence seq)
{
int count = seq.Count;
if (count != 2)
throw new ArgumentException("Bad sequence size: " + count.ToString(), "seq");
m_keyDerivationFunc = AlgorithmIdentifier.GetInstance(seq[0]);
m_messageAuthScheme = AlgorithmIdentifier.GetInstance(seq[1]);
}
public Pbmac1Params(AlgorithmIdentifier keyDerivationFunc, AlgorithmIdentifier messageAuthScheme)
{
if (keyDerivationFunc == null)
throw new ArgumentNullException("keyDerivationFunc");
m_keyDerivationFunc = keyDerivationFunc;
if (messageAuthScheme == null)
throw new ArgumentNullException("messageAuthScheme");
m_messageAuthScheme = messageAuthScheme;
}
public override Asn1Object ToAsn1Object()
{
return new DerSequence(m_keyDerivationFunc, m_messageAuthScheme);
}
}
}