krypt-core 0.0.1-universal-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011-2013 Hiroshi Nakamura, Martin Boßlet
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest.txt ADDED
@@ -0,0 +1,13 @@
1
+ Rakefile
2
+ Manifest.txt
3
+ README.rdoc
4
+ LICENSE
5
+ lib/krypt
6
+ lib/krypt-core.rb
7
+ lib/krypt/core
8
+ lib/krypt/core/version.rb
9
+ lib/kryptcore.jar
10
+ spec/README
11
+ spec/java
12
+ spec/java/parser_factory_spec.rb
13
+ spec/java/pull_header_parser_spec.rb
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ == krypt-core-java
2
+
3
+ The Java implementation of the krypt-core API
4
+ used by JRuby.
5
+
6
+ == Requirements
7
+
8
+ Java SE 6 or higher.
9
+
10
+ == krypt
11
+
12
+ For more information about krypt, please have a
13
+ look at the project and its wiki at
14
+
15
+ https://github.com/krypt/krypt
16
+
17
+ Copyright (c) 2011-2013
18
+ Hiroshi Nakamura <nahi@ruby-lang.org>
19
+ Martin Bosslet <Martin.Bosslet@gmail.com>
data/Rakefile ADDED
@@ -0,0 +1,44 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rspec/core/rake_task'
4
+ require 'ant'
5
+
6
+ KRYPT_HOME = '../krypt'
7
+
8
+ # TODO: update
9
+ MANIFEST = FileList["Rakefile", "Manifest.txt", "README.rdoc", "LICENSE", "lib/**/*", "spec/**/*"]
10
+ File.open("Manifest.txt", "w") {|f| MANIFEST.each {|n| f.puts n } }
11
+
12
+ task :default => [:build, :spec]
13
+
14
+ file "lib/kryptcore.jar" => :build
15
+
16
+ desc "Delete artifact files"
17
+ task :clean do
18
+ rm_f FileList['lib/kryptcore.jar']
19
+ ant :clean
20
+ end
21
+
22
+ RSpec::Core::RakeTask.new(:spec) do |spec|
23
+ spec.ruby_opts = ['--1.9']
24
+ spec.pattern = File.join(KRYPT_HOME, 'spec/**/*_spec.rb')
25
+ spec.fail_on_error = false
26
+ end
27
+
28
+ task :pre_coverage do
29
+ ant 'coverage-jar'
30
+ end
31
+
32
+ task :post_coverage do
33
+ ant 'coverage-report'
34
+ end
35
+
36
+ desc "Create coverage report of spec run"
37
+ task :coverage => [:clean, :pre_coverage, :spec, :post_coverage]
38
+
39
+ desc "Build a JAR file"
40
+ task :build do
41
+ ant 'jar'
42
+ end
43
+
44
+ task :java_compile => :build
data/lib/krypt-core.rb ADDED
@@ -0,0 +1,39 @@
1
+ =begin
2
+
3
+ = Info
4
+
5
+ krypt-core API - Java implementation
6
+
7
+ Copyright (C) 2011-2013
8
+ Hiroshi Nakamura <nahi@ruby-lang.org>
9
+ Martin Bosslet <martin.bosslet@gmail.com>
10
+ All rights reserved.
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining
13
+ a copy of this software and associated documentation files (the
14
+ "Software"), to deal in the Software without restriction, including
15
+ without limitation the rights to use, copy, modify, merge, publish,
16
+ distribute, sublicense, and/or sell copies of the Software, and to
17
+ permit persons to whom the Software is furnished to do so, subject to
18
+ the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be
21
+ included in all copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
+
31
+ =end
32
+
33
+ unless defined? JRUBY_VERSION
34
+ warn 'Loading krypt-core-java in a non-JRuby interpreter'
35
+ end
36
+
37
+ require 'kryptcore.jar'
38
+ require 'krypt-provider-jdk'
39
+
@@ -0,0 +1,8 @@
1
+ module Krypt
2
+ module Core
3
+ class Version
4
+ VERSION = "0.1.0.dev"
5
+ end
6
+ end
7
+ end
8
+
data/lib/kryptcore.jar ADDED
Binary file
data/spec/README ADDED
@@ -0,0 +1,2 @@
1
+ Specs for krypt-core are to be found in the main krypt project at https://github.com/emboss/krypt.
2
+
@@ -0,0 +1,20 @@
1
+ require 'java'
2
+ $CLASSPATH << File.expand_path('../../lib/kryptcore.jar', File.dirname(__FILE__))
3
+ java_import 'impl.krypt.asn1.ParserFactory'
4
+ java_import 'impl.krypt.asn1.parser.PullHeaderParser'
5
+
6
+ describe "ParserFactory" do
7
+ it "can be instanciated" do
8
+ ParserFactory.new.should be_an_instance_of ParserFactory
9
+ end
10
+
11
+ describe "instance" do
12
+ subject {
13
+ ParserFactory.new
14
+ }
15
+
16
+ it "creates PullHeaderParser" do
17
+ subject.newHeaderParser.should be_an_instance_of PullHeaderParser
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,22 @@
1
+ require 'java'
2
+ require 'openssl'
3
+ $CLASSPATH << File.expand_path('../../lib/kryptcore.jar', File.dirname(__FILE__))
4
+ java_import 'java.io.ByteArrayInputStream'
5
+ java_import 'impl.krypt.asn1.ParserFactory'
6
+ java_import 'impl.krypt.asn1.ParsedHeader'
7
+ java_import 'impl.krypt.asn1.parser.PullHeaderParser'
8
+
9
+ describe "PullHeaderParser" do
10
+ subject {
11
+ ParserFactory.new.new_header_parser
12
+ }
13
+
14
+ it "returns parsed header" do
15
+ test = %w{04 03 01 02 03}
16
+ raw = [test.join('')].pack('H*')
17
+ header = subject.next(ByteArrayInputStream.new(raw.to_java_bytes))
18
+ expected = OpenSSL::ASN1.decode(raw)
19
+ String.from_java_bytes(header.value).should == expected.value
20
+ header.parsed_tag.tag.should == expected.tag
21
+ end
22
+ end
data/test/scratch.rb ADDED
@@ -0,0 +1,11 @@
1
+ require 'krypt'
2
+ require 'openssl'
3
+ require 'stringio'
4
+ require 'pp'
5
+ require 'base64'
6
+
7
+ d = Krypt::Digest.new("SHA1")
8
+ p d
9
+
10
+ result = d.hexdigest("test")
11
+ p result
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: krypt-core
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: universal-java
7
+ authors:
8
+ - Hiroshi Nakamura, Martin Bosslet
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-02-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: krypt-provider-jdk
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '='
19
+ - !ruby/object:Gem::Version
20
+ version: 0.0.1
21
+ none: false
22
+ requirement: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.1
27
+ none: false
28
+ prerelease: false
29
+ type: :runtime
30
+ description: Java implementation of the krypt-core API
31
+ email: Martin.Bosslet@gmail.com
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - Rakefile
37
+ - LICENSE
38
+ - README.rdoc
39
+ - Manifest.txt
40
+ - lib/kryptcore.jar
41
+ - !binary |-
42
+ bGliL2tyeXB0LWNvcmUucmI=
43
+ - !binary |-
44
+ bGliL2tyeXB0L2NvcmUvdmVyc2lvbi5yYg==
45
+ - !binary |-
46
+ c3BlYy9SRUFETUU=
47
+ - !binary |-
48
+ c3BlYy9qYXZhL3B1bGxfaGVhZGVyX3BhcnNlcl9zcGVjLnJi
49
+ - !binary |-
50
+ c3BlYy9qYXZhL3BhcnNlcl9mYWN0b3J5X3NwZWMucmI=
51
+ - !binary |-
52
+ dGVzdC9zY3JhdGNoLnJi
53
+ homepage: https://github.com/krypt/krypt-core-java
54
+ licenses:
55
+ - MIT
56
+ post_install_message:
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: 1.9.3
65
+ none: false
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: !binary |-
71
+ MA==
72
+ none: false
73
+ requirements: []
74
+ rubyforge_project:
75
+ rubygems_version: 1.8.24
76
+ signing_key:
77
+ specification_version: 3
78
+ summary: krypt-core API for JRuby
79
+ test_files: []