def get_key(self): # type: () -> bytes """ Returns the public key as a byte string. """ assert self.check_key(), 'key is not initialised' return m2.ec_key_get_public_key(self.ec)