Implement secret key management as suggested by cdiehl