what-the-bank/sources/org/bouncycastle/asn1/pkcs/PBES2Parameters.java

58 lines
2.1 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.pkcs;
import java.util.Enumeration;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERSequence;
/* loaded from: classes6.dex */
public class PBES2Parameters extends ASN1Object implements PKCSObjectIdentifiers {
private KeyDerivationFunc func;
private EncryptionScheme scheme;
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
aSN1EncodableVector.add(this.func);
aSN1EncodableVector.add(this.scheme);
return new DERSequence(aSN1EncodableVector);
}
public KeyDerivationFunc getKeyDerivationFunc() {
return this.func;
}
public EncryptionScheme getEncryptionScheme() {
return this.scheme;
}
public static PBES2Parameters getInstance(Object obj) {
if (obj instanceof PBES2Parameters) {
return (PBES2Parameters) obj;
}
if (obj != null) {
return new PBES2Parameters(ASN1Sequence.getInstance(obj));
}
return null;
}
public PBES2Parameters(KeyDerivationFunc keyDerivationFunc, EncryptionScheme encryptionScheme) {
this.func = keyDerivationFunc;
this.scheme = encryptionScheme;
}
private PBES2Parameters(ASN1Sequence aSN1Sequence) {
Enumeration objects = aSN1Sequence.getObjects();
ASN1Sequence aSN1Sequence2 = ASN1Sequence.getInstance(((ASN1Encodable) objects.nextElement()).toASN1Primitive());
if (aSN1Sequence2.getObjectAt(0).equals(id_PBKDF2)) {
this.func = new KeyDerivationFunc(id_PBKDF2, PBKDF2Params.getInstance(aSN1Sequence2.getObjectAt(1)));
} else {
this.func = KeyDerivationFunc.getInstance(aSN1Sequence2);
}
this.scheme = EncryptionScheme.getInstance(objects.nextElement());
}
}