Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.bouncycastle.crypto.tls;
 
 
An implementation of TlsSRPIdentityManager that simulates the existence of "unknown" identities to obscure the fact that there is no verifier for them.
    implements TlsSRPIdentityManager
    private static final byte[] PREFIX_PASSWORD = Strings.toByteArray("password");
    private static final byte[] PREFIX_SALT = Strings.toByteArray("salt");

    
Create a SimulatedTlsSRPIdentityManager that implements the algorithm from RFC 5054 2.5.1.3

Parameters:
group the org.bouncycastle.crypto.params.SRP6GroupParameters defining the group that SRP is operating in
seedKey the secret "seed key" referred to in RFC 5054 2.5.1.3
Returns:
an instance of SimulatedTlsSRPIdentityManager
    public static SimulatedTlsSRPIdentityManager getRFC5054Default(SRP6GroupParameters groupbyte[] seedKey)
    {
        SRP6VerifierGenerator verifierGenerator = new SRP6VerifierGenerator();
        verifierGenerator.init(group, TlsUtils.createHash(.));
        HMac mac = new HMac(TlsUtils.createHash(.));
        mac.init(new KeyParameter(seedKey));
        return new SimulatedTlsSRPIdentityManager(groupverifierGeneratormac);
    }
    protected SRP6GroupParameters group;
    protected Mac mac;
    public SimulatedTlsSRPIdentityManager(SRP6GroupParameters groupSRP6VerifierGenerator verifierGeneratorMac mac)
    {
        this. = group;
        this. = verifierGenerator;
        this. = mac;
    }
    public TlsSRPLoginParameters getLoginParameters(byte[] identity)
    {
        .update(, 0, .);
        .update(identity, 0, identity.length);
        byte[] salt = new byte[.getMacSize()];
        .doFinal(salt, 0);
        .update(identity, 0, identity.length);
        byte[] password = new byte[.getMacSize()];
        .doFinal(password, 0);
        BigInteger verifier = .generateVerifier(saltidentitypassword);
        return new TlsSRPLoginParameters(verifiersalt);
    }
New to GrepCode? Check out our FAQ X