← 返回首页
CryptoKey: algorithm プロパティ - Web API | MDN

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

CryptoKey: algorithm プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.

安全なコンテキスト用: この機能は一部またはすべての対応しているブラウザーにおいて、安全なコンテキスト (HTTPS) でのみ利用できます。

algorithmCryptoKey インターフェイスの読み取り専用プロパティで、このキーを使用できるアルゴリズムを記述したオブジェクトと、関連する追加の引数を返します。

返されるオブジェクトは、キーを生成する際に使用するアルゴリズムによって異なります。

In this article

以下のいずれかに一致するオブジェクトです。

js
const rawKey = window.crypto.getRandomValues(new Uint8Array(16)); // 生のバイト列を格納する ArrayBuffer から AES 秘密鍵をインポートする // バイト列を格納する ArrayBuffer 文字列を引数にとり、 // 秘密鍵を表す CryptoKey に解決するプロミスを返す function importSecretKey(rawKey) { return window.crypto.subtle.importKey("raw", rawKey, "AES-GCM", true, [ "encrypt", "decrypt", ]); } const key = importSecretKey(rawKey); console.log(`このキーは ${key.algorithm} アルゴリズムで使われるものです。`);

仕様書

Specification
Web Cryptography Level 2
# dom-cryptokey-algorithm

ブラウザーの互換性

Enable JavaScript to view this browser compatibility table.