private String calculateSecretKey ( byte [ ] secretKey ) { switch ( config . getKeyRepresentation ( ) ) { case BASE32 : return new Base32 ( ) . encodeToString ( secretKey ) ; case BASE64 : return new Base64 ( ) . encodeToString ( secretKey ) ; default : throw new IllegalArgumentException ( "Unknown key representation type." ) ; } }
This method calculates the secret key given a random byte buffer .