keystores 0.3.0 → 0.4.0
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 +17 -0
- data/lib/keystores/java_key_store.rb +3 -3
- data/lib/keystores/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 72d3ffe6120e563c54ee4d86e2e18938a470bcde
         | 
| 4 | 
            +
              data.tar.gz: 778af20d95fe1361c51aae47f6370231d844cdd5
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f9489bc5e319e8c7dbbe1adad1e96ac70c715014b44ccf3b87081e50465e568ad54e5788c58eef37da3feea9407f0da3d60edebac53a4e0bbe238617d841875e
         | 
| 7 | 
            +
              data.tar.gz: 77bcf317fcfa157298e97ab54b3ba835f7072fa5d29dad1ef91411a06d5e78f74861b3d1439458c5fe0d2e02407e70fe604003758c315a55a09dd1dd81ec99db
         | 
    
        data/README.md
    CHANGED
    
    | @@ -62,6 +62,23 @@ certificate_chain = keystore.get_certificate_chain('my_key') | |
| 62 62 | 
             
            This gem supports writing trusted certificate entries and private key entries. It currently supports
         | 
| 63 63 | 
             
            writing DSA, RSA, and EC private key entries.
         | 
| 64 64 |  | 
| 65 | 
            +
            Example usage:
         | 
| 66 | 
            +
             | 
| 67 | 
            +
            ```
         | 
| 68 | 
            +
            require 'keystores'
         | 
| 69 | 
            +
            keystore = OpenSSL::JKS.new
         | 
| 70 | 
            +
             | 
| 71 | 
            +
             | 
| 72 | 
            +
            key = OpenSSL::PKey::RSA.new(File.read('my_key.pem'))
         | 
| 73 | 
            +
            cert_chain = OpenSSL::X509::Certificate.new(File.read('my_cert.pem'))
         | 
| 74 | 
            +
            private_key_password = 'key_password'
         | 
| 75 | 
            +
             | 
| 76 | 
            +
            keystore.set_key_entry('my-key', key, cert_chain, private_key_password)
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            key_store_password = 'keystores'
         | 
| 79 | 
            +
            keystore.store('my_keystore.jks', key_store_password)
         | 
| 80 | 
            +
            ```
         | 
| 81 | 
            +
             | 
| 65 82 | 
             
            ## Contributing
         | 
| 66 83 |  | 
| 67 84 | 
             
            Bug reports and pull requests are welcome on GitHub at https://github.com/rylarson/keystores.
         | 
| @@ -177,7 +177,7 @@ module Keystores | |
| 177 177 | 
             
                  end
         | 
| 178 178 | 
             
                end
         | 
| 179 179 |  | 
| 180 | 
            -
                def set_key_entry(aliaz, key, certificate_chain, password | 
| 180 | 
            +
                def set_key_entry(aliaz, key, certificate_chain, password)
         | 
| 181 181 | 
             
                  @entries_mutex.synchronize do
         | 
| 182 182 | 
             
                    entry = @entries[aliaz]
         | 
| 183 183 | 
             
                    if !entry.nil? && entry.is_a?(TrustedCertificateEntry)
         | 
| @@ -188,7 +188,7 @@ module Keystores | |
| 188 188 | 
             
                    # Java uses new Date().getTime() which returns milliseconds since epoch, so we do the same here with %Q
         | 
| 189 189 | 
             
                    entry.creation_date = DateTime.now.strftime('%Q').to_i
         | 
| 190 190 | 
             
                    entry.encrypted_private_key = Keystores::Jks::KeyProtector.new(password).protect(key)
         | 
| 191 | 
            -
                    entry.certificate_chain = certificate_chain
         | 
| 191 | 
            +
                    entry.certificate_chain = [certificate_chain].flatten
         | 
| 192 192 |  | 
| 193 193 | 
             
                    @entries[aliaz] = entry
         | 
| 194 194 | 
             
                  end
         | 
| @@ -365,4 +365,4 @@ module Keystores | |
| 365 365 | 
             
                  attr_accessor :creation_date, :certificate
         | 
| 366 366 | 
             
                end
         | 
| 367 367 | 
             
              end
         | 
| 368 | 
            -
            end
         | 
| 368 | 
            +
            end
         | 
    
        data/lib/keystores/version.rb
    CHANGED