[Opensource] refactor c.j.e.core.security.strongencryption.StringEncryption

Ian Darwin ian at darwinsys.com
Tue Feb 17 09:40:41 PST 2004


Refactor this code to construct the JCE provider by introspection instead
of hard-coding the class path.

Rationale:
  You should not need the JCE provider on your build path just to open
Expresso in an IDE like Eclipse that auto-builds everything nicely.
This would be like needing a particular JDBC driver in order to
compile a database example.

Both the historical comments should be removed once you've used them
to locate where the patch goes.

Sorry this isn't a patch/diff, but the changes are obvious.

   private static final String PROVIDER_NAME = "org.bouncycastle.jce.provider.BouncyCastleProvider";

   //    private Provider theProvider = new cryptix.jce.provider.CryptixCrypto();
    //private Provider theProvider = new org.bouncycastle.jce.provider.BouncyCastleProvider();
    private  Provider theProvider;

    /**
     *
     *
     * @throws  ChainedException
     */
    public StringEncryption() {
        super();
        try {
        	theProvider = (Provider)Class.forName(PROVIDER_NAME).newInstance();
        } catch (Exception ex){
        	throw new RuntimeException(ex.toString());
        }

    } /* StringEncryption() */




More information about the Opensource mailing list