Class CryptoKey
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The CryptoKey interface of the Web Crypto API represents a cryptographic {{glossary("key")}} obtained from one of the SubtleCrypto methods GenerateKey(Union187, bool, List<KeyUsage>), DeriveKey(Union187, CryptoKey, Union187, bool, List<KeyUsage>), ImportKey(KeyFormat, Union188, Union187, bool, List<KeyUsage>), or UnwrapKey(KeyFormat, Union224, CryptoKey, Union187, Union187, bool, List<KeyUsage>).
[Value("CryptoKey")]
public class CryptoKey
- Inheritance
-
CryptoKey
- Inherited Members
Remarks
For security reasons, the CryptoKey interface can only be used in a secure context.
-Web Crypto API
-Web security
-Privacy, permissions, and information security
-Crypto and Subtle.
Constructors
CryptoKey()
public CryptoKey()
Properties
Algorithm
The read-only algorithm property of the CryptoKey interface returns an object describing the algorithm for which this key can be used, and any associated extra parameters.
[Value("algorithm")]
public Object Algorithm { get; }
Property Value
- Object
An object matching:For
RsaHashedKeyGenParamsandHmacKeyGenParams, thehashproperty is always in the object form (with a property calledname), not the string form.
Remarks
The object returned depends of the algorithm used to generate the key.
Extractable
The read-only extractable property of the CryptoKey interface indicates whether or not the key may be extracted using SubtleCrypto.exportKey() or SubtleCrypto.wrapKey().
[Value("extractable")]
public bool Extractable { get; }
Property Value
- bool
A boolean value that is
trueif the key can be exported andfalseif not.
Remarks
If the key cannot be exported, exportKey() or wrapKey() will throw an exception if used to extract it.
Type
The read-only type property of the CryptoKey interface indicates which kind of key is represented by the object. It can have the following values:
[Value("type")]
public KeyType Type { get; }
Property Value
- KeyType
One of the following strings:
"secret","private", or"public".
Remarks
Usages
The read-only usages property of the CryptoKey interface indicates what can be done with the key.
[Value("usages")]
public Object Usages { get; }