org.bouncycastle.tls.crypto.impl.bc.BcTlsEd25519Signer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bctls-jdk14 Show documentation
Show all versions of bctls-jdk14 Show documentation
The Bouncy Castle Java APIs for TLS and DTLS.
The newest version!
package org.bouncycastle.tls.crypto.impl.bc;
import java.io.IOException;
import org.bouncycastle.crypto.params.Ed25519PrivateKeyParameters;
import org.bouncycastle.crypto.signers.Ed25519Signer;
import org.bouncycastle.tls.SignatureAndHashAlgorithm;
import org.bouncycastle.tls.SignatureScheme;
import org.bouncycastle.tls.crypto.TlsStreamSigner;
public class BcTlsEd25519Signer
extends BcTlsSigner
{
public BcTlsEd25519Signer(BcTlsCrypto crypto, Ed25519PrivateKeyParameters privateKey)
{
super(crypto, privateKey);
}
public byte[] generateRawSignature(SignatureAndHashAlgorithm algorithm, byte[] hash) throws IOException
{
throw new UnsupportedOperationException();
}
public TlsStreamSigner getStreamSigner(SignatureAndHashAlgorithm algorithm)
{
if (algorithm == null || SignatureScheme.from(algorithm) != SignatureScheme.ed25519)
{
throw new IllegalStateException("Invalid algorithm: " + algorithm);
}
Ed25519Signer signer = new Ed25519Signer();
signer.init(true, privateKey);
return new BcTlsStreamSigner(signer);
}
}