org.bouncycastle.tls.crypto.impl.bc.BcTlsStreamSigner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of impersonator Show documentation
Show all versions of impersonator Show documentation
Spoof TLS/JA3/JA4 and HTTP/2 fingerprints in Java
The newest version!
package org.bouncycastle.tls.crypto.impl.bc;
import java.io.IOException;
import java.io.OutputStream;
import org.bouncycastle.crypto.CryptoException;
import org.bouncycastle.crypto.Signer;
import org.bouncycastle.crypto.io.SignerOutputStream;
import org.bouncycastle.tls.AlertDescription;
import org.bouncycastle.tls.TlsFatalAlert;
import org.bouncycastle.tls.crypto.TlsStreamSigner;
class BcTlsStreamSigner
implements TlsStreamSigner
{
private final SignerOutputStream output;
BcTlsStreamSigner(Signer signer)
{
this.output = new SignerOutputStream(signer);
}
public OutputStream getOutputStream() throws IOException
{
return output;
}
public byte[] getSignature() throws IOException
{
try
{
return output.getSigner().generateSignature();
}
catch (CryptoException e)
{
throw new TlsFatalAlert(AlertDescription.internal_error, e);
}
}
}