refactor botan implementation