def encrypt(self, key_name, plaintext, authenticated_data=None):
keys = self.get_conn().projects().locations().keyRings().cryptoKeys()<EOL>body = {'<STR_LIT>': _b64encode(plaintext)}<EOL>if authenticated_data:<EOL><INDENT>body['<STR_LIT>'] = _b64encode(authenticated_data)<EOL><DEDENT>request = keys.encrypt(name=key_name, body=body)<EOL>response = request.execute(num_retries=self.num_retries)<EOL>ciphertext = response['<STR_LIT>']<EOL>return ciphertext<EOL>
Encrypts a plaintext message using Google Cloud KMS.

:param key_name: The Resource Name for the key (or key version)
                 to be used for encyption. Of the form
                 ``projects/*/locations/*/keyRings/*/cryptoKeys/**``
:type key_name: str
:param plaintext: The message to be encrypted.
:type plaintext: bytes
:param authenticated_data: Optional additional authenticated data that
                           must also be provided to decrypt the message.
:type authenticated_data: bytes
:return: The base 64 encoded ciphertext of the original message.
:rtype: str