def test_signer_encoded_public_key(patch_default_backend, patch_serialization,
                                   patch_build_hasher,
                                   patch_ecc_encode_compressed_point,
                                   patch_base64):
    patch_ecc_encode_compressed_point.return_value = sentinel.compressed_point
    patch_base64.b64encode.return_value = sentinel.encoded_point
    private_key = MagicMock()

    signer = Signer(MagicMock(), key=private_key)
    test_key = signer.encoded_public_key()

    patch_ecc_encode_compressed_point.assert_called_once_with(private_key)
    patch_base64.b64encode.assert_called_once_with(sentinel.compressed_point)
    assert test_key == sentinel.encoded_point
    def _generate_signing_key_and_update_encryption_context(
            self, algorithm, encryption_context):
        """Generates a signing key based on the provided algorithm.

        :param algorithm: Algorithm for which to generate signing key
        :type algorithm: aws_encryption_sdk.identifiers.Algorithm
        :param dict encryption_context: Encryption context from request
        :returns: Signing key bytes
        :rtype: bytes or None
        """
        _LOGGER.debug("Generating signing key")
        if algorithm.signing_algorithm_info is None:
            return None

        signer = Signer(algorithm=algorithm,
                        key=generate_ecc_signing_key(algorithm=algorithm))
        encryption_context[ENCODED_SIGNER_KEY] = to_str(
            signer.encoded_public_key())
        return signer.key_bytes()