@author Markus Hahn @author Gaston Dombiak
7879808182838485868788
{ "FEDCBA9876543210", "FFFFFFFFFFFFFFFF", "6B5C5A9C5D9E0A5A" } }; public void test(TestHarness harness) { harness.checkPoint("TestOfBlowfish"); cipher = new Blowfish(); HashMap attrib = new HashMap(); attrib.put(IBlockCipher.CIPHER_BLOCK_SIZE, new Integer(8)); attrib.put(IBlockCipher.KEY_MATERIAL, new byte[16]); try {
6566676869707172737475
// build an OFB-Blowfish cascade Cascade ofbBlowfish = new Cascade(); Object modeNdx = ofbBlowfish.append(Stage.getInstance( ModeFactory.getInstance( Registry.OFB_MODE, new Blowfish(), 8), Direction.FORWARD)); testcase.attributes.put(modeNdx, testcase.modeAttributes); IPad pkcs7 = PadFactory.getInstance(Registry.PKCS7_PAD);
227228229230231232233234235236237
*/ public static String encryptPassword(String password) { if (password == null) { return null; } Blowfish cipher = getCipher(); if (cipher == null) { throw new UnsupportedOperationException(); } return cipher.encryptString(password); }
248249250251252253254255256257258
*/ public static String decryptPassword(String encryptedPassword) { if (encryptedPassword == null) { return null; } Blowfish cipher = getCipher(); if (cipher == null) { throw new UnsupportedOperationException(); } return cipher.decryptString(encryptedPassword); }
282283284285286287288289290291292
// for example, when in setup mode. if (!keyString.equals(JiveGlobals.getProperty("passwordKey"))) { return null; } } cipher = new Blowfish(keyString); } catch (Exception e) { Log.error(e.getMessage(), e); } return cipher;