pkernel_jce 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.ruby-version +1 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +56 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/jars/bcmail-jdk15on-157.jar +0 -0
- data/jars/bcpg-jdk15on-157.jar +0 -0
- data/jars/bcpkix-jdk15on-157.jar +0 -0
- data/jars/bcprov-ext-jdk15on-157.jar +0 -0
- data/jars/bcprov-jdk15on-157.jar +0 -0
- data/lib/pkernel_jce/bc_helpers.rb +51 -0
- data/lib/pkernel_jce/certificate.rb +467 -0
- data/lib/pkernel_jce/certificate_owner.rb +90 -0
- data/lib/pkernel_jce/crl.rb +221 -0
- data/lib/pkernel_jce/csr.rb +126 -0
- data/lib/pkernel_jce/error.rb +7 -0
- data/lib/pkernel_jce/global.rb +17 -0
- data/lib/pkernel_jce/identity.rb +333 -0
- data/lib/pkernel_jce/io_utils.rb +45 -0
- data/lib/pkernel_jce/keypair.rb +359 -0
- data/lib/pkernel_jce/ocsp.rb +415 -0
- data/lib/pkernel_jce/provider.rb +40 -0
- data/lib/pkernel_jce/rfc3161.rb +389 -0
- data/lib/pkernel_jce/utils.rb +59 -0
- data/lib/pkernel_jce/version.rb +3 -0
- data/lib/pkernel_jce.rb +102 -0
- data/pkernel_jce.gemspec +45 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0277ced7b04af2e901fde75d62696e8eeb5f9a9f
|
4
|
+
data.tar.gz: 7a46ff97f5057bf662b14b796015045bd8e131cf
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cb10b1ee4cd5634a45028aae5fd6aa0ad33d76822b456f34217de0db7c7ec73de470a62be614bb9beede10770ff699b86e9560658d8c6c87e47db384c487883e
|
7
|
+
data.tar.gz: d1fe46327222a2bfabade8dcc44e17485ef631e981515da54b34f2a787e987958ff96f905c3864e5681cb76e2687588cdd0e2e3cce87b9e7921c70d3a413cc04
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
jruby-9.1.17.0
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../pkernel
|
3
|
+
specs:
|
4
|
+
pkernel (0.1.0)
|
5
|
+
tlogger
|
6
|
+
|
7
|
+
PATH
|
8
|
+
remote: .
|
9
|
+
specs:
|
10
|
+
pkernel_jce (0.1.0)
|
11
|
+
activesupport
|
12
|
+
tlogger
|
13
|
+
|
14
|
+
GEM
|
15
|
+
remote: https://rubygems.org/
|
16
|
+
specs:
|
17
|
+
activesupport (5.2.3)
|
18
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
19
|
+
i18n (>= 0.7, < 2)
|
20
|
+
minitest (~> 5.1)
|
21
|
+
tzinfo (~> 1.1)
|
22
|
+
coderay (1.1.2)
|
23
|
+
concurrent-ruby (1.1.5)
|
24
|
+
ffi (1.11.1-java)
|
25
|
+
i18n (1.6.0)
|
26
|
+
concurrent-ruby (~> 1.0)
|
27
|
+
method_source (0.9.2)
|
28
|
+
minitest (5.11.3)
|
29
|
+
pry (0.11.3-java)
|
30
|
+
coderay (~> 1.1.0)
|
31
|
+
method_source (~> 0.9.0)
|
32
|
+
spoon (~> 0.0)
|
33
|
+
pry-debugger-jruby (1.2.1-java)
|
34
|
+
pry (>= 0.10, < 0.12)
|
35
|
+
ruby-debug-base (~> 0.10.4)
|
36
|
+
rake (10.5.0)
|
37
|
+
ruby-debug-base (0.10.6-java)
|
38
|
+
spoon (0.0.6)
|
39
|
+
ffi
|
40
|
+
thread_safe (0.3.6-java)
|
41
|
+
tlogger (0.8.0)
|
42
|
+
tzinfo (1.2.5)
|
43
|
+
thread_safe (~> 0.1)
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
java
|
47
|
+
|
48
|
+
DEPENDENCIES
|
49
|
+
bundler (~> 2.0)
|
50
|
+
pkernel!
|
51
|
+
pkernel_jce!
|
52
|
+
pry-debugger-jruby
|
53
|
+
rake (~> 10.0)
|
54
|
+
|
55
|
+
BUNDLED WITH
|
56
|
+
2.0.2
|
data/LICENSE.txt
ADDED
@@ -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.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# PkernelJce
|
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/pkernel_jce`. 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 'pkernel_jce'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install pkernel_jce
|
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. You can also 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`, 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).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pkernel_jce.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "pkernel_jce"
|
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__)
|
data/bin/setup
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,51 @@
|
|
1
|
+
|
2
|
+
require_relative "provider"
|
3
|
+
|
4
|
+
module PkernelJce
|
5
|
+
# BC has notorious habit of complicating the object space
|
6
|
+
# This attempt to create single API from all those BC intermidiary objects/classes
|
7
|
+
module BcHelpers
|
8
|
+
def BcHelpers.find_digest_calculator(algo, prov = PkernelJce::Provider::DefProvider)
|
9
|
+
|
10
|
+
digestSel = org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder.new.setProvider(prov).build
|
11
|
+
|
12
|
+
case algo
|
13
|
+
when :sha256, "SHA256"
|
14
|
+
digestSel.get(org.bouncycastle.asn1.x509.AlgorithmIdentifier.new(org.bouncycastle.asn1.nist.NISTObjectIdentifiers.id_sha256))
|
15
|
+
when :sha384, "SHA384"
|
16
|
+
digestSel.get(org.bouncycastle.asn1.x509.AlgorithmIdentifier.new(org.bouncycastle.asn1.nist.NISTObjectIdentifiers.id_sha384))
|
17
|
+
when :sha512, "SHA512"
|
18
|
+
digestSel.get(org.bouncycastle.asn1.x509.AlgorithmIdentifier.new(org.bouncycastle.asn1.nist.NISTObjectIdentifiers.id_sha512))
|
19
|
+
when :sha512_224
|
20
|
+
digestSel.get(org.bouncycastle.asn1.x509.AlgorithmIdentifier.new(org.bouncycastle.asn1.nist.NISTObjectIdentifiers.id_sha512_224))
|
21
|
+
when :sha512_256
|
22
|
+
digestSel.get(org.bouncycastle.asn1.x509.AlgorithmIdentifier.new(org.bouncycastle.asn1.nist.NISTObjectIdentifiers.id_sha512_256))
|
23
|
+
when :sha3_224
|
24
|
+
digestSel.get(org.bouncycastle.asn1.x509.AlgorithmIdentifier.new(org.bouncycastle.asn1.nist.NISTObjectIdentifiers.id_sha3_224))
|
25
|
+
when :sha3_256
|
26
|
+
digestSel.get(org.bouncycastle.asn1.x509.AlgorithmIdentifier.new(org.bouncycastle.asn1.nist.NISTObjectIdentifiers.id_sha3_256))
|
27
|
+
when :sha3_384
|
28
|
+
digestSel.get(org.bouncycastle.asn1.x509.AlgorithmIdentifier.new(org.bouncycastle.asn1.nist.NISTObjectIdentifiers.id_sha3_384))
|
29
|
+
when :sha3_512
|
30
|
+
digestSel.get(org.bouncycastle.asn1.x509.AlgorithmIdentifier.new(org.bouncycastle.asn1.nist.NISTObjectIdentifiers.id_sha3_512))
|
31
|
+
when :shake128
|
32
|
+
digestSel.get(org.bouncycastle.asn1.x509.AlgorithmIdentifier.new(org.bouncycastle.asn1.nist.NISTObjectIdentifiers.id_shake128))
|
33
|
+
when :shake256
|
34
|
+
digestSel.get(org.bouncycastle.asn1.x509.AlgorithmIdentifier.new(org.bouncycastle.asn1.nist.NISTObjectIdentifiers.id_shake256))
|
35
|
+
when :ripemd128
|
36
|
+
digestSel.get(org.bouncycastle.asn1.x509.AlgorithmIdentifier.new(org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers.ripemd128))
|
37
|
+
when :ripemd160
|
38
|
+
digestSel.get(org.bouncycastle.asn1.x509.AlgorithmIdentifier.new(org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers.ripemd160))
|
39
|
+
when :ripemd256
|
40
|
+
digestSel.get(org.bouncycastle.asn1.x509.AlgorithmIdentifier.new(org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers.ripemd256))
|
41
|
+
else
|
42
|
+
dgstCal = digestSel.get(org.bouncycastle.asn1.x509.AlgorithmIdentifier.new(algo))
|
43
|
+
if dgstCal.nil?
|
44
|
+
raise PkernelJce::Error, "Unknown digest algo '#{algo}'"
|
45
|
+
else
|
46
|
+
dgstCal
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|