Java 类org.bouncycastle.crypto.EphemeralKeyPair 实例源码

项目:ipack    文件:EphemeralKeyPairGenerator.java   
public EphemeralKeyPair generate()
{
    AsymmetricCipherKeyPair eph = gen.generateKeyPair();

    // Encode the ephemeral public key
     return new EphemeralKeyPair(eph, keyEncoder);
}
项目:gwt-crypto    文件:EphemeralKeyPairGenerator.java   
public EphemeralKeyPair generate()
{
    AsymmetricCipherKeyPair eph = gen.generateKeyPair();

    // Encode the ephemeral public key
     return new EphemeralKeyPair(eph, keyEncoder);
}
项目:Aki-SSL    文件:EphemeralKeyPairGenerator.java   
public EphemeralKeyPair generate()
{
    AsymmetricCipherKeyPair eph = gen.generateKeyPair();

    // Encode the ephemeral public key
     return new EphemeralKeyPair(eph, keyEncoder);
}
项目:TinyTravelTracker    文件:EphemeralKeyPairGenerator.java   
public EphemeralKeyPair generate()
{
    AsymmetricCipherKeyPair eph = gen.generateKeyPair();

    // Encode the ephemeral public key
     return new EphemeralKeyPair(eph, keyEncoder);
}
项目:CryptMeme    文件:EphemeralKeyPairGenerator.java   
public EphemeralKeyPair generate()
{
    AsymmetricCipherKeyPair eph = gen.generateKeyPair();

    // Encode the ephemeral public key
     return new EphemeralKeyPair(eph, keyEncoder);
}
项目:irma_future_id    文件:EphemeralKeyPairGenerator.java   
public EphemeralKeyPair generate()
{
    AsymmetricCipherKeyPair eph = gen.generateKeyPair();

    // Encode the ephemeral public key
     return new EphemeralKeyPair(eph, keyEncoder);
}
项目:bc-java    文件:EphemeralKeyPairGenerator.java   
public EphemeralKeyPair generate()
{
    AsymmetricCipherKeyPair eph = gen.generateKeyPair();

    // Encode the ephemeral public key
     return new EphemeralKeyPair(eph, keyEncoder);
}
项目:ipack    文件:IESEngine.java   
public byte[] processBlock(
    byte[] in,
    int inOff,
    int inLen)
    throws InvalidCipherTextException
{
    if (forEncryption)
    {
        if (keyPairGenerator != null)
        {
            EphemeralKeyPair ephKeyPair = keyPairGenerator.generate();

            this.privParam = ephKeyPair.getKeyPair().getPrivate();
            this.V = ephKeyPair.getEncodedPublicKey();
        }
    }
    else
    {
        if (keyParser != null)
        {
            ByteArrayInputStream bIn = new ByteArrayInputStream(in, inOff, inLen);

            try
            {
                this.pubParam = keyParser.readKey(bIn);
            }
            catch (IOException e)
            {
                throw new InvalidCipherTextException("unable to recover ephemeral public key: " + e.getMessage(), e);
            }

            int encLength = (inLen - bIn.available());
            this.V = Arrays.copyOfRange(in, inOff, inOff + encLength);
        }
    }

    // Compute the common value and convert to byte array. 
    agree.init(privParam);
    BigInteger z = agree.calculateAgreement(pubParam);
    byte[] Z = BigIntegers.asUnsignedByteArray(agree.getFieldSize(), z);

    // Create input to KDF.  
    byte[] VZ;
    if (V.length != 0)
    {
        VZ = new byte[V.length + Z.length];
        System.arraycopy(V, 0, VZ, 0, V.length);
        System.arraycopy(Z, 0, VZ, V.length, Z.length);
    }
    else
    {
        VZ = Z;
    }

    // Initialise the KDF.
    KDFParameters kdfParam = new KDFParameters(VZ, param.getDerivationV());
    kdf.init(kdfParam);

    return forEncryption
        ? encryptBlock(in, inOff, inLen)
        : decryptBlock(in, inOff, inLen);
}
项目:gwt-crypto    文件:IESEngine.java   
public byte[] processBlock(
    byte[] in,
    int inOff,
    int inLen)
    throws InvalidCipherTextException
{
    if (forEncryption)
    {
        if (keyPairGenerator != null)
        {
            EphemeralKeyPair ephKeyPair = keyPairGenerator.generate();

            this.privParam = ephKeyPair.getKeyPair().getPrivate();
            this.V = ephKeyPair.getEncodedPublicKey();
        }
    }
    else
    {
        if (keyParser != null)
        {
            ByteArrayInputStream bIn = new ByteArrayInputStream(in, inOff, inLen);

            try
            {
                this.pubParam = keyParser.readKey(bIn);
            }
            catch (IOException e)
            {
                throw new InvalidCipherTextException("unable to recover ephemeral public key: " + e.getMessage(), e);
            }

            int encLength = (inLen - bIn.available());
            this.V = Arrays.copyOfRange(in, inOff, inOff + encLength);
        }
    }

    // Compute the common value and convert to byte array. 
    agree.init(privParam);
    BigInteger z = agree.calculateAgreement(pubParam);
    byte[] Z = BigIntegers.asUnsignedByteArray(agree.getFieldSize(), z);

    // Create input to KDF.  
    if (V.length != 0)
    {
        byte[] VZ = Arrays.concatenate(V, Z);
        Arrays.fill(Z, (byte)0);
        Z = VZ;
    }

    try
    {
        // Initialise the KDF.
        KDFParameters kdfParam = new KDFParameters(Z, param.getDerivationV());
        kdf.init(kdfParam);

        return forEncryption
            ? encryptBlock(in, inOff, inLen)
            : decryptBlock(in, inOff, inLen);
    }
    finally
    {
        Arrays.fill(Z, (byte)0);
    }
}
项目:Aki-SSL    文件:IESEngine.java   
public byte[] processBlock(
    byte[] in,
    int inOff,
    int inLen)
    throws InvalidCipherTextException
{
    if (forEncryption)
    {
        if (keyPairGenerator != null)
        {
            EphemeralKeyPair ephKeyPair = keyPairGenerator.generate();

            this.privParam = ephKeyPair.getKeyPair().getPrivate();
            this.V = ephKeyPair.getEncodedPublicKey();
        }
    }
    else
    {
        if (keyParser != null)
        {
            ByteArrayInputStream bIn = new ByteArrayInputStream(in, inOff, inLen);

            try
            {
                this.pubParam = keyParser.readKey(bIn);
            }
            catch (IOException e)
            {
                throw new InvalidCipherTextException("unable to recover ephemeral public key: " + e.getMessage(), e);
            }

            int encLength = (inLen - bIn.available());
            this.V = Arrays.copyOfRange(in, inOff, inOff + encLength);
        }
    }

    // Compute the common value and convert to byte array. 
    agree.init(privParam);
    BigInteger z = agree.calculateAgreement(pubParam);
    byte[] Z = BigIntegers.asUnsignedByteArray(agree.getFieldSize(), z);

    // Create input to KDF.  
    if (V.length != 0)
    {
        byte[] VZ = Arrays.concatenate(V, Z);
        Arrays.fill(Z, (byte)0);
        Z = VZ;
    }

    try
    {
        // Initialise the KDF.
        KDFParameters kdfParam = new KDFParameters(Z, param.getDerivationV());
        kdf.init(kdfParam);

        return forEncryption
            ? encryptBlock(in, inOff, inLen)
            : decryptBlock(in, inOff, inLen);
    }
    finally
    {
        Arrays.fill(Z, (byte)0);
    }
}
项目:TinyTravelTracker    文件:IESEngine.java   
public byte[] processBlock(
    byte[] in,
    int inOff,
    int inLen)
    throws InvalidCipherTextException
{
    if (forEncryption)
    {
        if (keyPairGenerator != null)
        {
            EphemeralKeyPair ephKeyPair = keyPairGenerator.generate();

            this.privParam = ephKeyPair.getKeyPair().getPrivate();
            this.V = ephKeyPair.getEncodedPublicKey();
        }
    }
    else
    {
        if (keyParser != null)
        {
            ByteArrayInputStream bIn = new ByteArrayInputStream(in, inOff, inLen);

            try
            {
                this.pubParam = keyParser.readKey(bIn);
            }
            catch (IOException e)
            {
                throw new InvalidCipherTextException("unable to recover ephemeral public key: " + e.getMessage(), e);
            }

            int encLength = (inLen - bIn.available());
            this.V = Arrays.copyOfRange(in, inOff, inOff + encLength);
        }
    }

    // Compute the common value and convert to byte array. 
    agree.init(privParam);
    BigInteger z = agree.calculateAgreement(pubParam);
    byte[] Z = BigIntegers.asUnsignedByteArray(agree.getFieldSize(), z);

    // Create input to KDF.  
    if (V.length != 0)
    {
        byte[] VZ = Arrays.concatenate(V, Z);
        Arrays.fill(Z, (byte)0);
        Z = VZ;
    }

    try
    {
        // Initialise the KDF.
        KDFParameters kdfParam = new KDFParameters(Z, param.getDerivationV());
        kdf.init(kdfParam);

        return forEncryption
            ? encryptBlock(in, inOff, inLen)
            : decryptBlock(in, inOff, inLen);
    }
    finally
    {
        Arrays.fill(Z, (byte)0);
    }
}
项目:CryptMeme    文件:IESEngine.java   
public byte[] processBlock(
    byte[] in,
    int inOff,
    int inLen)
    throws InvalidCipherTextException
{
    if (forEncryption)
    {
        if (keyPairGenerator != null)
        {
            EphemeralKeyPair ephKeyPair = keyPairGenerator.generate();

            this.privParam = ephKeyPair.getKeyPair().getPrivate();
            this.V = ephKeyPair.getEncodedPublicKey();
        }
    }
    else
    {
        if (keyParser != null)
        {
            ByteArrayInputStream bIn = new ByteArrayInputStream(in, inOff, inLen);

            try
            {
                this.pubParam = keyParser.readKey(bIn);
            }
            catch (IOException e)
            {
                throw new InvalidCipherTextException("unable to recover ephemeral public key: " + e.getMessage(), e);
            }

            int encLength = (inLen - bIn.available());
            this.V = Arrays.copyOfRange(in, inOff, inOff + encLength);
        }
    }

    // Compute the common value and convert to byte array. 
    agree.init(privParam);
    BigInteger z = agree.calculateAgreement(pubParam);
    byte[] Z = BigIntegers.asUnsignedByteArray(agree.getFieldSize(), z);

    // Create input to KDF.  
    byte[] VZ;
    if (V.length != 0)
    {
        VZ = new byte[V.length + Z.length];
        System.arraycopy(V, 0, VZ, 0, V.length);
        System.arraycopy(Z, 0, VZ, V.length, Z.length);
    }
    else
    {
        VZ = Z;
    }

    // Initialise the KDF.
    KDFParameters kdfParam = new KDFParameters(VZ, param.getDerivationV());
    kdf.init(kdfParam);

    return forEncryption
        ? encryptBlock(in, inOff, inLen)
        : decryptBlock(in, inOff, inLen);
}
项目:irma_future_id    文件:IESEngine.java   
public byte[] processBlock(
    byte[] in,
    int inOff,
    int inLen)
    throws InvalidCipherTextException
{
    if (forEncryption)
    {
        if (keyPairGenerator != null)
        {
            EphemeralKeyPair ephKeyPair = keyPairGenerator.generate();

            this.privParam = ephKeyPair.getKeyPair().getPrivate();
            this.V = ephKeyPair.getEncodedPublicKey();
        }
    }
    else
    {
        if (keyParser != null)
        {
            ByteArrayInputStream bIn = new ByteArrayInputStream(in, inOff, inLen);

            try
            {
                this.pubParam = keyParser.readKey(bIn);
            }
            catch (IOException e)
            {
                throw new InvalidCipherTextException("unable to recover ephemeral public key: " + e.getMessage(), e);
            }

            int encLength = (inLen - bIn.available());
            this.V = Arrays.copyOfRange(in, inOff, inOff + encLength);
        }
    }

    // Compute the common value and convert to byte array. 
    agree.init(privParam);
    BigInteger z = agree.calculateAgreement(pubParam);
    byte[] Z = BigIntegers.asUnsignedByteArray(agree.getFieldSize(), z);

    // Create input to KDF.  
    byte[] VZ;
    if (V.length != 0)
    {
        VZ = new byte[V.length + Z.length];
        System.arraycopy(V, 0, VZ, 0, V.length);
        System.arraycopy(Z, 0, VZ, V.length, Z.length);
    }
    else
    {
        VZ = Z;
    }

    // Initialise the KDF.
    KDFParameters kdfParam = new KDFParameters(VZ, param.getDerivationV());
    kdf.init(kdfParam);

    return forEncryption
        ? encryptBlock(in, inOff, inLen)
        : decryptBlock(in, inOff, inLen);
}
项目:bc-java    文件:IESEngine.java   
public byte[] processBlock(
    byte[] in,
    int inOff,
    int inLen)
    throws InvalidCipherTextException
{
    if (forEncryption)
    {
        if (keyPairGenerator != null)
        {
            EphemeralKeyPair ephKeyPair = keyPairGenerator.generate();

            this.privParam = ephKeyPair.getKeyPair().getPrivate();
            this.V = ephKeyPair.getEncodedPublicKey();
        }
    }
    else
    {
        if (keyParser != null)
        {
            ByteArrayInputStream bIn = new ByteArrayInputStream(in, inOff, inLen);

            try
            {
                this.pubParam = keyParser.readKey(bIn);
            }
            catch (IOException e)
            {
                throw new InvalidCipherTextException("unable to recover ephemeral public key: " + e.getMessage(), e);
            }

            int encLength = (inLen - bIn.available());
            this.V = Arrays.copyOfRange(in, inOff, inOff + encLength);
        }
    }

    // Compute the common value and convert to byte array. 
    agree.init(privParam);
    BigInteger z = agree.calculateAgreement(pubParam);
    byte[] Z = BigIntegers.asUnsignedByteArray(agree.getFieldSize(), z);

    // Create input to KDF.  
    byte[] VZ;
    if (V.length != 0)
    {
        VZ = new byte[V.length + Z.length];
        System.arraycopy(V, 0, VZ, 0, V.length);
        System.arraycopy(Z, 0, VZ, V.length, Z.length);
    }
    else
    {
        VZ = Z;
    }

    // Initialise the KDF.
    KDFParameters kdfParam = new KDFParameters(VZ, param.getDerivationV());
    kdf.init(kdfParam);

    return forEncryption
        ? encryptBlock(in, inOff, inLen)
        : decryptBlock(in, inOff, inLen);
}