本文整理汇总了Python中reportlab.lib.pdfencrypt.hexText函数的典型用法代码示例。如果您正苦于以下问题:Python hexText函数的具体用法?Python hexText怎么用?Python hexText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hexText函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testStdEnc
def testStdEnc(
expectedO, expectedU, expectedKey, strength=40, overrideID="xxxxxxxxxxxxxxxx", userPass="User", ownerPass="Owner"
):
# do a 40 bit example known to work in Acrobat Reader 4.0
enc = pdfencrypt.StandardEncryption(userPass, ownerPass, strength=strength)
enc.setAllPermissions(0)
enc.canPrint = 1
enc.prepare(None, overrideID)
pdfencrypt.equalityCheck(pdfencrypt.hexText(enc.O), expectedO, "%d bit O value" % strength)
pdfencrypt.equalityCheck(pdfencrypt.hexText(enc.U), expectedU, "%d bit U value" % strength)
pdfencrypt.equalityCheck(pdfencrypt.hexText(enc.key), expectedKey, "%d bit key value" % strength)
示例2: checkEncryptionKey128Bit
def checkEncryptionKey128Bit(self):
userPass = 'userpass'
ownerHash = unHexText('<68E5704AC779A5F0CD89704406587A52F25BF61CADC56A0F8DB6C4DB0052534D>')
documentID = 'xxxxxxxxxxxxxxxx'
permissions = -4
encKey = encryptionkey(userPass, ownerHash, permissions, documentID, revision=3)
assert hexText(encKey) == '<13DDE7585D9BE366C976DDD56AF541D1>'
示例3: checkEncryptionKey40Bit
def checkEncryptionKey40Bit(self):
userPass = 'userpass'
ownerHash = unHexText('<F86213EB0CED81F097947F3B343E34CAC8CA92CE8F6FEE2556FA31EC1FE968AF>')
documentID = 'xxxxxxxxxxxxxxxx'
permissions = -4
encKey = encryptionkey(userPass, ownerHash, permissions, documentID, revision=2)
assert hexText(encKey) == '<7EBBD07A88>'
示例4: checkEncryptString128Bit
def checkEncryptString128Bit(self):
assert hexText(encodePDF(unHexText('<3C0C5EBE0122D8EB2BDDF8A09FA8E29E>'),
9,
0,
'anonymous')
) == '<27FB3E943FCF61878B>'
示例5: checkUserHash128Bit
def checkUserHash128Bit(self):
encKey = unHexText('<13DDE7585D9BE366C976DDD56AF541D1>')
userHash = computeU(encKey, revision=3, documentId='xxxxxxxxxxxxxxxx')
assert hexText(userHash) == '<A9AE45CDE827FE0B7D6536267948836A00000000000000000000000000000000>'
示例6: check0wnerHash128Bit
def check0wnerHash128Bit(self):
"owner key calculation"
ownerHash = computeO('userpass','ownerpass', revision=3)
assert hexText(ownerHash) == '<68E5704AC779A5F0CD89704406587A52F25BF61CADC56A0F8DB6C4DB0052534D>'
示例7: checkEncryptString40Bit
def checkEncryptString40Bit(self):
assert hexText(encodePDF(unHexText('<3DC3EBDA71>'), 9, 0, 'anonymous')) == '<57AC33DDEB5775982A>'
示例8: checkUserHash40Bit
def checkUserHash40Bit(self):
encKey = unHexText('<7EBBD07A88>')
userHash = computeU(encKey, revision=2, documentId='xxxxxxxxxxxxxxxx')
assert hexText(userHash) == '<AA154131D8FA105317F7104D2001A345D78A3DEEFA3D85D032FC9B4B35DA72A0>'
示例9: check0wnerHash40Bit
def check0wnerHash40Bit(self):
"owner key calculation"
ownerHash = computeO('userpass','ownerpass', revision=2)
assert hexText(ownerHash) == '<F86213EB0CED81F097947F3B343E34CAC8CA92CE8F6FEE2556FA31EC1FE968AF>'