Made some methods public in BasicKeyChain and clean deterministic key generation.

I was between and empty list or null. Fixed.