what-the-bank/sources/org/bouncycastle/jcajce/io/CipherOutputStream.java

103 lines
3.9 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.jcajce.io;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import javax.crypto.Cipher;
/* loaded from: classes6.dex */
public class CipherOutputStream extends FilterOutputStream {
private final Cipher cipher;
private final byte[] oneByte;
@Override // java.io.FilterOutputStream, java.io.OutputStream
public void write(byte[] bArr, int i, int i2) throws IOException {
byte[] update = this.cipher.update(bArr, i, i2);
if (update != null) {
((FilterOutputStream) this).out.write(update);
}
}
@Override // java.io.FilterOutputStream, java.io.OutputStream
public void write(int i) throws IOException {
byte[] bArr = this.oneByte;
bArr[0] = (byte) i;
write(bArr, 0, 1);
}
@Override // java.io.FilterOutputStream, java.io.OutputStream, java.io.Flushable
public void flush() throws IOException {
((FilterOutputStream) this).out.flush();
}
/* JADX WARN: Can't wrap try/catch for region: R(4:(4:1|2|(1:4)|6)|7|8|(1:10)(1:12)) */
/* JADX WARN: Code restructure failed: missing block: B:14:0x0032, code lost:
r1 = move-exception;
*/
/* JADX WARN: Code restructure failed: missing block: B:15:0x0033, code lost:
if (r0 == null) goto L15;
*/
/* JADX WARN: Code restructure failed: missing block: B:16:0x0035, code lost:
r0 = r1;
*/
/* JADX WARN: Removed duplicated region for block: B:10:0x0038 A[RETURN] */
/* JADX WARN: Removed duplicated region for block: B:12:0x0039 */
@Override // java.io.FilterOutputStream, java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void close() throws java.io.IOException {
/*
r3 = this;
javax.crypto.Cipher r0 = r3.cipher // Catch: java.lang.Exception -> Lf java.security.GeneralSecurityException -> L20
byte[] r0 = r0.doFinal() // Catch: java.lang.Exception -> Lf java.security.GeneralSecurityException -> L20
if (r0 == 0) goto Ld
java.io.OutputStream r1 = r3.out // Catch: java.lang.Exception -> Lf java.security.GeneralSecurityException -> L20
r1.write(r0) // Catch: java.lang.Exception -> Lf java.security.GeneralSecurityException -> L20
Ld:
r0 = 0
goto L29
Lf:
r0 = move-exception
java.io.IOException r1 = new java.io.IOException
java.lang.String r2 = "Error closing stream: "
java.lang.String r0 = java.lang.String.valueOf(r0)
java.lang.String r0 = r2.concat(r0)
r1.<init>(r0)
goto L28
L20:
r0 = move-exception
org.bouncycastle.crypto.io.InvalidCipherTextIOException r1 = new org.bouncycastle.crypto.io.InvalidCipherTextIOException
java.lang.String r2 = "Error during cipher finalisation"
r1.<init>(r2, r0)
L28:
r0 = r1
L29:
r3.flush() // Catch: java.io.IOException -> L32
java.io.OutputStream r1 = r3.out // Catch: java.io.IOException -> L32
r1.close() // Catch: java.io.IOException -> L32
goto L36
L32:
r1 = move-exception
if (r0 != 0) goto L36
r0 = r1
L36:
if (r0 != 0) goto L39
return
L39:
throw r0
*/
throw new UnsupportedOperationException("Method not decompiled: org.bouncycastle.jcajce.io.CipherOutputStream.close():void");
}
public CipherOutputStream(OutputStream outputStream, Cipher cipher) {
super(outputStream);
this.oneByte = new byte[1];
this.cipher = cipher;
}
}