示例#1
0
	def generate_keys(self):	
		info("Generating keypair, please wait...")
		self.key1 = AnonCrypto.random_key(self.key_len)
		self.key2 = AnonCrypto.random_key(self.key_len)
		self.save_pub_key(self.key1, 1)
		self.save_pub_key(self.key2, 2)

		self.pub_keys[self.id] = (
				M2Crypto.RSA.load_pub_key(self.key_filename(1)),
				M2Crypto.RSA.load_pub_key(self.key_filename(2))) 
示例#2
0
	def generate_keys(self):	
		info("Generating keypair, please wait...")
		self.key1 = AnonCrypto.random_key(self.key_len)
		self.key2 = AnonCrypto.random_key(self.key_len)
		self.save_pub_key(self.key1, 1)
		self.save_pub_key(self.key2, 2)

		self.pub_keys[self.id] = (
				M2Crypto.RSA.load_pub_key(self.key_filename(1)),
				M2Crypto.RSA.load_pub_key(self.key_filename(2))) 
示例#3
0
    def gen_temp_keys(self):
        key1 = AnonCrypto.random_key(KEY_LENGTH)
        key2 = AnonCrypto.random_key(KEY_LENGTH)

        key1.save_key("config/temp1.priv", None)
        key1.save_pub_key("config/temp1.pub")

        key2.save_key("config/temp2.priv", None)
        key2.save_pub_key("config/temp2.pub")

        self.privgenkey1 = M2Crypto.RSA.load_key("config/temp1.priv")
        self.pubgenkey1 = M2Crypto.RSA.load_pub_key("config/temp1.pub")

        self.privgenkey2 = M2Crypto.RSA.load_key("config/temp2.priv")
        self.pubgenkey2 = M2Crypto.RSA.load_pub_key("config/temp2.pub")
示例#4
0
    def gen_temp_keys(self):
        key1 = AnonCrypto.random_key(KEY_LENGTH)
        key2 = AnonCrypto.random_key(KEY_LENGTH)

        key1.save_key('config/temp1.priv', None)
        key1.save_pub_key('config/temp1.pub')

        key2.save_key('config/temp2.priv', None)
        key2.save_pub_key('config/temp2.pub')

        self.privgenkey1 = M2Crypto.RSA.load_key('config/temp1.priv')
        self.pubgenkey1 = M2Crypto.RSA.load_pub_key('config/temp1.pub')

        self.privgenkey2 = M2Crypto.RSA.load_key('config/temp2.priv')
        self.pubgenkey2 = M2Crypto.RSA.load_pub_key('config/temp2.pub')
示例#5
0
    def generate_keys(self):
        info("Generating sining key pair, please wait...")
        self.key1 = AnonCrypto.random_signing_key()
        info("Generating encryption key pair, please wait...")
        self.key2 = AnonCrypto.random_key(self.key_len)
        info("Keys generated")
        self.save_pub_key(self.key1, 1)
        #self.save_pub_key(self.key2, 2)

        self.pub_keys[self.id] = (M2Crypto.EC.load_pub_key(
            self.key_filename(1)), self.key2)
示例#6
0
 def establish_keys(self):
     if not os.path.exists("config"):
         os.mkdir("config")
     try:
         # load them into instance vars if they already exist
         self.load_keys()
     except:
         # generate new keys, save them to config/priv
         # and config/pub -- then load them into instance vars
         self.DEBUG("keys don't exist/valid")
         newKey = AnonCrypto.random_key(KEY_LENGTH)
         self.save_keys(newKey)
         self.load_keys()
示例#7
0
 def establish_keys(self):
     if not os.path.exists('config'):
         os.mkdir('config')
     try:
         # load them into instance vars if they already exist
         self.load_keys()
     except:
         # generate new keys, save them to config/priv
         # and config/pub -- then load them into instance vars
         self.DEBUG("keys don't exist/valid")
         newKey = AnonCrypto.random_key(KEY_LENGTH)
         self.save_keys(newKey)
         self.load_keys()