pkernel 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 202062d0c154757be3779508de4900d44c52dfb8c0f99dd16b0fa99517c22863
4
+ data.tar.gz: 1457b731e950024aab3fb81e58b5aecdb87ef1dd780dfeacdbc558fb417e80c1
5
+ SHA512:
6
+ metadata.gz: e8c767de6cc001270728a6b51a7333696afed91f2d95e8923003f1e54a98071393e59d62108ecc50a6a31b565837d0278c83c7609cf511e0c31bf44d4e71b1d3
7
+ data.tar.gz: 34a76e32b896d7878a7bbf1b317c162d812949e8eff68605747b01c080e6ef46aeae5da7962cb02bf56d59f1bd3a95a6fcf79190a0abb157392ff72185bf87e1
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ /tags
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in pkernel.gemspec
4
+ gemspec
@@ -0,0 +1,23 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ pkernel (0.1.0)
5
+ tlogger
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ rake (10.5.0)
11
+ tlogger (0.8.0)
12
+
13
+ PLATFORMS
14
+ java
15
+ ruby
16
+
17
+ DEPENDENCIES
18
+ bundler (~> 2.0)
19
+ pkernel!
20
+ rake (~> 10.0)
21
+
22
+ BUNDLED WITH
23
+ 2.0.2
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Chris Liaw
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,43 @@
1
+ # Pkernel
2
+
3
+ PKI kernel - library for other system to create PKI aware application
4
+
5
+ This library is trying to abstract out the typical core API for the cryptographic operations and meant to be the basis of cryptographic API for the purpose regardless it is implemented in Java JCE (jruby), Java P#11 (jruby) or OpenSSL (ruby).
6
+
7
+ It is intended that user just require the required runtime implementation and maintain the high level (functional) API to enjoy the different implementations of library without needing the change of application API.
8
+
9
+ This gem hold as high level API abstraction only, not implementation except some global data structure or sharable values between implementations.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'pkernel'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install pkernel
26
+
27
+ ## Usage
28
+
29
+ Check out the test/ folder in each implementation library for details usage.
30
+
31
+ ## Development
32
+
33
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
34
+
35
+ 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`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
36
+
37
+ ## Contributing
38
+
39
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pkernel.
40
+
41
+ ## License
42
+
43
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "pkernel"
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(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,159 @@
1
+ require "pkernel/version"
2
+
3
+ module Pkernel
4
+ class Error < StandardError; end
5
+ # Your code goes here...
6
+
7
+ module Catcher
8
+ def method_missing(mtd,*args,&block)
9
+ STDERR.puts "Not implemented"
10
+ end
11
+ end
12
+
13
+ #CatchAll = Catcher.new
14
+
15
+ class KeyPair
16
+ RSA_KEY_NAME = "RSA"
17
+ DSA_KEY_NAME = "DSA"
18
+ EC_KEY_NAME = "EC"
19
+
20
+ include Catcher
21
+ end
22
+
23
+ class Certificate
24
+ include Catcher
25
+
26
+ class Owner
27
+ attr_accessor :name, :country, :locality, :org, :orgUnit, :serial, :csr
28
+ attr_reader :emails, :dns_names
29
+
30
+ def initialize
31
+ @emails = []
32
+ @dns_names = []
33
+ end
34
+
35
+ def add_email(email)
36
+ @emails << email if not email.nil? and not email.empty?
37
+ end
38
+
39
+ def add_dns_names(dns)
40
+ @dns_names << dns if not dns.nil? and not dns.empty?
41
+ end
42
+ end
43
+ # end class Owner
44
+
45
+ #def self.method_missing(mtd,*args,&block)
46
+ # if self.respond_to?(mtd)
47
+ # self.send(mtd,*args,&block)
48
+ # else
49
+ # super
50
+ # end
51
+ #end
52
+
53
+ #def method_missing(mtd,*args,&block)
54
+ # if self.respond_to?(mtd)
55
+ # self.send(mtd,*args,&block)
56
+ # else
57
+ # super
58
+ # end
59
+ #end
60
+
61
+ end
62
+ # end Certificate
63
+
64
+ class CSR
65
+ end
66
+
67
+ class CRL
68
+ end
69
+
70
+ class CRLReason
71
+ include Catcher
72
+
73
+ UNSPECIFIED = 0
74
+ KEY_COMPROMISE = 1
75
+ CA_COMPROMISE = 2
76
+ AFFILIATION_CHANGED = 3
77
+ SUPERSEDED = 4
78
+ CESSATION_OF_OPERATION = 5
79
+ CERTIFICATE_HOLD = 6
80
+ REMOVE_FROM_CRL = 8
81
+ PRIVILEGE_WITHDRAWN = 9
82
+ AA_COMPROMISE = 10
83
+
84
+ def self.to_string(reason)
85
+ case reason
86
+ when UNSPECIFIED
87
+ "CRL reason is not specified"
88
+ when KEY_COMPROMISE
89
+ "Key is compromised"
90
+ when CA_COMPROMISE
91
+ "Certificate authority is compromised"
92
+ when AFFILIATION_CHANGED
93
+ "Affiliation has changed"
94
+ when SUPERSEDED
95
+ "Certificate is superseded"
96
+ when CESSATION_OF_OPERATION
97
+ "Certificate issuer has ceased operation"
98
+ when CERTIFICATE_HOLD
99
+ "Certificate is on hold"
100
+ when REMOVE_FROM_CRL
101
+ "Certificate has removed from CRL"
102
+ when PRIVILEGE_WITHDRAWN
103
+ "Certificate owner has privilege withdrawn"
104
+ when AA_COMPROMISE
105
+ "AA has compromised"
106
+ else
107
+ ""
108
+ end
109
+ end
110
+ end
111
+
112
+ #
113
+ # Identity
114
+ # Identity is abstraction consist of keypair + certificate, stored separately
115
+ #
116
+ class Identity
117
+ attr_reader :privKey, :certificate, :keystore, :chain, :key, :pubKey
118
+ def initialize(opts = {})
119
+ @key = opts[:key]
120
+ @pubKey = opts[:pubKey]
121
+ @privKey = opts[:privKey]
122
+ @certificate = opts[:certificate]
123
+ @keystore = opts[:keystore]
124
+ @chain = opts[:chain]
125
+ end
126
+ end
127
+ # end Identity
128
+ #
129
+
130
+ class IdentityFactory
131
+ end
132
+
133
+ class OCSP
134
+ end
135
+
136
+ class Rfc3161
137
+ RESP_GRANTED = 0
138
+ RESP_GRANTED_WITH_MODS = 1
139
+ RESP_REJECTION = 2
140
+ RESP_WAITING = 3
141
+ RESP_REVOCATION_WARNING = 4
142
+ RESP_REVOCATION_NOTIFICATION = 5
143
+ RESP_KEY_UPDATE_WARNING = 6
144
+
145
+ REASON_BAD_ALG = 0
146
+ REASON_BAD_REQ = 2
147
+ REASON_BAD_DATAFORMAT = 5
148
+ REASON_TIME_NOT_AVAIL = 14
149
+ REASON_UNACCEPTED_POLICY = 15
150
+ REASON_UNACCEPTED_EXTENSION = 16
151
+ REASON_ADD_INFO_NOT_AVAIL = 17
152
+ REASON_SYS_FAILURE = 25
153
+ end
154
+
155
+ class Converter
156
+
157
+ end
158
+
159
+ end
@@ -0,0 +1,3 @@
1
+ module Pkernel
2
+ VERSION = "0.1"
3
+ end
@@ -0,0 +1,43 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "pkernel/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "pkernel"
8
+ spec.version = Pkernel::VERSION
9
+ spec.authors = ["Chris Liaw"]
10
+ spec.email = ["chrisliaw@antrapol.com"]
11
+
12
+ spec.summary = "PKI Kernel"
13
+ spec.description = "Collection of fundamental functions for PKI core engine"
14
+ spec.homepage = ""
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ #if spec.respond_to?(:metadata)
20
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
21
+
22
+ # spec.metadata["homepage_uri"] = spec.homepage
23
+ # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
24
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
25
+ #else
26
+ # raise "RubyGems 2.0 or newer is required to protect against " \
27
+ # "public gem pushes."
28
+ #end
29
+
30
+ # Specify which files should be added to the gem when it is released.
31
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
32
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
33
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
34
+ end
35
+ spec.bindir = "exe"
36
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
+ spec.require_paths = ["lib"]
38
+
39
+ spec.add_development_dependency "bundler", "~> 2.0"
40
+ spec.add_development_dependency "rake", "~> 10.0"
41
+
42
+ spec.add_dependency 'tlogger'
43
+ end
@@ -0,0 +1,53 @@
1
+
2
+
3
+ job :release do
4
+
5
+ include_job :prompt_version
6
+ #ver = prompt "Please provide version for this release:", required: true
7
+ #set :releasing_version, ver
8
+
9
+ include_job :build
10
+ include_job :check_in
11
+
12
+ end
13
+
14
+ job :prompt_version do
15
+ if get(:releasing_version) == nil
16
+ ver = prompt "Please provide version for this release:", required: true
17
+ set :releasing_version, ver
18
+ end
19
+ end
20
+
21
+ job :build do
22
+
23
+ dir File.dirname(__FILE__)
24
+
25
+ include_job :prompt_version
26
+
27
+ rubygem do
28
+ #publish build('alog.gemspec'), ignore_status: true #do |res|
29
+ build('pkernel.gemspec') do |res|
30
+ publish(res, ignore_status: true)
31
+ end
32
+ end
33
+
34
+ end
35
+
36
+
37
+ job :check_in do
38
+ dir File.dirname(__FILE__)
39
+ git do
40
+ commit
41
+ tag
42
+ push 'origin', 'master'
43
+ push 'git','master'
44
+ end
45
+ end
46
+
47
+ job :reinstall do
48
+ rubygem do
49
+ uninstall 'pkernel'
50
+ install 'pkernel'
51
+ end
52
+ end
53
+
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pkernel
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Chris Liaw
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-10-21 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: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
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: tlogger
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Collection of fundamental functions for PKI core engine
56
+ email:
57
+ - chrisliaw@antrapol.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - Gemfile.lock
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - lib/pkernel.rb
71
+ - lib/pkernel/version.rb
72
+ - pkernel.gemspec
73
+ - release.job
74
+ homepage: ''
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.7.6
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: PKI Kernel
98
+ test_files: []