nitrokey.nk3.secrets_app¶
Oath Authenticator client
CTAPHIDトランスポート、カスタムベンダーコマンド経由で使用。CCID上で直接使用することもできる。
- exception nitrokey.nk3.secrets_app.SecretsAppException¶
 ベースクラス:
ExceptionSecretsAppException(code: str, context: str)
- __init__(code, context)¶
 - パラメータ:
 code (str)
context (str)
- 戻り値の型:
 None
- to_id()¶
 - 戻り値の型:
 
- to_string()¶
 - 戻り値の型:
 str
- code: str¶
 
- context: str¶
 
- exception nitrokey.nk3.secrets_app.SecretsAppHealthCheckException¶
 ベースクラス:
Exception
- class nitrokey.nk3.secrets_app.Instruction¶
 ベースクラス:
Enum- Calculate = 162¶
 
- CalculateAll = 164¶
 
- ChangePIN = 179¶
 
- Delete = 2¶
 
- GetCredential = 181¶
 
- List = 161¶
 
- Put = 1¶
 
- Reset = 4¶
 
- SendRemaining = 165¶
 
- SetCode = 3¶
 
- SetPIN = 180¶
 
- UpdateCredential = 183¶
 
- Validate = 163¶
 
- VerifyCode = 177¶
 
- VerifyPIN = 178¶
 
- class nitrokey.nk3.secrets_app.Kind¶
 ベースクラス:
Enum- classmethod from_attribute_byte(attribute_byte)¶
 - パラメータ:
 attribute_byte (bytes)
- 戻り値の型:
 str
- Hmac = 64¶
 
- Hotp = 16¶
 
- HotpReverse = 48¶
 
- NotSet = 240¶
 
- Totp = 32¶
 
- class nitrokey.nk3.secrets_app.ListItem¶
 ベースクラス:
objectListItem(kind: 'Kind', algorithm: 'Algorithm', label: bytes, properties: nitrokey.nk3.secrets_app.ListItemProperties)
- __init__(kind, algorithm, label, properties)¶
 - パラメータ:
 kind (Kind)
algorithm (Algorithm)
label (bytes)
properties (ListItemProperties)
- 戻り値の型:
 None
- classmethod get_type_name(x)¶
 - パラメータ:
 x (Any)
- 戻り値の型:
 str
- label: bytes¶
 
- properties: ListItemProperties¶
 
- class nitrokey.nk3.secrets_app.ListItemProperties¶
 ベースクラス:
objectListItemProperties(touch_required: bool, secret_encryption: bool, pws_data_exist: bool)
- __init__(touch_required, secret_encryption, pws_data_exist)¶
 - パラメータ:
 touch_required (bool)
secret_encryption (bool)
pws_data_exist (bool)
- 戻り値の型:
 None
- classmethod from_byte(b)¶
 - パラメータ:
 b (int)
- 戻り値の型:
 
- pws_data_exist: bool¶
 
- secret_encryption: bool¶
 
- touch_required: bool¶
 
- class nitrokey.nk3.secrets_app.PasswordSafeEntry¶
 ベースクラス:
objectPasswordSafeEntry(login:Optional[bytes], password:Optional[bytes], metadata:オプション[バイト]、プロパティ:オプション[バイト] = なし、名前: オプション[バイト] = なし)
- __init__(login, password, metadata, properties=None, name=None)¶
 - パラメータ:
 login (bytes | None)
password (bytes | None)
metadata (bytes | None)
properties (bytes | None)
name (bytes | None)
- 戻り値の型:
 None
- tlv_encode()¶
 - 戻り値の型:
 list[Entry]
- login: bytes | None¶
 
- metadata: bytes | None¶
 
- name: bytes | None = None¶
 
- password: bytes | None¶
 
- properties: bytes | None = None¶
 
- class nitrokey.nk3.secrets_app.RawBytes¶
 ベースクラス:
objectRawBytes(data: list[int])
- __init__(data)¶
 - パラメータ:
 data (list[int])
- 戻り値の型:
 None
- data: list[int]¶
 
- class nitrokey.nk3.secrets_app.SecretsApp¶
 ベースクラス:
objectこれはシークレットアプリのクライアントです https://github.com/Nitrokey/trussed-secrets-app
- calculate(cred_id, challenge=None)¶
 クレデンシャル cred_id とチャレンジ challenge の OTP コードを計算する。
- パラメータ:
 cred_id (bytes) -- The name of the credential
challenge (int | None) -- 計算に挑戦する(TOTPのみ)。タイムスタンプ/期間。一般的に使用される期間の値は30である。
- 戻り値:
 バイト列としてのOTPコード
- 戻り値の型:
 bytes
- change_pin_raw(password, new_password)¶
 - パラメータ:
 password (str)
new_password (str)
- 戻り値の型:
 None
- clear_code()¶
 他のコマンドの認証に使用するパスフレーズをクリアする。
- 戻り値の型:
 None
- delete(cred_id)¶
 指定された ID のクレデンシャルを削除します。指定したクレデンシャルが存在しない場合は失敗しません。 :param credid:クレデンシャル ID。
- パラメータ:
 cred_id (bytes)
- 戻り値の型:
 None
- classmethod encode_properties_to_send(touch_button_required, pin_based_encryption, tlv=False)¶
 プロパティの構造を1バイトにエンコードする @param touch_button_required: タッチボタンの使用が必要かどうか @param pin_based_encryption: PIN暗号化を要求するかどうか(登録時のみ) @param tlv: デフォルトの「TV」ではなく、TLVとしてエンコードする場合はTrueを設定。
- パラメータ:
 touch_button_required (bool)
pin_based_encryption (bool)
tlv (bool)
- 戻り値の型:
 
- feature_active_PIN_authentication()¶
 - 戻り値の型:
 bool
- feature_challenge_response_support()¶
 - 戻り値の型:
 bool
- feature_extended_list()¶
 - 戻り値の型:
 bool
- feature_old_application_version()¶
 - 戻り値の型:
 bool
- feature_pws_support()¶
 - 戻り値の型:
 bool
- get_credential(cred_id)¶
 - パラメータ:
 cred_id (bytes)
- 戻り値の型:
 
- get_feature_status_cached()¶
 - 戻り値の型:
 
- get_response_for_secret(challenge, secret)¶
 - パラメータ:
 challenge (bytes)
secret (bytes)
- 戻り値の型:
 bytes
- get_secret_for_passphrase(passphrase)¶
 - パラメータ:
 passphrase (str)
- 戻り値の型:
 bytes
- is_pin_healthy()¶
 - 戻り値の型:
 bool
- list(extended=False)¶
 登録されているクレデンシャルのリストを返す :return:extended" スイッチが指定されている場合は、バイト列のリスト、またはバイト列のタプル @deprecated
- パラメータ:
 extended (bool)
- 戻り値の型:
 list[Tuple[bytes, bytes] | bytes]
- list_with_properties(version=1)¶
 プロパティを持つ登録済みクレデンシャルのリストを返す:リスト項目のリスト
- パラメータ:
 version (int)
- 戻り値の型:
 List[ListItem]
- protocol_v2_confirm_all_requests_with_pin()¶
 - 戻り値の型:
 bool
- protocol_v3_separate_pin_and_no_pin_space()¶
 - 戻り値の型:
 bool
- register(credid, secret=b'00000000000000000000', digits=6, kind=Kind.NotSet, algo=Algorithm.Sha1, initial_counter_value=0, touch_button_required=False, pin_based_encryption=False, login=None, password=None, metadata=None)¶
 新しいワンタイムパスワードクレデンシャルの登録 :param credid:param secret: 共有キー :param digits:param kind:OTP バリアント - HOTP または TOTP :param algo: 使用するハッシュアルゴリズム - SHA1、SHA256 または SHA512 :param initial_counter_value:HOTP クレデンシャルのカウンタの初期値 (HOTP のみ) :param touch_button_required:param pin_based_encryption: PIN ベースの暗号化:PIN ベースの暗号化を追加するかどうかのユーザの選択 :param login:パスワードセーフのログインフィールド :param password: パスワードセーフのパスワードフィールド :param metadata:param metadata: パスワードセーフのメタデータフィールド :return:戻り値:なし
- register_yk_hmac(slot, secret)¶
 Yubikey互換のチャレンジ・レスポンス・スロットを登録する。パラメータ slot: チャレンジ・レスポンス・スロット @param secret: 秘密
- パラメータ:
 slot (int)
secret (bytes)
- 戻り値の型:
 None
- rename_credential(cred_id, new_name)¶
 クレデンシャルの名前を変更する。update_credential() 呼び出しのエイリアス。パラメータ cred_id:param new_name: 新しいクレデンシャルID。
- パラメータ:
 cred_id (bytes)
new_name (bytes)
- 戻り値の型:
 None
- reset()¶
 データベースからすべての認証情報を削除する
- 戻り値の型:
 None
- select()¶
 SELECTコマンドを実行し、認証に必要なチャレンジを含むデバイスの詳細を返す。 :return SelectResponse Status構造体。パスフレーズが設定されていない場合、Challenge と Algorithm フィールドは None になります。
- 戻り値の型:
 
- set_code(passphrase)¶
 プロトコルの仕様で提案されているデフォルトでコードを設定する: - https://developers.yubico.com/OATH/YKOATH_Protocol.html
- パラメータ:
 passphrase (str)
- 戻り値の型:
 None
- set_code_raw(key, challenge, response)¶
 他のコマンドの認証に使用するパスフレーズを設定またはクリアする。param key:param challenge: SELECTコマンドから取得した現在のチャレンジ:param response: クライアント側で計算されたデータ。
- パラメータ:
 key (bytes)
challenge (bytes)
response (bytes)
- 戻り値の型:
 None
- set_pin_raw(password)¶
 - パラメータ:
 password (str)
- 戻り値の型:
 None
- update_credential(cred_id, new_name=None, login=None, password=None, metadata=None, touch_button=None)¶
 クレデンシャル・フィールド(名前、属性、および PWS フィールド)を更新する。未入力のフィールドはエンコードされず、更新処理中に使用されません(現在の値は変更されません)。パラメータ cred_id:変更するクレデンシャルID @param new_name: クレデンシャルの新しいID @param login:新しいログインフィールドの内容 @param password: 新しいパスワードフィールドの内容 @param metadata:新しいメタデータフィールドの内容 @param touch_button:タッチボタンの使用が必須かどうかを設定する
- パラメータ:
 cred_id (bytes)
new_name (bytes | None)
login (bytes | None)
password (bytes | None)
metadata (bytes | None)
touch_button (bool | None)
- 戻り値の型:
 None
- validate(passphrase)¶
 Authenticate using a passphrase
- パラメータ:
 passphrase (str)
- 戻り値の型:
 None
- validate_raw(challenge, response)¶
 パスフレーズを使って認証する。param challenge: SELECTコマンドから取得した現在のチャレンジ:param response: チャレンジとシークレットに対して計算されたレスポンス。
- パラメータ:
 challenge (bytes)
response (bytes)
- 戻り値の型:
 bytes
- verify_code(cred_id, code)¶
 param cred_id:param code: 検証する HOTP コード:param code: 検証する HOTP コード。u32 表現。 :return: OTPAppException エラーで失敗。コードが内部で計算された値と一致する場合は True を返す。
- パラメータ:
 cred_id (bytes)
code (int)
- 戻り値の型:
 bool
- verify_pin_raw(password)¶
 - パラメータ:
 password (str)
- 戻り値の型:
 None
- log: Logger¶
 
- logfn: Callable[[str], Any]¶
 
- write_corpus_fn: Callable[[Instruction | CCIDInstruction, bytes], Any] | None¶
 
- class nitrokey.nk3.secrets_app.SecretsAppExceptionID¶
 ベースクラス:
IntEnum- __new__(value)¶
 
- ClassNotSupported = 28160¶
 
- CommandChainingNotSupported = 26756¶
 
- ConditionsOfUseNotSatisfied = 27013¶
 
- FunctionNotSupported = 27265¶
 
- IncorrectDataParameter = 27264¶
 
- IncorrectP1OrP2Parameter = 27270¶
 
- InstructionNotSupportedOrInvalid = 27904¶
 
- KeyReferenceNotFound = 27272¶
 
- LogicalChannelNotSupported = 26753¶
 
- MoreDataAvailable = 25087¶
 
- NotEnoughMemory = 27268¶
 
- NotFound = 27266¶
 
- OperationBlocked = 27011¶
 
- SecureMessagingNotSupported = 26754¶
 
- SecurityStatusNotSatisfied = 27010¶
 
- Success = 36864¶
 
- UnspecifiedCheckingError = 28416¶
 
- UnspecifiedNonpersistentExecutionError = 25600¶
 
- UnspecifiedPersistentExecutionError = 25856¶
 
- VerificationFailed = 25344¶
 
- WrongLength = 26368¶
 
- class nitrokey.nk3.secrets_app.SelectResponse¶
 ベースクラス:
objectSelectResponse(version:Optional[bytes], pin_attempt_counter:Optional[int], salt:Optional[bytes], challenge:Optional[bytes]、アルゴリズム:Optional[bytes], serial_number:オプション[バイト])
- __init__(version, pin_attempt_counter, salt, challenge, algorithm, serial_number)¶
 - パラメータ:
 version (bytes | None)
pin_attempt_counter (int | None)
salt (bytes | None)
challenge (bytes | None)
algorithm (bytes | None)
serial_number (bytes | None)
- 戻り値の型:
 None
- version_str()¶
 - 戻り値の型:
 str
- algorithm: bytes | None¶
 
- challenge: bytes | None¶
 
- pin_attempt_counter: int | None¶
 
- salt: bytes | None¶
 
- serial_number: bytes | None¶
 
- version: bytes | None¶
 
- class nitrokey.nk3.secrets_app.Tag¶
 ベースクラス:
Enum- Algorithm = 123¶
 
- Challenge = 116¶
 
- CredentialId = 113¶
 
- InitialCounter = 122¶
 
- Key = 115¶
 
- NameList = 114¶
 
- NewPassword = 129¶
 
- PINCounter = 130¶
 
- Password = 128¶
 
- Properties = 120¶
 
- PwsLogin = 131¶
 
- PwsMetadata = 133¶
 
- PwsPassword = 132¶
 
- Response = 117¶
 
- SerialNumber = 143¶
 
- Version = 121¶