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 +4 -4
- data/README.md +2 -2
- data/cryptorecord.gemspec +2 -1
- data/exe/openpgpkeysrecord +1 -1
- data/lib/cryptorecord.rb +1 -1
- data/lib/cryptorecord/{openpgpkeys.rb → openpgpkey.rb} +19 -4
- data/lib/cryptorecord/sshfp.rb +17 -3
- data/lib/cryptorecord/tlsa.rb +18 -4
- data/lib/cryptorecord/version.rb +1 -1
- metadata +21 -12
- data/lib/cryptorecord/.yardoc/checksums +0 -0
- data/lib/cryptorecord/.yardoc/complete +0 -0
- data/lib/cryptorecord/.yardoc/object_types +0 -0
- data/lib/cryptorecord/.yardoc/objects/root.dat +0 -0
- data/lib/cryptorecord/.yardoc/proxy_types +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 2f65167997da3557c020dc4b9219b3be59e55a3b3bd819c12cedf6c10bca6e98
         | 
| 4 | 
            +
              data.tar.gz: 26ceb04de88c7f4649b5327989bab0ae096638b08db11e48acbb4d006cb0faa6
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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:: | 
| 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/ | 
| 119 | 
            +
            [rubydoc.info](https://www.rubydoc.info/gems/cryptorecord/)
         | 
| 120 120 |  | 
| 121 121 | 
             
            ## Resources
         | 
| 122 122 |  | 
    
        data/cryptorecord.gemspec
    CHANGED
    
    | @@ -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", " | 
| 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
         | 
    
        data/exe/openpgpkeysrecord
    CHANGED
    
    
    
        data/lib/cryptorecord.rb
    CHANGED
    
    
| @@ -23,15 +23,17 @@ | |
| 23 23 | 
             
            module Cryptorecord
         | 
| 24 24 | 
             
              require 'openssl'
         | 
| 25 25 | 
             
              require 'mail'
         | 
| 26 | 
            -
              # Cryptorecord:: | 
| 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 | 
            -
               | 
| 34 | 
            -
             | 
| 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 | 
            -
                  "#{ | 
| 131 | 
            +
                  "#{left} IN #{@rectype} #{right}"
         | 
| 117 132 | 
             
                end
         | 
| 118 133 |  | 
| 119 134 | 
             
                private
         | 
    
        data/lib/cryptorecord/sshfp.rb
    CHANGED
    
    | @@ -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 | 
            -
                  "#{ | 
| 130 | 
            +
                  "#{left} IN #{@rectype} #{right}"
         | 
| 117 131 | 
             
                end
         | 
| 118 132 |  | 
| 119 133 | 
             
                private
         | 
    
        data/lib/cryptorecord/tlsa.rb
    CHANGED
    
    | @@ -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 | 
            -
                  " | 
| 141 | 
            -
                  " #{@usage} #{@selector} #{@mtype} #{fingerprint}"
         | 
| 155 | 
            +
                  "#{left} IN #{@rectype} #{right}"
         | 
| 142 156 | 
             
                end
         | 
| 143 157 |  | 
| 144 158 | 
             
                private
         | 
    
        data/lib/cryptorecord/version.rb
    CHANGED
    
    
    
        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. | 
| 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:  | 
| 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:  | 
| 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:  | 
| 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/ | 
| 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
         | 
| Binary file | 
| Binary file | 
| Binary file |