Added dynamic assignment of secret key