org.bouncycastle.asn1.pkcs.PKCS12PBEParams Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bc-fips Show documentation
Show all versions of bc-fips Show documentation
The FIPS 140-3 Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms certified to FIPS 140-3 level 1. This jar contains JCE provider and low-level API for the BC-FJA version 2.0.0, FIPS Certificate #4743. Please see certificate for certified platform details.
/***************************************************************/
/****** DO NOT EDIT THIS CLASS bc-java SOURCE FILE ******/
/***************************************************************/
package org.bouncycastle.asn1.pkcs;
import java.math.BigInteger;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1OctetString;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.DERSequence;
public class PKCS12PBEParams
extends ASN1Object
{
ASN1Integer iterations;
ASN1OctetString iv;
public PKCS12PBEParams(
byte[] salt,
int iterations)
{
this.iv = new DEROctetString(salt);
this.iterations = new ASN1Integer(iterations);
}
private PKCS12PBEParams(
ASN1Sequence seq)
{
iv = (ASN1OctetString)seq.getObjectAt(0);
iterations = ASN1Integer.getInstance(seq.getObjectAt(1));
}
public static PKCS12PBEParams getInstance(
Object obj)
{
if (obj instanceof PKCS12PBEParams)
{
return (PKCS12PBEParams)obj;
}
else if (obj != null)
{
return new PKCS12PBEParams(ASN1Sequence.getInstance(obj));
}
return null;
}
public BigInteger getIterations()
{
return iterations.getValue();
}
public byte[] getIV()
{
return iv.getOctets();
}
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(iv);
v.add(iterations);
return new DERSequence(v);
}
}