当前位置: 首页>>代码示例>>Java>>正文


Java SRP6Util类代码示例

本文整理汇总了Java中org.bouncycastle.crypto.agreement.srp.SRP6Util的典型用法代码示例。如果您正苦于以下问题:Java SRP6Util类的具体用法?Java SRP6Util怎么用?Java SRP6Util使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SRP6Util类属于org.bouncycastle.crypto.agreement.srp包,在下文中一共展示了SRP6Util类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processClientKeyExchange

import org.bouncycastle.crypto.agreement.srp.SRP6Util; //导入依赖的package包/类
public void processClientKeyExchange(InputStream input) throws IOException
{
    /*
     * RFC 5054 2.5.4: The server MUST abort the handshake with an "illegal_parameter" alert if
     * A % N = 0.
     */
    try
    {
        this.srpPeerCredentials = SRP6Util.validatePublicValue(srpGroup.getN(), TlsSRPUtils.readSRPParameter(input));
    }
    catch (CryptoException e)
    {
        throw new TlsFatalAlert(AlertDescription.illegal_parameter, e);
    }

    context.getSecurityParameters().srpIdentity = Arrays.clone(identity);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:18,代码来源:TlsSRPKeyExchange.java

示例2: processServerKeyExchange

import org.bouncycastle.crypto.agreement.srp.SRP6Util; //导入依赖的package包/类
public void processServerKeyExchange(InputStream input)
    throws IOException
{

    SecurityParameters securityParameters = context.getSecurityParameters();

    InputStream sigIn = input;
    Signer signer = null;

    if (tlsSigner != null)
    {
        signer = initVerifyer(tlsSigner, securityParameters);
        sigIn = new SignerInputStream(input, signer);
    }

    byte[] NBytes = TlsUtils.readOpaque16(sigIn);
    byte[] gBytes = TlsUtils.readOpaque16(sigIn);
    byte[] sBytes = TlsUtils.readOpaque8(sigIn);
    byte[] BBytes = TlsUtils.readOpaque16(sigIn);

    if (signer != null)
    {
        byte[] sigByte = TlsUtils.readOpaque16(input);

        if (!signer.verifySignature(sigByte))
        {
            throw new TlsFatalAlert(AlertDescription.decrypt_error);
        }
    }

    BigInteger N = new BigInteger(1, NBytes);
    BigInteger g = new BigInteger(1, gBytes);

    // TODO Validate group parameters (see RFC 5054)
    // handler.failWithError(AlertLevel.fatal, AlertDescription.insufficient_security);

    this.s = sBytes;

    /*
     * RFC 5054 2.5.3: The client MUST abort the handshake with an "illegal_parameter" alert if
     * B % N = 0.
     */
    try
    {
        this.B = SRP6Util.validatePublicValue(N, new BigInteger(1, BBytes));
    }
    catch (CryptoException e)
    {
        throw new TlsFatalAlert(AlertDescription.illegal_parameter);
    }

    this.srpClient.init(N, g, new SHA1Digest(), context.getSecureRandom());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:54,代码来源:TlsSRPKeyExchange.java

示例3: generateClientCredentials

import org.bouncycastle.crypto.agreement.srp.SRP6Util; //导入依赖的package包/类
public byte[] generateClientCredentials() {
    return generateClientCredentials(SRP6Util.generatePrivateValue(digest, N, g, random));
}
 
开发者ID:horrorho,项目名称:InflatableDonkey,代码行数:4,代码来源:SRPClient.java

示例4: processServerKeyExchange

import org.bouncycastle.crypto.agreement.srp.SRP6Util; //导入依赖的package包/类
public void processServerKeyExchange(InputStream is, SecurityParameters securityParameters)
        throws IOException
    {
        InputStream sigIn = is;
        Signer signer = null;

        if (tlsSigner != null)
        {
            signer = initSigner(tlsSigner, securityParameters);
            sigIn = new SignerInputStream(is, signer);
        }

        byte[] NBytes = TlsUtils.readOpaque16(sigIn);
        byte[] gBytes = TlsUtils.readOpaque16(sigIn);
        byte[] sBytes = TlsUtils.readOpaque8(sigIn);
        byte[] BBytes = TlsUtils.readOpaque16(sigIn);

        if (signer != null)
        {
            byte[] sigByte = TlsUtils.readOpaque16(is);

            if (!signer.verifySignature(sigByte))
            {
                handler.failWithError(TlsProtocolHandler.AL_fatal,
                    TlsProtocolHandler.AP_bad_certificate);
            }
        }

        BigInteger N = new BigInteger(1, NBytes);
        BigInteger g = new BigInteger(1, gBytes);

        // TODO Validate group parameters (see RFC 5054)
//        handler.failWithError(TlsProtocolHandler.AL_fatal,
//            TlsProtocolHandler.AP_insufficient_security);

        this.s = sBytes;

        /*
         * RFC 5054 2.5.3: The client MUST abort the handshake with an "illegal_parameter"
         * alert if B % N = 0.
         */
        try
        {
            this.B = SRP6Util.validatePublicValue(N, new BigInteger(1, BBytes));
        }
        catch (CryptoException e)
        {
            handler.failWithError(TlsProtocolHandler.AL_fatal,
                TlsProtocolHandler.AP_illegal_parameter);
        }

        this.srpClient.init(N, g, new SHA1Digest(), handler.getRandom());
    }
 
开发者ID:coova,项目名称:jradius,代码行数:54,代码来源:TlsSRPKeyExchange.java


注:本文中的org.bouncycastle.crypto.agreement.srp.SRP6Util类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。