A method and apparatus for performing a cryptographic operation