39 lines
1.0 KiB
Java
39 lines
1.0 KiB
Java
|
package org.bouncycastle.crypto.io;
|
||
|
|
||
|
import java.io.FilterInputStream;
|
||
|
import java.io.IOException;
|
||
|
import java.io.InputStream;
|
||
|
import org.bouncycastle.crypto.Mac;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public class MacInputStream extends FilterInputStream {
|
||
|
protected Mac mac;
|
||
|
|
||
|
@Override // java.io.FilterInputStream, java.io.InputStream
|
||
|
public int read(byte[] bArr, int i, int i2) throws IOException {
|
||
|
int read = ((FilterInputStream) this).in.read(bArr, i, i2);
|
||
|
if (read >= 0) {
|
||
|
this.mac.update(bArr, i, read);
|
||
|
}
|
||
|
return read;
|
||
|
}
|
||
|
|
||
|
@Override // java.io.FilterInputStream, java.io.InputStream
|
||
|
public int read() throws IOException {
|
||
|
int read = ((FilterInputStream) this).in.read();
|
||
|
if (read >= 0) {
|
||
|
this.mac.update((byte) read);
|
||
|
}
|
||
|
return read;
|
||
|
}
|
||
|
|
||
|
public Mac getMac() {
|
||
|
return this.mac;
|
||
|
}
|
||
|
|
||
|
public MacInputStream(InputStream inputStream, Mac mac) {
|
||
|
super(inputStream);
|
||
|
this.mac = mac;
|
||
|
}
|
||
|
}
|