All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bouncycastle.tls.crypto.impl.bc.BcTlsSRP6Server Maven / Gradle / Ivy

Go to download

The Bouncy Castle Java APIs for the TLS, including a JSSE provider. The APIs are designed primarily to be used in conjunction with the BC LTS provider but may also be used with other providers providing cryptographic services.

There is a newer version: 2.73.7
Show newest version
package org.bouncycastle.tls.crypto.impl.bc;

import java.io.IOException;
import java.math.BigInteger;

import org.bouncycastle.crypto.CryptoException;
import org.bouncycastle.crypto.agreement.srp.SRP6Server;
import org.bouncycastle.tls.AlertDescription;
import org.bouncycastle.tls.TlsFatalAlert;
import org.bouncycastle.tls.crypto.TlsSRP6Server;

final class BcTlsSRP6Server
    implements TlsSRP6Server
{
    private final SRP6Server srp6Server;

    BcTlsSRP6Server(SRP6Server srp6Server)
    {
        this.srp6Server = srp6Server;
    }

    public BigInteger generateServerCredentials()
    {
        return srp6Server.generateServerCredentials();
    }

    public BigInteger calculateSecret(BigInteger clientA)
        throws IOException
    {
        try
        {
            return srp6Server.calculateSecret(clientA);
        }
        catch (CryptoException e)
        {
            throw new TlsFatalAlert(AlertDescription.illegal_parameter, e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy