PKCS12PBEParams.java
资源名称:security.rar [点击查看]
上传用户:lior1029
上传日期:2013-05-07
资源大小:209k
文件大小:1k
源码类别:
CA认证
开发平台:
Java
- package org.bouncycastle.asn1.pkcs;
- import java.math.BigInteger;
- import org.bouncycastle.asn1.*;
- public class PKCS12PBEParams
- implements DEREncodable
- {
- DERInteger iterations;
- ASN1OctetString iv;
- public PKCS12PBEParams(
- byte[] salt,
- int iterations)
- {
- this.iv = new DEROctetString(salt);
- this.iterations = new DERInteger(iterations);
- }
- public PKCS12PBEParams(
- ASN1Sequence seq)
- {
- iv = (ASN1OctetString)seq.getObjectAt(0);
- iterations = (DERInteger)seq.getObjectAt(1);
- }
- public static PKCS12PBEParams getInstance(
- Object obj)
- {
- if (obj instanceof PKCS12PBEParams)
- {
- return (PKCS12PBEParams)obj;
- }
- else if (obj instanceof ASN1Sequence)
- {
- return new PKCS12PBEParams((ASN1Sequence)obj);
- }
- throw new IllegalArgumentException("unknown object in factory");
- }
- public BigInteger getIterations()
- {
- return iterations.getValue();
- }
- public byte[] getIV()
- {
- return iv.getOctets();
- }
- public DERObject getDERObject()
- {
- ASN1EncodableVector v = new ASN1EncodableVector();
- v.add(iv);
- v.add(iterations);
- return new DERSequence(v);
- }
- }