def _addPKCS1Padding(self, bytes, blockType):
        padLength = (numBytes(self.n) - (len(bytes)+3))
        if blockType == 1: #Signature padding
            pad = [0xFF] * padLength
        elif blockType == 2: #Encryption padding
            pad = createByteArraySequence([])
            while len(pad) < padLength:
                padBytes = getRandomBytes(padLength * 2)
                pad = [b for b in padBytes if b != 0]
                pad = pad[:padLength]
        else:
            raise AssertionError()

        padding = createByteArraySequence([0,blockType] + pad + [0])
        paddedBytes = padding + bytes
        return paddedBytes
dataset/ETHPy150Open splunk/splunk-webframework/contrib/tlslite/tlslite/utils/rsakey.py/RSAKey._addPKCS1Padding/original