Java 类java.security.KeyStore.LoadStoreParameter 实例源码

项目:vespa    文件:PemKeyStore.java   
/**
 * The user is responsible for closing any readers given in the parameter.
 */
@Override
public synchronized void engineLoad(LoadStoreParameter parameter) throws IOException {
    if (storeRole != null)
        throw new IllegalStateException("Already initialized.");

    if (parameter instanceof KeyStoreLoadParameter) {
        storeRole = new KeyStoreRole();
        loadKeyStore((KeyStoreLoadParameter) parameter);
    } else if (parameter instanceof TrustStoreLoadParameter) {
        storeRole = new TrustStoreRole();
        loadTrustStore((TrustStoreLoadParameter) parameter);
    } else {
        throw new IllegalArgumentException("Expected key store or trust store load parameter, got " + parameter.getClass());
    }
}
项目:In-the-Box-Fork    文件:TestKeyStoreSpi.java   
@Override
public void engineLoad(LoadStoreParameter param) throws IOException,
        NoSuchAlgorithmException, CertificateException {
    if (param == null) {
        engineLoad(null, null);
        return;
    }

    ProtectionParameter pParam = param.getProtectionParameter();
    if (pParam == null) {
        throw new NoSuchAlgorithmException();
    }

    if (pParam instanceof PasswordProtection) {
        char[] password = ((PasswordProtection) pParam).getPassword();
        if (password == null) {
            throw new NoSuchAlgorithmException();
        } else {
            return;
        }
    }
    throw new CertificateException();
}
项目:In-the-Box-Fork    文件:TestKeyStoreSpi.java   
@Override
public void engineStore(LoadStoreParameter param) throws IOException,
        NoSuchAlgorithmException, CertificateException {
    if (param == null) {
        throw new IOException();
    }

    ProtectionParameter pParam = param.getProtectionParameter();
    if (pParam instanceof PasswordProtection) {
        char[] password = ((PasswordProtection) pParam).getPassword();
        if (password == null) {
            throw new NoSuchAlgorithmException();
        } else if (password.length == 0) {
            throw new CertificateException();
        }
        return;
    }
    throw new UnsupportedOperationException();
}
项目:commons-eid    文件:BeIDKeyStore.java   
@Override
public void engineLoad(final LoadStoreParameter param)
        throws IOException, NoSuchAlgorithmException, CertificateException {
    LOGGER.debug("engineLoad"); /*
                                 * Allows for a KeyStore to be re-loaded
                                 * several times.
                                 */
    this.beIDCard = null;
    this.authnCertificateChain = null;
    this.signCertificateChain = null;
    this.rrnCertificateChain = null;
    this.authnCertificate = null;
    this.signCertificate = null;
    this.citizenCaCertificate = null;
    this.rootCaCertificate = null;
    this.rrnCertificate = null;
    if (null == param) {
        return;
    }
    if (param instanceof BeIDKeyStoreParameter) {
        this.keyStoreParameter = (BeIDKeyStoreParameter) param;
        return;
    }
    if (param instanceof JFrame) {
        this.keyStoreParameter = new BeIDKeyStoreParameter();
        JFrame frame = (JFrame) param;
        this.keyStoreParameter.setParentComponent(frame);
        return;
    }
    throw new NoSuchAlgorithmException();
}
项目:Aki-SSL    文件:PKCS12KeyStoreSpi.java   
public void engineStore(LoadStoreParameter param)
    throws IOException,
    NoSuchAlgorithmException, CertificateException
{
    if (param == null)
    {
        throw new IllegalArgumentException("'param' arg cannot be null");
    }

    if (!(param instanceof PKCS12StoreParameter || param instanceof JDKPKCS12StoreParameter))
    {
        throw new IllegalArgumentException(
            "No support for 'param' of type " + param.getClass().getName());
    }

    PKCS12StoreParameter bcParam;

    if (param instanceof PKCS12StoreParameter)
    {
        bcParam = (PKCS12StoreParameter)param;
    }
    else
    {
        bcParam = new PKCS12StoreParameter(((JDKPKCS12StoreParameter)param).getOutputStream(),
            param.getProtectionParameter(), ((JDKPKCS12StoreParameter)param).isUseDEREncoding());
    }

    char[] password;
    ProtectionParameter protParam = param.getProtectionParameter();
    if (protParam == null)
    {
        password = null;
    }
    else if (protParam instanceof KeyStore.PasswordProtection)
    {
        password = ((KeyStore.PasswordProtection)protParam).getPassword();
    }
    else
    {
        throw new IllegalArgumentException(
            "No support for protection parameter of type " + protParam.getClass().getName());
    }

    doStore(bcParam.getOutputStream(), password, bcParam.isForDEREncoding());
}
项目:commons-eid    文件:BeIDKeyStore.java   
@Override
public void engineStore(LoadStoreParameter param)
        throws IOException, NoSuchAlgorithmException, CertificateException {
    LOGGER.debug("engineStore");
    super.engineStore(param);
}
项目:opensc-java    文件:PKCS11RSAKeyPairGenParameterSpec.java   
public LoadStoreParameter getLoadStoreParameter()
{
    return this.loadStoreParameter;
}
项目:opensc-java    文件:PKCS11RSAKeyPairGenParameterSpec.java   
public void setLoadStoreParameter(LoadStoreParameter loadStoreParameter)
{
    this.loadStoreParameter = loadStoreParameter;
}
项目:opensc-java    文件:PKCS11DSAKeyPairGenParameterSpec.java   
public LoadStoreParameter getLoadStoreParameter()
{
    return this.loadStoreParameter;
}
项目:opensc-java    文件:PKCS11DSAKeyPairGenParameterSpec.java   
public void setLoadStoreParameter(LoadStoreParameter loadStoreParameter)
{
    this.loadStoreParameter = loadStoreParameter;
}
项目:RipplePower    文件:PKCS12KeyStoreSpi.java   
public void engineStore(LoadStoreParameter param)
    throws IOException,
    NoSuchAlgorithmException, CertificateException
{
    if (param == null)
    {
        throw new IllegalArgumentException("'param' arg cannot be null");
    }

    if (!(param instanceof PKCS12StoreParameter || param instanceof JDKPKCS12StoreParameter))
    {
        throw new IllegalArgumentException(
            "No support for 'param' of type " + param.getClass().getName());
    }

    PKCS12StoreParameter bcParam;

    if (param instanceof PKCS12StoreParameter)
    {
        bcParam = (PKCS12StoreParameter)param;
    }
    else
    {
        bcParam = new PKCS12StoreParameter(((JDKPKCS12StoreParameter)param).getOutputStream(),
            param.getProtectionParameter(), ((JDKPKCS12StoreParameter)param).isUseDEREncoding());
    }

    char[] password;
    ProtectionParameter protParam = param.getProtectionParameter();
    if (protParam == null)
    {
        password = null;
    }
    else if (protParam instanceof KeyStore.PasswordProtection)
    {
        password = ((KeyStore.PasswordProtection)protParam).getPassword();
    }
    else
    {
        throw new IllegalArgumentException(
            "No support for protection parameter of type " + protParam.getClass().getName());
    }

    doStore(bcParam.getOutputStream(), password, bcParam.isForDEREncoding());
}
项目:ripple-lib-java    文件:PKCS12KeyStoreSpi.java   
public void engineStore(LoadStoreParameter param)
    throws IOException,
    NoSuchAlgorithmException, CertificateException
{
    if (param == null)
    {
        throw new IllegalArgumentException("'param' arg cannot be null");
    }

    if (!(param instanceof PKCS12StoreParameter || param instanceof JDKPKCS12StoreParameter))
    {
        throw new IllegalArgumentException(
            "No support for 'param' of type " + param.getClass().getName());
    }

    PKCS12StoreParameter bcParam;

    if (param instanceof PKCS12StoreParameter)
    {
        bcParam = (PKCS12StoreParameter)param;
    }
    else
    {
        bcParam = new PKCS12StoreParameter(((JDKPKCS12StoreParameter)param).getOutputStream(),
            param.getProtectionParameter(), ((JDKPKCS12StoreParameter)param).isUseDEREncoding());
    }

    char[] password;
    ProtectionParameter protParam = param.getProtectionParameter();
    if (protParam == null)
    {
        password = null;
    }
    else if (protParam instanceof KeyStore.PasswordProtection)
    {
        password = ((KeyStore.PasswordProtection)protParam).getPassword();
    }
    else
    {
        throw new IllegalArgumentException(
            "No support for protection parameter of type " + protParam.getClass().getName());
    }

    doStore(bcParam.getOutputStream(), password, bcParam.isForDEREncoding());
}
项目:opensc-java    文件:PKCS11KeyPairGenParams.java   
/**
 * @param loadStoreParameter An optional {@link LoadStoreParameter} setting for
 *             opening a PKCS11 session in contexts, which require opening
 *             a new session is required.
 */
void setLoadStoreParameter(LoadStoreParameter loadStoreParameter);
项目:opensc-java    文件:PKCS11KeyPairGenParams.java   
/**
 * @return The optional LoadStoreParameter settings.
 */
LoadStoreParameter getLoadStoreParameter();