protected static String getAlgorithm(String algDetails) { if (algDetails.indexOf('[') > 0) { return algDetails.substring(0, algDetails.indexOf('[')); } if (algDetails.startsWith(NISTObjectIdentifiers.aes.getId())) { return "AES"; } if (algDetails.startsWith(GNUObjectIdentifiers.Serpent.getId())) { return "Serpent"; } String name = (String)nameTable.get(Strings.toUpperCase(algDetails)); if (name != null) { return name; } return algDetails; }
public void configure(ConfigurableProvider provider) { provider.addAlgorithm("Cipher.Serpent", PREFIX + "$ECB"); provider.addAlgorithm("KeyGenerator.Serpent", PREFIX + "$KeyGen"); provider.addAlgorithm("AlgorithmParameters.Serpent", PREFIX + "$AlgParams"); provider.addAlgorithm("Cipher.Tnepres", PREFIX + "$TECB"); provider.addAlgorithm("KeyGenerator.Tnepres", PREFIX + "$TKeyGen"); provider.addAlgorithm("AlgorithmParameters.Tnepres", PREFIX + "$TAlgParams"); provider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_128_ECB, PREFIX + "$ECB"); provider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_192_ECB, PREFIX + "$ECB"); provider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_256_ECB, PREFIX + "$ECB"); provider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_128_CBC, PREFIX + "$CBC"); provider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_192_CBC, PREFIX + "$CBC"); provider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_256_CBC, PREFIX + "$CBC"); provider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_128_CFB, PREFIX + "$CFB"); provider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_192_CFB, PREFIX + "$CFB"); provider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_256_CFB, PREFIX + "$CFB"); provider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_128_OFB, PREFIX + "$OFB"); provider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_192_OFB, PREFIX + "$OFB"); provider.addAlgorithm("Cipher", GNUObjectIdentifiers.Serpent_256_OFB, PREFIX + "$OFB"); addGMacAlgorithm(provider, "SERPENT", PREFIX + "$SerpentGMAC", PREFIX + "$KeyGen"); addGMacAlgorithm(provider, "TNEPRES", PREFIX + "$TSerpentGMAC", PREFIX + "$TKeyGen"); addPoly1305Algorithm(provider, "SERPENT", PREFIX + "$Poly1305", PREFIX + "$Poly1305KeyGen"); }