Web Crypto's SubtleCrypto, synchronous.
Functions#
digest#
digest(algorithm, data) -> bytes| Parameter | Type | Description |
|---|---|---|
algorithm | AlgorithmIdentifier | |
data | bytes |
Returns bytes
def digest(self, algorithm: AlgorithmIdentifier, data: bytes) -> bytes: ...import_key#
import_key(format, key_data, algorithm, extractable, usages) -> CryptoKey| Parameter | Type | Description |
|---|---|---|
format | KeyFormat | |
key_data | bytes | JsonWebKey | |
algorithm | AlgorithmIdentifier | |
extractable | bool | |
usages | Sequence[KeyUsage] |
Returns CryptoKey
def import_key(
self,
format: KeyFormat,
key_data: bytes | JsonWebKey,
algorithm: AlgorithmIdentifier,
extractable: bool,
usages: Sequence[KeyUsage],
) -> CryptoKey: ...export_key#
export_key(format: BinaryFormat, key: CryptoKey) -> bytes
export_key(format: Literal['jwk'], key: CryptoKey) -> JsonWebKey| Parameter | Type | Description |
|---|---|---|
format | ||
key |
@overload
def export_key(self, format: BinaryFormat, key: CryptoKey) -> bytes: ...
@overload
def export_key(self, format: Literal["jwk"], key: CryptoKey) -> JsonWebKey: ...
def export_key(self, format: KeyFormat, key: CryptoKey) -> bytes | JsonWebKey: ...generate_key#
generate_key(algorithm, extractable, usages) -> CryptoKey | CryptoKeyPair| Parameter | Type | Description |
|---|---|---|
algorithm | AlgorithmIdentifier | |
extractable | bool | |
usages | Sequence[KeyUsage] |
Returns CryptoKey | CryptoKeyPair
def generate_key(
self, algorithm: AlgorithmIdentifier, extractable: bool, usages: Sequence[KeyUsage]
) -> CryptoKey | CryptoKeyPair: ...encrypt#
encrypt(algorithm, key, data) -> bytes| Parameter | Type | Description |
|---|---|---|
algorithm | AlgorithmIdentifier | |
key | CryptoKey | |
data | bytes |
Returns bytes
def encrypt(self, algorithm: AlgorithmIdentifier, key: CryptoKey, data: bytes) -> bytes: ...decrypt#
decrypt(algorithm, key, data) -> bytes| Parameter | Type | Description |
|---|---|---|
algorithm | AlgorithmIdentifier | |
key | CryptoKey | |
data | bytes |
Returns bytes
def decrypt(self, algorithm: AlgorithmIdentifier, key: CryptoKey, data: bytes) -> bytes: ...sign#
sign(algorithm, key, data) -> bytes| Parameter | Type | Description |
|---|---|---|
algorithm | AlgorithmIdentifier | |
key | CryptoKey | |
data | bytes |
Returns bytes
def sign(self, algorithm: AlgorithmIdentifier, key: CryptoKey, data: bytes) -> bytes: ...verify#
verify(algorithm, key, signature, data) -> bool| Parameter | Type | Description |
|---|---|---|
algorithm | AlgorithmIdentifier | |
key | CryptoKey | |
signature | bytes | |
data | bytes |
Returns bool
def verify(
self, algorithm: AlgorithmIdentifier, key: CryptoKey, signature: bytes, data: bytes
) -> bool: ...derive_bits#
derive_bits(algorithm, base_key, length) -> bytes| Parameter | Type | Description |
|---|---|---|
algorithm | AlgorithmIdentifier | |
base_key | CryptoKey | |
length | int | None |
Returns bytes
def derive_bits(
self, algorithm: AlgorithmIdentifier, base_key: CryptoKey, length: int | None
) -> bytes: ...wrap_key#
wrap_key(format, key, wrapping_key, wrap_algorithm) -> bytes| Parameter | Type | Description |
|---|---|---|
format | KeyFormat | |
key | CryptoKey | |
wrapping_key | CryptoKey | |
wrap_algorithm | AlgorithmIdentifier |
Returns bytes
def wrap_key(
self,
format: KeyFormat,
key: CryptoKey,
wrapping_key: CryptoKey,
wrap_algorithm: AlgorithmIdentifier,
) -> bytes: ...unwrap_key#
unwrap_key(format, wrapped_key, unwrapping_key, unwrap_algorithm, unwrapped_key_algorithm, extractable, usages) -> CryptoKey| Parameter | Type | Description |
|---|---|---|
format | KeyFormat | |
wrapped_key | bytes | |
unwrapping_key | CryptoKey | |
unwrap_algorithm | AlgorithmIdentifier | |
unwrapped_key_algorithm | AlgorithmIdentifier | |
extractable | bool | |
usages | Sequence[KeyUsage] |
Returns CryptoKey
def unwrap_key( # noqa: PLR0917
self,
format: KeyFormat,
wrapped_key: bytes,
unwrapping_key: CryptoKey,
unwrap_algorithm: AlgorithmIdentifier,
unwrapped_key_algorithm: AlgorithmIdentifier,
extractable: bool,
usages: Sequence[KeyUsage],
) -> CryptoKey: ...