
org.spongycastle.crypto.tls.TlsSessionImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Spongy Castle is a package-rename (org.bouncycastle.* to org.spongycastle.*) of Bouncy Castle
intended for the Android platform. Android unfortunately ships with a stripped-down version of
Bouncy Castle, which prevents easy upgrades - Spongy Castle overcomes this and provides a full,
up-to-date version of the Bouncy Castle cryptographic libs.
package org.spongycastle.crypto.tls;
import org.spongycastle.util.Arrays;
class TlsSessionImpl implements TlsSession
{
final byte[] sessionID;
SessionParameters sessionParameters;
TlsSessionImpl(byte[] sessionID, SessionParameters sessionParameters)
{
if (sessionID == null)
{
throw new IllegalArgumentException("'sessionID' cannot be null");
}
if (sessionID.length < 1 || sessionID.length > 32)
{
throw new IllegalArgumentException("'sessionID' must have length between 1 and 32 bytes, inclusive");
}
this.sessionID = Arrays.clone(sessionID);
this.sessionParameters = sessionParameters;
}
public synchronized SessionParameters exportSessionParameters()
{
return this.sessionParameters == null ? null : this.sessionParameters.copy();
}
public synchronized byte[] getSessionID()
{
return sessionID;
}
public synchronized void invalidate()
{
if (this.sessionParameters != null)
{
this.sessionParameters.clear();
this.sessionParameters = null;
}
}
public synchronized boolean isResumable()
{
return this.sessionParameters != null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy