You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| A JWK in Python dict |`jwk = Jwk({'kty': 'RSA', 'n': '...', ...})`|
23
-
| A JWK in JSON formatted string |`jwk = Jwk('{"kty": "RSA", "n": "...", ...}')`|
24
-
| A `cryptography` key |`jwk = Jwk(cryptography_key, password='mypassword')`|
25
-
| A PEM formatted string |`jwk = Jwk.from_pem(`<br/>`'''-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAp0VYc2zc/6yNzQUSFprv`<br/>`... 3QIDAQAB`<br/>`-----END PUBLIC KEY----- '''`<br/>`)`|
| A public key in a PEM formatted string |`jwk = Jwk.from_pem(`<br/>`'''-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAp0VYc2zc/6yNzQUSFprv`<br/>`... 3QIDAQAB`<br/>`-----END PUBLIC KEY----- '''`<br/>`)`|
28
+
| A private key in a PEM formatted string |`jwk = Jwk.from_pem(`<br/>`'''-----BEGIN PRIVATE KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAp0VYc2zc/6yNzQUSFprv`<br/>`... 3QIDAQAB`<br/>`-----END PRIVATE KEY----- ''',`<br/> `password=b'password_if_any'`<br/> `)`|
29
+
| A private key in a DER binary |`jwk = Jwk.from_der(b'der_formatted_binary')`|
| Get Alg (if present) |`jwk.alg`| intended algorithm identifier, as `str`|
48
-
| Get Use |`jwk.use`| intended key use, if present, or deduced from `alg`|
49
-
| Get Key Ops |`jwk.key_ops`| intended key operations, if present,<br>or deduced from `use`, `kty`, privateness and symmetricness |
50
-
| Get attributes |`jwk['attribute']`<br>`jwk.attribute`| attribute value |
51
-
| Get thumbprint |`jwk.thumbprint()`<br>`jwk.thumbprint_uri()`| Computed thumbprint or thumbprint URI |
52
-
| Get supported algorithms |`jwk.supported_signing_algorithms()`<br>`jwk.supported_key_management_algorithms()`<br>`jwk.supported_encryption_algorithms()`| List of supported algorithms identifiers, as `str`. |
| Get Alg (if present) |`jwk.alg`| intended algorithm identifier, as`str`|
55
+
| Get Use |`jwk.use`| intended key use, if present, or deduced from`alg`|
56
+
| Get Key Ops |`jwk.key_ops`| intended key operations, if present,<br>or deduced from `use`, `kty`, privateness and symmetricness |
57
+
| Get attributes |`jwk['attribute']`<br>`jwk.attribute`| attribute value |
58
+
| Get thumbprint |`jwk.thumbprint()`<br>`jwk.thumbprint_uri()`| Computed thumbprint or thumbprint URI |
59
+
| Get supported algorithms |`jwk.supported_signing_algorithms()`<br>`jwk.supported_key_management_algorithms()`<br>`jwk.supported_encryption_algorithms()`| List of supported algorithms identifiers, as`str`. |
Those will return the exact (usually base64url-encoded) value exactly as expressed in the JWK. You can also get the
149
-
real, decoded parameters with some special attributes:
155
+
Those will return the exact (usually base64url-encoded) value, exactly as expressed in the JWK. You can also get the
156
+
real, decoded parameters with some special attributes, which depend on the key type (thus on the `Jwk` subclass):
150
157
151
158
```python
152
159
from jwskate import Jwk
@@ -180,8 +187,8 @@ The available special attributes vary depending on the key type.
180
187
181
188
`jwskate` can generate private keys from any of it supported key types. To generate a key, use `Jwk.generate()`. It just
182
189
needs some hints to know what kind of key to generate, either an identifier for the algorithm that will be used with
183
-
that key (`alg`), or a key type (`kty`). An `alg` is preferred, since it gives more hints, like the Elliptic Curve to
184
-
use, or the key size to generate. The specified `alg` will be part of the generated key, and will avoid having to
190
+
that key (`alg`), or a key type (`kty`). An `alg` is preferred, since it gives more hints to generate a key that is suitable
191
+
for its purpose. Those hints include the Elliptic Curve to use, or the key size to generate. The specified `alg` will be part of the generated key, and will avoid having to
185
192
specify the alg for every cryptographic operation you will perform with that key.
0 commit comments