Refactored deprecated bouncycastle API calls.