EncryptionService create(String alias, char[] password) {
        PublicKey pk = getPublicKey(alias);

        Key key;
        try {
            key = this.keyStore.getKey(alias, password);
        } catch (UnrecoverableKeyException e) {
            throw SeedException.wrap(e, CryptoErrorCode.UNRECOVERABLE_KEY);
        } catch (KeyStoreException e) {
            throw SeedException.wrap(e, CryptoErrorCode.UNEXPECTED_EXCEPTION);
        } catch (NoSuchAlgorithmException e) {
            throw SeedException.wrap(e, CryptoErrorCode.ALGORITHM_CANNOT_BE_FOUND);
        }

        return new EncryptionServiceImpl(alias, pk, key);
    }
EncryptionService create ( String alias , char [ ] password ) { PublicKey pk = getPublicKey ( alias ) ; Key key ; try { key = this . keyStore . getKey ( alias , password ) ; } catch ( UnrecoverableKeyException e ) { throw SeedException . wrap ( e , CryptoErrorCode . UNRECOVERABLE_KEY ) ; } catch ( KeyStoreException e ) { throw SeedException . wrap ( e , CryptoErrorCode . UNEXPECTED_EXCEPTION ) ; } catch ( NoSuchAlgorithmException e ) { throw SeedException . wrap ( e , CryptoErrorCode . ALGORITHM_CANNOT_BE_FOUND ) ; } return new EncryptionServiceImpl ( alias , pk , key ) ; }
Creates an encryption service for the key pair associated to the alias.
<p>
The certificate will be loaded from an external file if a location is specified
in the configuration.
</p>

@param alias    the alias corresponding to the key store entry
@param password the password protecting the private key
@return encryption service