what-the-bank/sources/org/bouncycastle/asn1/cms/RsaKemParameters.java

56 lines
2.0 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.cms;
import java.math.BigInteger;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
/* loaded from: classes6.dex */
public class RsaKemParameters extends ASN1Object {
private final AlgorithmIdentifier keyDerivationFunction;
private final BigInteger keyLength;
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
aSN1EncodableVector.add(this.keyDerivationFunction);
aSN1EncodableVector.add(new ASN1Integer(this.keyLength));
return new DERSequence(aSN1EncodableVector);
}
public BigInteger getKeyLength() {
return this.keyLength;
}
public AlgorithmIdentifier getKeyDerivationFunction() {
return this.keyDerivationFunction;
}
public static RsaKemParameters getInstance(Object obj) {
if (obj instanceof RsaKemParameters) {
return (RsaKemParameters) obj;
}
if (obj != null) {
return new RsaKemParameters(ASN1Sequence.getInstance(obj));
}
return null;
}
public RsaKemParameters(AlgorithmIdentifier algorithmIdentifier, int i) {
this.keyDerivationFunction = algorithmIdentifier;
this.keyLength = BigInteger.valueOf(i);
}
private RsaKemParameters(ASN1Sequence aSN1Sequence) {
if (aSN1Sequence.size() != 2) {
throw new IllegalArgumentException("ASN.1 SEQUENCE should be of length 2");
}
this.keyDerivationFunction = AlgorithmIdentifier.getInstance(aSN1Sequence.getObjectAt(0));
this.keyLength = ASN1Integer.getInstance(aSN1Sequence.getObjectAt(1)).getValue();
}
}