コード例 #1
0
    def decrypt_text(self, cipherText, privateKey):
        """ Decrypt cipherText with private key """

        #  Now decrypt:
        rsaDecryptor = chilkat.CkRsa()

        rsaDecryptor.put_EncodingMode("hex")
        rsaDecryptor.ImportPrivateKey(privateKey)

        usePrivateKey = True
        plainText = rsaDecryptor.decryptStringENC(cipherText, usePrivateKey)

        # print(plainText)

        return plainText
コード例 #2
0
    def encrypt_with_private(self, plainText, privateKey):
        """ Encrypt plainText with private key """

        #  Start with a new RSA object to demonstrate that all we
        #  need are the keys previously exported:
        rsaEncryptor = chilkat.CkRsa()

        #  Encrypted output is always binary.  In this case, we want
        #  to encode the encrypted bytes in a printable string.
        #  Our choices are "hex", "base64", "url", "quoted-printable".
        rsaEncryptor.put_EncodingMode("hex")

        #  We'll encrypt with the public key and decrypt with the private
        #  key.  It's also possible to do the reverse.
        rsaEncryptor.ImportPublicKey(privateKey)

        usePrivateKey = True
        cipherText = rsaEncryptor.encryptStringENC(plainText, usePrivateKey)
        # print(cipherText)

        return cipherText
コード例 #3
0
imap = chilkat.CkImap()
print("IMAP: " + imap.version())

ftp = chilkat.CkFtp2()
print("FTP: " + ftp.version())

mailman = chilkat.CkMailMan()
print("POP3/SMTP: " + mailman.version())

ssh = chilkat.CkSsh()
print("SSH: " + ssh.version())

sftp = chilkat.CkSFtp()
print("SFTP: " + sftp.version())

rsa = chilkat.CkRsa()
print("RSA: " + rsa.version())

http = chilkat.CkHttp()
print("RSA: " + http.version())

crypt = chilkat.CkCrypt2()
print("Crypt: " + crypt.version())

xml = chilkat.CkXml()
print("XML: " + xml.version())

sock = chilkat.CkSocket()
print("Socket/SSL/TLS: " + sock.version())

tar = chilkat.CkTar()
コード例 #4
0
 def __init__(self):
     self.rsa = chilkat.CkRsa()
     self.unlock_component()
     self.publicKey = None
     self.privateKey = None