protected Cipher createCipher()

in src/java/org/apache/fulcrum/jce/crypto/CryptoStreamFactoryImpl.java [234:252]


    protected Cipher createCipher( int mode, char[] password )
        throws GeneralSecurityException, IOException
    {
        Cipher cipher;
        PBEParameterSpec paramSpec = new PBEParameterSpec( this.getSalt(), this.getCount() );
        Key key = this.createKey( password );

        if( this.getProviderName() == null )
        {
            cipher = Cipher.getInstance( this.getAlgorithm() );
        }
        else
        {
            cipher = Cipher.getInstance( this.getAlgorithm(), this.getProviderName() );
        }

        cipher.init( mode, key, paramSpec );
        return cipher;
    }