Added generate key pair function