def rsa_pkcs1v15_encrypt(certificate_or_public_key, data):
if not isinstance(certificate_or_public_key, (Certificate, PublicKey)):<EOL><INDENT>raise TypeError(pretty_message(<EOL>'''<STR_LIT>''',<EOL>type_name(certificate_or_public_key)<EOL>))<EOL><DEDENT>if not isinstance(data, byte_cls):<EOL><INDENT>raise TypeError(pretty_message(<EOL>'''<STR_LIT>''',<EOL>type_name(data)<EOL>))<EOL><DEDENT>key_length = certificate_or_public_key.byte_size<EOL>buffer = buffer_from_bytes(key_length)<EOL>output_length = new(Security, '<STR_LIT>', key_length)<EOL>result = Security.SecKeyEncrypt(<EOL>certificate_or_public_key.sec_key_ref,<EOL>SecurityConst.kSecPaddingPKCS1,<EOL>data,<EOL>len(data),<EOL>buffer,<EOL>output_length<EOL>)<EOL>handle_sec_error(result)<EOL>return bytes_from_buffer(buffer, deref(output_length))<EOL>
Encrypts a byte string using an RSA public key or certificate. Uses PKCS#1
v1.5 padding.

:param certificate_or_public_key:
    A PublicKey or Certificate object

:param data:
    A byte string, with a maximum length 11 bytes less than the key length
    (in bytes)

:raises:
    ValueError - when any of the parameters contain an invalid value
    TypeError - when any of the parameters are of the wrong type
    OSError - when an error is returned by the OS crypto library

:return:
    A byte string of the encrypted data