35 lines
1.1 KiB
Java
35 lines
1.1 KiB
Java
|
package org.bouncycastle.crypto.paddings;
|
||
|
|
||
|
import java.security.SecureRandom;
|
||
|
import org.bouncycastle.crypto.InvalidCipherTextException;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public class ZeroBytePadding implements BlockCipherPadding {
|
||
|
@Override // org.bouncycastle.crypto.paddings.BlockCipherPadding
|
||
|
public void init(SecureRandom secureRandom) throws IllegalArgumentException {
|
||
|
}
|
||
|
|
||
|
@Override // org.bouncycastle.crypto.paddings.BlockCipherPadding
|
||
|
public int padCount(byte[] bArr) throws InvalidCipherTextException {
|
||
|
int length = bArr.length;
|
||
|
while (length > 0 && bArr[length - 1] == 0) {
|
||
|
length--;
|
||
|
}
|
||
|
return bArr.length - length;
|
||
|
}
|
||
|
|
||
|
@Override // org.bouncycastle.crypto.paddings.BlockCipherPadding
|
||
|
public String getPaddingName() {
|
||
|
return "ZeroByte";
|
||
|
}
|
||
|
|
||
|
@Override // org.bouncycastle.crypto.paddings.BlockCipherPadding
|
||
|
public int addPadding(byte[] bArr, int i) {
|
||
|
int length = bArr.length;
|
||
|
for (int i2 = i; i2 < bArr.length; i2++) {
|
||
|
bArr[i2] = 0;
|
||
|
}
|
||
|
return length - i;
|
||
|
}
|
||
|
}
|