本文整理汇总了Python中pwman.util.crypto.CryptoEngine类的典型用法代码示例。如果您正苦于以下问题:Python CryptoEngine类的具体用法?Python CryptoEngine怎么用?Python CryptoEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CryptoEngine类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_get
def test_get(self):
old_engine = CryptoEngine.get()
self.assertIsInstance(old_engine, CryptoEngineOld)
CryptoEngine._instance = None
new_engine = CryptoEngine.get(dbver=0.5)
self.assertIsInstance(new_engine, CryptoEngine)
self.assertFalse(isinstance(new_engine, CryptoEngineOld))
CryptoEngine._instance = None
old_engine = CryptoEngine.get()
开发者ID:hbrunn,项目名称:pwman3,代码行数:9,代码来源:crypto_tests.py
示例2: __init__
def __init__(self):
config.set_defaults(default_config)
enc = CryptoEngine.get(dbver=0.4)
enc.callback = DummyCallback4()
self.enc1 = copy.copy(enc)
enc = CryptoEngine.get(dbver=0.5)
enc.callback = DummyCallback4()
self.enc2 = copy.copy(enc)
self.db1 = SQLiteDatabaseNewForm('konverter-v0.4.db', dbformat=0.4)
self.db2 = SQLiteDatabaseNewForm('konverter-v0.5.db', dbformat=0.5)
assert self.enc1 is not self.enc2
开发者ID:minghuadev,项目名称:people-pwman3-pwman3,代码行数:12,代码来源:test_converter.py
示例3: changepassword
def changepassword(self):
"""
Change the databases password.
"""
enc = CryptoEngine.get()
newkey = enc.changepassword()
return self.savekey(newkey)
开发者ID:k0lter,项目名称:pwman3,代码行数:7,代码来源:database.py
示例4: run
def run(self):
global AUTHENTICATED, TAGS, DB
OSX = False
sys.argv = []
args = parser_options().parse_args()
xselpath, dbtype = get_conf_options(args, OSX)
dbver = 0.5
DB = pwman.data.factory.create(dbtype, dbver)
DB.open(dbver=0.5)
print(dir(DB))
CryptoEngine.get(dbver=0.5)
print(pwman.config._conf)
debug(True)
run(port=9030)
开发者ID:gadeleon,项目名称:pwman3,代码行数:16,代码来源:webui.py
示例5: forget
def forget():
global AUTHENTICATED
AUTHENTICATED = False
enc = CryptoEngine.get()
enc.forget()
redirect('/auth')
开发者ID:gadeleon,项目名称:pwman3,代码行数:7,代码来源:webui.py
示例6: do_tags
def do_tags(self, arg):
enc = CryptoEngine.get()
if not enc.alive():
enc._getcipher()
print ("Tags: \n",)
t = self._tags(enc)
print ('\n'.join(t))
开发者ID:minghuadev,项目名称:people-pwman3-pwman3,代码行数:7,代码来源:base.py
示例7: get_user_password
def get_user_password(self):
"""
get the databases password from the user
"""
enc = CryptoEngine.get()
newkey = enc.changepassword()
return self.savekey(newkey)
开发者ID:hbrunn,项目名称:pwman3,代码行数:7,代码来源:database.py
示例8: __init__
def __init__(self, db, hasxsel, callback):
"""
initialize CLI interface, set up the DB
connecion, see if we have xsel ...
"""
cmd.Cmd.__init__(self)
self.intro = "%s %s (c) visit: %s" % (pwman.appname, pwman.version, pwman.website)
self._historyfile = config.get_value("Readline", "history")
self.hasxsel = hasxsel
try:
enc = CryptoEngine.get()
enc._callback = callback()
self._db = db
# this cascades down all the way to setting the database key
self._db.open()
except Exception as e: # pragma: no cover
self.error(e)
sys.exit(1)
try:
readline.read_history_file(self._historyfile)
except IOError as e: # pragma: no cover
pass
self.prompt = "pwman> "
开发者ID:hbrunn,项目名称:pwman3,代码行数:25,代码来源:cli.py
示例9: test_db_change_pass
def test_db_change_pass(self):
"fuck yeah, we change the password and the new dummy works"
enc = CryptoEngine.get()
enc._callback = DummyCallback3()
self.tester.cli._db.changepassword()
self.tester.cli.do_forget('')
enc._callback = DummyCallback4()
self.tester.cli.do_ls('')
开发者ID:hbrunn,项目名称:pwman3,代码行数:8,代码来源:db_tests.py
示例10: get_username
def get_username(self):
"""
Return the username.
This solution with strip is horribly assuming that
the username does not containg space as the last character.
The same is also true for the password.
"""
enc = CryptoEngine.get()
return enc.decrypt(self._username).strip()
开发者ID:k0lter,项目名称:pwman3,代码行数:9,代码来源:nodes.py
示例11: read_old_db
def read_old_db(self):
"read the old db and get all nodes"
self.db = SQLiteDatabaseReader()
enc = CryptoEngine.get()
enc.set_callback(CLICallback())
self.db.open()
self.oldnodes = self.db.listnodes()
self.oldnodes = self.db.getnodes(self.oldnodes)
开发者ID:hbrunn,项目名称:pwman3,代码行数:9,代码来源:convertdb.py
示例12: open
def open(self):
"""Open the database."""
self._open()
enc = CryptoEngine.get()
key = self.loadkey()
if key != None:
enc.set_cryptedkey(key)
else:
self.changepassword()
开发者ID:oz123,项目名称:pwman3,代码行数:10,代码来源:database.py
示例13: __init__
def __init__(self,username="",password="",url="",notes="",tags=[]):
"""Initialise everything to null."""
self._id = 0;
enc = CryptoEngine.get()
self._username = enc.encrypt(username)
self._password = enc.encrypt(password)
self._url = enc.encrypt(url)
self._notes = enc.encrypt(notes)
self._tags = []
self.set_tags(tags)
开发者ID:dbeecham,项目名称:pwman3-1,代码行数:11,代码来源:nodes.py
示例14: complete_filter
def complete_filter(self, text, line, begidx, endidx):
strings = []
enc = CryptoEngine.get()
if not enc.alive():
return strings
tags = self._db.listtags()
for t in tags:
name = t.get_name()
if name.startswith(text):
strings.append(t.get_name())
return strings
开发者ID:ikegam,项目名称:pwman3,代码行数:12,代码来源:cli.py
示例15: do_tags
def do_tags(self, arg):
tags = self._db.listtags()
# request password
enc = CryptoEngine.get()
if not enc.alive():
enc._getcipher()
print "Tags: ",
if len(tags) == 0:
print "None",
for t in tags:
print "%s " % t,
print
开发者ID:k0lter,项目名称:pwman3,代码行数:12,代码来源:cli.py
示例16: __str__
def __str__(self): # pragma: no cover
enc = CryptoEngine.get()
try:
tags = ', '.join([enc.decrypt(tag).strip() for tag in filter(None,
self._tags)])
except Exception:
tags = ', '.join([tag.strip() for tag in filter(None, self._tags)])
user = enc.decrypt(self._username).strip()
url = enc.decrypt(self._url).strip()
return '{0}@{1}\t{2}'.format(user, url,
tags)
开发者ID:minghuadev,项目名称:people-pwman3-pwman3,代码行数:12,代码来源:nodes.py
示例17: __init__
def __init__(self, db):
cmd.Cmd.__init__(self)
self.intro = "%s %s (c) %s <%s>" % (pwman.appname, pwman.version, pwman.author, pwman.authoremail)
self._historyfile = config.get_value("Readline", "history")
try:
enc = CryptoEngine.get()
enc.set_callback(CLICallback())
self._db = db
self._db.open()
except Exception, e:
self.error(e)
sys.exit(1)
开发者ID:davidtnorth,项目名称:pwman3,代码行数:13,代码来源:cli.py
示例18: run
def run(self):
# before add nodes to db1 we have to create an encryption key!
# this is handeld by the open method
self.db1._open()
enc1 = CryptoEngine.get(dbver=0.4)
enc1.callback = DummyCallback4()
key = self.db1.loadkey()
if key is not None:
enc1.set_cryptedkey(key)
else:
newkey = enc1.changepassword()
self.db1.savekey(newkey)
enc1c = copy.copy(enc1)
if key is not None:
enc1.set_cryptedkey(key)
self.add_nodes_to_db1()
CryptoEngine._instance = None
self.db2._open()
enc2 = CryptoEngine.get(dbver=0.5)
enc2.callback = DummyCallback4()
key = self.db2.loadkey()
if key is not None:
enc2.set_cryptedkey(key)
else:
newkey = enc2.changepassword()
self.db2.savekey(newkey)
enc2c = copy.copy(enc2)
if key is not None:
enc2.set_cryptedkey(key)
self.add_nodes_to_db2()
assert enc1 is not enc2
assert enc1c is not enc2c
开发者ID:minghuadev,项目名称:people-pwman3-pwman3,代码行数:37,代码来源:test_converter.py
示例19: open
def open(self):
"""
Open the database, by calling the _open method of the
class inherited for the specific database.
When done validation that the file is OK, check if it has
encryption key, by calling
enc = CryptoEngine.get()
key = self.loadkey()
"""
self._open()
enc = CryptoEngine.get()
key = self.loadkey()
if (key != None):
enc.set_cryptedkey(key)
else:
self.changepassword()
开发者ID:k0lter,项目名称:pwman3,代码行数:16,代码来源:database.py
示例20: __init__
def __init__(self, db, hasxsel):
"""
initialize CLI interface, set up the DB
connecion, see if we have xsel ...
"""
cmd.Cmd.__init__(self)
self.intro = "%s %s (c) visit: %s" % (pwman.appname, pwman.version, pwman.website)
self._historyfile = config.get_value("Readline", "history")
self.hasxsel = hasxsel
try:
enc = CryptoEngine.get()
enc.set_callback(CLICallback())
self._db = db
self._db.open()
except Exception, e:
self.error(e)
sys.exit(1)
开发者ID:k0lter,项目名称:pwman3,代码行数:17,代码来源:cli.py
注:本文中的pwman.util.crypto.CryptoEngine类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论