Java 类org.bouncycastle.crypto.params.DHKeyGenerationParameters 实例源码

项目:ipack    文件:KeyPairGeneratorSpi.java   
public void initialize(
    AlgorithmParameterSpec params,
    SecureRandom random)
    throws InvalidAlgorithmParameterException
{
    if (!(params instanceof DHParameterSpec))
    {
        throw new InvalidAlgorithmParameterException("parameter object not a DHParameterSpec");
    }
    DHParameterSpec dhParams = (DHParameterSpec)params;

    param = new DHKeyGenerationParameters(random, new DHParameters(dhParams.getP(), dhParams.getG(), null, dhParams.getL()));

    engine.init(param);
    initialised = true;
}
项目:gwt-crypto    文件:DHTest.java   
private void testBounds()
{
     BigInteger p1 = new BigInteger("00C8028E9151C6B51BCDB35C1F6B2527986A72D8546AE7A4BF41DC4289FF9837EE01592D36C324A0F066149B8B940C86C87D194206A39038AE3396F8E12435BB74449B70222D117B8A2BB77CB0D67A5D664DDE7B75E0FEC13CE0CAF258DAF3ADA0773F6FF0F2051D1859929AAA53B07809E496B582A89C3D7DA8B6E38305626621", 16);
     BigInteger g1 = new BigInteger("1F869713181464577FE4026B47102FA0D7675503A4FCDA810881FAEC3524E6DBAEA9B96561EF7F8BEA76466DF11C2F3EB1A90CC5851735BF860606481257EECE6418C0204E61004E85D7131CE54BCBC7AD67E53C79DCB715E7C8D083DCD85D728283EC8F96839B4C9FA7C0727C472BEB94E4613CAFA8D580119C0AF4BF8AF252", 16);
     int l1 = 1023;

     BigInteger p2 = new BigInteger("00B333C98720220CC3946F494E25231B3E19F9AD5F6B19F4E7ABF80D8826C491C3224D4F7415A14A7C11D1BE584405FED12C3554F103E56A72D986CA5E325BB9DE07AC37D1EAE5E5AC724D32EF638F0E4462D4C1FC7A45B9FD3A5DF5EC36A1FA4DAA3FBB66AA42B1B71DF416AB547E987513426C7BB8634F5F4D37705514FDC1E1", 16);
     BigInteger g2 = new BigInteger("2592F5A99FE46313650CCE66C94C15DBED9F4A45BD05C329986CF5D3E12139F0405A47C6385FEA27BFFEDC4CBABC5BB151F3BEE7CC3D51567F1E2B12A975AA9F48A70BDAAE7F5B87E70ADCF902490A3CBEFEDA41EBA8E12E02B56120B5FDEFBED07F5EAD3AE020DF3C8233216F8F0D35E13A7AE4DA5CBCC0D91EADBF20C281C6", 16);
     int l2 = 1024;

    DHKeyGenerationParameters   params1 = new DHKeyGenerationParameters(new SecureRandom(), new DHParameters(p1, g1, null, l1));
    DHKeyGenerationParameters   params2 = new DHKeyGenerationParameters(new SecureRandom(), new DHParameters(p2, g2, null, l2));

    DHBasicKeyPairGenerator     kpGen = new DHBasicKeyPairGenerator();

    kpGen.init(params1);
    kpGen.init(params2);
}
项目:Aki-SSL    文件:KeyPairGeneratorSpi.java   
public void initialize(
    AlgorithmParameterSpec params,
    SecureRandom random)
    throws InvalidAlgorithmParameterException
{
    if (!(params instanceof DHParameterSpec))
    {
        throw new InvalidAlgorithmParameterException("parameter object not a DHParameterSpec");
    }
    DHParameterSpec dhParams = (DHParameterSpec)params;

    param = new DHKeyGenerationParameters(random, new DHParameters(dhParams.getP(), dhParams.getG(), null, dhParams.getL()));

    engine.init(param);
    initialised = true;
}
项目:CryptMeme    文件:KeyPairGeneratorSpi.java   
public void initialize(
    AlgorithmParameterSpec params,
    SecureRandom random)
    throws InvalidAlgorithmParameterException
{
    if (!(params instanceof DHParameterSpec))
    {
        throw new InvalidAlgorithmParameterException("parameter object not a DHParameterSpec");
    }
    DHParameterSpec dhParams = (DHParameterSpec)params;

    param = new DHKeyGenerationParameters(random, new DHParameters(dhParams.getP(), dhParams.getG(), null, dhParams.getL()));

    engine.init(param);
    initialised = true;
}
项目:irma_future_id    文件:DHTest.java   
private void testBounds()
{
     BigInteger p1 = new BigInteger("00C8028E9151C6B51BCDB35C1F6B2527986A72D8546AE7A4BF41DC4289FF9837EE01592D36C324A0F066149B8B940C86C87D194206A39038AE3396F8E12435BB74449B70222D117B8A2BB77CB0D67A5D664DDE7B75E0FEC13CE0CAF258DAF3ADA0773F6FF0F2051D1859929AAA53B07809E496B582A89C3D7DA8B6E38305626621", 16);
     BigInteger g1 = new BigInteger("1F869713181464577FE4026B47102FA0D7675503A4FCDA810881FAEC3524E6DBAEA9B96561EF7F8BEA76466DF11C2F3EB1A90CC5851735BF860606481257EECE6418C0204E61004E85D7131CE54BCBC7AD67E53C79DCB715E7C8D083DCD85D728283EC8F96839B4C9FA7C0727C472BEB94E4613CAFA8D580119C0AF4BF8AF252", 16);
     int l1 = 1023;

     BigInteger p2 = new BigInteger("00B333C98720220CC3946F494E25231B3E19F9AD5F6B19F4E7ABF80D8826C491C3224D4F7415A14A7C11D1BE584405FED12C3554F103E56A72D986CA5E325BB9DE07AC37D1EAE5E5AC724D32EF638F0E4462D4C1FC7A45B9FD3A5DF5EC36A1FA4DAA3FBB66AA42B1B71DF416AB547E987513426C7BB8634F5F4D37705514FDC1E1", 16);
     BigInteger g2 = new BigInteger("2592F5A99FE46313650CCE66C94C15DBED9F4A45BD05C329986CF5D3E12139F0405A47C6385FEA27BFFEDC4CBABC5BB151F3BEE7CC3D51567F1E2B12A975AA9F48A70BDAAE7F5B87E70ADCF902490A3CBEFEDA41EBA8E12E02B56120B5FDEFBED07F5EAD3AE020DF3C8233216F8F0D35E13A7AE4DA5CBCC0D91EADBF20C281C6", 16);
     int l2 = 1024;

    DHKeyGenerationParameters   params1 = new DHKeyGenerationParameters(new SecureRandom(), new DHParameters(p1, g1, null, l1));
    DHKeyGenerationParameters   params2 = new DHKeyGenerationParameters(new SecureRandom(), new DHParameters(p2, g2, null, l2));

    DHBasicKeyPairGenerator     kpGen = new DHBasicKeyPairGenerator();

    kpGen.init(params1);
    kpGen.init(params2);
}
项目:irma_future_id    文件:KeyPairGeneratorSpi.java   
public void initialize(
    AlgorithmParameterSpec params,
    SecureRandom random)
    throws InvalidAlgorithmParameterException
{
    if (!(params instanceof DHParameterSpec))
    {
        throw new InvalidAlgorithmParameterException("parameter object not a DHParameterSpec");
    }
    DHParameterSpec dhParams = (DHParameterSpec)params;

    param = new DHKeyGenerationParameters(random, new DHParameters(dhParams.getP(), dhParams.getG(), null, dhParams.getL()));

    engine.init(param);
    initialised = true;
}
项目:bc-java    文件:DHTest.java   
private void testBounds()
{
     BigInteger p1 = new BigInteger("00C8028E9151C6B51BCDB35C1F6B2527986A72D8546AE7A4BF41DC4289FF9837EE01592D36C324A0F066149B8B940C86C87D194206A39038AE3396F8E12435BB74449B70222D117B8A2BB77CB0D67A5D664DDE7B75E0FEC13CE0CAF258DAF3ADA0773F6FF0F2051D1859929AAA53B07809E496B582A89C3D7DA8B6E38305626621", 16);
     BigInteger g1 = new BigInteger("1F869713181464577FE4026B47102FA0D7675503A4FCDA810881FAEC3524E6DBAEA9B96561EF7F8BEA76466DF11C2F3EB1A90CC5851735BF860606481257EECE6418C0204E61004E85D7131CE54BCBC7AD67E53C79DCB715E7C8D083DCD85D728283EC8F96839B4C9FA7C0727C472BEB94E4613CAFA8D580119C0AF4BF8AF252", 16);
     int l1 = 1023;

     BigInteger p2 = new BigInteger("00B333C98720220CC3946F494E25231B3E19F9AD5F6B19F4E7ABF80D8826C491C3224D4F7415A14A7C11D1BE584405FED12C3554F103E56A72D986CA5E325BB9DE07AC37D1EAE5E5AC724D32EF638F0E4462D4C1FC7A45B9FD3A5DF5EC36A1FA4DAA3FBB66AA42B1B71DF416AB547E987513426C7BB8634F5F4D37705514FDC1E1", 16);
     BigInteger g2 = new BigInteger("2592F5A99FE46313650CCE66C94C15DBED9F4A45BD05C329986CF5D3E12139F0405A47C6385FEA27BFFEDC4CBABC5BB151F3BEE7CC3D51567F1E2B12A975AA9F48A70BDAAE7F5B87E70ADCF902490A3CBEFEDA41EBA8E12E02B56120B5FDEFBED07F5EAD3AE020DF3C8233216F8F0D35E13A7AE4DA5CBCC0D91EADBF20C281C6", 16);
     int l2 = 1024;

    DHKeyGenerationParameters   params1 = new DHKeyGenerationParameters(new SecureRandom(), new DHParameters(p1, g1, null, l1));
    DHKeyGenerationParameters   params2 = new DHKeyGenerationParameters(new SecureRandom(), new DHParameters(p2, g2, null, l2));

    DHBasicKeyPairGenerator     kpGen = new DHBasicKeyPairGenerator();

    kpGen.init(params1);
    kpGen.init(params2);
}
项目:bc-java    文件:KeyPairGeneratorSpi.java   
public void initialize(
    AlgorithmParameterSpec params,
    SecureRandom random)
    throws InvalidAlgorithmParameterException
{
    if (!(params instanceof DHParameterSpec))
    {
        throw new InvalidAlgorithmParameterException("parameter object not a DHParameterSpec");
    }
    DHParameterSpec dhParams = (DHParameterSpec)params;

    param = new DHKeyGenerationParameters(random, new DHParameters(dhParams.getP(), dhParams.getG(), null, dhParams.getL()));

    engine.init(param);
    initialised = true;
}
项目:jradius    文件:TlsDHKeyExchange.java   
public byte[] generateClientKeyExchange() throws IOException
    {
        // TODO RFC 2246 7.4.72
        /*
         * If the client certificate already contains a suitable Diffie-Hellman key, then
         * Yc is implicit and does not need to be sent again. In this case, the Client Key
         * Exchange message will be sent, but will be empty.
         */
//        return new byte[0];

        /*
         * Generate a keypair (using parameters from server key) and send the public value
         * to the server.
         */
        DHBasicKeyPairGenerator dhGen = new DHBasicKeyPairGenerator();
        dhGen.init(new DHKeyGenerationParameters(handler.getRandom(),
            dhAgreeServerPublicKey.getParameters()));
        this.dhAgreeClientKeyPair = dhGen.generateKeyPair();
        BigInteger Yc = ((DHPublicKeyParameters)dhAgreeClientKeyPair.getPublic()).getY();
        return BigIntegers.asUnsignedByteArray(Yc);
    }
项目:ipack    文件:TlsDHEKeyExchange.java   
public byte[] generateServerKeyExchange()
    throws IOException
{

    if (this.dhParameters == null)
    {
        throw new TlsFatalAlert(AlertDescription.internal_error);
    }

    ByteArrayOutputStream buf = new ByteArrayOutputStream();

    DHKeyPairGenerator kpg = new DHKeyPairGenerator();
    kpg.init(new DHKeyGenerationParameters(context.getSecureRandom(), this.dhParameters));
    AsymmetricCipherKeyPair kp = kpg.generateKeyPair();

    BigInteger Ys = ((DHPublicKeyParameters)kp.getPublic()).getY();

    TlsDHUtils.writeDHParameter(dhParameters.getP(), buf);
    TlsDHUtils.writeDHParameter(dhParameters.getG(), buf);
    TlsDHUtils.writeDHParameter(Ys, buf);

    byte[] digestInput = buf.toByteArray();

    Digest d = new CombinedHash();
    SecurityParameters securityParameters = context.getSecurityParameters();
    d.update(securityParameters.clientRandom, 0, securityParameters.clientRandom.length);
    d.update(securityParameters.serverRandom, 0, securityParameters.serverRandom.length);
    d.update(digestInput, 0, digestInput.length);

    byte[] hash = new byte[d.getDigestSize()];
    d.doFinal(hash, 0);

    byte[] sigBytes = serverCredentials.generateCertificateSignature(hash);
    /*
     * TODO RFC 5246 4.7. digitally-signed element needs SignatureAndHashAlgorithm prepended from TLS 1.2
     */
    TlsUtils.writeOpaque16(sigBytes, buf);

    return buf.toByteArray();
}
项目:ipack    文件:TlsDHUtils.java   
public static AsymmetricCipherKeyPair generateDHKeyPair(SecureRandom random,
                                                        DHParameters dhParams)
{
    DHBasicKeyPairGenerator dhGen = new DHBasicKeyPairGenerator();
    dhGen.init(new DHKeyGenerationParameters(random, dhParams));
    return dhGen.generateKeyPair();
}
项目:ipack    文件:DHAgreement.java   
/**
 * calculate our initial message.
 */
public BigInteger calculateMessage()
{
    DHKeyPairGenerator dhGen = new DHKeyPairGenerator();
    dhGen.init(new DHKeyGenerationParameters(random, dhParams));
    AsymmetricCipherKeyPair dhPair = dhGen.generateKeyPair();

    this.privateValue = ((DHPrivateKeyParameters)dhPair.getPrivate()).getX();

    return ((DHPublicKeyParameters)dhPair.getPublic()).getY();
}
项目:gwt-crypto    文件:DHAgreement.java   
/**
 * calculate our initial message.
 */
public BigInteger calculateMessage()
{
    DHKeyPairGenerator dhGen = new DHKeyPairGenerator();
    dhGen.init(new DHKeyGenerationParameters(random, dhParams));
    AsymmetricCipherKeyPair dhPair = dhGen.generateKeyPair();

    this.privateValue = ((DHPrivateKeyParameters)dhPair.getPrivate()).getX();

    return ((DHPublicKeyParameters)dhPair.getPublic()).getY();
}
项目:gwt-crypto    文件:DHTest.java   
private DHBasicKeyPairGenerator getDHBasicKeyPairGenerator(
    BigInteger g,
    BigInteger p,
    int        privateValueSize)
{
    DHParameters                dhParams = new DHParameters(p, g, null, privateValueSize);
    DHKeyGenerationParameters   params = new DHKeyGenerationParameters(new SecureRandom(), dhParams);
    DHBasicKeyPairGenerator     kpGen = new DHBasicKeyPairGenerator();

    kpGen.init(params);

    return kpGen;
}
项目:gwt-crypto    文件:DHTest.java   
private DHKeyPairGenerator getDHKeyPairGenerator(
    BigInteger g,
    BigInteger p)
{
    DHParameters                dhParams = new DHParameters(p, g);
    DHKeyGenerationParameters   params = new DHKeyGenerationParameters(new SecureRandom(), dhParams);
    DHKeyPairGenerator          kpGen = new DHKeyPairGenerator();

    kpGen.init(params);

    return kpGen;
}
项目:Aki-SSL    文件:DHAgreement.java   
/**
 * calculate our initial message.
 */
public BigInteger calculateMessage()
{
    DHKeyPairGenerator dhGen = new DHKeyPairGenerator();
    dhGen.init(new DHKeyGenerationParameters(random, dhParams));
    AsymmetricCipherKeyPair dhPair = dhGen.generateKeyPair();

    this.privateValue = ((DHPrivateKeyParameters)dhPair.getPrivate()).getX();

    return ((DHPublicKeyParameters)dhPair.getPublic()).getY();
}
项目:TinyTravelTracker    文件:DHAgreement.java   
/**
 * calculate our initial message.
 */
public BigInteger calculateMessage()
{
    DHKeyPairGenerator dhGen = new DHKeyPairGenerator();
    dhGen.init(new DHKeyGenerationParameters(random, dhParams));
    AsymmetricCipherKeyPair dhPair = dhGen.generateKeyPair();

    this.privateValue = ((DHPrivateKeyParameters)dhPair.getPrivate()).getX();

    return ((DHPublicKeyParameters)dhPair.getPublic()).getY();
}
项目:CryptMeme    文件:DHAgreement.java   
/**
 * calculate our initial message.
 */
public BigInteger calculateMessage()
{
    DHKeyPairGenerator dhGen = new DHKeyPairGenerator();
    dhGen.init(new DHKeyGenerationParameters(random, dhParams));
    AsymmetricCipherKeyPair dhPair = dhGen.generateKeyPair();

    this.privateValue = ((DHPrivateKeyParameters)dhPair.getPrivate()).getX();

    return ((DHPublicKeyParameters)dhPair.getPublic()).getY();
}
项目:irma_future_id    文件:DHAgreement.java   
/**
 * calculate our initial message.
 */
public BigInteger calculateMessage()
{
    DHKeyPairGenerator dhGen = new DHKeyPairGenerator();
    dhGen.init(new DHKeyGenerationParameters(random, dhParams));
    AsymmetricCipherKeyPair dhPair = dhGen.generateKeyPair();

    this.privateValue = ((DHPrivateKeyParameters)dhPair.getPrivate()).getX();

    return ((DHPublicKeyParameters)dhPair.getPublic()).getY();
}
项目:irma_future_id    文件:DHTest.java   
private DHBasicKeyPairGenerator getDHBasicKeyPairGenerator(
    BigInteger g,
    BigInteger p,
    int        privateValueSize)
{
    DHParameters                dhParams = new DHParameters(p, g, null, privateValueSize);
    DHKeyGenerationParameters   params = new DHKeyGenerationParameters(new SecureRandom(), dhParams);
    DHBasicKeyPairGenerator     kpGen = new DHBasicKeyPairGenerator();

    kpGen.init(params);

    return kpGen;
}
项目:irma_future_id    文件:DHTest.java   
private DHKeyPairGenerator getDHKeyPairGenerator(
    BigInteger g,
    BigInteger p)
{
    DHParameters                dhParams = new DHParameters(p, g);
    DHKeyGenerationParameters   params = new DHKeyGenerationParameters(new SecureRandom(), dhParams);
    DHKeyPairGenerator          kpGen = new DHKeyPairGenerator();

    kpGen.init(params);

    return kpGen;
}
项目:bc-java    文件:DHAgreement.java   
/**
 * calculate our initial message.
 */
public BigInteger calculateMessage()
{
    DHKeyPairGenerator dhGen = new DHKeyPairGenerator();
    dhGen.init(new DHKeyGenerationParameters(random, dhParams));
    AsymmetricCipherKeyPair dhPair = dhGen.generateKeyPair();

    this.privateValue = ((DHPrivateKeyParameters)dhPair.getPrivate()).getX();

    return ((DHPublicKeyParameters)dhPair.getPublic()).getY();
}
项目:bc-java    文件:DHTest.java   
private DHBasicKeyPairGenerator getDHBasicKeyPairGenerator(
    BigInteger g,
    BigInteger p,
    int        privateValueSize)
{
    DHParameters                dhParams = new DHParameters(p, g, null, privateValueSize);
    DHKeyGenerationParameters   params = new DHKeyGenerationParameters(new SecureRandom(), dhParams);
    DHBasicKeyPairGenerator     kpGen = new DHBasicKeyPairGenerator();

    kpGen.init(params);

    return kpGen;
}
项目:bc-java    文件:DHTest.java   
private DHKeyPairGenerator getDHKeyPairGenerator(
    BigInteger g,
    BigInteger p)
{
    DHParameters                dhParams = new DHParameters(p, g);
    DHKeyGenerationParameters   params = new DHKeyGenerationParameters(new SecureRandom(), dhParams);
    DHKeyPairGenerator          kpGen = new DHKeyPairGenerator();

    kpGen.init(params);

    return kpGen;
}
项目:ipack    文件:DHKeyPairGenerator.java   
public void init(
    KeyGenerationParameters param)
{
    this.param = (DHKeyGenerationParameters)param;
}
项目:ipack    文件:DHBasicKeyPairGenerator.java   
public void init(
    KeyGenerationParameters param)
{
    this.param = (DHKeyGenerationParameters)param;
}
项目:Direct-File-Downloader    文件:DHKeyPairGenerator.java   
public void init(
    KeyGenerationParameters param)
{
    this.param = (DHKeyGenerationParameters)param;
}
项目:Direct-File-Downloader    文件:DHBasicKeyPairGenerator.java   
public void init(
    KeyGenerationParameters param)
{
    this.param = (DHKeyGenerationParameters)param;
}
项目:gwt-crypto    文件:TlsDHUtils.java   
public static AsymmetricCipherKeyPair generateDHKeyPair(SecureRandom random, DHParameters dhParams)
{
    DHBasicKeyPairGenerator dhGen = new DHBasicKeyPairGenerator();
    dhGen.init(new DHKeyGenerationParameters(random, dhParams));
    return dhGen.generateKeyPair();
}
项目:gwt-crypto    文件:DHKeyPairGenerator.java   
public void init(
    KeyGenerationParameters param)
{
    this.param = (DHKeyGenerationParameters)param;
}
项目:gwt-crypto    文件:DHBasicKeyPairGenerator.java   
public void init(
    KeyGenerationParameters param)
{
    this.param = (DHKeyGenerationParameters)param;
}
项目:Aki-SSL    文件:TlsDHUtils.java   
public static AsymmetricCipherKeyPair generateDHKeyPair(SecureRandom random, DHParameters dhParams)
{
    DHBasicKeyPairGenerator dhGen = new DHBasicKeyPairGenerator();
    dhGen.init(new DHKeyGenerationParameters(random, dhParams));
    return dhGen.generateKeyPair();
}
项目:Aki-SSL    文件:DHKeyPairGenerator.java   
public void init(
    KeyGenerationParameters param)
{
    this.param = (DHKeyGenerationParameters)param;
}
项目:Aki-SSL    文件:DHBasicKeyPairGenerator.java   
public void init(
    KeyGenerationParameters param)
{
    this.param = (DHKeyGenerationParameters)param;
}
项目:TinyTravelTracker    文件:TlsDHUtils.java   
public static AsymmetricCipherKeyPair generateDHKeyPair(SecureRandom random, DHParameters dhParams)
{
    DHBasicKeyPairGenerator dhGen = new DHBasicKeyPairGenerator();
    dhGen.init(new DHKeyGenerationParameters(random, dhParams));
    return dhGen.generateKeyPair();
}
项目:TinyTravelTracker    文件:DHKeyPairGenerator.java   
public void init(
    KeyGenerationParameters param)
{
    this.param = (DHKeyGenerationParameters)param;
}
项目:TinyTravelTracker    文件:DHBasicKeyPairGenerator.java   
public void init(
    KeyGenerationParameters param)
{
    this.param = (DHKeyGenerationParameters)param;
}
项目:AcademicTorrents-Downloader    文件:DHKeyPairGenerator.java   
public void init(
    KeyGenerationParameters param)
{
    this.param = (DHKeyGenerationParameters)param;
}
项目:AcademicTorrents-Downloader    文件:DHBasicKeyPairGenerator.java   
public void init(
    KeyGenerationParameters param)
{
    this.param = (DHKeyGenerationParameters)param;
}
项目:CryptMeme    文件:TlsDHUtils.java   
public static AsymmetricCipherKeyPair generateDHKeyPair(SecureRandom random, DHParameters dhParams)
{
    DHBasicKeyPairGenerator dhGen = new DHBasicKeyPairGenerator();
    dhGen.init(new DHKeyGenerationParameters(random, dhParams));
    return dhGen.generateKeyPair();
}