1package org.bouncycastle.asn1.pkcs;
2
3import org.bouncycastle.asn1.ASN1Encodable;
4import org.bouncycastle.asn1.ASN1Object;
5import org.bouncycastle.asn1.ASN1ObjectIdentifier;
6import org.bouncycastle.asn1.ASN1Primitive;
7import org.bouncycastle.asn1.ASN1Sequence;
8import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
9
10public class KeyDerivationFunc
11    extends ASN1Object
12{
13    private AlgorithmIdentifier algId;
14
15    public KeyDerivationFunc(
16        ASN1ObjectIdentifier objectId,
17        ASN1Encodable parameters)
18    {
19        this.algId = new AlgorithmIdentifier(objectId, parameters);
20    }
21
22    private KeyDerivationFunc(
23        ASN1Sequence seq)
24    {
25        this.algId = AlgorithmIdentifier.getInstance(seq);
26    }
27
28    public static KeyDerivationFunc getInstance(Object obj)
29    {
30        if (obj instanceof KeyDerivationFunc)
31        {
32            return (KeyDerivationFunc)obj;
33        }
34        else if (obj != null)
35        {
36            return new KeyDerivationFunc(ASN1Sequence.getInstance(obj));
37        }
38
39        return null;
40    }
41
42    public ASN1ObjectIdentifier getAlgorithm()
43    {
44        return algId.getAlgorithm();
45    }
46
47    public ASN1Encodable getParameters()
48    {
49        return algId.getParameters();
50    }
51
52    public ASN1Primitive toASN1Primitive()
53    {
54        return algId.toASN1Primitive();
55    }
56}
57