keygen + encrypt