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

org.bouncycastle.jcajce.BCFKSStoreParameter Maven / Gradle / Ivy

Go to download

The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.5 to JDK 1.7. Note: this package includes the IDEA and NTRU encryption algorithms.

There is a newer version: 1.70
Show newest version
package org.bouncycastle.jcajce;

import java.io.OutputStream;
import java.security.KeyStore;

import org.bouncycastle.crypto.util.PBKDFConfig;

/**
 * LoadStoreParameter to allow configuring of the PBKDF used to generate encryption keys for
 * use in the keystore.
 */
public class BCFKSStoreParameter
    implements KeyStore.LoadStoreParameter
{
    private final KeyStore.ProtectionParameter protectionParameter;
    private final PBKDFConfig storeConfig;

    private OutputStream out;

    public BCFKSStoreParameter(OutputStream out, PBKDFConfig storeConfig, char[] password)
    {
        this(out, storeConfig, new KeyStore.PasswordProtection(password));
    }

    public BCFKSStoreParameter(OutputStream out, PBKDFConfig storeConfig, KeyStore.ProtectionParameter protectionParameter)
    {
        this.out = out;
        this.storeConfig = storeConfig;
        this.protectionParameter = protectionParameter;
    }

    public KeyStore.ProtectionParameter getProtectionParameter()
    {
        return protectionParameter;
    }

    public OutputStream getOutputStream()
    {
        return out;
    }

    /**
     * Return the PBKDF used for generating the HMAC and store encryption keys.
     *
     * @return the PBKDF to use for deriving HMAC and store encryption keys.
     */
    public PBKDFConfig getStorePBKDFConfig()
    {
        return storeConfig;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy