what-the-bank/sources/org/bouncycastle/crypto/tls/SignatureAndHashAlgorithm.java

55 lines
1.7 KiB
Java

package org.bouncycastle.crypto.tls;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/* loaded from: classes6.dex */
public class SignatureAndHashAlgorithm {
protected short hash;
protected short signature;
public int hashCode() {
return (getHash() << 16) | getSignature();
}
public short getSignature() {
return this.signature;
}
public short getHash() {
return this.hash;
}
public boolean equals(Object obj) {
if (!(obj instanceof SignatureAndHashAlgorithm)) {
return false;
}
SignatureAndHashAlgorithm signatureAndHashAlgorithm = (SignatureAndHashAlgorithm) obj;
return signatureAndHashAlgorithm.getHash() == getHash() && signatureAndHashAlgorithm.getSignature() == getSignature();
}
public void encode(OutputStream outputStream) throws IOException {
TlsUtils.writeUint8(getHash(), outputStream);
TlsUtils.writeUint8(getSignature(), outputStream);
}
public static SignatureAndHashAlgorithm parse(InputStream inputStream) throws IOException {
return new SignatureAndHashAlgorithm(TlsUtils.readUint8(inputStream), TlsUtils.readUint8(inputStream));
}
public SignatureAndHashAlgorithm(short s, short s2) {
if (!TlsUtils.isValidUint8(s)) {
throw new IllegalArgumentException("'hash' should be a uint8");
}
if (!TlsUtils.isValidUint8(s2)) {
throw new IllegalArgumentException("'signature' should be a uint8");
}
if (s2 == 0) {
throw new IllegalArgumentException("'signature' MUST NOT be \"anonymous\"");
}
this.hash = s;
this.signature = s2;
}
}