added public key caching