View difference between Paste ID: nyvPWcV1 and 6QDW2vb5
SHOW: | | - or go back to the newest paste.
1
class EncryptedString():
2
3
4
    def __init__(self,homegpg,user,set_result):
5
6
        self.homegpg = homegpg
7
        self.user = user
8
        
9
        self.set_result = set_result
10
    def encrypt_string(self,input_string):
11
        #Encrypt a string
12
        self.input_string = input_string
13
        gpg  =  gnupg.GPG(gnupghome = self.homegpg)
14
        unencrypted_string  =  self.input_string
15-
        encrypted_data  =  gpg.encrypt(unencrypted_string, self.user)
15+
        # agregar en la siguiente linea always_trust=True 
16
* * * * encrypted_data  =  gpg.encrypt(unencrypted_string, self.user,always_trust=True)
17
        encrypted_string  =  str(encrypted_data)
18
        ok =  encrypted_data.ok
19
        status =  encrypted_data.status
20
        stderr =  encrypted_data.stderr
21
        result = [ok,status,stderr,unencrypted_string,encrypted_string]
22
        return result[self.set_result]
23
         
24
# instantiate
25
if __name__  ==  "__main__":
26
    print "Is not shown if import"
27
    
28
    homegpg = '../home/gpg/'
29
    user = '[email protected]'
30
    input_string = 'string en texto plano'
31
    set_result = 2
32
    encryptstring = EncryptedString(homegpg,user,set_result)
33
    print encryptstring.encrypt_string(input_string)
34
    print " enjoy "