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

62 lines
2.0 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.crypto.tls;
import org.bouncycastle.util.Arrays;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public class TlsSessionImpl implements TlsSession {
final byte[] sessionID;
SessionParameters sessionParameters;
@Override // org.bouncycastle.crypto.tls.TlsSession
public boolean isResumable() {
boolean z;
synchronized (this) {
z = this.sessionParameters != null;
}
return z;
}
@Override // org.bouncycastle.crypto.tls.TlsSession
public void invalidate() {
synchronized (this) {
SessionParameters sessionParameters = this.sessionParameters;
if (sessionParameters != null) {
sessionParameters.clear();
this.sessionParameters = null;
}
}
}
@Override // org.bouncycastle.crypto.tls.TlsSession
public byte[] getSessionID() {
byte[] bArr;
synchronized (this) {
bArr = this.sessionID;
}
return bArr;
}
@Override // org.bouncycastle.crypto.tls.TlsSession
public SessionParameters exportSessionParameters() {
SessionParameters copy;
synchronized (this) {
SessionParameters sessionParameters = this.sessionParameters;
copy = sessionParameters == null ? null : sessionParameters.copy();
}
return copy;
}
/* JADX INFO: Access modifiers changed from: package-private */
public TlsSessionImpl(byte[] bArr, SessionParameters sessionParameters) {
if (bArr == null) {
throw new IllegalArgumentException("'sessionID' cannot be null");
}
if (bArr.length <= 0 || bArr.length > 32) {
throw new IllegalArgumentException("'sessionID' must have length between 1 and 32 bytes, inclusive");
}
this.sessionID = Arrays.clone(bArr);
this.sessionParameters = sessionParameters;
}
}