Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.google.code.springcryptoutils.core.key;
 
 
 import java.security.*;

A spring bean factory for retrieving secret keys from a keystore reference.

Author(s):
Mirko Caserta (mirko.caserta@gmail.com)
public class SecretKeyFactoryBean implements FactoryBeanInitializingBean {
    private KeyStore keystore;
    private String alias;
    private String password;
    private Key key;

    
Sets the keystore holding the secret key.

Parameters:
keystore the keystore
    public void setKeystore(KeyStore keystore) {
        this. = keystore;
    }

    
Sets the key alias as known in the keystore.

Parameters:
alias the key alias
    public void setAlias(String alias) {
        this. = alias;
    }

    
Sets the password used to read the key from the keystore.

Parameters:
password the password
    public void setPassword(String password) {
        this. = password;
    }
    public Object getObject() {
        return ;
    }
    public Class getObjectType() {
        return Key.class;
    }
    public boolean isSingleton() {
        return true;
    }
         = .getKey(.toCharArray());
        if ( == null) {
            throw new SecretKeyException("no such secret key with alias: " + );
        }
    }
New to GrepCode? Check out our FAQ X