機密データと通常のデータを明確に区別するために、常時機密データベースは機密データのデータ型を定義し、頻繁に使用されるSQL演算子を提供します。 機密データ型と関連するSQL演算子の詳細については、「機能」をご参照ください。
機密データのデータ型の定義
ビジネス要件に基づいて、機密データと通常データを区別する必要があります。 テーブルスキーマで機密データのデータ型を定義する必要があります。
次の例では、テーブルスキーマについて説明します。
CREATE TABLE example (
account integer, -- The account that corresponds to plaintext data of the INTEGER type.
name text, -- The name that corresponds to plaintext data of the TEXT type.
balance real, -- The account balance that corresponds to plaintext data of the REAL type.
credit real, -- The credit line of the account that corresponds to plaintext data of the REAL type.
quota real, -- The plaintext column.
address text, -- The address that corresponds to plaintext data of the TEXT type.
remark text, -- The remarks.
PRIMARY KEY (account) -- Specifies that the account column is used as the primary key.
);
上記のテーブルスキーマでは、account
、name
、balance
、credit
、およびaddress
は、ビジネス要件に基づいて定義される機密データフィールドです。 次の例では、常に機密性の高いデータベースのテーブルスキーマの機密データフィールドについて説明します。
CREATE TABLE example (
account enc_int4, -- The account that corresponds to plaintext data of the INTEGER type.
name enc_text, -- The name that corresponds to plaintext data of the TEXT type.
balance enc_float4, -- The account balance that corresponds to plaintext data of the REAL type.
credit enc_float4, -- The credit line of the account that corresponds to plaintext data of the REAL type.
quota real, -- The plaintext column.
address enc_text, -- The address that corresponds to plaintext data of the TEXT type.
remark text, -- The remarks.
PRIMARY KEY (account) -- Specifies that the account column is used as the primary key.
);
既存の通常データを機密データに変換
ALTER TABLE
ステートメントを実行して、既存のテーブルを個別に設定し、テーブル内の平文の通常データを暗号文の機密データに変換できます。 詳細については、「平文と暗号文の間のデータ変換」をご参照ください。
次に何をすべきか
機密データを定義した後、クライアントから常に機密のデータベース機能を使用できます。 クライアントから常に機密のデータベース機能を使用する方法については、「クライアントから常に機密のデータベース機能を使用する」をご参照ください。