Git Product home page Git Product logo

translation-keychain-doc's Introduction

English -> En-README.md

Appleの、keychain Searviseの日本語訳です

そこまで英語上手いわけではないので、間違い等ありましたらPRお願いします。喜びます。

本家URL -> Keychain Servise Programming Guide

ドキュメントの構成について

このドキュメントは、上記記事の構成通りに翻訳して行きます。

translation-keychain-doc's People

Contributors

cj-bc avatar

Watchers

 avatar  avatar

translation-keychain-doc's Issues

macOSでは、ログインキーチェーンのパスワードがユーザーのログインアカウントのパスワードと同じ時、ログインしている間は自動的にアンロックされます。初期状態では、ログインキーチェーンはデフォルトのキーチェーンでもあります。

デフォルトキーチェーンは、関数呼び出しの際に他のキーチェーンが指定されない限り、新しくできたキーチェーン項目を格納するために使われます。特定の他のキーチェーンサービス機能も、他のキーチェーンが指定されていない時デフォルトキーチェーンを使用します。
ユーザーはキーチェーンアクセスユーティリティを用いて、他のキーチェーンをデフォルトキーチェーンに指定することができます。但し、ログインキーチェーンは変わりません。

iOSでは、より簡単です。アプリケーションからアクセスできるキーチェーン(論理的に異なるiCloudキーチェーンを含む)が一つあるだけです。このキーチェーンはユーザーが端末をアンロックした時に自動的にアンロックされ、端末がロックされたときにロックされます。
アプリケーションは、それの所有するキーチェーン項目とアプリの所属するグループで共有されている項目にのみアクセスできます。

高レベル関数で基本的なキーチェーンアクセスをする

キーチェーンの構造はかなりの力と柔軟性を提供する一方で、ある程度の複雑さをもたらします。幸運なことに、キーチェーンサービスAPIはアプリが文字通り必要とする共通のキーチェーン処理を扱う高レベル関数をいくつか提供します。


注意: iOSやmacOSのiCloudキーチェーンは、この節で説明されている関数を提供していません。iCloudキーチェーンにおいて同じタスクを行うには、一段階下がったAPIを使う必要があります。
詳しくはいかに出てくる|Use-Lower-Level-Functions-When-You-Need-More-Control|を参照してください。

macOSでは、パスワード項目を作成してキーチェーンに追加する際、インターネットパスワードかそれ以外の種類のパスワードかによって二つの関数のうちどちらかを呼ぶ必要があります: SecKeychainAddInternetPasswordSecKeychainAddGenericPasswordです。
例として、インターネットパスワードではない一般的なパスワードを追加するには、以下のようにします。

NSString* service = @"myService";
NSString* account = @"username";
NSString* password = @"somethingSecret";
const void* passwordData = [[password dataUsingEncoding:NSUTF8StringEncoding] bytes];

OSStatus status = SecKeychainAddGenericPassword(
                      NULL,        // Use default keychain
                      (UInt32)service.length,
                      [service UTF8String],
                      (UInt32)account.length,
                      [account UTF8String],
                      (UInt32)password.length,
                      passwordData,
                      NULL         // Uninterested in item reference
                  );

if (status != errSecSuccess) {     // Always check the status
    NSLog(@"Write failed: %@", SecCopyErrorMessageString(status, NULL));
}

keychain referenceNULLを渡した場合、その項目はデフォルトキーチェーンに追加されます。又、システムは最後の引数を使って新しく作成された項目への任意参照(?)を返します。もし項目への参照が必要ない場合は、上記の例にもあるようにNULLを引数として渡してください。
add関数はアクセスオブジェクトを作成し、初期状態で信用されている唯一のアプリケーションとして呼び出し元のアプリケーションをリスト化します。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.