2017-05-20 06:06:50 +00:00
|
|
|
require 'fileutils'
|
2017-02-11 12:43:29 +00:00
|
|
|
require 'gpgme'
|
|
|
|
|
2017-05-20 06:06:50 +00:00
|
|
|
FileUtils.rm_rf("#{Dir.home}/.config/mpw")
|
|
|
|
FileUtils.rm_rf("#{Dir.home}/.gnupg")
|
|
|
|
|
2017-02-11 12:43:29 +00:00
|
|
|
param = ''
|
|
|
|
param << '<GnupgKeyParms format="internal">' + "\n"
|
|
|
|
param << "Key-Type: RSA\n"
|
2017-05-20 06:06:50 +00:00
|
|
|
param << "Key-Length: 512\n"
|
2017-02-11 12:43:29 +00:00
|
|
|
param << "Subkey-Type: ELG-E\n"
|
2017-05-20 06:06:50 +00:00
|
|
|
param << "Subkey-Length: 512\n"
|
2017-02-11 12:43:29 +00:00
|
|
|
param << "Name-Real: test\n"
|
|
|
|
param << "Name-Comment: test\n"
|
|
|
|
param << "Name-Email: test2@example.com\n"
|
|
|
|
param << "Expire-Date: 0\n"
|
|
|
|
param << "Passphrase: password\n"
|
|
|
|
param << "</GnupgKeyParms>\n"
|
|
|
|
|
|
|
|
ctx = GPGME::Ctx.new
|
|
|
|
ctx.genkey(param, nil, nil)
|