parameters: (self, message)
return_statement: return c
docstring: Encrypt a message with PKCS#1 OAEP.
  
          :param message:
              The message to encrypt, also known as plaintext. It can be of
              variable length, but not longer than the RSA modulus (in bytes)
              minus 2, minus twice the hash output size.
              For instance, if you use RSA 2048 and SHA-256, the longest message
              you can encrypt is 190 byte long.
          :type message: bytes/bytearray/memoryview
  
          :returns: The ciphertext, as large as the RSA modulus.
          :rtype: bytes
  
          :raises ValueError:
              if the message is too long.
docstring_summary: Encrypt a message with PKCS#1 OAEP.
docstring_tokens: Encrypt a message with PKCS#1 OAEP .
function: def encrypt(self, message):
          """Encrypt a message with PKCS#1 OAEP.
  
          :param message:
              The message to encrypt, also known as plaintext. It can be of
              variable length, but not longer than the RSA modulus (in bytes)
              minus 2, minus twice the hash output size.
              For instance, if you use RSA 2048 and SHA-256, the longest message
              you can encrypt is 190 byte long.
          :type message: bytes/bytearray/memoryview
  
          :returns: The ciphertext, as large as the RSA modulus.
          :rtype: bytes
  
          :raises ValueError:
              if the message is too long.
          """
  
          # See 7.1.1 in RFC3447
          modBits = Crypto.Util.number.size(self._key.n)
          k = ceil_div(modBits, 8) # Convert from bits to bytes
          hLen = self._hashObj.digest_size
          mLen = len(message)
  
          # Step 1b
          ps_len = k - mLen - 2 * hLen - 2
          if ps_len < 0:
              raise ValueError("Plaintext is too long.")
          # Step 2a
          lHash = self._hashObj.new(self._label).digest()
          # Step 2b
          ps = b'\x00' * ps_len
          # Step 2c
          db = lHash + ps + b'\x01' + _copy_bytes(None, None, message)
          # Step 2d
          ros = self._randfunc(hLen)
          # Step 2e
          dbMask = self._mgf(ros, k-hLen-1)
          # Step 2f
          maskedDB = strxor(db, dbMask)
          # Step 2g
          seedMask = self._mgf(maskedDB, hLen)
          # Step 2h
          maskedSeed = strxor(ros, seedMask)
          # Step 2i
          em = b'\x00' + maskedSeed + maskedDB
          # Step 3a (OS2IP)
          em_int = bytes_to_long(em)
          # Step 3b (RSAEP)
          m_int = self._key._encrypt(em_int)
          # Step 3c (I2OSP)
          c = long_to_bytes(m_int, k)
          return c
function_tokens: def encrypt ( self , message ) : # See 7.1.1 in RFC3447 modBits = Crypto . Util . number . size ( self . _key . n ) k = ceil_div ( modBits , 8 ) # Convert from bits to bytes hLen = self . _hashObj . digest_size mLen = len ( message ) # Step 1b ps_len = k - mLen - 2 * hLen - 2 if ps_len < 0 : raise ValueError ( "Plaintext is too long." ) # Step 2a lHash = self . _hashObj . new ( self . _label ) . digest ( ) # Step 2b ps = b'\x00' * ps_len # Step 2c db = lHash + ps + b'\x01' + _copy_bytes ( None , None , message ) # Step 2d ros = self . _randfunc ( hLen ) # Step 2e dbMask = self . _mgf ( ros , k - hLen - 1 ) # Step 2f maskedDB = strxor ( db , dbMask ) # Step 2g seedMask = self . _mgf ( maskedDB , hLen ) # Step 2h maskedSeed = strxor ( ros , seedMask ) # Step 2i em = b'\x00' + maskedSeed + maskedDB # Step 3a (OS2IP) em_int = bytes_to_long ( em ) # Step 3b (RSAEP) m_int = self . _key . _encrypt ( em_int ) # Step 3c (I2OSP) c = long_to_bytes ( m_int , k ) return c