64 lines
1.8 KiB
Java
64 lines
1.8 KiB
Java
|
package org.bouncycastle.crypto.engines;
|
||
|
|
||
|
import org.bouncycastle.crypto.BlockCipher;
|
||
|
import org.bouncycastle.crypto.CipherParameters;
|
||
|
import org.bouncycastle.crypto.DataLengthException;
|
||
|
import org.bouncycastle.crypto.OutputLengthException;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public class NullEngine implements BlockCipher {
|
||
|
protected static final int DEFAULT_BLOCK_SIZE = 1;
|
||
|
private final int blockSize;
|
||
|
private boolean initialised;
|
||
|
|
||
|
@Override // org.bouncycastle.crypto.BlockCipher
|
||
|
public void reset() {
|
||
|
}
|
||
|
|
||
|
@Override // org.bouncycastle.crypto.BlockCipher
|
||
|
public int processBlock(byte[] bArr, int i, byte[] bArr2, int i2) throws DataLengthException, IllegalStateException {
|
||
|
if (!this.initialised) {
|
||
|
throw new IllegalStateException("Null engine not initialised");
|
||
|
}
|
||
|
int i3 = this.blockSize;
|
||
|
if (i + i3 > bArr.length) {
|
||
|
throw new DataLengthException("input buffer too short");
|
||
|
}
|
||
|
if (i3 + i2 > bArr2.length) {
|
||
|
throw new OutputLengthException("output buffer too short");
|
||
|
}
|
||
|
int i4 = 0;
|
||
|
while (true) {
|
||
|
int i5 = this.blockSize;
|
||
|
if (i4 >= i5) {
|
||
|
return i5;
|
||
|
}
|
||
|
bArr2[i2 + i4] = bArr[i + i4];
|
||
|
i4++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // org.bouncycastle.crypto.BlockCipher
|
||
|
public void init(boolean z, CipherParameters cipherParameters) throws IllegalArgumentException {
|
||
|
this.initialised = true;
|
||
|
}
|
||
|
|
||
|
@Override // org.bouncycastle.crypto.BlockCipher
|
||
|
public int getBlockSize() {
|
||
|
return this.blockSize;
|
||
|
}
|
||
|
|
||
|
@Override // org.bouncycastle.crypto.BlockCipher
|
||
|
public String getAlgorithmName() {
|
||
|
return "Null";
|
||
|
}
|
||
|
|
||
|
public NullEngine(int i) {
|
||
|
this.blockSize = i;
|
||
|
}
|
||
|
|
||
|
public NullEngine() {
|
||
|
this(1);
|
||
|
}
|
||
|
}
|