Skip to content
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

docs: crypto supported algorithms #3338

Closed
Closed
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
46 changes: 40 additions & 6 deletions docs/admin/auth-server/crypto/key-generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,48 @@ tags:
- cryptography
---

## This content is in progress
# Key Generation

The Janssen Project documentation is currently in development. Topic pages are being created in order of broadest relevance, and this page is coming in the near future.
## Generating Cryptographic Keys

## Have questions in the meantime?
The Jans Server is compatible with the [Java KeyGenerator](https://docs.oracle.com/javase/7/docs/api/javax/crypto/KeyGenerator.html) to create new cryptographic keys if needed.

While this documentation is in progress, you can ask questions through [GitHub Discussions](https://github.com/JanssenProject/jans/discussion) or the [community chat on Gitter](https://gitter.im/JanssenProject/Lobby). Any questions you have will help determine what information our documentation should cover.
### Backup

* Backup `jansConfWebKeys` attribute data from LDAP. Location of this attribute is: `o=jans > ou=configuration > ou=jans-auth`
* Backup `jans-auth-keys.p12` from `/etc/certs/`

[N.B] Below if `Keystore` location is anywhere except `/etc/certs/` no need to backup.

### Key Generate
To get KeyGenerator, run the following command inside the terminal.

You can put expiration according to your own policy. For testing purpose we are keeping it 2 days.

```commandLine
/opt/jre/bin/java -Dlog4j.defaultInitOverride=true -cp /opt/dist/jans/jans-auth-client-jar-with-dependencies.jar io.jans.as.client.util.KeyGenerator -keystore /etc/certs/jans-auth-keys.p12 -keypasswd <Password> -sig_keys RS256 RS384 -enc_keys RSA1_5 RSA-OAEP -dnname "CN=jansAuth CA Certificates" -expiration 2 > /etc/certs/jans-auth-keys.json
```
Lets see our newly generated crypto keys

```commandLine
keytool -list -v -keystore /etc/certs/jans-auth-keys.p12 -storetype pkcs12 -storepass <password>
```

The jans implementation of KeyGenerator accepts the following arguments:
|Argument |Description|
|------|------|
|-at| oxEleven Access Token|
|-dnname| DN of certificate issuer|
|-key_length|Length of hash key|
|-enc_keys |Encryption keys to generate (For example: RSA_OAEP, RSA1_5)|
|-expiration| Expiration in days|
|-expiration_hours|Expiration in hours|
|-h |Show help|
|-keypasswd| Key Store password|
|-keystore| Key Store file (such as /etc/certs/jans-auth-keys.p12)|
|-ox11| oxEleven Generate Key Endpoint.|
|-sig_keys| Signature keys to generate. (For example: RS256 RS384 RS512 ES256 ES384 ES512 PS256 PS384 PS512)|
|test_prop_file||
|_keyId|Key name suffix|

## Want to contribute?

If you have content you'd like to contribute to this page in the meantime, you can get started with our [Contribution guide](https://docs.jans.io/head/CONTRIBUTING/).
Loading