using SynchronizedTask for public key generation