Implemented KeyManager with most necessary methods.