Skip to content

Documentation for the #57 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions bundle/jwk/keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,23 @@ Each key service will be an instance of the `Jose\Component\Core\JWK` class.

As any other configuration values, you can use environment variables.

## From A JWK From A Shared Secret

> This feature was introduced in version 1.1.

This method will directly get a shared secret.

```yaml
jose:
keys:
key_name:
secret: # Method
secret: 'This is my shared secret'
additional_values:
use: 'sig'
alg: 'RS512'
```

## From A JWK Object

This method will directly get a JWK object.
Expand Down
18 changes: 18 additions & 0 deletions component/jwk/jwk.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,24 @@ $key = JWKFactory::createOctKey(
);
```

> The following feature was introduced in version 1.1.

If you already have a shared secret, you can use it to create an `oct` key:

```php
<?php

use Jose\Component\KeyManagement\JWKFactory;

$jwk = JWKFactory::createFromSecret(
'My Secret Key', // The shared secret
[ // Optional additional members
'alg' => 'HS256',
'use' => 'sig'
]
);
```

## RSA Key Pair

The following example will show you how to create a `RSA` key.
Expand Down
16 changes: 16 additions & 0 deletions console/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,22 @@ This key type is only used by the `none` algorithm. Key parameters `alg` and `us
{"kty":"none","use":"sig","alg":"none"}
```

#### From An Existing Secret

> This feature was introduced in version 1.1.

If you already have a secret, you can use it to create an octet key (`oct`).

```sh
./jose.phar key:generate:from_secret "This is my secret"
```

In case your secret is binary string, you will have to encode it first (Base64) and indicate it is encoded.

```sh
./jose.phar key:generate:from_secret "VGhpcyBpcyBteSBzZWNyZXQ=" --is_b64
```

### Key Loaders

The key loader commands will loader keys from various sources.
Expand Down