RFC2628 日本語訳
2628 Simple Cryptographic Program Interface (Crypto API). V. Smyslov. June 1999. (Format: TXT=60070 bytes) (Status: INFORMATIONAL)
RFC一覧
英語原文
Network Working Group V. Smyslov Request for Comments: 2628 TWS Category: Informational June 1999 Simple Cryptographic Program Interface (Crypto API) シンプルな暗号プログラムインターフェイス (Crypto API) Status of this Memo このメモの位置づけ This memo provides information for the Internet community. It does not specify an Internet standard of any kind. Distribution of this memo is unlimited. このメモは、Internet community のための情報を提供する。これは、いか なる種類の Internet 標準を明細に述べるものではない。このメモの配布は 無制限である。 ----------------------------------------------------------------------- Copyright Notice 著作権表示 Copyright (C) The Internet Society (1999). All Rights Reserved. ----------------------------------------------------------------------- Abstract 要約 This document describes a simple Application Program Interface to cryptographic functions. The main purpose of such an interface is to separate cryptographic libraries from internet applications, thus allowing an independent development of both. It can be used in various internet applications such as [IPsec], [ISAKMP], [IKE], [TLS]. この文書は、暗号関数へのシンプルな Application Program Interface を 記述する。そのようなインターフェイスの主な目的は、インターネットアプ リケーションから暗号ライブラリを分離するためである。したがって、両方 の依存しない開発を許している。これは、[IPsec], [ISAKMP], [IKE], [TLS] のようなさまざまなインターネットアプリケーションで使用されるこ とができる。 ----------------------------------------------------------------------- Table of Contents 目次 1. Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1. Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.3. Objectives of Development . . . . . . . . . . . . . . . . . . 3 2. Cryptoplugin Structure. . . . . . . . . . . . . . . . . . . . . 3 3. Program Interface . . . . . . . . . . . . . . . . . . . . . . . 4 3.1. Cryptoplugin Initialization Function. . . . . . . . . . . . . 4 3.1.1. Description of CryptoPluginInfo structure . . . . . . . . . 6 3.1.2. Description of CryptoAlgInfo structure. . . . . . . . . . . 6 3.2. Cryptoplugin Deinitialization Function. . . . . . . . . . . . 9 3.3. Cryptographic Context Opening Function. . . . . . . . . . . . 10 3.4. Cryptographic Context Reopening Function. . . . . . . . . . . 11 3.5. Cryptographic Context Closing Function. . . . . . . . . . . . 12 3.6. Key Verification Function . . . . . . . . . . . . . . . . . . 12 3.7. Data Transformation Function. . . . . . . . . . . . . . . . . 13 3.7.1. For CRYPTO_TYPE_ENCRYPT Algorithm Type. . . . . . . . . . . 13 3.7.2. For CRYPTO_TYPE_DECRYPT Algorithm Type. . . . . . . . . . . 14 3.7.3. For CRYPTO_TYPE_SIGN Algorithm Type . . . . . . . . . . . . 15 3.7.4. For CRYPTO_TYPE_VERIFY Algorithm Type . . . . . . . . . . . 17 3.7.5. For CRYPTO_TYPE_COMPRESS Algorithm Type . . . . . . . . . . 18 3.7.6. For CRYPTO_TYPE_UNCOMPRESS Algorithm Type . . . . . . . . . 18 3.7.7. For CRYPTO_TYPE_HASH Algorithm Type . . . . . . . . . . . . 19 3.7.8. For CRYPTO_TYPE_RANDOM Algorithm Type. . . . . . . . . . . 21 3.8. Cryptographic Context Control Function. . . . . . . . . . . . 22 4. Cryptoplugin Registration Procedure . . . . . . . . . . . . . . 23 5. Security Considerations . . . . . . . . . . . . . . . . . . . . 23 6. References. . . . . . . . . . . . . . . . . . . . . . . . . . . 23 7. Author's Address . . . . . . . . . . . . . . . . . . . . . . . 24 Appendix A. The interface specification as a C header file . . . . 25 Full Copyright Statement . . . . . . . . . . . . . . . . . . . . . 30 1. 序論. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1. 概略. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2. 用語. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.3. 開発の目的. . . . . . . . . . . . . . . . . . . . . . . . . . 3 2. 暗号プラグイン構造. . . . . . . . . . . . . . . . . . . . . . . 3 3. プログラムインターフェイス. . . . . . . . . . . . . . . . . . . 4 3.1. 暗号プラグイン初期化関数. . . . . . . . . . . . . . . . . . . 4 3.1.1. CryptoPluginInfo 構造体の解説 . . . . . . . . . . . . . . . 6 3.1.2. CryptoAlgInfo 構造体の解説. . . . . . . . . . . . . . . . . 6 3.2. 暗号プラグイン終了関数. . . . . . . . . . . . . . . . . . . . 9 3.3. 暗号コンテクストオープン関数. . . . . . . . . . . . . . . . . 10 3.4. 暗号コンテクスト再オープン関数. . . . . . . . . . . . . . . . 11 3.5. 暗号コンテクストクローズ関数. . . . . . . . . . . . . . . . . 12 3.6. 鍵検証関数. . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.7. データ変換関数. . . . . . . . . . . . . . . . . . . . . . . . 13 3.7.1. CRYPTO_TYPE_ENCRYPT アルゴリズムタイプについて. . . . . . . 13 3.7.2. CRYPTO_TYPE_DECRYPT アルゴリズムタイプについて. . . . . . . 14 3.7.3. CRYPTO_TYPE_SIGN タイプアルゴリズムについて . . . . . . . . 15 3.7.4. CRYPTO_TYPE_VERIFY アルゴリズムタイプについて . . . . . . . 17 3.7.5. CRYPTO_TYPE_COMPRESS アルゴリズムタイプについて . . . . . . 18 3.7.6. CRYPTO_TYPE_UNCOMPRESS アルゴリズムタイプについて . . . . . 18 3.7.7. CRYPTO_TYPE_HASH アルゴリズムタイプについて . . . . . . . . 19 3.7.8. CRYPTO_TYPE_RANDOM アルゴリズムタイプについて . . . . . . . 21 3.8. 暗号コンテクスト制御関数. . . . . . . . . . . . . . . . . . . 22 4. 暗号プラグイン登録手続き. . . . . . . . . . . . . . . . . . . . 23 5. セキュリティに関する考察. . . . . . . . . . . . . . . . . . . . 23 6. 参考文献. . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 7. 著者のアドレス. . . . . . . . . . . . . . . . . . . . . . . . . 24 付録 A. C ヘッダファイルとしてのインターフェイス仕様書 . . . . . . 25 著作権表示全文 . . . . . . . . . . . . . . . . . . . . . . . . . . 30 ----------------------------------------------------------------------- 1. Introduction 1. 序論 1.1. Summary 1.1. 概略 Nowadays internet applications that require cryptographic functions at the level of operating system kernel, use the method that assumes the libraries must be compiled/linked together with the module (driver) which provides product functionality. For the sake of possibility of independent development of the cryptographic modules and in order to provide a simple, effective and universal (suitable for application and as well kernel level of operating system) solution this specification offers the method to extract encrypting algorithms to the separate cryptographic modules. 今日、オペレーティングシステムカーネルのレベルで暗号関数を必要とする インターネットアプリケーションは、次に述べる方式を使用する。その方式 とはライブラリ(s) が製品機能を提供するモジュール (ドライバ) と共にコ ンパイル/リンクされなければならないことを想定したものである。暗号モ ジュール(s) の依存しない開発の実現性を目的として、かつシンプルで有効 性と (アプリケーションとその上オペレーティングシステムのカーネルレベ ルのために適した) すべてに及ぶ解決法を提供するために、この仕様書は、 別々の暗号モジュール(s) に対し暗号アルゴリズムを引き出すための方式を 提供する。 This document describes simple open interface (Crypto API) to external cryptographic libraries optimized both for the application and kernel level of the operating system. この文書は、アプリケーションとオペレーティングシステムのカーネルレベ ルのため両方に最適化された外部 (にある) 暗号ライブラリへのシンプルな オープンインターフェイス (Crypto API) を記述する。 1.2. Terminology 1.2. 用語 Cryptoplugin 暗号プラグイン Operation system unit (driver, shared library, module) that provides cryptographic functions via well-defined (but OS- specific) interface. 適切に定義された (しかし OS 特定の) インターフェイス経由で暗号関 数を提供するオペレーションシステムユニット (ドライバ、共有ライブ ラリ、モジュール)。 Cryptolibrary 暗号ライブラリ Part of cryptoplugin that provides its cryptographic functionality via Crypto API. Crypto API によりその暗号機能を提供する cryptoplugin の一部分。 Wrapper ラッパー Part of cryptoplugin that provides interfaces translation between Crypto API and OS-specific interface. Crypto API と OS 特定のインターフェイス間のインターフェイス変換を 提供する cryptoplugin の一部分。 Definition of all cryptography related terms can be found in [Schneier]. すべての暗号関連の用語定義は、[Schneier] で見つけられる。 1.3. Objectives of Development 1.3. 開発の目的 The objectives of Simple CryptoAPI development are as follows: Simple CryptoAPI 開発の目的は、次の通りである: 1) To extract program implementations of encryption, one-way hash function, digital signature and random numbers generation algorithms to separate, independently developed modules. 開発モジュールを依存なしに分離するため、暗号、一方向ハッシュ関 数、デジタル署名と乱数値生成アルゴリズムのプログラム実装を引き 出すためである。 2) To provide version independence between using encryption modules and external cryptoplugin. 使用する暗号モジュールと外部 cryptoplugin 間のバージョン独立を 提供するためである。 3) To ensure platform independent developments of encrypting algorithm modules with portable source code. ポータブルなソースコードを持つ暗号アルゴリズムモジュール(s) の プラットフォーム独立な開発を保証するためである。 4) To enable independent development of modules and compatibility of modules developed independently. モジュール(s) の独立した開発と、独立に開発されたモジュール(s) の互換性を可能にするためである。 ----------------------------------------------------------------------- 2. Cryptoplugin Structure 2. 暗号プラグイン構造 In order to provide fast exchange between the cryptoplugin and its client the cryptoplugin is implemented as a separate driver (or module) of the particular operating system (Fig.1). Cryptoplugin consists of two parts (Fig.2): cryptoplugin とそのクライアント間の速い交換を提供するために、 cryptoplugin は、特定のオペレーティングシステム (図 1) の別々のドラ イバ (もしくはモジュール) として実装される。cryptoplugin は、2 つの 部分からなる (図 2): 1) cryptolibrary itself (1) cryptolibrary それ自身 (1) 2) system-dependent module (wrapper) for interaction between cryptolibrary and its client (2) cryptolibrary とそのクライアント間の相互作用のためのシステム依 存モジュール (wrapper) (2) Cryptoplugin initialization / by the operating system | | +------------------+ +-|-+-------------+ | | | | | | Cryptoplugin's | -------> | | | | | Cryptoplugin | | client | <------- | | | | | | | +------------------+ | +---+-------------+ | \ \ System-dependent CPI Fig. 1 Interaction between cryptoplugin and its client オペレーティングシステムによる / 暗号プラグインの初期化 | | +------------------+ +-|-+-------------+ | | | | | | 暗号プラグイン | -------> | | | | | 暗号プラグイン | | のクライアント | <------- | | | | | | | +------------------+ | +-+---------------+ | \ \ システム依存 CPI 図 1 暗号プラグインとそのクライアント間の相互作用 +---------------+-------------------------------+ | | | | --> Submodule of | | Submodule - | | | | encrypting algorithms (1) | | wrapper (2) | | | <-- (cryptolibrary) | | | | +---------------+-------------------------------+ | \ \ Cryptographic Program Interface Fig. 2 Cryptoplugin structure +------------------+----------------------------+ | | | | --> 暗号モジュールの | | サブモジュール - | | | | サブモジュール (1) | | ラッパー (2) | | | <-- (暗号ライブラリ) | | | | +------------------+----------------------------+ | \ \ 暗号プログラムインターフェイス 図 2 暗号プログラム構造 The system-dependent module (wrapper) is delivered by the driver- client developer in the form of source code or in the form of libraries (for example, in the form of object files) for particular operating system. The wrapper is intended for translation of system-independent application interface to the particular system- dependent interface with the cryptoplugin's client. The wrapper context does not include components specific to cryptoplugin's client functionality or to some cryptographic algorithm. The interface described in section 3 is the standard for interaction between the submodules (1) and (2). システム依存モジュール (wrapper) は、特定のオペレーティングシステム のために、ソースコードの形式かライブラリの形式 (たとえば、オブジェク トファイルの形式) で、ドライバクライアント開発者により渡される。その wrapper は、cryptoplugin クライアントとで特定のシステム依存インター フェイスへと、システム非依存アプリケーションインターフェイス変換のた めに意図される。wrapper の中身は、cryptoplugin のクライアント機能に 対するか、またはいくつかの暗号アルゴリズムに対する特定の構成要素を含 まない。section 3 で記述されるインターフェイスは、サブモジュール (1) と (2) 間の相互作用のための標準である。 A cryptoplugin can contain a number of different algorithms. Moreover, it can contain some different implementations of one particular algorithm. cryptoplugin は、多数の異なるアルゴリズムを含むことができる。その上 これは、1 つの特定のアルゴリズムに関するいくつかの異なる実装を含むこ とができる。 ----------------------------------------------------------------------- 3. Program Interface 3. プログラムインターフェイス The CPI (Cryptographic Program Interface) consists of a set of functions exported by encrypting algorithm submodule (cryptolibrary). The interface functions are described below (see also Appendix A). CPI (Cryptographic Program Interface/暗号プログラムインターフェイス) は、暗号アルゴリズムサブモジュール (cryptolibrary) により外へ運ばれ る関数(s) の集合からなる。インターフェイス関数(s) は、下で記述される (付録 A も参照しなさい)。 3.1. Cryptoplugin Initialization Function 3.1. 暗号プラグイン初期化関数 The function is intended for cryptoplugin initialization and obtaining information about algorithms contained in cryptoplugin. The function is called once before the beginning of cryptoplugin operation. この関数は、cryptoplugin 初期化と、cryptoplugin に含まれるアルゴリズ ム(s) に関する情報取得のために意図される。この関数は、cryptoplugin オペレーションを始める前に一度呼ばれる。 /* CryptoPlugin initialization. Returns pointer to CryptoPluginInfo structure on success or NULL on fatal error. */ /* cryptoplugin 初期化。成功時、CryptoPluginInfo 構造体へのポインタ を、または致命的エラー時、NULL を返す */ CryptoPluginInfo *CryptoPluginInit( void *param);/* Ptr to OS parameters (platform-specific) */ /* OS パラメータへのポインタ (プラットフォーム特有) */ Description of parameters: パラメータ解説: param - pointer to system-dependent parameters transmitted to cryptoplugin by the operating system. Intention and format of parameters are specific to each operating system and should be described in documentation on the cryptoplugin wrapper. オペレーティングシステムにより cryptoplugin へ渡されるシステム 依存パラメータ(s) へのポインタ。パラメータ(s) の意図と形式は、 それぞれオペレーティングシステムに特有であり、cryptoplugin wrapper に関して文書で記述されるべきである。 The function is called at the moment of cryptoplugin initialization. If succeeded it returns the pointer to CryptoPluginInfo structure that describes the module and algorithms implemented in the cryptolibrary. If function call did not succeed, function will return NULL or appropriate error code in CryptoPluginInfo structure status field. If the initialization is partially succeeded then the cryptoplugin either returns CryptoPluginInfo structure transformed so that it contains only successfully initialized algorithms or returns appropriate error code in status field of CryptoAlgInfo structures that describes the reason for the failure. この関数は、cryptoplugin 初期化時に呼ばれる。もし成功なら、この関数 は、cryptolibrary に実装されたモジュールとアルゴリズムを記述した CryptoPluginInfo 構造体へのポインタを返す。もし関数呼び出しが成功し ないなら、関数は NULL か、CryptoPlugInfo 構造体状態フィールドに適切 なエラーコードを返す。もし初期化が部分的に成功するなら、それから cryptoplugin は、次に述べるどちらかを返す。それは、成功して初期化さ れたアルゴリズム(s) のみを含むように変換された CryptoPluginInfo 構造 体か、失敗理由を記述する CryptoAlgInfo 構造体(s) の状態フィールドに 適切なエラーかである。 Error codes for the function: その関数のエラーコード(s): NULL - fatal unsuccessful cryptoplugin initialization. The module is unable even to indicate the reason of failure. 致命的な不成功 cryptoplugin 初期化。モジュールは、失敗理由を指 し示すことさえできない。 The pointer to cryptoplugin description structure in the case of full or partial success. The status fields in CryptoPluginInfo structure and in comprised CryptoAlgInfo structures can be set to the following values: 完全か部分的な成功のケースで、cryptoplugin 記述構造体へのポインタ。 CryptoPluginInfo 構造体と (それに) 含まれる CryptoAlgInfo 構造体(s) の状態フィールドは、次に述べる値に設定されることができる: CRYPTO_OK - cryptoplugin (algorithm) is initialized successfully. cryptoplugin (アルゴリズム) は、成功して初期化された。 CRYPTO_ERR_GENERAL - internal error. 内部エラー。 CRYPTO_ERR_NOT_SUPPORTED - (only for algorithm) - the algorithm is not supported by the module at the moment. (アルゴリズムについてのみ) - そのアルゴリズムは、今のところこ のモジュールによりサポートされていない。 CRYPTO_ERR_HARDWARE - error of hardware initialization. ハードウェア初期化エラー。 CRYPTO_ERR_NO_RESOURCES - insufficient internal resources. 不足した内部リソース。 CRYPTO_ERR_NO_MEMORY - not enough memory. Contrary to general CRYPTO_ERR_NO_RESOURCES error this code assumes that the calling module can release system memory (if it is in position to) and try to call the function once again. 不十分なメモリ。一般的な CRYPTO_ERR_NO_RESOURCES エラーに反し このコードは、呼んでいるモジュールがシステムメモリを開放するこ とができ (もしそれがおこなえる立場にあるなら)、もう一度その関 数を呼び出そうと試みることができると想定する。 3.1.1. Description of CryptoPluginInfo structure 3.1.1. CryptoPluginInfo 構造体の解説 The CryptoPluginInfo structure consists of header of fixed size that generally describes cryptoplugin and array of CryptoAlgInfo structures following the header. Each structure describes particular algorithm implemented in the cryptolibrary (see Appendix A) CryptoPluginInfo 構造体は、cryptoplugin を一般的に記述する固定サイズ のヘッダと、ヘッダに続く CryptoAlgInfo 構造体(s) の配列からなる。そ れぞれの構造体は、cryptolibrary に実装される特定のアルゴリズムを記述 する (付録 A を参照しなさい)。 Structure fields description: 構造体フィールドの解説: cpi_version - CPI version (should be CRYPTO_VER (1,0)). CPI version determines both functions set and fields layout in CryptoPluginInfo/CryptoAlgInfo structures. CPI バージョン (これは CRYPTO_VER (1,0) であるべきである)。CPI バージョンは、関数(s) 集合と CryptoPluginInfo/CryptoAlgInfo 構 造体(s) 内のフィールド配置両方を決定する。 status - returns the error code if cryptoplugin initialization failed (otherwise should be CRYPTO_OK) もし cryptoplugin 初期化が失敗するなら、エラーコードを返す (さ もなければ、CRYPTO_OK であるべきである)。 name - text cryptoplugin description (ASCII-7 characters only; all unused bytes must be set to 0). テキスト cryptoplugin 記述 (ASCII-7 文字のみ; すべての使用され ない bytes は 0 に設定されなければならない)。 version - cryptoplugin version (CRYPTO_VER(maj,min)). cryptoplugin バージョン (CRYPTO_VER(maj,min))。 flags - various flags that characterize the cryptoplugin. cryptoplugin を特徴づけるさまざまなフラグ(s)。 number_of_algs - number of algorithms the cryptolibrary comprises of (i.e. the number of consequent CryptoAlgInfo structures). cryptolibrary が含むアルゴリズム数 (すなわち、結果となる CryptoAlgInfo 構造体数)。 3.1.2. Description of CryptoAlgInfo structure 3.1.2. CryptoAlgInfo 構造体の解説 Structure fields description 構造体フィールドの解説 status - returns the error code if particular algorithm initialization failed (otherwise should be CRYPTO_OK). もし特定のアルゴリズム初期化が失敗するなら、エラーコードを返す (さもなければ、CRYPTO_OK であるべきである)。 id - algorithm identifier (CRYPTO_A_XXX). Values in the range of 0..249 are reserved; Values in the range of 250..32767 indicate algorithms not enrolled in standard list. It should be emphasized that algorithm IDs are independent for each algorithm type. But it is considered that pairs of types CRYPTO_TYPE_ENCRYPT and CRYPTO_TYPE_DECRYPT, CRYPTO_TYPE_SIGN and CRYPTO_TYPE_VERIFY, CRYPTO_TYPE_COMPRESS and CRYPTO_TYPE_UNCOMPRESS are equivalent because they define reverse actions of the same nature. アルゴリズム識別子 (CRYPTO_A_XXX)。範囲 0..249 の値は、予約さ れる; 範囲 250..32767 の値は、標準リストに登録されないアルゴリ ズム(s) を指し示す。これは、アルゴリズム IDs がそれぞれのアル ゴリズムタイプに依存しないことを強調されるべきである。しかし、 タイプのペア CRYPTO_TYPE_ENCRYPT と CRYPTO_TYPE_DECRYPT, CRYPTO_TYPE_SIGN と CRYPTO_TYPE_VERIFY, CRYPTO_TYPE_COMPRESS と CRYPTO_TYPE_UNCOMPRESS は同じ性質の逆動作を定義するので、こ れらペアは同等であると考えられる。 group - algorithm implementation group (variants algorithm implementations with various parameters not covered by CryptoAlgInfo structure). Values in the range of 0..32767 are well-known numbers defined in Appendix A; vendors may arbitrarily use values in the range of 32768..65535. アルゴリズム実装グループ (CryptoAlgInfo 構造体により扱われない さまざまなパラメータを持つ変形アルゴリズム実装(s))。範囲 0.. 32767 の値は、付録 A で定義された well-known (よく知られた) 番 号である; ベンダ(s) は、範囲 32768..65535 の値を任意に使用する かもしれない。 type - algorithm type (CRYPTO_TYPE_XXX). Unambiguously determines algorithm application. アルゴリズムタイプ (CRYPTO_TYPE_XXX)。アルゴリズム利用をあいま いなく決定する。 version - version of algorithm implementation (CRYPTO_VER (maj,min)). アルゴリズム実装のバージョン (CRYPTO_VER(maj,min))。 flags - flags that characterize the algorithm and its implementation. All bits, that are not defined in Appendix A, must be zeroed. アルゴリズムとその実装を特徴づけるフラグ(s)。付録 A で定義され ないすべての bits は、zero にしなければならない。 maxcontexts - maximum cryptographic contexts number that are simultaneously supported by the algorithm implementation (0 if the number is unlimited or is limited only by environmental conditions like memory size). アルゴリズム実装により同時にサポートされる最大の暗号状況数。 (もし番号が無制限なら 0 で、もしくは番号はメモリサイズのような 環境状況にのみ制限される)。 name - text algorithm name (ASCII characters use only; all unused bytes must be set to 0). テキストアルゴリズム名 (ASCII 文字が使用されるだけである; すべ ての使用されない bytes は、0 に設定されなければならない)。 The next information depends on algorithm type: 次の情報は、アルゴリズムタイプに依存する: For encryption algorithms (CRYPTO_TYPE_ENCRYPT and CRYPTO_TYPE_DECRYPT): 暗号アルゴリズム(s) (CRYPTO_TYPE_ENCRYPT と CRYPTO_TYPE_DECRYPT) に ついて: blocklen - data block length in bytes (value 1 must be used for stream cipher algorithms). bytes でのデータブロック長 (値 1 は、ストリーム暗号アルゴリズ ムのために使用されなければならない)。 keylen - encrypting (or decrypting) key length in bytes. bytes での暗号 (もしくは復号) 鍵長。 outlen - output data size for conversion of one input data block in bytes. Usually it is equal to blocklen. When prediction of this value is impossible zero value must be indicated. bytes での 1 つの入力データブロック変換の出力データサイズ。通 例、これは、blocklen に等しい。この値の予想が不可能である時、 zero が指し示されなければならない。 milen - size of initialization vector (for block algorithms) or message indicator (for stream algorithms) in bytes. For block algorithms zero value of the parameter means that the algorithm implements ECB encoding. Non-zero milen parameter means that the algorithm implements CBC encoding. For stream algorithms zero value of the parameter means that the message indicator is not required. bytes での (ブロックアルゴリズム(s) のための) 初期ベクトルサイ ズや、(ストリームアルゴリズム(s) のための) メッセージ指示子。 ブロックアルゴリズム(s) について、パラメータの zero 値は、その アルゴリズムが ECB エンコーディングを実装していることを意味す る。zero でない milen パラメータは、そのアルゴリズムが CBC エ ンコーディングを実装していることを意味する。ストリームアルゴリ ズム(s) について、パラメータの zero 値は、メッセージ指示子が必 要とされないことを意味する。 For signature algorithms (CRYPTO_TYPE_SIGN): 署名アルゴリズム(s) (CRYPTO_TYPE_SIGN) について: blocklen - block size in bytes. The length of input signature data will be padded up to this value. When there is no need in padding the value of 1 must be set. bytes でのブロックサイズ。入力署名データの長さは、この値にまで パディングされる。パディングの必要がない時、1 の値が設定されな ければならない。 keylen - private key length in bytes. bytes でのプライベート鍵長。 outlen - signature length in bytes. When prediction of this value is impossible 0 value must be indicated. If the signature consists of several values then the total length is indicated. bytes での署名長。この値の予想が不可能な時、値 0 が指し示され なければならない。もし署名がいくつもの値からなるなら、それから 全長が指し示される。 milen - non-zero value specifies signature parameter length (random number), zero value indicates that the parameter is not required. zero でない値が、署名パラメータ長 (乱数値) を述べる。値 zero は、パラメータが必要とされないことを指し示す。 For signature verification algorithms (CRYPTO_TYPE_VERIFY): 署名検証アルゴリズム(s) (CRYPTO_TYPE_VERIFY) について: blocklen - is not used. 未使用。 keylen - length of public key in bytes. bytes での公開鍵長。 outlen - signature length in bytes. When prediction of this value is impossible 0 value must be indicated. If the signature consists of several values then the total length is indicated. bytes での署名長。この値の予想が不可能な時、値 0 が指し示され なければならない。もし署名がいくつもの値からなるなら、それから 全長が指し示される。 milen - is not used. 未使用。 For data compression algorithms (CRYPTO_TYPE_COMPRESS): データ圧縮アルゴリズム (CRYPTO_TYPE_COMPRESS) について: blocklen - see outlen. outlen を参照しなさい。 keylen - is not used. 未使用。 outlen - if the algorithm provides the fixed compression with known value then it is indicated as blocklen/outlen ratio. The values can be arbitrary. If the compression value is not known then outlen is set to 0 and blocklen is not used. もしアルゴリズムが既知な固定圧縮を提供するなら、それからこれは blocklen/outlen 比率として指し示される。値は、任意であることが できる。もし圧縮値が未知であるなら、それから outlen は 0 に設 定され、blocklen は使用されない。 milen - is not used. 未使用。 For data uncompressing algorithms (CRYPTO_TYPE_UNCOMPRESS): データ伸長アルゴリズム(s) (CRYPTO_TYPE_UNCOMPRESS) について: blocklen - see outlen. outlen を参照しなさい。 keylen - is not used. 未使用。 outlen - if the algorithm provides the fixed compression with known value then it is indicated as blocklen/outlen ratio. The values can be arbitrary. It is natural that the ratio will be reverse to the similar value for the same algorithm but of CRYPTO_TYPE_COMPRESS type. If the compression value is not known then outlen is set to 0 and blocklen is not used. もしアルゴリズムが既知な固定圧縮を提供するなら、それからこれは blocklen/outlen 比率として指し示される。値は、任意であることが できる。比率が、CRYPTO_TYPE_COMPRESS タイプのその値を除いて、 同じアルゴリズムについて類似の値と逆であるのは自然である。もし 圧縮値が未知であるなら、それから outlen は 0 に設定され、 blocklen は使用されない。 milen - is not used. 未使用。 For one-way hash function algorithms (CRYPTO_TYPE_HASH): 一方向関数アルゴリズム(s) (CRYPTO_TYPE_HASH) について: blocklen - block size in bytes. The length of input data will be padded up to this value. When there is no need in padding value 1 should be used. bytes でのブロックサイズ。入力データ長は、この値にまでパディン グされる。パディングの必要がない時、値 1 が使用されるべきであ る。 keylen - is not used. 未使用。 outlen - resulting hash value length in bytes. bytes での結果となるハッシュ値長。 milen - is not used. 未使用。 For random number generation algorithms (CRYPTO_TYPE_RANDOM): 乱数値生成アルゴリズム(s) (CRYPTO_TYPE_RANDOM) について: blocklen - is not used. 未使用。 keylen - initial seed length (0 - if not required, for example in a physical effects based generators). 初期 seed 長 (0 - もし必要とされないならば。たとえば、物理的に 結果が生成器に基づく)。 outlen - resulting random number length in bytes (0 - arbitrary) bytes での結果となる乱数値長 (0 - 任意)。 milen - is not used. 未使用。 3.2. Cryptoplugin Deinitialization Function 3.2. 暗号プラグイン終了関数 /* Plugin deinitialization */ /* プラグイン終了 */ CRYPTO_STATUS CryptoPluginFini(void); The function is called before the cryptoplugin operation is to be terminated. Function execution causes closing of all open cryptographic contexts, system resources deallocation and hardware deinitialization. The value returned is informational only. この関数は、cryptoplugin オペレーションが終了されることになっている ことの前に呼ばれる。関数実行は、すべてのオープン暗号コンテクスト、シ ステムリソース開放とハードウェア終了のクローズを引き起こす。返される 値は、情報のみである。 Return codes for the function: この関数のためのリターンコード: CRYPTO_OK - cryptoplugin is deinitialized successfully. cryptoplugin は、成功して終了した。 CRYPTO_ERR_GENERAL - internal error. 内部エラー。 CRYPTO_ERR_UNCLOSED_HANDLES - warning that there were open cryptographic contexts during cryptoplugin deinitialization. The warning is informational only. The open contexts are destroyed anyway. cryptoplugin 終了の間にオープン暗号コンテクストがあったことの 警告。この警告は、情報のみである。オープンコンテクストは、いず れにせよ破壊される。 3.3. Cryptographic Context Opening Function 3.3. 暗号コンテクストオープン関数 New algorithm instance (cipher state) */ /* 新しいアルゴリズムインスタンス (暗号状態) */ CRYPTO_STATUS CryptoOpen( CRYPTO_HANDLE *state, /* Pointer to cipher state handle (filled on exit) */ /* 暗号状態ハンドルへのポインタ ((この関数の) 終了で満たされる) */ long algnum, /* Algorithm number in CryptoPluginInfo structure */ /* CryptoPluginInfo 構造体内のアルゴリ ズム番号 */ const char *key); /* key (in plain) */ /* 鍵 (平文で) */ The function creates cryptographic context copy inside cryptoplugin and initializes it with the provided key. Later the handle of the context is used in calls of other algorithm functions. この関数は、cryptoplugin 内部の暗号コンテクストコピーを作り出す。そ して、それを提供された鍵で初期化する。後で、コンテクストのハンドルは 他のアルゴリズム関数(s) の呼び出しに使用する。 Description of parameters: パラメータ解説: state - pointer to the variable that will be set to the handle of the context created if succeeded. NULL parameter value should result in the CRYPTO_ERR_BAD_PARAMS code returned by the function. もし成功するなら、作り出されたコンテクストのハンドルに設定され る変数へのポインタ。NULL パラメータ値は、その関数により返され る CRYPTO_ERR_BAD_PARAMS コードという結果となるべきである。 algnum - algorithm number in the cryptoplugin. It is equal to the number of CryptoAlgInfo structure (that describes the algorithm) in CryptoPluginInfo structure. The number begins with zero value. It should be taken into account that it is not an algorithm identifier but its number in the cryptoplugin. cryptoplugin のアルゴリズム番号。これは、CryptoPluginInfo 構造 体内の (アルゴリズムを記述する) CryptoAlgInfo 構造体の番号に等 しい。番号は、zero 値で始まる。これは、アルゴリズム識別子でな く、cryptoplugin 内の番号であることに注意されるべきである。 key - pointer to the key (if it is required) or to the seed (for random number generation algorithm). (もし必要とされるなら) 鍵、もしくは (乱数値生成アルゴリズムの ための) seed へのポインタ。 Notes. 注意 1. Generated cryptographic context is stored inside the cryptoplugin until it will be destroyed by the CryptoAlgClose function call. The maximum number of cryptographic contexts supported by cryptoplugin can be indicated in algorithm parameters description. If maximum number of cryptographic contexts equals to zero then the cryptographic contexts number is either unlimited (for example, for stateless algorithms like random number generators and one-way hash functions) or it is limited by external factors only (like memory size). 生成された暗号コンテクストは、CryptoAlgClose 関数呼び出しにより破 壊されるまで、cryptoplugin 内部に格納される。cryptoplugin により サポートされる暗号コンテクストの最大数は、アルゴリズムパラメータ 記述で指し示されることができる。もし暗号コンテクストの最大数が zero に等しいなら、それから暗号コンテクスト番号は、無制限 (たとえ ば、乱数生成器と一方向ハッシュ関数のようなステートレスアルゴリズ ムのためか)、(メモリサイズのような) 外部要因のみに制限されるかの どちらかである。 Return codes for the function: この関数のためのリターンコード: CRYPTO_OK - successful completion. 成功終了。 CRYPTO_ERR_GENERAL - internal error. 内部エラー。 CRYPTO_ERR_NO_RESOURCES - insufficient internal resources. 不足した内部リソース。 CRYPTO_ERR_NO_MEMORY - not enough memory. Contrary to general CRYPTO_ERR_NO_RESOURCES error this code assumes that the calling module can release system memory (if it is in position to) and try to call the function once again. 不十分なメモリ。一般的な CRYPTO_ERR_NO_RESOURCES エラーに反し このコードは、呼んでいるモジュールがシステムメモリを開放するこ とができ (もしそれがおこなえる立場にあるなら)、もう一度その関 数を呼び出そうと試みることができると想定する。 CRYPTO_ERR_BAD_PARAMS - invalid parameters (invalid algorithm number, zero pointer to the handle or to key (seed) if it is required. 無効パラメータ (無効なアルゴリズム番号、ハンドルへの zero ポイ ンタや、もし必要とされるなら鍵 (seed) への zero ポインタ)。 3.4. Cryptographic Context Reopening Function 3.4. 暗号コンテクスト再オープン関数 /* Reinitialize algorithm instance */ CRYPTO_STATUS CryptoReOpen( CRYPTO_HANDLE state, /* current cipher state handle */ /* 現在の暗号状態ハンドル */ const char *key); /* key (in plain) */ /* 鍵 (平文で) */ The function reinitializes an existing context. This function is used for key change without new system resources allocation. The function parameters are handle of opened earlier context and pointer to a new key. この関数は、存在しているコンテクストを再初期化する。この関数は、新し いシステムリソース確保なしに鍵変更のために使用される。関数パラメータ は、オープンされた初期のコンテクストのハンドルと、新しい鍵へのポイン タである。 Return codes for the function: この関数のためのリターンコード: CRYPTO_OK - successful completion. 成功終了。 CRYPTO_ERR_GENERAL - internal error. 内部エラー。 CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle. 無効な暗号コンテクストハンドル。 CRYPTO_ERR_NO_RESOURCES - insufficient internal resources. 不足した内部リソース。 CRYPTO_ERR_NO_MEMORY - not enough memory. Contrary to general CRYPTO_ERR_NO_RESOURCES error this code assumes that the calling module may release system memory and try function call once more. 不十分なメモリ。一般的な CRYPTO_ERR_NO_RESOURCES エラーに反し このコードは、呼んでいるモジュールがシステムメモリを開放するこ とができ (もしそれがおこなえる立場にあるなら)、もう一度その関 数を呼び出そうと試みることができると想定する。 CRYPTO_ERR_BAD_PARAMS - invalid parameters (invalid algorithm number, zero pointer to the handle or to key (seed) if it is required. 無効パラメータ (無効なアルゴリズム番号、ハンドルへの zero ポイ ンタや、もし必要とされるなら鍵 (seed) への zero ポインタ)。 3.5. Cryptographic Context Closing Function 3.5. 暗号コンテクストクローズ関数 /* Destroy algorithm instance */ /* アルゴリズムインスタンスの破壊 */ CRYPTO_STATUS CryptoClose( CRYPTO_HANDLE state); /* Handle of cipher state */ /* 暗号状態のハンドル */ The function provides cryptographic context destruction. The cryptographic context handle is its parameter. The value returned is informational only. この関数は、暗号コンテクスト破壊を提供する。暗号コンテクストハンドル は、そのパラメータである。返される値は、情報のみである。 Return codes for the function: この関数のためのリターンコード: CRYPTO_OK - successful completion. 成功終了。 CRYPTO_ERR_GENERAL - internal error. 内部エラー。 CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle. 無効な暗号コンテクストハンドル。 3.6. Key Verification Function 3.6. 鍵検証関数 /* Check key for possible weakness */ /* 可能性のある弱点鍵のチェック */ CRYPTO_STATUS CryptoCheckForWeakKey( long algnum, /* Algorithm number in CryptoPluginInfo structure */ /* CryptoPluginInfo 構造体内のアル ゴリズム番号 */ const char *key); /* Proposed key */ /* 提案鍵 */ The function verifies key material whether it is weak (from the algorithm's point of view). The function is actual for encryption/decryption or signing/verification algorithms only. Algorithm number (similar to CryptoAlgOpen) and pointer to the key to be verified are the parameters. この関数は、鍵材料が (アルゴリズムの考え方の点から) 弱点であるかどう かを検証する。この関数は、暗号/復号や署名/検証アルゴリズムのみについ て現実的である。(CryptoAlgOpen に似て) アルゴリズム番号と、検証され る鍵へのポインタは、そのパラメータである。 Return codes for the function: この関数のためのリターンコード: CRYPTO_O - the key has passed the test. その鍵は、テストをパスした。 CRYPTO_ERR_WEAK_KEY - the key has not passed the test (being weak or possibly weak). その鍵は、テストをパスしなかった (弱点か、可能性のある弱点であ る)。 CRYPTO_ERR_NOT_SUPPORTED - is not supported. 未サポート。 CRYPTO_ERR_NO_RESOURCES - insufficient internal resources. 不足した内部リソース。 CRYPTO_ERR_NO_MEMORY - not enough memory. Contrary to general CRYPTO_ERR_NO_RESOURCES error this code assumes that the calling module can release system memory (if it is in position to) and try to call the function once again. 不十分なメモリ。一般的な CRYPTO_ERR_NO_RESOURCES エラーに反し このコードは、呼んでいるモジュールがシステムメモリを開放するこ とができ (もしそれがおこなえる立場にあるなら)、もう一度その関 数を呼び出そうと試みることができると想定する。 3.7. Data Transformation Function 3.7. データ変換関数 /* Perform CryptoTransform (depends on cipher state type) */ /* CryptoTranform 実行 (暗号状態タイプ依存) */ CRYPTO_STATUS CryptoTransform( CRYPTO_HANDLE state, /* Cipher state */ /* 暗号状態 */ const char *inbuff,/* input data */ /* 入力データ */ long inlen, /* input data length */ /* 入力データ長 */ char *outbuff,/* output buffer */ /* 出力バッファ */ long *outlen,/* On entry - output buffer length, on exit - number of bytes written to outbuff */ /* 呼び出し時、出力バッファ長、 終了時、outbuff に書かれた bytes 数 */ char *mi); /* Message indicator */ /* メッセージ指示子 */ This is a cryptographic data transformation function. Function call results and function parameters are dependent on algorithm type. For algorithm types CRYTO_TYPE_ENCRYPT, CRYPTO_TYPE_DECRYPT, CRYPTO_TYPE_SIGN and CRYPTO_TYPE_VERIFY (items 3.7.1 - 3.7.4) function call results are history independent. これは、暗号データ変換関数である。関数呼び出し結果(s) と関数パラメー タ(s) は、アルゴリズムタイプに依存する。アルゴリズムタイプ CRYPTO_TYPE_ENCRYPT, CRYPTO_TYPE_DECRYPT, CRYPTO_TYPE_SIGN と CRYPTO_TYPE_VERIFY (アイテム 3.7.1 - 3.7.4) について、関数呼び出し結 果は、履歴非依存 (独立) である。 Note. Stream encryption algorithms may seem an "exception". However the same cryptoalgorithm handle must hide its history dependence. For algorithm types CRYPTO_TYPE_COMPRESS, CRYPTO_TYPE_UNCOMPRESS and CRYPTO_TYPE_HASH (items 3.7.5 - 3.7.7) function calls are history dependent. For the CRYPTO_TYPE_RANDOM algorithm function call may be for different implementations either dependent or independent on the history. 注意。ストリーム暗号アルゴリズム(s) は、"exception (例外)" に見える かもしれない。しかしながら、同じ暗号アルゴリズムハンドルは、その履歴 依存を隠さなければならない。アルゴリズムタイプ CRYPTO_TYPE_COMPRESS, CRYPTO_TYPE_UNCOMPRESS と CRYPTO_TYPE_HASH (アイテム 3.7.5 - 3.7.7) について、関数呼び出し結果は、履歴依存である。CRYPTO_TYPE_RANDOM ア ルゴリズムについて、関数呼び出しは、履歴に依存か非依存どちらかの異な る実装としてかもしれない。 3.7.1. For CRYPTO_TYPE_ENCRYPT Algorithm Type: 3.7.1. CRYPTO_TYPE_ENCRYPT アルゴリズムタイプについて: The function encrypts input data. Its parameters are intended for: この関数は、入力データを暗号化する。そのパラメータ(s) は、(次のよ うに) 意図される: inbuff - pointer to the input data. If this parameter is equal to NULL then the function should return the CRYPTO_ERR_BAD_PARAMS error code. 入力データへのポインタ。もしこのパラメータが NULL に等しいなら それからこの関数は、CRYPTO_ERR_BAD_PARAMS エラーコードを返すべ きである。 inlen - input data size (in bytes). If the size indicated in algorithm description is divisible by blocklen then padding is not carried out. Otherwise the algorithm either caries out padding according to the algorithm standard or returns appropriate error code (CRYPTO_ERR_BAD_PARAMS). The zero parameter is allowed so that the function quits at once and returns CRYPTO_OK code. (bytes での) 入力データサイズ。もしアルゴリズム記述で指し示さ れたサイズが blocklen により割り切れるなら、それからパディング は、外へ運ばれない。さもなければアルゴリズムは、アルゴリズム標 準に従ってパディングを外に出すか、適切なエラーコード (CRYPTO_ERR_BAD_PARAMS) を返すかどちらかである。zero パラメー タは、関数がただちに抜け出すために許され、CRYPTO_OK コードを返 す。 outbuff - output data buffer. NULL parameter value results in the outlen parameter setting to output buffer size required to encrypt the input buffer represented. In this case the CRYPTO_ERR_SMALL_BUFFER error should not be returned. 出力データバッファ。NULL パラメータ値は、表される入力バッファ を暗号化するため必要とされる出力バッファサイズへと設定する outlen パラメータという結果となる。このケースで、 CRYPTO_ERR_SMALL_BUFFER エラーが返されるべきでない。 outlen - Output buffer size is an input function parameter while the number of bytes written in the output buffer is the output parameter. Both the NULL parameter value and the zero value addressed result in CRYPTO_ERR_BAD_PARAMS code returned by the function. 出力バッファサイズは、入力 (呼び出し) 関数パラメータである。だ が一方、出力バッファに書かれる bytes 数は、出力 (呼び出し後の) パラメータであるけれども。NULL パラメータ値と指し示される zero 値両方は、その関数により返される CRYPTO_ERR_BAD_PARAMS という 結果となる。 mi - message indicator. Its content depends on whether the block or stream algorithm is applied. In the block algorithm case it is set to the last block encrypted. When the first block is encrypted mi parameter specifies initial initialization vector. In the stream algorithm case it is set to the offset of the first byte encrypted in the stream. If the algorithm uses the message indicator and the mi parameter value is set to NULL then function should return CRYPTO_ERR_BAD_PARAMS. If the algorithm (ECB Mode encrypting as an example) does not apply the message indicator then NULL value of mi is acceptable while non-NULL value should be ignored. メッセージ指示子。その内容は、ブロックかストリームアルゴリズム が適用されるかどうかに依存する。ブロックアルゴリズムケースで、 これは、最後に暗号化されたブロックに設定される。最初のブロック が暗号化される時、mi パラメータは、初期となる初期ベクトルを指 定する。ストリームアルゴリズムケースで、これは、ストリームで最 初暗号化された byte のオフセットに設定される。もしこのアルゴリ ズムがメッセージ指示子を使用して mi パラメータが NULL に設定さ れるなら、それから関数は、CRYPTO_ERR_BAD_PARAMS を返すべきであ る。もしアルゴリズム (例として ECB モード暗号化) がメッセージ 指示子を適用するなら、そのとき mi の NULL 値は適用可能である。 だが一方、NULL でない値は無視されるべきであるけれども。 Returned values: 戻り値: CRYPTO_OK - successful completion. 成功終了。 CRYPTO_ERR_GENERAL - internal error. 内部エラー。 CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle. 無効な暗号コンテクストハンドル。 CRYPTO_ERR_NO_RESOURCES - insufficient internal resources. 不足した内部リソース。 CRYPTO_ERR_NO_MEMORY - not enough memory. Contrary to general CRYPTO_ERR_NO_RESOURCES error this code assumes that the calling module can release system memory (if it is in position to) and try to call the function once again. 不十分なメモリ。一般的な CRYPTO_ERR_NO_RESOURCES エラーに反し このコードは、呼んでいるモジュールがシステムメモリを開放するこ とができ (もしそれがおこなえる立場にあるなら)、もう一度その関 数を呼び出そうと試みることができると想定する。 CRYPTO_ERR_SMALL_BUFFER - insufficient output buffer size. 不足した出力バッファサイズ。 CRYPTO_ERR_BAD_PARAMS - invalid parameters. 無効なパラメータ。 3.7.2. For CRYPTO_TYPE_DECRYPT Algorithm Type: 3.7.2. CRYPTO_TYPE_DECRYPT アルゴリズムタイプについて: The function decrypts the input data. Its parameters are intended for: この関数は、入力データを復号化する。そのパラメータ(s) は、(次のよう に) 意図される: inbuff - pointer to the input data. If the parameter is equal to NULL then the function should return the CRYPTO_ERR_BAD_PARAMS error code. 入力データへのポインタ。もしこのパラメータが NULL に等しいなら それからこの関数は、CRYPTO_ERR_BAD_PARAMS エラーコードを返すべ きである。 inlen - input data size (in bytes). When the parameter is set to zero the function quits at once and CRYPTO_OK code is returned. (bytes での) 入力データサイズ。パラメータが zero に設定される 時、関数はただちに抜け出し、CRYPTO_OK コードが返される。 outbuff - output data buffer. NULL parameter value results in the outlen parameter setting to output buffer size required to decrypt the input buffer represented. In this case the CRYPTO_ERR_SMALL_BUFFER error should not be returned. 出力データバッファ。NULL パラメータ値は、表される入力バッファ を復号化するため必要とされる出力バッファサイズへと設定する outlen パラメータという結果となる。このケースで、 CRYPTO_ERR_SMALL_BUFFER エラーが返されるべきでない。 outlen - Output buffer size is an input function parameter while the number of bytes written in the output buffer is the output parameter. Both the NULL parameter value and the zero value addressed result in CRYPTO_ERR_BAD_PARAMS code returned by the function. 出力バッファサイズは、入力 (呼び出し) 関数パラメータである。だ が一方、出力バッファに書かれる bytes 数は、出力 (呼び出し後の) パラメータであるけれども。NULL パラメータ値と指し示される zero 値両方は、その関数により返される CRYPTO_ERR_BAD_PARAMS という 結果となる。 mi - message indicator. The content depends on whether the block or stream algorithm is applied. In the block algorithm case it is set to the last block encrypted. When the first block is decrypted mi specifies initial initialization vector. In the stream algorithm case it is set to the offset of the first byte decrypted in the stream. If the algorithm uses the message indicator and the mi parameter is set to NULL then function should return CRYPTO_ERR_BAD_PARAMS. If the algorithm (ECB Mode as an example) does not apply the message indicator then NULL value of mi is acceptable while non-NULL value should be ignored. メッセージ指示子。この内容は、ブロックかストリームアルゴリズム が適用されるかどうかに依存する。ブロックアルゴリズムケースで、 これは、最後の暗号化されたブロックが設定される。最初のブロック が復号化される時、mi は、初期となる初期ベクトルを指定する。ス トリームアルゴリズムケースで、これは、そのストリームで復号化さ れる最初の byte のオフセットに設定される。もしそのアルゴリズム がメッセージ指示子を使用し mi パラメータが NULL に設定されるな ら、それから関数は、CRYPTO_ERR_BAD_PARAMS を返すべきである。も しアルゴリズム (たとえば、ECB モード) がメッセージ指示子を適用 しないなら、そのとき mi の NULL 値は適用可能である。だが NULL でない値は無視されるべきであるけれども。 Returned values: 戻り値: CRYPTO_OK - successful completion. 成功終了。 CRYPTO_ERR_GENERAL - internal error. 内部エラー。 CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle. 無効な暗号コンテクストハンドル。 CRYPTO_ERR_NO_RESOURCES - insufficient internal resources. 不足した内部リソース。 CRYPTO_ERR_NO_MEMORY - not enough memory. Contrary to general CRYPTO_ERR_NO_RESOURCES error this code assumes that the calling module can release system memory (if it is in position to) and try to call the function once again. 不十分なメモリ。一般的な CRYPTO_ERR_NO_RESOURCES エラーに反し このコードは、呼んでいるモジュールがシステムメモリを開放するこ とができ (もしそれがおこなえる立場にあるなら)、もう一度その関 数を呼び出そうと試みることができると想定する。 CRYPTO_ERR_SMALL_BUFFER - insufficient output buffer size. 不足した出力バッファサイズ。 CRYPTO_ERR_BAD_PARAMS - invalid parameters. 無効なパラメータ。 3.7.3. For CRYPTO_TYPE_SIGN Type Algorithm: 3.7.3. CRYPTO_TYPE_SIGN タイプアルゴリズムについて: The function signs the input data. Its parameters are intended for: この関数は、入力データに署名する。そのパラメータ(s) は、(次のように) 意図される: inbuff - pointer to the input data. If the parameter is equal to NULL then the function should return the CRYPTO_ERR_BAD_PARAMS code error. 入力データへのポインタ。もしパラメータが NULL に等しいなら、それ からこの関数は、CRYPTO_ERR_BAD_PARAMS コードエラーを返すべきであ る。 inlen - input data size (in bytes). If the size indicated in algorithm description is divisible by blocklen then padding is not carried out. Otherwise the algorithm either caries out padding according to the algorithm standard or returns appropriate error code (CRYPTO_ERR_BAD_PARAMS). The zero parameter is allowed so that the function quits at once and returns CRYPTO_OK code. (bytes での) 入力データサイズ。もしアルゴリズム記述で指し示される サイズが blocklen により割り切れるなら、それからパディングは、外 へ運ばれない。さもなければ、そのアルゴリズムは、アルゴリズム標準 に従ってパディングを外に出すか、適切なエラーコード (CRYPTO_ERR_BAD_PARAMS) を返すかどちらかである。zero パラメータは 関数がただちに抜け出すために許され、CRYPTO_OK コードを返す。 outbuff - output data buffer. NULL parameter value results in the outlen parameter setting to output buffer size required to sign the input buffer represented. In this case the CRYPTO_ERR_SMALL_BUFFER error should not be returned. 出力データバッファ。NULL パラメータ値は、表される入力バッファに署 名するために必要とされる出力バッファサイズへと設定する outlen パ ラメータという結果となる。このケースで、CRYPTO_ERR_SMALL_BUFFER エラーが返されるべきでない。 outlen - Output buffer size is an input function parameter while the number of bytes written in the output buffer is the output parameter. Both the NULL parameter value and the zero value addressed result in CRYPTO_ERR_BAD_PARAMS code returned by the function. 出力バッファサイズは、入力 (呼び出し) 関数パラメータである。だが 一方、出力バッファに書かれる bytes 数は、出力 (呼び出し後の) パラ メータであるけれども。NULL パラメータ値と指し示される zero 値両方 は、関数により返される CRYPTO_ERR_BAD_PARAMS コードという結果とな る。 mi - pointer to signature parameter (random number usually) if milen parameter in algorithm description is non-zero. In this case zero mi parameter indicates that the parameter should be chosen (generated) inside the algorithm. If milen parameter in algorithm description is set to zero then mi parameter is ignored. もしアルゴリズム記述の milen が zero でないなら、署名パラメータ (通例乱数値) へのポインタ。このケースで、zero mi パラメータは、パ ラメータがアルゴリズム内側で選ばれる (生成される) べきであること を指し示す。もしアルゴリズム記述の milen パラメータが zero に設定 されるなら、そのとき mi パラメータは無視される。 Returned values: 戻り値: CRYPTO_OK - successful completion. 成功終了。 CRYPTO_ERR_GENERAL - internal error. 内部エラー。 CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle. 無効な暗号コンテクストハンドル。 CRYPTO_ERR_NO_RESOURCES - insufficient internal resources. 不足した内部リソース。 CRYPTO_ERR_NO_MEMORY - not enough memory. Contrary to general CRYPTO_ERR_NO_RESOURCES error this code assumes that the calling module can release system memory (if it is in position to) and try to call the function once again. 不十分なメモリ。一般的な CRYPTO_ERR_NO_RESOURCES エラーに反し このコードは、呼んでいるモジュールがシステムメモリを開放するこ とができ (もしそれがおこなえる立場にあるなら)、もう一度その関 数を呼び出そうと試みることができると想定する。 CRYPTO_ERR_SMALL_BUFFER - insufficient output buffer size. 不足した出力バッファサイズ。 CRYPTO_ERR_BAD_PARAMS - invalid parameters. 無効なパラメータ。 3.7.4. For CRYPTO_TYPE_VERIFY Algorithm Type: 3.7.4. CRYPTO_TYPE_VERIFY アルゴリズムタイプについて: The function verifies input data signature. Its parameters are intended for: この関数は、入力データ署名を検証する。そのパラメータ(s) は、(次のよ うに) 意図される: inbuff - pointer to the input data. If the parameter is equal to NULL then the function should return the CRYPTO_ERR_BAD_PARAMS code error. 入力データへのポインタ。もしこのパラメータが NULL に等しいなら それからこの関数は、CRYPTO_ERR_BAD_PARAMS コードエラーを返すべ きである。 inlen - input data size (in bytes). The zero parameter is allowed so that the function quits at once and returns CRYPTO_OK code. (bytes での) 入力データサイズ。zero パラメータは、関数がただち に抜け出すために許され、CRYPTO_OK コードを返す。 outbuff -pointer to the signature. If the parameter is set to NULL then the function returns CRYPTO_ERR_BAD_PARAMS error code. If the signature consists of several parts then they are combined to one array. 署名へのポインタ。もしパラメータが NULL に設定されるなら、その ときこの関数は、CRYPTO_ERR_BAD_PARAMS エラーコードを返す。もし 署名がいくつかの部分からなるなら、それからそれら署名は、1 つの 配列に組み合わされる。 outlen - specifies the signature length if the signature length is set to zero in algorithm description structure. If non-zero value is specified in algorithm description structure then the parameter is ignored. If the signature consists of several parts then the maximum part length multiplied by the number of parts is specified. もし署名長がアルゴリズム記述構造で zero に設定されるなら、署名 長を指定する。もし zero でない値がアルゴリズム記述構造で指定さ れるなら、そのときパラメータは無視される。もし署名がいくつかの 部分からなるなら、それからそれら部分の数により掛けられた最大部 分長が指定される。 mi - is not used. 未使用。 Returned values: 戻り値: CRYPTO_OK - successful completion. 成功終了。 CRYPTO_ERR_INVALID_SIGNATURE - invalid signature. 無効な署名。 CRYPTO_ERR_GENERAL - internal error. 内部エラー。 CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle. 無効な暗号コンテクストハンドル。 CRYPTO_ERR_NO_RESOURCES - insufficient internal resources. 不足した内部リソース。 CRYPTO_ERR_NO_MEMORY - not enough memory. Contrary to general CRYPTO_ERR_NO_RESOURCES error this code assumes that the calling module can release system memory (if it is in position to) and try to call the function once again. 不十分なメモリ。一般的な CRYPTO_ERR_NO_RESOURCES エラーに反し このコードは、呼んでいるモジュールがシステムメモリを開放するこ とができ (もしそれがおこなえる立場にあるなら)、もう一度その関 数を呼び出そうと試みることができると想定する。 CRYPTO_ERR_SMALL_BUFFER - insufficient output buffer size. 不足した出力バッファサイズ。 CRYPTO_ERR_BAD_PARAMS - invalid parameters. 無効なパラメータ。 3.7.5. For CRYPTO_TYPE_COMPRESS Algorithm Type: 3.7.5. CRYPTO_TYPE_COMPRESS アルゴリズムタイプについて: The function compresses the input data. Its parameters are intended for: この関数は、入力データを圧縮する。そのパラメータ(s) は、(次のように) 意図される: inbuff - pointer to the input data. 入力データへのポインタ。 inlen - input data size (in bytes). The zero parameter is allowed so that the function quits at once and returns CRYPTO_OK code. (bytes での) 入力データサイズ。zero パラメータは、関数がただち に抜け出すために許され、CRYPTO_OK コードを返す。 outbuff - output data buffer. NULL parameter value results in the outlen parameter setting to output buffer size required to compress the input buffer represented. In this case the CRYPTO_ERR_SMALL_BUFFER error should not be returned. 出力データバッファ。NULL パラメータ値は、表される入力バッファ を圧縮するために必要とされる出力バッファサイズへと設定する outlen パラメータという結果となる。このケースで、 CRYPTO_ERR_SMALL_BUFFER エラーが返されるべきでない。 outlen - Output buffer size is an input function parameter while the number of bytes written in the output buffer is the output parameter. Both the NULL parameter value and the zero value addressed result in CRYPTO_ERR_BAD_PARAMS code returned by the function. 出力バッファサイズは、入力 (呼び出し) 関数パラメータである。だ が一方、出力バッファに書かれる bytes 数は、出力 (呼び出し後の) パラメータであるけれども。NULL パラメータ値と指し示される zero 値両方は、その関数により返される CRYPTO_ERR_BAD_PARAMS コード という結果となる。 mi - is not used. 未使用。 Returned values: 戻り値: CRYPTO_OK - successful completion. 成功終了。 CRYPTO_ERR_GENERAL - internal error. 内部エラー。 CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle. 無効な暗号コンテクストハンドル。 CRYPTO_ERR_NO_RESOURCES - insufficient internal resources 不足した内部リソース。 CRYPTO_ERR_NO_MEMORY - not enough memory. Contrary to general CRYPTO_ERR_NO_RESOURCES error this code assumes that the calling module can release system memory (if it is in position to) and try to call the function once again. 不十分なメモリ。一般的な CRYPTO_ERR_NO_RESOURCES エラーに反し このコードは、呼んでいるモジュールがシステムメモリを開放するこ とができ (もしそれがおこなえる立場にあるなら)、もう一度その関 数を呼び出そうと試みることができると想定する。 CRYPTO_ERR_SMALL_BUFFER - insufficient output buffer size. 不足した出力バッファサイズ。 CRYPTO_ERR_BAD_PARAMS - invalid parameters. 無効なパラメータ。 3.7.6. For CRYPTO_TYPE_UNCOMPRESS Algorithm Type: 3.7.6. CRYPTO_TYPE_UNCOMPRESS アルゴリズムタイプについて: The function decompresses the input data. Its parameters are intended for: この関数は、入力データを伸長する。そのパラメータ(s) は、(次のよう に) 意図される: inbuff - pointer to the input data. 入力データへのポインタ。 inlen - input data size (in bytes). The zero parameter is allowed so that the function quits at once and returns CRYPTO_OK code. (bytes での) 入力データサイズ。zero パラメータは、関数がただち に抜け出すために許され、CRYPTO_OK コードを返す。 outbuff - output data buffer. NULL parameter value results in the outlen parameter setting to output buffer size required to decompress the input buffer represented. In this case the CRYPTO_ERR_SMALL_BUFFER error should not be returned. 出力データバッファ。NULL パラメータ値は、表される入力バッファ を伸長するために必要とされる出力バッファサイズへと設定する outlen パラメータという結果となる。このケースで、 CRYPTO_ERR_SMALL_BUFFER エラーが返されるべきでない。 outlen - Output buffer size is an input function parameter while the number of bytes written in the output buffer is the output parameter. Both the NULL parameter value and the zero value addressed result in CRYPTO_ERR_BAD_PARAMS code returned by the function. 出力バッファサイズは、入力 (呼び出し) 関数パラメータである。だ が一方、出力バッファに書かれる bytes 数は、出力 (呼び出し後の) パラメータであるけれども。NULL パラメータ値と指し示される zero 値両方は、その関数により返される CRYPTO_ERR_BAD_PARAMS コード という結果となる。 mi - is not used. 未使用。 Returned values: 戻り値: CRYPTO_OK - successful completion. 成功終了。 CRYPTO_ERR_GENERAL - internal error. 内部エラー。 CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle. 無効な暗号コンテクストハンドル。 CRYPTO_ERR_NO_RESOURCES - insufficient internal resources. 不足した内部リソース。 CRYPTO_ERR_NO_MEMORY - not enough memory. Contrary to general CRYPTO_ERR_NO_RESOURCES error this code assumes that the calling module can release system memory (if it is in position to) and try to call the function once again. 不十分なメモリ。一般的な CRYPTO_ERR_NO_RESOURCES エラーに反し このコードは、呼んでいるモジュールがシステムメモリを開放するこ とができ (もしそれがおこなえる立場にあるなら)、もう一度その関 数を呼び出そうと試みることができると想定する。 CRYPTO_ERR_SMALL_BUFFER - insufficient output buffer size. 不足した出力バッファサイズ。 CRYPTO_ERR_BAD_PARAMS - invalid parameters. 無効なパラメータ。 3.7.7. For CRYPTO_TYPE_HASH Algorithm Type: 3.7.7. CRYPTO_TYPE_HASH アルゴリズムタイプについて: The function calculates the hash value of the input data. Its parameters are intended for: この関数は、入力データのハッシュ値を計算する。そのパラメータ(s) は、 (次のように) 意図される: inbuff - pointer to the input data. If the parameter is of NULL value then the function calculates cumulative hash value for the data represented (taking into account all previous data represented). If total length of all the data represented by the moment is divisible by blocklen and outbuff is non-NULL then it is returned to outbuff. Nothing is written in outbuff when the length is not divisible by blocklen. NULL inbuff indicates the last conversion when the input data is padded up to the blocklen size and the result is written to outbuff address. The padding procedure is defined for the algorithm. 入力データへのポインタ。もしパラメータが NULL からなるなら、そ のときこの関数は、(前に表されるデータすべてに注意して) 表され るデータに関する累積ハッシュ値を計算する。もしその時点に表され るすべてのデータ全長が blocklen により割り切れ outbuff が NULL でないなら、そのとき outbuff が返される。長さが blocklen によ り割り切れないなら、outbuff に書かれるものは何もない。入力デー タが blocklen サイズにまでパッドされその結果が outbuff アドレ スに書かれる時、NULL の inbuff は、最後の変換を指し示す。その パディング手続きは、アルゴリズムに対して定義される。 inlen - input data size (in bytes). The zero parameter is allowed when the function quits at once and returns CRYPTO_OK code. (bytes での) 入力データサイズ。関数がただちに抜け出す時、zero パラメータが許される。そして CRYPTO_OK コードを返す。 outbuff - output data buffer. 出力データバッファ。 outlen - Output buffer size is an input function parameter while the number of bytes written in the output buffer is the output parameter. If intermediate conversion value (inbuff is not NULL) and total length of data represented by the moment are not divisible by blocklen then outlen is set to zero and the hash value is not written in outbuff. Both the NULL parameter value and the zero value addressed result in CRYPTO_ERR_BAD_PARAMS code returned by the function. 出力バッファサイズは、入力 (呼び出し) 関数パラメータである。だ が一方、出力バッファに書かれる bytes 数は、出力 (呼び出し後の) パラメータであるけれども。もし中間の変換値 (inbuff は NULL で ない) とその時点で表されるデータ全長が blocklen により割り切れ ないなら、そのとき outlen は zero に設定され、ハッシュ値は outbuff に書かれない。NULL パラメータ値と指し示される zero 値 両方は、その関数により返される CRYPTO_ERR_BAD_PARAMS コードと いう結果となる。 mi - is not used. 未使用。 Returned values: 戻り値: CRYPTO_OK - successful completion. 成功終了。 CRYPTO_ERR_GENERAL - internal error. 内部エラー。 CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle. 無効な暗号コンテクストハンドル。 CRYPTO_ERR_NO_RESOURCES - insufficient internal resources. 不足した内部リソース。 CRYPTO_ERR_NO_MEMORY - not enough memory. Contrary to general CRYPTO_ERR_NO_RESOURCES error this code assumes that the calling module can release system memory (if it is in position to) and try to call the function once again. 不十分なメモリ。一般的な CRYPTO_ERR_NO_RESOURCES エラーに反し このコードは、呼んでいるモジュールがシステムメモリを開放するこ とができ (もしそれがおこなえる立場にあるなら)、もう一度その関 数を呼び出そうと試みることができると想定する。 CRYPTO_ERR_SMALL_BUFFER - insufficient output buffer size. 不足した出力バッファサイズ。 CRYPTO_ERR_BAD_PARAMS - invalid parameters. 無効なパラメータ。 3.7.8. For CRYPTO_TYPE_RANDOM Algorithm Type: 3.7.8. CRYPTO_TYPE_RANDOM アルゴリズムタイプについて: The function generates a random number. Its parameters are intended for: この関数は、乱数値を生成する。そのパラメータ(s) は、(次のように) 意 図される: inbuff - pointer to the input data used for generation (when one of the pseudorandom algorithms is implemented). NULL parameter indicates absence of the input data. (疑似乱数アルゴリズムの 1 つが実装される時) 生成のために使用さ れる入力データへのポインタ。NULL パラメータは、入力データなし を指し示す。 inlen - input data size (in bytes). (bytes での) 入力データサイズ。 outbuff - output data 出力データ。 outlen - Output buffer size is an input function parameter while the number of bytes written in the output buffer is the output parameter. If zero (i.e. arbitrary) generated number size is set in the algorithm description then the outlen value determines the number of random bytes required by the calling procedure. 出力バッファサイズは、入力 (呼び出し) 関数パラメータである。だ が一方、出力バッファに書かれる bytes 数は、出力 (呼び出し後の) パラメータであるけれども。もし生成される番号サイズ zero (すな わち任意) がアルゴリズム記述に設定されるなら、そのとき outlen 値は、呼び出し手続きにより必要とされる乱数 bytes の数を決定す る。 mi - is not used. 未使用。 Returned values: 戻り値: CRYPTO_OK - successful completion. 成功終了。 CRYPTO_ERR_GENERAL - internal error. 内部エラー。 CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle. 無効な暗号コンテクストハンドル。 CRYPTO_ERR_NO_RESOURCES - insufficient internal resources. 不足した内部リソース。 CRYPTO_ERR_NO_MEMORY - not enough memory. Contrary to general CRYPTO_ERR_NO_RESOURCES error this code assumes that the calling module can release system memory (if it is in position to) and try to call the function once again. 不十分なメモリ。一般的な CRYPTO_ERR_NO_RESOURCES エラーに反し このコードは、呼んでいるモジュールがシステムメモリを開放するこ とができ (もしそれがおこなえる立場にあるなら)、もう一度その関 数を呼び出そうと試みることができると想定する。 CRYPTO_ERR_SMALL_BUFFER - insufficient output buffer size. 不足した出力バッファサイズ。 CRYPTO_ERR_BAD_PARAMS - invalid parameters. 無効なパラメータ。 3.8. Cryptographic Context Control Function 3.8. 暗号コンテクスト制御関数 /* Algorithm control */ /* アルゴリズム制御 */ CRYPTO_STATUS CryptoControl( CRYPTO_HANDLE state, /* Cipher state handle */ /* 暗号状態ハンドル */ long cmd, /* Control command */ /* 制御コマンド */ long param, /* Parameter id */ /* パラメータ id */ char val, /* Parameter value */ /* パラメータ値 */ long *len); /* For CRYPTO_GET: on entry - val buffer length, on exit - number of bytes written to val; for CRYPTO_SET: length of value to set */ /* CRYPTO_GET について: 入力時 val バッファ長、終了時、val に書かれる bytes 数; CRYPTO_SET について: 設定さ れる値の長さ */ The function provides cryptographic context internal parameters management. It may be used to check context parameters or to change the context state, for example it may return information about cryptoalgorithm (is given context uses hardware encryption facilities), or it may "scroll" stream algorithms context if necessary, etc. この関数は、暗号コンテクスト内部パラメータ(s) 管理を提供する。これは コンテクストパラメータ(s) をチェックするためか、コンテクスト状態を変 更するために使用される。たとえば、(ハードウェア暗号手段を使用するコ ンテクストに与えられる) 暗号アルゴリズムに関する情報を返すかもしれな い。または、もし必要なら、ストリームアルゴリズムコンテクストを "scroll" かもしれない、など。 Description of parameters: パラメータの説明: state - cryptographic context handle. 暗号コンテクストハンドル。 cmd - command (CRYPTO_GET or CRYPTO_SET). コマンド (CRYPTO_GET か CRYPTO_SET)。 param - identifier of parameter. Values in the range of 0..32767 are assigned well-known numbers for all algorithms. Values in the range of 32768..65535 mean various variables for various algorithms (may be arbitrarily used by cryptolibrary developer). パラメータの識別子。範囲 0..32767 の値は、すべてのアルゴリズムに ついて well-known 値に割り当てられる。範囲 32768..65535 の値は、 (cryptolibrary 開発者により任意に使用されるかもしれない) さまざま なアルゴリズムに関するさまざまな変数を意味する。 val - pointer to the data buffer. データバッファへのポインタ。 len - data size (in bytes). (bytes での) データサイズ。 Returned values: 戻り値: CRYPTO_OK - successful completion. 成功終了。 CRYPTO_ERR_GENERAL - internal error. 内部エラー。 CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle. 無効な暗号コンテクストハンドル。 CRYPTO_ERR_NO_RESOURCES - insufficient internal resources. 不足した内部リソース。 CRYPTO_ERR_NO_MEMORY - not enough memory. Contrary to general CRYPTO_ERR_NO_RESOURCES error this code assumes that the calling module can release system memory (if it is in position to) and try to call the function once again. 不十分なメモリ。一般的な CRYPTO_ERR_NO_RESOURCES エラーに反し このコードは、呼んでいるモジュールがシステムメモリを開放するこ とができ (もしそれがおこなえる立場にあるなら)、もう一度その関 数を呼び出そうと試みることができると想定する。 CRYPTO_ERR_SMALL_BUFFER - insufficient output buffer size. 不足した出力バッファサイズ。 CRYPTO_ERR_BAD_PARAMS - invalid parameters. 無効なパラメータ。 ----------------------------------------------------------------------- 4. Cryptoplugin Registration Procedure 4. 暗号プラグイン登録手続き Cryptoplugin should be linked together with the cryptoplugin wrapper library delivered by the cryptoplugin's client developer according to the rules specified by the module-client developer for each platform. It should result in a driver (module) of appropriate operating system that implements the cryptolibrary functions. The driver should be one of the drivers loaded during operating system boot. The procedure of cryptoplugin driver installation should be defined, documented, and automated when necessary, by the cryptoplugin developer. At the beginning of operation the driver-client determines cryptoplugin driver availability and establishes interconnection with it. Both module-client configuration and current security policy determine data conversion algorithms to be chosen. cryptoplugin は、それぞれのプラットフォームに関しモジュールクライア ント開発者により述べられるルールに従って、cryptoplugin のクライアン ト開発者により渡される cryptoplugin wrapper ライブラリと共にリンクさ れるべきである。これ (cryptoplugin) は、cryptolibrary 関数(s) を実装 する適切なオペレーティングシステムのドライバ (モジュール) という結果 になるべきである。このドライバは、オペレーティングシステムブートの間 にロードされるドライバ(s) の 1 つであるべきである。cryptoplugin ドラ イバインストールの手続きは、cryptoplugin 開発者により定義され、文書 化され、必要な時に自動化されるべきである。オペレーションの始めに、ド ライバクライアントは、cryptoplugin ドライバ有用性を決定し、そのドラ イバとの相互接続性を確立する。モジュールクライアントコンフィギュレー ションと今のセキュリティポリシー両方は、選ばれるデータ変換アルゴリズ ム(s) を決定する。 ----------------------------------------------------------------------- 5. Security Considerations 5. セキュリティに関する考察 Security issues are addressed throughout this memo. セキュリティ問題は、このメモの至るところで指し示される。 ----------------------------------------------------------------------- 6. References 6. 参考文献 [Schneier] Bruce Schneier, Applied Cryptography - Protocols, Algorithms, and Source Code in C (Second Edition), John Wiley & Sons, Inc., 1996. [IPsec] Kent, S. and R. Atkinson, "Security Architecture for the Internet Protocol", RFC 2401, November 1998. [ISAKMP] Maughhan, D., Schertler, M. Schneider, M. and J. Turner, "Internet Security Association and Key Management Protocol (ISAKMP)", RFC 2408, November 1998. [IKE] Harkins, D. and D. Carrel, "The Internet Key Exchange (IKE)", RFC 2409, November 1998. [TLS] Dierks, T. and C. Allen, "The TLS protocol Version 1.0", RFC 2246, January 1999. ----------------------------------------------------------------------- 7. Author's Address 7. 著者のアドレス Valery Smyslov TWS Centralny prospekt, 11, Moscow, Russia Phone: +7 (095) 531 4633 Fax: +7 (095) 531 2403 EMail: svan@trustworks.com ----------------------------------------------------------------------- Appendix A. The interface specification as a C header file 付録 A. C ヘッダファイルとしてのインターフェイス仕様書 #ifndef __CRYPTPI_H #define __CRYPTPI_H #define CRYPTO_VER(maj,min) (((maj & 0xff) << 8) | (min & 0xff)) #define CRYPTO_MAJ_VER(ver) ((ver >> 8) & 0xff) #define CRYPTO_MIN_VER(ver) (ver & 0xff) #define CRYPTO_PLUGIN_NAME_LEN 64 /* Must be multiple of 4 to */ /* 4 の倍数でなければならない */ #define CRYPTO_ALG_NAME_LEN 32 /* avoid alignment problems */ /* アライメント問題を避ける ため */ #ifndef CRYPTO_HANDLE #define CRYPTO_HANDLE void* /* cipher state handle */ /* 暗号状態のハンドル */ #endif typedef enum tag_CRYPTO_STATUS { CRYPTO_OK = 1, /* success */ /* 成功 */ CRYPTO_ERR_GENERAL, /* undefined (internal) error */ /* 未定義 (内部) エラー */ CRYPTO_ERR_NOT_SUPPORTED, /* unsupported */ /* 未サポート */ CRYPTO_ERR_BAD_HANDLE, /* invalid handle */ /* 無効なハンドル */ CRYPTO_ERR_SMALL_BUFFER, /* insufficient output buffer size */ /* 不足した出力バッファサイズ */ CRYPTO_ERR_WEAK_KEY, /* key is considered to be weak (semiweak, pseudoweak) */ /* 鍵が弱点であると考えられる (準弱点、疑似弱点) */ CRYPTO_ERR_NO_RESOURCES, /* insufficient resources to perform operation */ /* オペレーションをおこなうのに 不足したリソース */ CRYPTO_ERR_NO_MEMORY, /* insufficient memory to perform operation */ /* オペレーションをおこなうのに 不足したメモリ */ CRYPTO_ERR_BAD_PARAMS, /* invalid parameters */ /* 無効なパラメータ */ CRYPTO_ERR_HARDWARE, /* hardware error */ /* ハードウェアエラー */ CRYPTO_ERR_INVALID_SIGNATURE, /* invalid signature */ /* 無効な署名 */ CRYPTO_ERR_UNCLOSED_HANDLES /* unclosed handles exist while plugin deinitializises */ /* plugin が終了する間にクロー ズしないハンドルが存在 */ } CRYPTO_STATUS; /* CryptoControl commands */ /* CryptoControl コマンド */ #define CRYPTO_GET 1 /* get parameter */ /* パラメータ取得 */ #define CRYPTO_SET 2 /* set parameter */ /* パラメータ設定 */ /* Currently defined algorithm types */ /* 現在定義されたアルゴリズムタイプ */ #define CRYPTO_TYPE_ENCRYPT 1 #define CRYPTO_TYPE_DECRYPT 2 #define CRYPTO_TYPE_SIGN 3 #define CRYPTO_TYPE_VERIFY 4 #define CRYPTO_TYPE_COMPRESS 5 #define CRYPTO_TYPE_UNCOMPRESS 6 #define CRYPTO_TYPE_HASH 7 #define CRYPTO_TYPE_RANDOM 8 /* Currently defined algorithm IDs (for types CRYPTO_TYPE_ENCRYPT & CRYPTO_TYPE_DECRYPT) */ /* 現在定義されたアルゴリズム ID (タイプ CRYTO_TYPE_ENCRYPT & CRYPTO_TYPE_DECRYPT のための) */ #define CRYPTO_AE_DUMMY 1 /* no encryption */ /* 暗号化なし */ #define CRYPTO_AE_DES 2 /* DES-CBC */ #define CRYPTO_AE_3DES_EDE 3 /* Triple DES-EDE-CBC */ #define CRYPTO_AE_IDEA 4 /* IDEA-CBC */ #define CRYPTO_AE_RC2 5 /* RC2 */ #define CRYPTO_AE_RC4 6 /* RC4 */ #define CRYPTO_AE_RC5 7 /* RC5 */ #define CRYPTO_AE_SAFER 8 /* SAFER */ #define CRYPTO_AE_CAST 9 /* CAST */ #define CRYPTO_AE_BLOWFISH 10 /* Blowfish */ #define CRYPTO_AE_RSA 11 /* RSA */ #define CRYPTO_AE_GOST 12 /* GOST */ /* Currently defined algorithm IDs (for types CRYPTO_TYPE_SIGN & CRYPTO_TYPE_VERIFY) */ /* 現在定義されたアルゴリズム ID (タイプ CRYTO_SIGN & CRYPTO_TYPE_VERIFY のための) */ #define CRYPTO_AS_RSA 2 /* RSA */ #define CRYPTO_AS_DSA 3 /* DSA */ #define CRYPTO_AS_GOST 4 /* GOST */ /* Currently defined algorithm IDs (for types CRYPTO_TYPE_COMPRESS & CRYPTO_TYPE_UNCOMPRESS) */ /* 現在定義されたアルゴリズム ID (タイプ CRYTO_TYPE_COMPRESS & CRYPTO_TYPE_DECOMPRESS のための) */ #define CRYPTO_AC_DUMMY 1 /* no compression */ /* 圧縮なし */ #define CRYPTO_AC_DEFLATE 2 /* Deflate */ #define CRYPTO_AC_LZS 3 /* LZS */ /* Currently defined algorithm IDs (for type CRYPTO_TYPE_HASH) */ /* 現在定義されたアルゴリズム ID (タイプ CRYTO_TYPE_HASH のための) */ #define CRYPTO_AH_MD5 1 /* MD5 */ #define CRYPTO_AH_SHA 2 /* SHA-1 */ #define CRYPTO_AH_GOST 3 /* GOST */ /* Currently defined algorithm IDs (for type CRYPTO_TYPE_RANDOM) */ /* 現在定義されたアルゴリズム ID (タイプ CRYPTO_TYPE_RANDOM のための) */ #define CRYPTO_AR_UNKNOWN 1 /* Currently defined plugin flags */ /* 現在定義された plugin フラグ */ #define CRYPTO_PLUGIN_HARDWARE 1 /* plugin uses hdw */ /* plugin はハードウェ ア使用 */ /* TBD more */ /* Currently defined algorithm flags */ /* 現在定義されたアルゴリズムフラグ */ #define CRYPTO_ALG_HARDWARE 1 /* algorithm implemented in hardware */ /* アルゴリズムはハード ウェアで実装 */ #define CRYPTO_ALG_MULTITHREADED 2 /* implementation allows multithreading */ /* 実装はマルチスレッド を許可 */ /* TBD more */ /* Currently defined parameters identifiers for CryptoControl */ /* CryptoControl のために現在定義されたパラメータ識別子 */ #define CRYPTO_PARAM_KEY 1 /* Only for CRYPTO_GET - get current key */ /* CRYPTO_GET にのみ 現在鍵を取得 */ /* TBD more */ typedef struct tag_CryptoAlgInfo { long status; /* Algorithm status */ /* アルゴリズム状態 */ long type; /* algorithm type (One of CRYPTO_TYPE_XXX) */ /* アルゴリズムタイプ CRYPTO_TYPE_XXX の 1 つ */ long id; /* algorithm ID */ /* アルゴリズム ID */ long group; /* algorithm group */ /* アルゴリズムグループ */ long version; /* algorithm version (CRYPTO_VER) */ /* アルゴリズムバージョン (CRYPTO_VER) */ long flags; /* algorithm flags (CRYPTO_ALG_XXX) */ /* アルゴリズムフラグ (CRYPTO_ALG_XXX) */ long maxcontexts; /* max number of cipher states supported (0 - any) */ /* サポートされる暗号状態最大数 (0 - いくつでも) */ char name[CRYPTO_ALG_NAME_LEN]; /* algorithm name */ /* アルゴリズム名 */ /* CRYPT SIGN COMPRESS HASH RANDOM */ /* DECRYPT VERIFY */ long blocklen; /* blklen (blklen) inlen blklen - */ long keylen; /* keylen keylen - - seedlen */ long outlen; /* outlen (signlen) outlen hashlen randlen */ long milen; /* milen (param) - - - */ } CryptoAlgInfo; typedef struct tag_CryptoPluginInfo { long cpi_version; /* Crypto PI version (currently CRYPTO_VER(1,0)) */ /* Crypto PI バージョン (現在 CRYPTO_VER(1,0)) */ long status; /* Plugin status */ /* plugin 状態 */ char name[CRYPTO_PLUGIN_NAME_LEN]; /* plugin text description */ /* plugin text 記述 */ long version; /* plugin version (CRYPTO_VER) */ /* plugin バージョン (CRYPTO_VER) */ long flags; /* plugin flags (CRYPTO_PLUGIN_XXX) */ /* plugin フラグ (CRYPTO_PLUGIN_XXX) */ long number_of_algs; /* number of AlgInfo structures followed (min 1) */ 続く AlgInfo 構造体数 (最小 1) */ CryptoAlgInfo algs[1]; /* array of AlgInfo structures (min 1) */ /* AlgInfo 構造体の配列 (最小 1) */ } CryptoPluginInfo; #ifdef __cplusplus extern "C" { #endif /* CryptoPlugin initialization. Returns pointer to CryptoPluginInfo structure on success or NULL on fatal error. */ /* CryptoPlugin 初期化。成功時、CryptoPluginInfo 構造体へのポインタを返 す。致命的なエラー時、NULL を返す */ CryptoPluginInfo *CryptoPluginInit( void *param);/* Ptr to OS parameters (platform-specific) */ /* OS パラメータへのポインタ (プラットフォーム特有) */ /* Plugin deinitialization */ /* plugin 終了 */ CRYPTO_STATUS CryptoPluginFini(void); /* Get new algorithm instance (cipher state) */ /* 新しいアルゴリズムインスタンス (暗号状態) 取得 */ CRYPTO_STATUS CryptoOpen( CRYPTO_HANDLE *state, /* Pointer to cipher state handle (filled on exit) */ /* 暗号状態ハンドルへのポインタ (終了時、満たされる) */ long algnum, /* Algorithm number in CryptoPluginInfo structure */ /* CryptoPluginInfo 構造体のア ルゴリズム番号 */ const char *key); /* key (in plain) */ /* (平文での) 鍵 */ /* Reinitialize algorithm instance */ /* アルゴリズムインスタンスの再初期化 */ CRYPTO_STATUS CryptoReOpen( CRYPTO_HANDLE state, /* current cipher state handle */ /* 現在の暗号状態ハンドル */ const char *key); /* key (in plain) */ /* (平文での) 鍵 */ /* Destroy algorithm instance */ /* アルゴリズムインスタンスの破壊 */ CRYPTO_STATUS CryptoClose( CRYPTO_HANDLE state); /* Handle of cipher state */ /* 暗号状態のハンドル */ /* Check key for possible weakness */ /* 可能性のある弱点の鍵をチェック */ CRYPTO_STATUS CryptoCheckForWeakKey( long algnum, /* Algorithm number in CryptoPluginInfo structure */ /* CryptoPluginInfo 構造体のア ルゴリズム番号 */ const char *key); /* Proposed key */ /* 提案鍵 */ /* Perform CryptoTransform (depends on cipher state type) */ /* CryptoTransform 実行 (暗号状態タイプに依存) */ CRYPTO_STATUS CryptoTransform( CRYPTO_HANDLE state, /* Cipher state handle */ /* 暗号状態ハンドル */ const char *inbuff,/* input data */ /* 入力データ */ long inlen, /* input data length */ /* 入力データ長 */ char *outbuff,/* output buffer */ /* 出力バッファ */ long *outlen,/* On entry - output buffer length, on exit - number of bytes written to outbuff */ /* 入力時、出力バッファ長、出力 時、outbuff に書かれた bytes 数 */ char *mi); /* Message indicator */ /* メッセージ指示子 */ /* Algorithm control */ /* アルゴリズム制御 */ CRYPTO_STATUS CryptoControl( CRYPTO_HANDLE state, /* Cipher state handle */ /* 暗号状態ハンドル */ long cmd, /* Control command */ /* 制御コマンド */ long param, /* Parameter id */ /* パラメータ id */ char val, /* Parameter value */ /* パラメータ値 */ long *len); /* For CRYPTO_GET: on entry - val buffer length, on exit - number of bytes written to val; for CRYPTO_SET: length of value to set */ /* CRYPTO_GET について: 入力時 val バッファ長、終了時、val に書かれた bytes 数; CRYPTO_SET について: 設定さ れる値の長さ */ #ifdef __cplusplus } #endif #endif /* __CRYPTPI_H */ ----------------------------------------------------------------------- Full Copyright Statement 著作権表示全文 Copyright (C) The Internet Society (1999). All Rights Reserved. This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English. The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns. This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. ----------------------------------------------------------------------- Acknowledgement 謝辞 Funding for the RFC Editor function is currently provided by the Internet Society. RFC Editor の働きに対する資金援助は、Internet Society により現在提供 される。
一覧
スポンサーリンク