secret_generator 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/secret_generator.rb +50 -0
- data/bin/setup +7 -0
- data/lib/secret_generator/version.rb +3 -0
- data/lib/secret_generator.rb +5 -0
- data/secret_generator.gemspec +24 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 85a37f49ae0f1a0157f518b52686cd4c7ac66d77
|
4
|
+
data.tar.gz: cc00b89b402bab4baf41249081040d97ec95ae73
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9b138a3827abe993da01f9fc5246b3dd72c63400300d8e269d61f9c445f4f1b69dcfcc633b24d816c4da2c07ff9854509977f93c4d67b08781302d28934195f2
|
7
|
+
data.tar.gz: 202cfe568b91fefa164a034d8c0880a1b3dbb45079f0dc0b9e0e9785d20822a09346180b01a2615a209e16c65d7cd9189b2d08d17917152680367fc7a153f94f
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# SecretGenerator
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/secret_generator`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'secret_generator'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install secret_generator
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it ( https://github.com/[my-github-username]/secret_generator/fork )
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "secret_generator"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'openssl'
|
2
|
+
|
3
|
+
if ARGV[0] == nil then
|
4
|
+
hostname = `hostname`.chop
|
5
|
+
p "hostname = " + hostname
|
6
|
+
else
|
7
|
+
hostname = ARGV[0]
|
8
|
+
p "hostname = " + hostname
|
9
|
+
end
|
10
|
+
|
11
|
+
key = OpenSSL::PKey::RSA.new 2048
|
12
|
+
file = File.new("secret.key", "w")
|
13
|
+
file.write(key.to_pem)
|
14
|
+
file.close
|
15
|
+
|
16
|
+
request = OpenSSL::X509::Request.new
|
17
|
+
request.version = 0
|
18
|
+
request.subject = OpenSSL::X509::Name.new([
|
19
|
+
['C', "test", OpenSSL::ASN1::PRINTABLESTRING],
|
20
|
+
['ST', "test", OpenSSL::ASN1::PRINTABLESTRING],
|
21
|
+
['L', "test", OpenSSL::ASN1::PRINTABLESTRING],
|
22
|
+
['O', "test", OpenSSL::ASN1::UTF8STRING],
|
23
|
+
['OU', "test", OpenSSL::ASN1::UTF8STRING],
|
24
|
+
['CN', hostname, OpenSSL::ASN1::UTF8STRING],
|
25
|
+
['emailAddress', "test@hostname", OpenSSL::ASN1::UTF8STRING]
|
26
|
+
])
|
27
|
+
|
28
|
+
request.public_key = key.public_key
|
29
|
+
request.sign(key, OpenSSL::Digest::SHA1.new)
|
30
|
+
|
31
|
+
name = OpenSSL::X509::Name.parse "CN=" + hostname + "/DC=" + hostname
|
32
|
+
|
33
|
+
cert = OpenSSL::X509::Certificate.new
|
34
|
+
cert.serial = 0
|
35
|
+
cert.version = 2
|
36
|
+
cert.not_before = Time.now
|
37
|
+
cert.not_after = Time.now + 600
|
38
|
+
cert.subject = request.subject
|
39
|
+
cert.public_key = request.public_key
|
40
|
+
cert.subject = name
|
41
|
+
cert.sign key, OpenSSL::Digest::SHA1.new
|
42
|
+
|
43
|
+
file = File.new("public.key", "w")
|
44
|
+
file.write(cert.to_pem)
|
45
|
+
file.close
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
data/bin/setup
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'secret_generator/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "secret_generator"
|
8
|
+
spec.version = SecretGenerator::VERSION
|
9
|
+
spec.authors = ["0xfffffff7"]
|
10
|
+
spec.email = ["0xfffffff7@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{secret_generator can easily create a self-signed certificate. }
|
13
|
+
spec.description = %q{}
|
14
|
+
spec.homepage = "https://github.com/0xfffffff7/secret_generator"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: secret_generator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- '0xfffffff7'
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: ''
|
56
|
+
email:
|
57
|
+
- 0xfffffff7@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/console
|
69
|
+
- bin/secret_generator.rb
|
70
|
+
- bin/setup
|
71
|
+
- lib/secret_generator.rb
|
72
|
+
- lib/secret_generator/version.rb
|
73
|
+
- secret_generator.gemspec
|
74
|
+
homepage: https://github.com/0xfffffff7/secret_generator
|
75
|
+
licenses: []
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.4.5
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: secret_generator can easily create a self-signed certificate.
|
97
|
+
test_files: []
|