57 lines
1.8 KiB
Java
57 lines
1.8 KiB
Java
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 CCMParameters 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 CCMParameters getInstance(Object obj) {
|
|
if (obj instanceof CCMParameters) {
|
|
return (CCMParameters) obj;
|
|
}
|
|
if (obj != null) {
|
|
return new CCMParameters(ASN1Sequence.getInstance(obj));
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public CCMParameters(byte[] bArr, int i) {
|
|
this.nonce = Arrays.clone(bArr);
|
|
this.icvLen = i;
|
|
}
|
|
|
|
private CCMParameters(ASN1Sequence aSN1Sequence) {
|
|
this.nonce = ASN1OctetString.getInstance(aSN1Sequence.getObjectAt(0)).getOctets();
|
|
this.icvLen = aSN1Sequence.size() == 2 ? ASN1Integer.getInstance(aSN1Sequence.getObjectAt(1)).getValue().intValue() : 12;
|
|
}
|
|
}
|