cryptorecord 0.9.2 → 0.9.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4845afdba30c98434e9119a47449fd3e8ccce546b787e1615eb8d93963fddfc
4
- data.tar.gz: 74501e6a8f101a212a7adf481e0177560d6505a67b62d3a2b89878bf8307eff4
3
+ metadata.gz: 2f65167997da3557c020dc4b9219b3be59e55a3b3bd819c12cedf6c10bca6e98
4
+ data.tar.gz: 26ceb04de88c7f4649b5327989bab0ae096638b08db11e48acbb4d006cb0faa6
5
5
  SHA512:
6
- metadata.gz: 5c88e3b01578ab2edb6bebafa0b10da7432ff409aac4798435c000c280dcae71fd9ddc32c5f7cec5bd8b22e9d434f23708718b250d836d909e4b35030538c5f8
7
- data.tar.gz: 5a1ed28ea06866b2b64201c1073e171d95c318869415896beee1483d692a0acb2bad639ddf90bedab144061f02a6acb8a52b7f3ad19a3a8db93953b59b060015
6
+ metadata.gz: 9f324bf32e8f6a990367063931bd5c1c4df6f393080ecc892d20f845b9babcdacbed3fca8fdefc2688d7e3fa0258853ca04509aa8f8d3bb0a2723b794b682558
7
+ data.tar.gz: b8b331f2ecc17de0b2c543a0a2c80c3ca6990a10517ad0f30c6daf3d5a52fc4bdbf2a4025231ebd61786fa04f1ef768215e5629c0f7e4419bd8bb1936f4f7368
data/README.md CHANGED
@@ -109,14 +109,14 @@ puts sshfp
109
109
 
110
110
  require 'cryptorecord'
111
111
 
112
- sshfp = Cryptorecord::Openpgpkeys.new(:uid => "hacky@hacktheplanet.com")
112
+ sshfp = Cryptorecord::Openpgpkey.new(:uid => "hacky@hacktheplanet.com")
113
113
  sshfp.read_file("resources/hacky.asc")
114
114
  puts sshfp
115
115
 
116
116
  ```
117
117
  ## Documentation
118
118
 
119
- [rubydoc.info](https://www.rubydoc.info/github/whotwagner/cryptorecord/master)
119
+ [rubydoc.info](https://www.rubydoc.info/gems/cryptorecord/)
120
120
 
121
121
  ## Resources
122
122
 
@@ -32,6 +32,7 @@ DESCRIPTION
32
32
  spec.require_paths = ["lib"]
33
33
 
34
34
  spec.add_development_dependency "bundler", "~> 1.13"
35
- spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "rake", ">= 12.3.3"
36
36
  spec.add_development_dependency "rspec", "~> 3.0"
37
+ spec.add_dependency 'mail', '>=2.7.0'
37
38
  end
@@ -31,6 +31,6 @@ unless defined? options.uid
31
31
  exit 1
32
32
  end
33
33
 
34
- openpgpkeys = Cryptorecord::Openpgpkeys.new(options.to_h)
34
+ openpgpkeys = Cryptorecord::Openpgpkey.new(options.to_h)
35
35
  openpgpkeys.read_file(options.keyfile)
36
36
  puts openpgpkeys
@@ -1,5 +1,5 @@
1
1
  require 'cryptorecord/version'
2
- require 'cryptorecord/openpgpkeys'
2
+ require 'cryptorecord/openpgpkey'
3
3
  require 'cryptorecord/tlsa'
4
4
  require 'cryptorecord/sshfp'
5
5
  require 'cryptorecord/exceptions'
@@ -23,15 +23,17 @@
23
23
  module Cryptorecord
24
24
  require 'openssl'
25
25
  require 'mail'
26
- # Cryptorecord::Openpgpkeys-class generates
26
+ # Cryptorecord::Openpgpkey-class generates
27
27
  # openphpkeys-dns-records. Instances must have an
28
28
  # uid. The PGP-Key can be read from file
29
29
  # @!attribute [r] uid
30
30
  # @return [Mail::Address] the userid or nil
31
31
  # @!attribute [r] key
32
32
  # @return [String] the pgp-key as a string
33
- class Openpgpkeys
34
- attr_reader :uid, :key
33
+ # @!attribute [r] rectype
34
+ # @return [String] "OPENPGPKEY"
35
+ class Openpgpkey
36
+ attr_reader :uid, :key, :rectype
35
37
 
36
38
  # This constructor initializes uid and key by calling the setters.
37
39
  # @see uid=
@@ -42,6 +44,7 @@ module Cryptorecord
42
44
  def initialize(args = {})
43
45
  self.uid = args.fetch(:uid, nil)
44
46
  self.key = args.fetch(:key, nil)
47
+ @rectype = 'OPENPGPKEY'
45
48
  end
46
49
 
47
50
  # This setter takes the argument val to create a Mail::Address-object.
@@ -109,11 +112,23 @@ module Cryptorecord
109
112
  self.key = data
110
113
  end
111
114
 
115
+ # This method returns the left-hand name of a dns-record
116
+ # @return [String] left-hand name of a dns-record
117
+ def left
118
+ "#{localpart}._openpgpkey.#{domain}."
119
+ end
120
+
121
+ # This method returns the right-hand content of a dns-record
122
+ # @return [String] right-hand content of a dns-record
123
+ def right
124
+ @key.to_s
125
+ end
126
+
112
127
  # This method concats the openpgpkey-record
113
128
  #
114
129
  # @return [String] openpgpkey dns-record as defined in rfc7929
115
130
  def to_s
116
- "#{localpart}._openpgpkey.#{domain}. IN OPENPGPKEY #{@key}"
131
+ "#{left} IN #{@rectype} #{right}"
117
132
  end
118
133
 
119
134
  private
@@ -33,10 +33,12 @@ module Cryptorecord
33
33
  # @return [Integer] sha1 = 1, sha256 = 2
34
34
  # @!attribute [r] key
35
35
  # @return [String] the ssh-host-key, without the type and comment
36
+ # @!attribute [r] rectype
37
+ # @return [String] "SSHFP"
36
38
  # @!attribute host
37
39
  # @return [String] the fqdn-host
38
40
  class Sshfp
39
- attr_reader :cipher, :digest, :key
41
+ attr_reader :cipher, :digest, :key, :rectype
40
42
  attr_accessor :host
41
43
 
42
44
  # This constructor initializes cipher, key, digest, host and keyfile
@@ -52,7 +54,7 @@ module Cryptorecord
52
54
  self.digest = args.fetch(:digest, 2)
53
55
  @host = args.fetch(:host, 'localhost')
54
56
  keyfile = args.fetch(:keyfile, nil)
55
-
57
+ @rectype = 'SSHFP'
56
58
  read_file(keyfile) unless keyfile.nil?
57
59
  end
58
60
 
@@ -107,13 +109,25 @@ module Cryptorecord
107
109
  end
108
110
  end
109
111
 
112
+ # This method returns the left-hand name of a dns-record
113
+ # @return [String] left-hand name of a dns-record
114
+ def left
115
+ "#{@host}."
116
+ end
117
+
118
+ # This method returns the right-hand content of a dns-record
119
+ # @return [String] right-hand content of a dns-record
120
+ def right
121
+ "#{@cipher} #{@digest} #{fingerprint}"
122
+ end
123
+
110
124
  # This method concats the sshfp-record
111
125
  #
112
126
  # @return [String] sshfp dns-record as defined in rfc4255
113
127
  # @raise Cryptorecord::KeyError
114
128
  def to_s
115
129
  raise Cryptorecord::KeyError, 'No certificate defined' if @key.nil?
116
- "#{@host}. IN SSHFP #{@cipher} #{@digest} #{fingerprint}"
130
+ "#{left} IN #{@rectype} #{right}"
117
131
  end
118
132
 
119
133
  private
@@ -30,8 +30,10 @@ module Cryptorecord
30
30
  # @return [Integer] the match-type
31
31
  # @!attribute [r] usage
32
32
  # @return [Integer] the usage
33
- # @!attribute cert
33
+ # @!attribute [r] cert
34
34
  # @return [String] the x509 certificate
35
+ # @!attribute [r] rectype
36
+ # @return [String] "TLSA"
35
37
  # @!attribute host
36
38
  # @return [String] the fqdn for the record
37
39
  # @!attribute proto
@@ -39,7 +41,7 @@ module Cryptorecord
39
41
  # @!attribute port
40
42
  # @return [String] the network port
41
43
  class Tlsa
42
- attr_reader :selector, :mtype, :usage, :cert
44
+ attr_reader :selector, :mtype, :usage, :cert, :rectype
43
45
  attr_accessor :host, :proto, :port
44
46
 
45
47
  # constructor for the tlsa-object
@@ -60,6 +62,7 @@ module Cryptorecord
60
62
  @port = args.fetch(:port, 443)
61
63
  self.usage = args.fetch(:usage, 3)
62
64
  self.cert = args.fetch(:cert, nil)
65
+ @rectype = 'TLSA'
63
66
  end
64
67
 
65
68
  # This setter initializes the selector
@@ -133,12 +136,23 @@ module Cryptorecord
133
136
  end
134
137
  end
135
138
 
139
+ # This method returns the left-hand name of a dns-record
140
+ # @return [String] left-hand name of a dns-record
141
+ def left
142
+ "_#{@port}._#{@proto}.#{@host}."
143
+ end
144
+
145
+ # This method returns the right-hand content of a dns-record
146
+ # @return [String] right-hand content of a dns-record
147
+ def right
148
+ "#{@usage} #{@selector} #{@mtype} #{fingerprint}"
149
+ end
150
+
136
151
  # This method concats the tlsa-record
137
152
  #
138
153
  # @return [String] tlsa dns-record as defined in rfc6698
139
154
  def to_s
140
- "_#{@port}._#{@proto}.#{@host}. IN TLSA"\
141
- " #{@usage} #{@selector} #{@mtype} #{fingerprint}"
155
+ "#{left} IN #{@rectype} #{right}"
142
156
  end
143
157
 
144
158
  private
@@ -20,5 +20,5 @@
20
20
  #++
21
21
  module Cryptorecord
22
22
  # Guess what..
23
- VERSION = '0.9.2'.freeze
23
+ VERSION = '0.9.6'.freeze
24
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptorecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wolfgang Hotwagner
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-07 00:00:00.000000000 Z
11
+ date: 2020-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: mail
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 2.7.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 2.7.0
55
69
  description: "This gem provides an API and scripts for creating crypto-related dns-records(e.g.
56
70
  DANE). \nAt the moment the following records are supported:\n * TLSA\n * SSHFP\n
57
71
  \ * OPENPGPKEYS\n\nThis API does not create nor provide any public keys or certificates.
@@ -80,13 +94,8 @@ files:
80
94
  - exe/sshfprecord
81
95
  - exe/tlsarecord
82
96
  - lib/cryptorecord.rb
83
- - lib/cryptorecord/.yardoc/checksums
84
- - lib/cryptorecord/.yardoc/complete
85
- - lib/cryptorecord/.yardoc/object_types
86
- - lib/cryptorecord/.yardoc/objects/root.dat
87
- - lib/cryptorecord/.yardoc/proxy_types
88
97
  - lib/cryptorecord/exceptions.rb
89
- - lib/cryptorecord/openpgpkeys.rb
98
+ - lib/cryptorecord/openpgpkey.rb
90
99
  - lib/cryptorecord/sshfp.rb
91
100
  - lib/cryptorecord/tlsa.rb
92
101
  - lib/cryptorecord/version.rb
File without changes
File without changes