示例#1
0
 def __init__(self, cmdname, args):
     BaseAction.__init__(self, cmdname, args)
     nitrokey = NitroKey(verbose=(self.args.verbose > 0),
                         so_path=self.args.so_path,
                         pin=self.args.pin,
                         sopin=self.args.sopin)
     nitrokey.unblock_pin()
示例#2
0
    def __init__(self, cmdname, args):
        BaseAction.__init__(self, cmdname, args)
        if self.args.affect_so_pin:
            pin = None
            sopin = self.args.old
        else:
            pin = self.args.old
            sopin = None

        if self.args.randomize_new:
            if self.args.affect_so_pin:
                new_value = os.urandom(8).hex()
                print("!!! Do not lose this !!!")
                print("--> New SO-PIN: %s <--" % (new_value))
                print("!!! Do not lose this !!!")
            else:
                new_value = self._gen_int_pin(6)
                print("New PIN: %s" % (new_value))
        else:
            new_value = self.args.new

        nitrokey = NitroKey(verbose=(self.args.verbose > 0),
                            so_path=self.args.so_path,
                            pin=pin,
                            sopin=sopin)
        if self.args.affect_so_pin:
            nitrokey.change_sopin(new_value)
        else:
            nitrokey.change_pin(new_value)
示例#3
0
 def __init__(self, cmdname, args):
     BaseAction.__init__(self, cmdname, args)
     nitrokey = NitroKey(verbose=(self.args.verbose > 0))
     if nitrokey.initialized:
         print("Error: Cannot initialize NitroKey -- already initialized.",
               file=sys.stderr)
         sys.exit(1)
示例#4
0
 def __init__(self, cmdname, args):
     BaseAction.__init__(self, cmdname, args)
     nitrokey = NitroKey(verbose=(self.args.verbose > 0),
                         so_path=self.args.so_path,
                         pin=self.args.pin)
     nitrokey.keygen(key_spec=self.args.keyspec,
                     key_id=self.args.id,
                     key_label=self.args.label)
示例#5
0
 def __init__(self, cmdname, args):
     BaseAction.__init__(self, cmdname, args)
     if all(argument is None
            for argument in [self.args.label, self.args.id]):
         print(
             "Error: Must specify either a label or key ID to remove from smartcard.",
             file=sys.stderr)
         sys.exit(1)
     nitrokey = NitroKey(verbose=(self.args.verbose > 0),
                         so_path=self.args.so_path,
                         pin=self.args.pin)
     nitrokey.removekey(key_id=self.args.id, key_label=self.args.label)
示例#6
0
 def __init__(self, cmdname, args):
     BaseAction.__init__(self, cmdname, args)
     nitrokey = NitroKey(verbose=(self.args.verbose > 0),
                         so_path=self.args.so_path,
                         pin=self.args.pin)
     if cmdname == "gencsr":
         nitrokey.gencsr(key_id=self.args.id, subject=self.args.subject)
     else:
         nitrokey.gencrt(key_id=self.args.id,
                         subject=self.args.subject,
                         validity_days=self.args.validity_days,
                         hashfnc=self.args.hashfnc)
示例#7
0
    def __init__(self, cmdname, args):
        BaseAction.__init__(self, cmdname, args)

        if not args.verify_sopin:
            nitrokey = NitroKey(verbose=(self.args.verbose > 0),
                                so_path=self.args.so_path,
                                pin=self.args.pin)
            if nitrokey.login():
                print("PIN correct.", file=sys.stderr)
            else:
                print("PIN was WRONG!", file=sys.stderr)
        else:
            nitrokey = NitroKey(verbose=(self.args.verbose > 0),
                                so_path=self.args.so_path,
                                sopin=self.args.pin)
            if nitrokey.login(with_sopin=True):
                print("SO-PIN correct.", file=sys.stderr)
            else:
                print("SO-PIN was WRONG!", file=sys.stderr)
示例#8
0
 def __init__(self, cmdname, args):
     BaseAction.__init__(self, cmdname, args)
     nitrokey = NitroKey(verbose=True).list()
示例#9
0
 def __init__(self, cmdname, args):
     BaseAction.__init__(self, cmdname, args)
     nitrokey = NitroKey(verbose=(self.args.verbose > 0)).explore()
示例#10
0
 def __init__(self, cmdname, args):
     BaseAction.__init__(self, cmdname, args)
     nitrokey = NitroKey(verbose=(self.args.verbose > 0),
                         so_path=self.args.so_path)
     nitrokey.check_engine()
示例#11
0
 def __init__(self, cmdname, args):
     BaseAction.__init__(self, cmdname, args)
     nitrokey = NitroKey(verbose=(self.args.verbose > 0),
                         so_path=self.args.so_path,
                         sopin=self.args.so_pin)
     nitrokey.format()
示例#12
0
	def __init__(self, cmdname, args):
		BaseAction.__init__(self, cmdname, args)
		crt_derdata = subprocess.check_output([ "openssl", "x509", "-outform", "der", "-in", self.args.crt_pemfile ])
		nitrokey = NitroKey(verbose = (self.args.verbose > 0), so_path = self.args.so_path, pin = self.args.pin)
		nitrokey.putcrt(crt_derdata = crt_derdata, cert_id = self.args.id, cert_label = self.args.label)