java.lang.Object
org.htmlunit.corejs.javascript.SlotMapOwner<org.htmlunit.corejs.javascript.Scriptable>
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.javascript.HtmlUnitScriptable
org.htmlunit.javascript.host.crypto.SubtleCrypto
- All Implemented Interfaces:
Serializable,Cloneable,org.htmlunit.corejs.javascript.ConstProperties<org.htmlunit.corejs.javascript.Scriptable>,org.htmlunit.corejs.javascript.debug.DebuggableObject,org.htmlunit.corejs.javascript.PropHolder<org.htmlunit.corejs.javascript.Scriptable>,org.htmlunit.corejs.javascript.Scriptable,org.htmlunit.corejs.javascript.SymbolScriptable
A JavaScript object for
SubtleCrypto.- Author:
- Ahmed Ashour, Ronald Brill, Atsushi Nakagawa, Lai Quang Duong
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.corejs.javascript.ScriptableObject.DescriptorInfo, org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator, org.htmlunit.corejs.javascript.ScriptableObject.LambdaGetterFunction, org.htmlunit.corejs.javascript.ScriptableObject.LambdaSetterFunction -
Field Summary
Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTFields inherited from class org.htmlunit.corejs.javascript.SlotMapOwner
isSealedFields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.htmlunit.corejs.javascript.NativePromiseDecrypts data using the given key and algorithm.org.htmlunit.corejs.javascript.NativePromiseNot yet implemented.org.htmlunit.corejs.javascript.NativePromiseNot yet implemented.org.htmlunit.corejs.javascript.NativePromiseGenerates a digest of the given data.org.htmlunit.corejs.javascript.NativePromiseEncrypts data using the given key and algorithm.org.htmlunit.corejs.javascript.NativePromiseExports a key in the specified format.org.htmlunit.corejs.javascript.NativePromisegenerateKey(org.htmlunit.corejs.javascript.Scriptable keyGenParams, boolean isExtractable, org.htmlunit.corejs.javascript.Scriptable keyUsages) Generates a new key (for symmetric algorithms) or key pair (for public-key algorithms).org.htmlunit.corejs.javascript.NativePromiseimportKey(String format, org.htmlunit.corejs.javascript.Scriptable keyData, org.htmlunit.corejs.javascript.Scriptable keyImportParams, boolean isExtractable, org.htmlunit.corejs.javascript.Scriptable keyUsages) Imports a key from external, portable key material.voidCreates an instance.org.htmlunit.corejs.javascript.NativePromiseSigns data using the given key.org.htmlunit.corejs.javascript.NativePromiseNot yet implemented.org.htmlunit.corejs.javascript.NativePromiseVerifies a signature using the given key.org.htmlunit.corejs.javascript.NativePromisewrapKey()Not yet implemented.Methods inherited from class org.htmlunit.javascript.HtmlUnitScriptable
clone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getWindow, getWindow, getWindowOrWorkerGlobalScope, getWithPreemption, has, hasInstance, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setupPromise, setupRejectedPromiseMethods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkNotSealed, checkPropertyChangeForSlot, checkPropertyChangeForSlot, checkPropertyDefinition, checkPropertyDefinition, checkSlotRemoval, defineBuiltinProperty, defineBuiltinProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, ensureType, get, get, getAllIds, getAncestor, getArrayPrototype, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSuperProperty, getSuperProperty, getSuperProperty, getThis, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, hasProperty, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGenericDescriptor, isGetterOrSetter, isGetterOrSetter, isTrue, preventExtensions, put, put, putConst, putConstProperty, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, redefineProperty, sameValue, sealObject, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, sizeMethods inherited from class org.htmlunit.corejs.javascript.SlotMapOwner
associateValue, checkNotSealed, copyAssociatedValue, createSlotMap, defineProperty, defineProperty, get, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getIds, has, has, isSealed, readMaps, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, writeMapsMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.htmlunit.corejs.javascript.Scriptable
get, getIds, has, hasMethods inherited from interface org.htmlunit.corejs.javascript.SymbolScriptable
get, has
-
Constructor Details
-
SubtleCrypto
public SubtleCrypto()
-
-
Method Details
-
jsConstructor
public void jsConstructor()Creates an instance. -
encrypt
public org.htmlunit.corejs.javascript.NativePromise encrypt(Object algorithm, CryptoKey key, Object data) Encrypts data using the given key and algorithm.- Parameters:
algorithm- the algorithm identifier with parameterskey- the CryptoKey to encrypt withdata- the data to encrypt- Returns:
- a Promise that fulfills with an ArrayBuffer containing the ciphertext
- See Also:
-
decrypt
public org.htmlunit.corejs.javascript.NativePromise decrypt(Object algorithm, CryptoKey key, Object data) Decrypts data using the given key and algorithm.- Parameters:
algorithm- the algorithm identifier with parameterskey- the CryptoKey to decrypt withdata- the data to decrypt- Returns:
- a Promise that fulfills with an ArrayBuffer containing the plaintext
- See Also:
-
sign
public org.htmlunit.corejs.javascript.NativePromise sign(Object algorithm, CryptoKey key, Object data) Signs data using the given key.- Parameters:
algorithm- the algorithm identifier (String or object with name property)key- the CryptoKey to sign withdata- the data to sign- Returns:
- a Promise that fulfills with an ArrayBuffer containing the signature
- See Also:
-
verify
public org.htmlunit.corejs.javascript.NativePromise verify(Object algorithm, CryptoKey key, Object signature, Object data) Verifies a signature using the given key.- Parameters:
algorithm- the algorithm identifier (String or object with name property)key- the CryptoKey to verify withsignature- the signature to verifydata- the data that was signed- Returns:
- a Promise that fulfills with a boolean indicating whether the signature is valid
- See Also:
-
digest
Generates a digest of the given data.- Parameters:
hashAlgorithm- a string or an object with a single property name containing the hash algorithm to usedata- an object containing the data to be digested- Returns:
- a Promise that fulfills with an ArrayBuffer containing the digest
- See Also:
-
generateKey
public org.htmlunit.corejs.javascript.NativePromise generateKey(org.htmlunit.corejs.javascript.Scriptable keyGenParams, boolean isExtractable, org.htmlunit.corejs.javascript.Scriptable keyUsages) Generates a new key (for symmetric algorithms) or key pair (for public-key algorithms).- Parameters:
keyGenParams- algorithm-specific key generation parametersisExtractable- whether the key(s) can be exportedkeyUsages- permitted operations for the key(s)- Returns:
- a Promise that fulfills with a CryptoKey or CryptoKeyPair
- See Also:
-
deriveKey
public org.htmlunit.corejs.javascript.NativePromise deriveKey()Not yet implemented.- Returns:
- a Promise which will be fulfilled with a CryptoKey object representing the new key
-
deriveBits
public org.htmlunit.corejs.javascript.NativePromise deriveBits()Not yet implemented.- Returns:
- a Promise which will be fulfilled with an ArrayBuffer containing the derived bits
-
importKey
public org.htmlunit.corejs.javascript.NativePromise importKey(String format, org.htmlunit.corejs.javascript.Scriptable keyData, org.htmlunit.corejs.javascript.Scriptable keyImportParams, boolean isExtractable, org.htmlunit.corejs.javascript.Scriptable keyUsages) Imports a key from external, portable key material.- Parameters:
format- the data format ("raw", "pkcs8", "spki", "jwk")keyData- the key material (BufferSource for raw/pkcs8/spki, JsonWebKey for jwk)keyImportParams- algorithm-specific import parametersisExtractable- whether the key can be exportedkeyUsages- permitted operations for this key- Returns:
- a Promise that fulfills with the imported CryptoKey
- See Also:
-
exportKey
Exports a key in the specified format.- Parameters:
format- the data format ("raw", "pkcs8", "spki", "jwk")key- the CryptoKey to export- Returns:
- a Promise that fulfills with the key data
- See Also:
-
wrapKey
public org.htmlunit.corejs.javascript.NativePromise wrapKey()Not yet implemented.- Returns:
- a Promise that fulfills with an ArrayBuffer containing the encrypted exported key
-
unwrapKey
public org.htmlunit.corejs.javascript.NativePromise unwrapKey()Not yet implemented.- Returns:
- a Promise that fulfills with the unwrapped key as a CryptoKey object
-