Not in this case unfortunately. The BouncyCastle library uses a raw Enumeration type so this is the only thing short of upgrading the library.