[要約] RFC 2628は、シンプルな暗号プログラムインターフェース(Crypto API)に関する仕様であり、暗号化や復号化などの暗号操作を簡単に実行するための方法を提供します。その目的は、暗号化ソフトウェアの開発や統合を容易にし、セキュリティを向上させることです。

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.

このメモは、インターネットコミュニティに情報を提供します。いかなる種類のインターネット標準も規定していません。このメモの配布は無制限です。

Copyright Notice

著作権表示

Copyright (C) The Internet Society (1999). All Rights Reserved.

Copyright(C)The Internet Society(1999)。全著作権所有。

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].

このドキュメントでは、暗号化機能への簡単なアプリケーションプログラムインターフェイスについて説明します。そのようなインターフェースの主な目的は、暗号化ライブラリをインターネットアプリケーションから分離することであり、それによって両方の独立した開発を可能にします。 [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. 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.

現在、オペレーティングシステムカーネルのレベルで暗号化機能を必要とするインターネットアプリケーションでは、製品の機能を提供するモジュール(ドライバー)と共にライブラリをコンパイル/リンクする必要があると想定する方法を使用します。暗号化モジュールの独立した開発の可能性のために、シンプルで効果的でユニバーサルな(アプリケーションおよびオペレーティングシステムのカーネルレベルに適した)ソリューションを提供するために、この仕様は、暗号化アルゴリズムを個別の暗号化に抽出する方法を提供しますモジュール。

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を介して暗号機能を提供する暗号プラグインの一部。

Wrapper

ラッパー

Part of cryptoplugin that provides interfaces translation between Crypto API and OS-specific interface.

Crypto APIとOS固有のインターフェース間のインターフェース変換を提供する暗号プラグインの一部。

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.

1)暗号化、一方向ハッシュ関数、デジタル署名、乱数生成アルゴリズムのプログラム実装を抽出して、独立して開発されたモジュールを分離します。

2) To provide version independence between using encryption modules and external cryptoplugin.

2)暗号化モジュールと外部暗号プラグインの使用の間でバージョンに依存しないようにするため。

3) To ensure platform independent developments of encrypting algorithm modules with portable source code.

3)ポータブルソースコードを使用した暗号化アルゴリズムモジュールのプラットフォームに依存しない開発を保証する。

4) To enable independent development of modules and compatibility of modules developed independently.

4)モジュールの独立した開発および独立して開発されたモジュールの互換性を可能にする。

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):

暗号プラグインとそのクライアント間の高速交換を提供するために、暗号プラグインは特定のオペレーティングシステムの個別のドライバー(またはモジュール)として実装されます(図1)。 Cryptopluginは2つの部分で構成されています(図2)。

1) cryptolibrary itself (1)

1)暗号ライブラリ自体(1)

2) system-dependent module (wrapper) for interaction between cryptolibrary and its client (2)

2)暗号ライブラリとそのクライアントの間の相互作用のためのシステム依存モジュール(ラッパー)(2)

                                       Cryptoplugin initialization
                                     / by the operating system
                                     |
                                     |
     +------------------+          +-|-+-------------+
     |                  |          |   |             |
     |  Cryptoplugin's  | -------> |                 |
     |                  |          |  Cryptoplugin   |
     |     client       | <------- |                 |
     |                  |          |   |             |
     +------------------+     |    +---+-------------+
                              |
                              \
                               \ System-dependent CPI
        

Fig. 1 Interaction between cryptoplugin and its client

図1クリプトプラグインとそのクライアント間の相互作用

     +---------------+-------------------------------+
     |               |                               |
     |              -->       Submodule of           |
     |  Submodule -  |                               |
     |               |   encrypting algorithms (1)   |
     |  wrapper (2)  |                               |
     |              <--       (cryptolibrary)        |
     |               |                               |
     +---------------+-------------------------------+
                     |
                     \
                      \ Cryptographic Program Interface
        

Fig. 2 Cryptoplugin structure

図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).

システム依存のモジュール(ラッパー)は、特定のオペレーティングシステム用に、ソースコードの形式またはライブラリーの形式(オブジェクトファイルの形式など)でドライバーとクライアントの開発者によって提供されます。ラッパーは、システムに依存しないアプリケーションインターフェイスを、暗号プラグインのクライアントを使用する特定のシステムに依存するインターフェイスに変換することを目的としています。ラッパーコンテキストには、cryptopluginのクライアント機能または一部の暗号化アルゴリズムに固有のコンポーネントは含まれていません。セクション3で説明するインターフェースは、サブモジュール(1)と(2)間の相互作用の標準です。

A cryptoplugin can contain a number of different algorithms. Moreover, it can contain some different implementations of one particular algorithm.

暗号プラグインには、さまざまなアルゴリズムを含めることができます。さらに、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)によってエクスポートされた一連の関数で構成されています。インターフェース機能については以下で説明します(付録Aも参照)。

3.1. Cryptoplugin Initialization Function
3.1. Cryptoplugin初期化関数

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に含まれるアルゴリズムに関する情報の取得を目的としています。この関数は、cryptopluginの動作が始まる前に一度呼び出されます。

   /* CryptoPlugin initialization. Returns pointer to CryptoPluginInfo
   structure on success or NULL on fatal error. */
   CryptoPluginInfo *CryptoPluginInit(
                   void            *param);/* Ptr to OS parameters
                                              (platform-specific) */
        

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.

param-オペレーティングシステムによって暗号プラグインに送信されるシステム依存のパラメーターへのポインター。パラメータの意図と形式は各オペレーティングシステムに固有であり、cryptopluginラッパーのドキュメントに記載する必要があります。

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または適切なエラーコードをCryptoPluginInfo構造ステータスフィールドに返します。初期化が部分的に成功した場合、cryptopluginは正常に初期化されたアルゴリズムのみを含むように変換されたCryptoPluginInfo構造を返すか、CryptoAlgInfo構造のステータスフィールドに失敗の理由を説明する適切なエラーコードを返します。

Error codes for the function:

関数のエラーコード:

NULL - fatal unsuccessful cryptoplugin initialization. The module is unable even to indicate the reason of failure.

NULL-致命的に失敗した暗号プラグインの初期化。モジュールは、失敗の理由を示すことさえできません。

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:

完全または部分的な成功の場合の暗号プラグイン記述構造へのポインター。 CryptoPluginInfo構造および構成されたCryptoAlgInfo構造のステータスフィールドは、次の値に設定できます。

CRYPTO_OK - cryptoplugin (algorithm) is initialized successfully.

CRYPTO_OK-cryptoplugin(アルゴリズム)が正常に初期化されました。

CRYPTO_ERR_GENERAL - internal error.

CRYPTO_ERR_GENERAL-内部エラー。

CRYPTO_ERR_NOT_SUPPORTED - (only for algorithm) - the algorithm is not supported by the module at the moment.

CRYPTO_ERR_NOT_SUPPORTED-(アルゴリズムのみ)-現在、アルゴリズムはモジュールでサポートされていません。

CRYPTO_ERR_HARDWARE - error of hardware initialization.

CRYPTO_ERR_HARDWARE-ハードウェア初期化のエラー。

CRYPTO_ERR_NO_RESOURCES - insufficient internal resources.

CRYPTO_ERR_NO_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_MEMORY-メモリが不足しています。一般的な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構造は、一般的に暗号プラグインを記述する固定サイズのヘッダーと、ヘッダーに続くCryptoAlgInfo構造の配列で構成されます。各構造は、暗号ライブラリに実装された特定のアルゴリズムを記述します(付録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_version-CPIバージョン(CRYPTO_VER(1,0)でなければなりません)。 CPIバージョンは、CryptoPluginInfo / CryptoAlgInfo構造体の関数セットとフィールドレイアウトの両方を決定します。

status - returns the error code if cryptoplugin initialization failed (otherwise should be CRYPTO_OK)

status-cryptopluginの初期化が失敗した場合はエラーコードを返します(そうでない場合はCRYPTO_OKである必要があります)

name - text cryptoplugin description (ASCII-7 characters only; all unused bytes must be set to 0).

name-テキスト暗号プラグインの説明(ASCII-7文字のみ。未使用のバイトはすべて0に設定する必要があります)。

version - cryptoplugin version (CRYPTO_VER(maj,min)).

version-暗号プラグインのバージョン(CRYPTO_VER(5月、分))。

flags - various flags that characterize the cryptoplugin.

flags-暗号プラグインを特徴付けるさまざまなフラグ。

number_of_algs - number of algorithms the cryptolibrary comprises of (i.e. the number of consequent CryptoAlgInfo structures).

number_of_algs-暗号ライブラリが構成するアルゴリズムの数(つまり、結果として生じる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).

status-特定のアルゴリズムの初期化が失敗した場合にエラーコードを返します(それ以外の場合は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.

id-アルゴリズム識別子(CRYPTO_A_XXX)。 0..249の範囲の値は予約されています。 250..32767の範囲の値は、標準リストに登録されていないアルゴリズムを示します。アルゴリズムIDは、アルゴリズムタイプごとに独立していることを強調しておく必要があります。ただし、タイプ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.

group-アルゴリズム実装グループ(CryptoAlgInfo構造ではカバーされないさまざまなパラメーターを持つバリアントアルゴリズム実装)。 0..32767の範囲の値は、付録Aで定義されている既知の数値です。ベンダーは、32768..65535の範囲の値を任意に使用できます。

type - algorithm type (CRYPTO_TYPE_XXX). Unambiguously determines algorithm application.

type-アルゴリズムのタイプ(CRYPTO_TYPE_XXX)。アルゴリズムの適用を明確に決定します。

version - version of algorithm implementation (CRYPTO_VER (maj,min)).

version-アルゴリズム実装のバージョン(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.

flags-アルゴリズムとその実装を特徴付けるフラグ。付録Aで定義されていないすべてのビットはゼロにする必要があります。

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).

maxcontexts-アルゴリズム実装によって同時にサポートされる最大の暗号化コンテキスト数(数値が無制限であるか、メモリサイズなどの環境条件によってのみ制限される場合は0)。

name - text algorithm name (ASCII characters use only; all unused bytes must be set to 0).

name-テキストアルゴリズム名(ASCII文字のみ使用。未使用のバイトはすべて0に設定する必要があります)。

The next information depends on algorithm type:

次の情報は、アルゴリズムのタイプによって異なります。

For encryption algorithms (CRYPTO_TYPE_ENCRYPT and CRYPTO_TYPE_DECRYPT):

暗号化アルゴリズム(CRYPTO_TYPE_ENCRYPTおよびCRYPTO_TYPE_DECRYPT)の場合:

blocklen - data block length in bytes (value 1 must be used for stream cipher algorithms).

blocklen-バイト単位のデータブロック長(ストリーム暗号アルゴリズムには値1を使用する必要があります)。

keylen - encrypting (or decrypting) key length in bytes.

keylen-キーの長さをバイト単位で暗号化(または復号化)します。

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.

outlen-1つの入力データブロックを変換するための出力データサイズ(バイト単位)。通常はblocklenと同じです。この値の予測が不可能な場合は、ゼロ値を指定する必要があります。

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.

milen-初期化ベクトル(ブロックアルゴリズムの場合)またはメッセージインジケーター(ストリームアルゴリズムの場合)のサイズ(バイト単位)。ブロックアルゴリズムの場合、パラメーターのゼロ値は、アルゴリズムがECBエンコーディングを実装することを意味します。ゼロ以外のmilenパラメータは、アルゴリズムがCBCエンコーディングを実装することを意味します。ストリームアルゴリズムの場合、パラメーターの値がゼロの場合、メッセージインジケーターは必要ありません。

For signature algorithms (CRYPTO_TYPE_SIGN):

署名アルゴリズム(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.

blocklen-バイト単位のブロックサイズ。入力署名データの長さは、この値まで埋め込まれます。パディングする必要がない場合は、値1を設定する必要があります。

keylen - private key length in bytes.

keylen-バイト単位の秘密鍵の長さ。

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.

outlen-バイト単位の署名の長さ。この値の予測が不可能な場合は、0値を指定する必要があります。署名が複数の値で構成されている場合は、全長が示されます。

milen - non-zero value specifies signature parameter length (random number), zero value indicates that the parameter is not required.

milen-ゼロ以外の値は署名パラメーターの長さ(乱数)を指定し、ゼロの値はパラメーターが不要であることを示します。

For signature verification algorithms (CRYPTO_TYPE_VERIFY):

署名検証アルゴリズム(CRYPTO_TYPE_VERIFY)の場合:

blocklen - is not used.

blocklen-使用されません。

keylen - length of public key in bytes.

keylen-公開鍵の長さ(バイト単位)。

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.

outlen-バイト単位の署名の長さ。この値の予測が不可能な場合は、0値を指定する必要があります。署名が複数の値で構成されている場合は、全長が示されます。

milen - is not used.

milen-使用されません。

For data compression algorithms (CRYPTO_TYPE_COMPRESS):

データ圧縮アルゴリズム(CRYPTO_TYPE_COMPRESS)の場合:

blocklen - see outlen.

blocklen-outlenを参照してください。

keylen - is not used.

keylen-使用されません。

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.

outlen-アルゴリズムが既知の値で固定圧縮を提供する場合、それはblocklen / outlen比として示されます。値は任意にすることができます。圧縮値が不明な場合、outlenは0に設定され、blocklenは使用されません。

milen - is not used.

milen-使用されません。

For data uncompressing algorithms (CRYPTO_TYPE_UNCOMPRESS):

データ圧縮解除アルゴリズム(CRYPTO_TYPE_UNCOMPRESS)の場合:

blocklen - see outlen.

blocklen-outlenを参照してください。

keylen - is not used.

keylen-使用されません。

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.

outlen-アルゴリズムが既知の値で固定圧縮を提供する場合、それはblocklen / outlen比として示されます。値は任意にすることができます。同じアルゴリズムの比率がCRYPTO_TYPE_COMPRESSタイプの比率と逆になるのは当然です。圧縮値が不明な場合、outlenは0に設定され、blocklenは使用されません。

milen - is not used.

milen-使用されません。

For one-way hash function algorithms (CRYPTO_TYPE_HASH):

一方向ハッシュ関数アルゴリズム(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.

blocklen-バイト単位のブロックサイズ。入力データの長さは、この値まで埋め込まれます。パディングの必要がない場合は、値1を使用する必要があります。

keylen - is not used.

keylen-使用されません。

outlen - resulting hash value length in bytes.

outlen-結果のハッシュ値の長さ(バイト単位)。

milen - is not used.

milen-使用されません。

For random number generation algorithms (CRYPTO_TYPE_RANDOM):

乱数生成アルゴリズム(CRYPTO_TYPE_RANDOM)の場合:

blocklen - is not used.

blocklen-使用されません。

keylen - initial seed length (0 - if not required, for example in a physical effects based generators).

keylen-初期シード長(0-物理エフェクトベースのジェネレーターなどで必要でない場合は0)。

outlen - resulting random number length in bytes (0 - arbitrary)

outlen-結果のバイト単位の乱数の長さ(0-任意)

milen - is not used.

milen-使用されません。

3.2. Cryptoplugin Deinitialization Function
3.2. Craptoplugin非初期化関数
   /* 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.

CRYPTO_OK-cryptopluginは正常に非初期化されました。

CRYPTO_ERR_GENERAL - internal error.

CRYPTO_ERR_GENERAL-内部エラー。

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.

CRYPTO_ERR_UNCLOSED_HANDLES-暗号化プラグインの初期化解除中に開いている暗号化コンテキストがあったという警告。警告は情報のみです。とにかく、開いているコンテキストは破棄されます。

3.3. Cryptographic Context Opening Function
3.3. 暗号コンテキストオープン関数

New algorithm instance (cipher state) */ CRYPTO_STATUS CryptoOpen(

新しいアルゴリズムインスタンス(暗号状態)* / CRYPTO_STATUS CryptoOpen(

         CRYPTO_HANDLE   *state, /* Pointer to cipher state
                                    handle (filled on exit) */
         long            algnum, /* Algorithm number in
                                    CryptoPluginInfo structure */
         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内に暗号化コンテキストのコピーを作成し、提供されたキーで初期化します。後でコンテキストのハンドルは、他のアルゴリズム関数の呼び出しで使用されます。

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.

state-成功した場合に作成されたコンテキストのハンドルに設定される変数へのポインター。 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.

algnum-暗号プラグインのアルゴリズム番号。これは、CryptoPluginInfo構造内の(アルゴリズムを説明する)CryptoAlgInfo構造の数と同じです。数値はゼロ値で始まります。これはアルゴリズム識別子ではなく、cryptoplugin内の番号であることを考慮する必要があります。

key - pointer to the key (if it is required) or to the seed (for random number generation algorithm).

key-キー(必要な場合)またはシード(乱数生成アルゴリズムの場合)へのポインター。

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).

1. 生成された暗号コンテキストは、CryptoAlgClose関数呼び出しによって破棄されるまで、cryptoplugin内に保存されます。 cryptopluginでサポートされる暗号化コンテキストの最大数は、アルゴリズムパラメーターの説明で指定できます。暗号化コンテキストの最大数がゼロに等しい場合、暗号化コンテキストの数は無制限(たとえば、乱数ジェネレーターや一方向ハッシュ関数などのステートレスアルゴリズムの場合)か、外部要素(メモリサイズなど)のみによって制限されます。

Return codes for the function:

関数の戻りコード:

CRYPTO_OK - successful completion.

CRYPTO_OK-正常に完了しました。

CRYPTO_ERR_GENERAL - internal error.

CRYPTO_ERR_GENERAL-内部エラー。

CRYPTO_ERR_NO_RESOURCES - insufficient internal resources.

CRYPTO_ERR_NO_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_MEMORY-メモリが不足しています。一般的な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.

CRYPTO_ERR_BAD_PARAMS-無効なパラメーター(無効なアルゴリズム番号、ハンドルまたはキー(シード)へのゼロポインター)(必要な場合)。

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_OK-正常に完了しました。

CRYPTO_ERR_GENERAL - internal error.

CRYPTO_ERR_GENERAL-内部エラー。

CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle.

CRYPTO_ERR_BAD_HANDLE-無効な暗号コンテキストハンドル。

CRYPTO_ERR_NO_RESOURCES - insufficient internal resources.

CRYPTO_ERR_NO_RESOURCES-内部リソースが不十分です。

CRYPTO_ERR_NO_MEMORY - not enough memory. Contrary to general

CRYPTO_ERR_NO_MEMORY-メモリが不足しています。一般に反する

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.

CRYPTO_ERR_BAD_PARAMS-無効なパラメーター(無効なアルゴリズム番号、ハンドルまたはキー(シード)へのゼロポインター)(必要な場合)。

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_OK-正常に完了しました。

CRYPTO_ERR_GENERAL - internal error.

CRYPTO_ERR_GENERAL-内部エラー。

CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle.

CRYPTO_ERR_BAD_HANDLE-無効な暗号コンテキストハンドル。

3.6. Key Verification Function
3.6. キー検証機能
      /* Check key for possible weakness */
      CRYPTO_STATUS   CryptoCheckForWeakKey(
                    long            algnum, /* Algorithm number in
                                    CryptoPluginInfo structure */
                    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_O-キーはテストに合格しました。

CRYPTO_ERR_WEAK_KEY - the key has not passed the test (being weak or possibly weak).

CRYPTO_ERR_WEAK_KEY-キーはテストに合格していません(弱い、またはおそらく弱い)。

CRYPTO_ERR_NOT_SUPPORTED - is not supported.

CRYPTO_ERR_NOT_SUPPORTED-サポートされていません。

CRYPTO_ERR_NO_RESOURCES - insufficient internal resources.

CRYPTO_ERR_NO_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_MEMORY-メモリが不足しています。一般的なCRYPTO_ERR_NO_RESOURCESエラーとは異なり、このコードは、呼び出し元のモジュールがシステムメモリを解放して(適切な位置にある場合)、関数をもう一度呼び出せると想定しています。

3.7. Data Transformation Function
3.7. データ変換機能
/* Perform CryptoTransform (depends on cipher state type) */
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 */
                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.

暗号データ​​変換機能です。関数呼び出しの結果と関数パラメーターは、アルゴリズムのタイプによって異なります。アルゴリズムタイプCRYTO_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.

注意。ストリーム暗号化アルゴリズムは「例外」のように見えるかもしれません。ただし、同じ暗号アルゴリズムハンドルは、その履歴依存性を隠す必要があります。アルゴリズムタイプ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:

この関数は、入力データを暗号化します。そのパラメーターは、以下を対象としています。

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.

inbuff-入力データへのポインター。このパラメーターが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.

inlen-入力データサイズ(バイト単位)。アルゴリズムの説明に示されているサイズがblocklenで割り切れる場合、パディングは実行されません。そうでない場合、アルゴリズムはアルゴリズム標準に従ってパディングを実行するか、適切なエラーコード(CRYPTO_ERR_BAD_PARAMS)を返します。関数がすぐに終了して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.

outbuff-出力データバッファー。 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.

outlen-出力バッファーサイズは入力関数パラメーターですが、出力バッファーに書き込まれるバイト数は出力パラメーターです。 NULLパラメータ値とアドレス指定されたゼロ値の両方により、関数から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-メッセージインジケータ。その内容は、ブロックアルゴリズムとストリームアルゴリズムのどちらが適用されているかによって異なります。ブロックアルゴリズムの場合は、暗号化された最後のブロックに設定されます。最初のブロックが暗号化されるとき、miパラメータは初期初期化ベクトルを指定します。ストリームアルゴリズムの場合は、ストリームで暗号化された最初のバイトのオフセットに設定されます。アルゴリズムがメッセージインジケーターを使用し、miパラメーター値がNULLに設定されている場合、関数はCRYPTO_ERR_BAD_PARAMSを返す必要があります。アルゴリズム(例としてECBモード暗号化)がメッセージインジケーターを適用しない場合、非NULL値は無視する必要がありますが、miのNULL値は許容されます。

Returned values:

戻り値:

CRYPTO_OK - successful completion.

CRYPTO_OK-正常に完了しました。

CRYPTO_ERR_GENERAL - internal error.

CRYPTO_ERR_GENERAL-内部エラー。

CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle.

CRYPTO_ERR_BAD_HANDLE-無効な暗号コンテキストハンドル。

CRYPTO_ERR_NO_RESOURCES - insufficient internal resources.

CRYPTO_ERR_NO_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_MEMORY-メモリが不足しています。一般的なCRYPTO_ERR_NO_RESOURCESエラーとは異なり、このコードは、呼び出し元のモジュールがシステムメモリを解放して(適切な位置にある場合)、関数をもう一度呼び出せると想定しています。

CRYPTO_ERR_SMALL_BUFFER - insufficient output buffer size.

CRYPTO_ERR_SMALL_BUFFER-出力バッファサイズが不十分です。

CRYPTO_ERR_BAD_PARAMS - invalid parameters.

CRYPTO_ERR_BAD_PARAMS-無効なパラメーター。

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:

関数は、入力データを復号化します。そのパラメーターは、以下を対象としています。

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.

inbuff-入力データへのポインター。パラメータが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.

inlen-入力データサイズ(バイト単位)。パラメータがゼロに設定されると、関数はすぐに終了し、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.

outbuff-出力データバッファー。パラメータ値が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.

outlen-出力バッファーサイズは入力関数パラメーターですが、出力バッファーに書き込まれるバイト数は出力パラメーターです。 NULLパラメータ値とアドレス指定されたゼロ値の両方により、関数から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-メッセージインジケータ。内容は、ブロックアルゴリズムとストリームアルゴリズムのどちらが適用されているかによって異なります。ブロックアルゴリズムの場合は、暗号化された最後のブロックに設定されます。最初のブロックが復号化されると、miは初期初期化ベクトルを指定します。ストリームアルゴリズムの場合は、ストリームで復号化された最初のバイトのオフセットに設定されます。アルゴリズムがメッセージインジケーターを使用し、miパラメーターがNULLに設定されている場合、関数はCRYPTO_ERR_BAD_PARAMSを返す必要があります。アルゴリズム(例としてECBモード)がメッセージインジケーターを適用しない場合、非NULL値は無視する必要がありますが、miのNULL値は許容されます。

Returned values:

戻り値:

CRYPTO_OK - successful completion.

CRYPTO_OK-正常に完了しました。

CRYPTO_ERR_GENERAL - internal error.

CRYPTO_ERR_GENERAL-内部エラー。

CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle.

CRYPTO_ERR_BAD_HANDLE-無効な暗号コンテキストハンドル。

CRYPTO_ERR_NO_RESOURCES - insufficient internal resources.

CRYPTO_ERR_NO_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_MEMORY-メモリが不足しています。一般的なCRYPTO_ERR_NO_RESOURCESエラーとは異なり、このコードは、呼び出し元のモジュールがシステムメモリを解放して(適切な位置にある場合)、関数をもう一度呼び出せると想定しています。

CRYPTO_ERR_SMALL_BUFFER - insufficient output buffer size.

CRYPTO_ERR_SMALL_BUFFER-出力バッファサイズが不十分です。

CRYPTO_ERR_BAD_PARAMS - invalid parameters.

CRYPTO_ERR_BAD_PARAMS-無効なパラメーター。

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: 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.

関数は入力データに署名します。そのパラメーターは、以下を対象としています。inbuff-入力データへのポインター。パラメータが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.

inlen-入力データサイズ(バイト単位)。アルゴリズムの説明に示されているサイズがblocklenで割り切れる場合、パディングは実行されません。そうでない場合、アルゴリズムはアルゴリズム標準に従ってパディングを実行するか、適切なエラーコード(CRYPTO_ERR_BAD_PARAMS)を返します。関数がすぐに終了して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.

outbuff-出力データバッファー。 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.

outlen-出力バッファーサイズは入力関数パラメーターですが、出力バッファーに書き込まれるバイト数は出力パラメーターです。 NULLパラメータ値とアドレス指定されたゼロ値の両方により、関数から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.

mi-アルゴリズムの説明のmilenパラメータがゼロ以外の場合、署名パラメータへのポインタ(通常は乱数)。この場合、ゼロmiパラメーターは、パラメーターがアルゴリズム内で選択(生成)される必要があることを示します。アルゴリズムの説明のmilenパラメータがゼロに設定されている場合、miパラメータは無視されます。

Returned values:

戻り値:

CRYPTO_OK - successful completion.

CRYPTO_OK-正常に完了しました。

CRYPTO_ERR_GENERAL - internal error.

CRYPTO_ERR_GENERAL-内部エラー。

CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle.

CRYPTO_ERR_BAD_HANDLE-無効な暗号コンテキストハンドル。

CRYPTO_ERR_NO_RESOURCES - insufficient internal resources.

CRYPTO_ERR_NO_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_MEMORY-メモリが不足しています。一般的なCRYPTO_ERR_NO_RESOURCESエラーとは異なり、このコードは、呼び出し元のモジュールがシステムメモリを解放して(適切な位置にある場合)、関数をもう一度呼び出せると想定しています。

CRYPTO_ERR_SMALL_BUFFER - insufficient output buffer size.

CRYPTO_ERR_SMALL_BUFFER-出力バッファサイズが不十分です。

CRYPTO_ERR_BAD_PARAMS - invalid parameters.

CRYPTO_ERR_BAD_PARAMS-無効なパラメーター。

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:

関数は入力データの署名を検証します。そのパラメーターは、以下を対象としています。

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.

inbuff-入力データへのポインター。パラメータが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.

inlen-入力データサイズ(バイト単位)。関数がすぐに終了して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.

outbuff-署名へのポインター。パラメータが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.

outlen-アルゴリズムの説明構造で署名の長さがゼロに設定されている場合、署名の長さを指定します。アルゴリズムの説明構造でゼロ以外の値が指定されている場合、パラメーターは無視されます。署名が複数のパーツで構成されている場合は、最大パーツ長にパーツ数を掛けた値が指定されます。

mi - is not used.

mi-使用されません。

Returned values:

戻り値:

CRYPTO_OK - successful completion.

CRYPTO_OK-正常に完了しました。

CRYPTO_ERR_INVALID_SIGNATURE - invalid signature.

CRYPTO_ERR_INVALID_SIGNATURE-無効な署名。

CRYPTO_ERR_GENERAL - internal error.

CRYPTO_ERR_GENERAL-内部エラー。

CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle.

CRYPTO_ERR_BAD_HANDLE-無効な暗号コンテキストハンドル。

CRYPTO_ERR_NO_RESOURCES - insufficient internal resources.

CRYPTO_ERR_NO_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_MEMORY-メモリが不足しています。一般的なCRYPTO_ERR_NO_RESOURCESエラーとは異なり、このコードは、呼び出し元のモジュールがシステムメモリを解放して(適切な位置にある場合)、関数をもう一度呼び出せると想定しています。

CRYPTO_ERR_SMALL_BUFFER - insufficient output buffer size.

CRYPTO_ERR_SMALL_BUFFER-出力バッファサイズが不十分です。

CRYPTO_ERR_BAD_PARAMS - invalid parameters.

CRYPTO_ERR_BAD_PARAMS-無効なパラメーター。

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:

関数は入力データを圧縮します。そのパラメーターは、以下を対象としています。

inbuff - pointer to the input data.

inbuff-入力データへのポインター。

inlen - input data size (in bytes). The zero parameter is allowed so that the function quits at once and returns CRYPTO_OK code.

inlen-入力データサイズ(バイト単位)。関数がすぐに終了して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.

outbuff-出力データバッファー。 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.

outlen-出力バッファーサイズは入力関数パラメーターですが、出力バッファーに書き込まれるバイト数は出力パラメーターです。 NULLパラメータ値とアドレス指定されたゼロ値の両方により、関数からCRYPTO_ERR_BAD_PARAMSコードが返されます。

mi - is not used.

mi-使用されません。

Returned values:

戻り値:

CRYPTO_OK - successful completion.

CRYPTO_OK-正常に完了しました。

CRYPTO_ERR_GENERAL - internal error.

CRYPTO_ERR_GENERAL-内部エラー。

CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle.

CRYPTO_ERR_BAD_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_NO_MEMORY-メモリが不足しています。一般的なCRYPTO_ERR_NO_RESOURCESエラーとは異なり、このコードは、呼び出し元のモジュールがシステムメモリを解放して(適切な位置にある場合)、関数をもう一度呼び出せると想定しています。

CRYPTO_ERR_SMALL_BUFFER - insufficient output buffer size.

CRYPTO_ERR_SMALL_BUFFER-出力バッファサイズが不十分です。

CRYPTO_ERR_BAD_PARAMS - invalid parameters.

CRYPTO_ERR_BAD_PARAMS-無効なパラメーター。

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:

関数は、入力データを解凍します。そのパラメーターは、以下を対象としています。

inbuff - pointer to the input data.

inbuff-入力データへのポインター。

inlen - input data size (in bytes). The zero parameter is allowed so that the function quits at once and returns CRYPTO_OK code.

inlen-入力データサイズ(バイト単位)。関数がすぐに終了して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.

outbuff-出力データバッファー。パラメータ値が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.

outlen-出力バッファーサイズは入力関数パラメーターですが、出力バッファーに書き込まれるバイト数は出力パラメーターです。 NULLパラメータ値とアドレス指定されたゼロ値の両方により、関数からCRYPTO_ERR_BAD_PARAMSコードが返されます。

mi - is not used.

mi-使用されません。

Returned values:

戻り値:

CRYPTO_OK - successful completion.

CRYPTO_OK-正常に完了しました。

CRYPTO_ERR_GENERAL - internal error.

CRYPTO_ERR_GENERAL-内部エラー。

CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle.

CRYPTO_ERR_BAD_HANDLE-無効な暗号コンテキストハンドル。

CRYPTO_ERR_NO_RESOURCES - insufficient internal resources.

CRYPTO_ERR_NO_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_MEMORY-メモリが不足しています。一般的なCRYPTO_ERR_NO_RESOURCESエラーとは異なり、このコードは、呼び出し元のモジュールがシステムメモリを解放して(適切な位置にある場合)、関数をもう一度呼び出せると想定しています。

CRYPTO_ERR_SMALL_BUFFER - insufficient output buffer size.

CRYPTO_ERR_SMALL_BUFFER-出力バッファサイズが不十分です。

CRYPTO_ERR_BAD_PARAMS - invalid parameters.

CRYPTO_ERR_BAD_PARAMS-無効なパラメーター。

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:

この関数は、入力データのハッシュ値を計算します。そのパラメーターは、以下を対象としています。

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.

inbuff-入力データへのポインター。パラメータがNULL値の場合、関数は、表されたデータの累積ハッシュ値を計算します(表された以前のすべてのデータを考慮に入れて)。モーメントによって表されるすべてのデータの全長がblocklenで割り切れ、outbuffがNULLでない場合、outbuffに返されます。長さがblocklenで割り切れない場合、outbuffには何も書き込まれません。 NULL inbuffは、入力データがblocklenサイズまでパディングされ、結果がoutbuffアドレスに書き込まれるときの最後の変換を示します。パディング手順は、アルゴリズムに対して定義されています。

inlen - input data size (in bytes). The zero parameter is allowed when the function quits at once and returns CRYPTO_OK code.

inlen-入力データサイズ(バイト単位)。関数がすぐに終了してCRYPTO_OKコードを返す場合、ゼロパラメータが許可されます。

outbuff - output data buffer.

outbuff-出力データバッファー。

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.

outlen-出力バッファーサイズは入力関数パラメーターですが、出力バッファーに書き込まれるバイト数は出力パラメーターです。中間変換値(inbuffがNULLではない)とモーメントによって表されるデータの全長がblocklenで割り切れない場合、outlenはゼロに設定され、ハッシュ値はoutbuffに書き込まれません。 NULLパラメータ値とアドレス指定されたゼロ値の両方により、関数からCRYPTO_ERR_BAD_PARAMSコードが返されます。

mi - is not used.

mi-使用されません。

Returned values:

戻り値:

CRYPTO_OK - successful completion.

CRYPTO_OK-正常に完了しました。

CRYPTO_ERR_GENERAL - internal error.

CRYPTO_ERR_GENERAL-内部エラー。

CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle.

CRYPTO_ERR_BAD_HANDLE-無効な暗号コンテキストハンドル。

CRYPTO_ERR_NO_RESOURCES - insufficient internal resources.

CRYPTO_ERR_NO_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_MEMORY-メモリが不足しています。一般的なCRYPTO_ERR_NO_RESOURCESエラーとは異なり、このコードは、呼び出し元のモジュールがシステムメモリを解放して(適切な位置にある場合)、関数をもう一度呼び出せると想定しています。

CRYPTO_ERR_SMALL_BUFFER - insufficient output buffer size.

CRYPTO_ERR_SMALL_BUFFER-出力バッファサイズが不十分です。

CRYPTO_ERR_BAD_PARAMS - invalid parameters.

CRYPTO_ERR_BAD_PARAMS-無効なパラメーター。

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:

この関数は乱数を生成します。そのパラメーターは、以下を対象としています。

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.

inbuff-生成に使用される入力データへのポインター(擬似ランダムアルゴリズムの1つが実装されている場合)。 NULLパラメータは、入力データがないことを示します。

inlen - input data size (in bytes).

inlen-入力データサイズ(バイト単位)。

outbuff - output data

outbuff-出力データ

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.

outlen-出力バッファーサイズは入力関数パラメーターですが、出力バッファーに書き込まれるバイト数は出力パラメーターです。アルゴリズムの説明でゼロ(つまり、任意)の生成された数値サイズが設定されている場合、outlen値によって、呼び出し側のプロシージャで必要なランダムバイトの数が決まります。

mi - is not used.

mi-使用されません。

Returned values:

戻り値:

CRYPTO_OK - successful completion.

CRYPTO_OK-正常に完了しました。

CRYPTO_ERR_GENERAL - internal error.

CRYPTO_ERR_GENERAL-内部エラー。

CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle.

CRYPTO_ERR_BAD_HANDLE-無効な暗号コンテキストハンドル。

CRYPTO_ERR_NO_RESOURCES - insufficient internal resources.

CRYPTO_ERR_NO_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_MEMORY-メモリが不足しています。一般的なCRYPTO_ERR_NO_RESOURCESエラーとは異なり、このコードは、呼び出し元のモジュールがシステムメモリを解放して(適切な位置にある場合)、関数をもう一度呼び出せると想定しています。

CRYPTO_ERR_SMALL_BUFFER - insufficient output buffer size.

CRYPTO_ERR_SMALL_BUFFER-出力バッファサイズが不十分です。

CRYPTO_ERR_BAD_PARAMS - invalid parameters.

CRYPTO_ERR_BAD_PARAMS-無効なパラメーター。

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 */
                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 */
        

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.

この関数は、暗号化コンテキストの内部パラメーター管理を提供します。これは、コンテキストパラメータのチェックやコンテキスト状態の変更に使用できます。たとえば、暗号アルゴリズムに関する情報を返す場合(コンテキストにハードウェア暗号化機能が使用されている場合)、または必要に応じてストリームアルゴリズムコンテキストを「スクロール」する場合などです。

Description of parameters:

パラメータの説明:

state - cryptographic context handle.

状態-暗号化コンテキストハンドル。

cmd - command (CRYPTO_GET or CRYPTO_SET).

cmd-コマンド(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).

param-パラメータの識別子。 0..32767の範囲の値には、すべてのアルゴリズムの既知の番号が割り当てられます。 32768..65535の範囲の値は、さまざまなアルゴリズムのさまざまな変数を意味します(暗号ライブラリの開発者が任意に使用できます)。

val - pointer to the data buffer.

val-データバッファへのポインタ。

len - data size (in bytes).

len-データサイズ(バイト単位)。

Returned values:

戻り値:

CRYPTO_OK - successful completion.

CRYPTO_OK-正常に完了しました。

CRYPTO_ERR_GENERAL - internal error.

CRYPTO_ERR_GENERAL-内部エラー。

CRYPTO_ERR_BAD_HANDLE - invalid cryptographic context handle.

CRYPTO_ERR_BAD_HANDLE-無効な暗号コンテキストハンドル。

CRYPTO_ERR_NO_RESOURCES - insufficient internal resources.

CRYPTO_ERR_NO_RESOURCES-内部リソースが不十分です。

CRYPTO_ERR_NO_MEMORY - not enough memory. Contrary to general

CRYPTO_ERR_NO_MEMORY-メモリが不足しています。一般に反する

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_SMALL_BUFFER-出力バッファサイズが不十分です。

CRYPTO_ERR_BAD_PARAMS - invalid parameters.

CRYPTO_ERR_BAD_PARAMS-無効なパラメーター。

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.

暗号プラグインは、各プラットフォームのモジュールクライアント開発者が指定したルールに従って、暗号プラグインのクライアント開発者が提供する暗号プラグインラッパーライブラリとリンクする必要があります。これにより、暗号ライブラリ機能を実装する適切なオペレーティングシステムのドライバー(モジュール)が生成されます。ドライバーは、オペレーティングシステムの起動時に読み込まれるドライバーの1つである必要があります。 cryptopluginドライバーのインストール手順は、cryptoplugin開発者が定義、文書化し、必要に応じて自動化する必要があります。動作の開始時に、ドライバークライアントは暗号プラグインドライバーの可用性を決定し、それとの相互接続を確立します。モジュールクライアント構成と現在のセキュリティポリシーの両方が、選択するデータ変換アルゴリズムを決定します。

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.

[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.

[IPsec] Kent、S。およびR. Atkinson、「インターネットプロトコルのセキュリティアーキテクチャ」、RFC 2401、1998年11月。

[ISAKMP] Maughhan, D., Schertler, M. Schneider, M. and J. Turner, "Internet Security Association and Key Management Protocol (ISAKMP)", RFC 2408, November 1998.

[ISAKMP] Maughhan、D.、Schertler、M。Schneider、M。、およびJ. Turner、「インターネットセキュリティアソシエーションおよびキー管理プロトコル(ISAKMP)」、RFC 2408、1998年11月。

[IKE] Harkins, D. and D. Carrel, "The Internet Key Exchange (IKE)", RFC 2409, November 1998.

[IKE] Harkins、D。およびD. Carrel、「The Internet Key Exchange(IKE)」、RFC 2409、1998年11月。

[TLS] Dierks, T. and C. Allen, "The TLS protocol Version 1.0", RFC 2246, January 1999.

[TLS] Dierks、T。およびC. Allen、「The TLS protocol Version 1.0」、RFC 2246、1999年1月。

7. Author's Address
7. 著者のアドレス

Valery Smyslov TWS Centralny prospekt, 11, Moscow, Russia

Valery Smyslov TWS Central Prospect、11、モスクワ、ロシア

   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 */
#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 */
} CRYPTO_STATUS;
        
/* CryptoControl commands */
#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

#define CRYPTO_TYPE_RANDOM 8

/* Currently defined algorithm IDs (for types
   CRYPTO_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) */
#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) */
#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) */
#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) */
#define         CRYPTO_AR_UNKNOWN       1
        
/* Currently defined plugin flags */
#define CRYPTO_PLUGIN_HARDWARE          1       /* plugin uses hdw */
/* 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 */
#define CRYPTO_PARAM_KEY                1       /* Only for CRYPTO_GET -
                                                   get current key */
/* TBD more */
        
typedef struct  tag_CryptoAlgInfo {
        long    status;                 /* Algorithm status */
        long    type;                   /* algorithm type (One of
                                           CRYPTO_TYPE_XXX) */
        long    id;                     /* algorithm ID */
        long    group;                  /* algorithm group */
        long    version;                /* algorithm version
                                           (CRYPTO_VER) */
        long    flags;                  /* algorithm flags
                                           (CRYPTO_ALG_XXX) */
        long    maxcontexts;            /* max number of cipher states
                                           supported (0 - any) */
        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)) */
        long    status;                 /* Plugin status */
        char    name[CRYPTO_PLUGIN_NAME_LEN];   /* plugin text
                                                   description */
        long    version;                /* plugin version
                                           (CRYPTO_VER) */
        long    flags;                  /* plugin flags
                                           (CRYPTO_PLUGIN_XXX) */
        long    number_of_algs;         /* number of AlgInfo structures
                                           followed (min 1) */
        CryptoAlgInfo   algs[1];        /* array of AlgInfo structures
                                           (min 1) */
} CryptoPluginInfo;
        
#ifdef __cplusplus
extern "C" {
#endif
        
/* CryptoPlugin initialization. Returns pointer to CryptoPluginInfo
structure on success or NULL on fatal error. */
CryptoPluginInfo *CryptoPluginInit(
                void            *param);/* Ptr to OS parameters
                                           (platform-specific) */
        
/* Plugin deinitialization */
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 */
                 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 */
                 const char      *key);  /* Proposed key */
        
 /* Perform CryptoTransform (depends on cipher state type) */
 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 */
                 char            *mi);   /* Message indicator  */
        
 /* Algorithm control */
 CRYPTO_STATUS   CryptoControl(
                 CRYPTO_HANDLE   state,  /* Cipher state handle */
                 long            cmd,    /* Control command */
                 long            param,  /* Parameter 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 */
        
 #ifdef __cplusplus
 }
 #endif
        
 #endif  /* __CRYPTPI_H */
        

Full Copyright Statement

完全な著作権表示

Copyright (C) The Internet Society (1999). All Rights Reserved.

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から提供されています。