pkernel_jce 0.1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ tags
11
+
12
+ !test/artifacts/
13
+ test/artifacts/*
14
+ test/*.tsp
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ jruby-9.1.17.0
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in pkernel_jce.gemspec
4
+ gemspec
5
+
6
+ gem 'pkernel', path: '../pkernel'
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
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
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
@@ -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
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