001package org.apache.commons.ssl.org.bouncycastle.asn1.pkcs; 002 003import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1Encodable; 004import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1Object; 005import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1ObjectIdentifier; 006import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1Primitive; 007import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1Sequence; 008import org.apache.commons.ssl.org.bouncycastle.asn1.x509.AlgorithmIdentifier; 009 010public class KeyDerivationFunc 011 extends ASN1Object 012{ 013 private AlgorithmIdentifier algId; 014 015 public KeyDerivationFunc( 016 ASN1ObjectIdentifier objectId, 017 ASN1Encodable parameters) 018 { 019 this.algId = new AlgorithmIdentifier(objectId, parameters); 020 } 021 022 private KeyDerivationFunc( 023 ASN1Sequence seq) 024 { 025 this.algId = AlgorithmIdentifier.getInstance(seq); 026 } 027 028 public static KeyDerivationFunc getInstance(Object obj) 029 { 030 if (obj instanceof KeyDerivationFunc) 031 { 032 return (KeyDerivationFunc)obj; 033 } 034 else if (obj != null) 035 { 036 return new KeyDerivationFunc(ASN1Sequence.getInstance(obj)); 037 } 038 039 return null; 040 } 041 042 public ASN1ObjectIdentifier getAlgorithm() 043 { 044 return algId.getAlgorithm(); 045 } 046 047 public ASN1Encodable getParameters() 048 { 049 return algId.getParameters(); 050 } 051 052 public ASN1Primitive toASN1Primitive() 053 { 054 return algId.toASN1Primitive(); 055 } 056}