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

57 lines
1.8 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.cms;
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;
import org.bouncycastle.util.Arrays;
/* loaded from: classes6.dex */
public class GCMParameters extends ASN1Object {
private int icvLen;
private byte[] nonce;
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
aSN1EncodableVector.add(new DEROctetString(this.nonce));
int i = this.icvLen;
if (i != 12) {
aSN1EncodableVector.add(new ASN1Integer(i));
}
return new DERSequence(aSN1EncodableVector);
}
public byte[] getNonce() {
return Arrays.clone(this.nonce);
}
public int getIcvLen() {
return this.icvLen;
}
public static GCMParameters getInstance(Object obj) {
if (obj instanceof GCMParameters) {
return (GCMParameters) obj;
}
if (obj != null) {
return new GCMParameters(ASN1Sequence.getInstance(obj));
}
return null;
}
public GCMParameters(byte[] bArr, int i) {
this.nonce = Arrays.clone(bArr);
this.icvLen = i;
}
private GCMParameters(ASN1Sequence aSN1Sequence) {
this.nonce = ASN1OctetString.getInstance(aSN1Sequence.getObjectAt(0)).getOctets();
this.icvLen = aSN1Sequence.size() == 2 ? ASN1Integer.getInstance(aSN1Sequence.getObjectAt(1)).getValue().intValue() : 12;
}
}