Release of 1.0.0
test: reuse code
1 file changed
tree: 1b483878841e9b3940cc0ad6ab9cc1fbc13b2efb
  1. .idea/
  2. .stutter/
  3. gradle/
  4. src/
  5. .gitattributes
  6. .gitignore
  7. .project
  8. build.gradle
  9. gradlew
  10. gradlew.bat
  11. LICENSE
  12. README.md
  13. settings.gradle
README.md

gradle-keygen-plugin

This plugin provides Gradle ability to generate SSH keys.

It uses JSch Java library, no installation of extra tools is required.

Usage


plugins { id 'org.fidata.keygen' } keygen { keyType = RSA keySize = 4096 } task('generateSSHKey', type: GenerateSSHKeyTask) { privateKeyFile = new File(buildDir, 'ssh_key') email = 'test@example.com' }

This task, when run, would produce ssh_key and ssh_key.pub files in build directory.

keyType and keySize properties can be set per-task via its properties. Otherwise, project-wide values from keygen extension are used.

Since keys can't be restored, to prevent key loss task will run only if either private or public key file doesn't exist. If you want to regenerate key (including when you changed desired key properties) you should clean them manually beforehand.

Other types of keys could be supported in the future.

Compatibility

  • Gradle >= 4.4
  • Developed and tested with JDK 8

Copyright © 2018 Basil Peace

This file is part of gradle-keygen-plugin.

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.