Commit 534fe32
Changed files (43)
bin
lib
xml
kit
spec
bin/console
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
require 'bundler/setup'
require 'xml/kit'
lib/xml/kit/crypto/oaep_cipher.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
module Crypto
lib/xml/kit/crypto/rsa_cipher.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
module Crypto
lib/xml/kit/crypto/symmetric_cipher.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
module Crypto
lib/xml/kit/crypto/unknown_cipher.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
module Crypto
lib/xml/kit/templates/certificate.builder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
xml.KeyDescriptor use ? { use: use } : {} do
xml.KeyInfo "xmlns": ::Xml::Kit::Namespaces::XMLDSIG do
xml.X509Data do
lib/xml/kit/templates/encryption.builder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
xml.EncryptedData xmlns: ::Xml::Kit::Namespaces::XMLENC do
xml.EncryptionMethod Algorithm: symmetric_algorithm
xml.KeyInfo xmlns: ::Xml::Kit::Namespaces::XMLDSIG do
lib/xml/kit/templates/signature.builder
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
xml.Signature 'xmlns' => ::Xml::Kit::Namespaces::XMLDSIG do
xml.SignedInfo do
xml.CanonicalizationMethod Algorithm: ::Xml::Kit::Namespaces::CANONICALIZATION
lib/xml/kit/certificate.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
# {include:file:spec/xml/certificate_spec.rb}
lib/xml/kit/crypto.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'xml/kit/crypto/oaep_cipher'
require 'xml/kit/crypto/rsa_cipher'
require 'xml/kit/crypto/symmetric_cipher'
lib/xml/kit/decryption.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
# {include:file:spec/saml/xml_decryption_spec.rb}
lib/xml/kit/decryption_error.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
class DecryptionError < StandardError
lib/xml/kit/document.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
# {include:file:spec/saml/xml_spec.rb}
lib/xml/kit/encryption.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
class Encryption
lib/xml/kit/fingerprint.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
# This generates a fingerprint for an X509 Certificate.
lib/xml/kit/id.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
# This class is used primary for generating ID.
lib/xml/kit/key_pair.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
class KeyPair # :nodoc:
lib/xml/kit/namespaces.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
module Namespaces
lib/xml/kit/self_signed_certificate.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
class SelfSignedCertificate
lib/xml/kit/signature.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
class Signature
lib/xml/kit/signatures.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
# @!visibility private
lib/xml/kit/templatable.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
module Templatable
lib/xml/kit/template.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
class Template
lib/xml/kit/version.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module Xml
module Kit
VERSION = '0.1.11'.freeze
lib/xml/kit.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'active_model'
require 'active_support/core_ext/numeric/time'
require 'active_support/deprecation'
lib/xml-kit.rb
@@ -1,1 +1,3 @@
+# frozen_string_literal: true
+
require 'xml/kit'
spec/support/certificate_helper.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module CertificateHelper
def generate_key_pair(passphrase)
::Xml::Kit::SelfSignedCertificate.new.create(passphrase: passphrase)
spec/support/item.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class Item
include ::Xml::Kit::Templatable
spec/xml/kit/crypto/oaep_cipher_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe ::Xml::Kit::Crypto::OaepCipher do
let(:key_pair) { ::Xml::Kit::KeyPair.generate(use: :encryption) }
let(:private_key) { key_pair.private_key }
spec/xml/kit/crypto/rsa_cipher_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe ::Xml::Kit::Crypto::RsaCipher do
let(:key_pair) { ::Xml::Kit::KeyPair.generate(use: :encryption) }
let(:private_key) { key_pair.private_key }
spec/xml/kit/crypto/symmetric_cipher_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe ::Xml::Kit::Crypto::SymmetricCipher do
[
'tripledes-cbc',
spec/xml/kit/certificate_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Xml::Kit::Certificate do
subject { described_class.new(certificate, use: :signing) }
spec/xml/kit/decryption_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Xml::Kit::Decryption do
describe '#decrypt_hash' do
let(:secret) { FFaker::Movie.title }
spec/xml/kit/document_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Xml::Kit::Document do
describe '#valid_signature?' do
let(:login_url) { "https://#{FFaker::Internet.domain_name}/login" }
spec/xml/kit/encryption_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Xml::Kit::Encryption do
describe '#to_xml' do
[
spec/xml/kit/fingerprint_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Xml::Kit::Fingerprint do
describe '#sha' do
it 'returns the SHA256' do
spec/xml/kit/kit_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe Xml::Kit do
it 'has a version number' do
expect(Xml::Kit::VERSION).not_to be nil
spec/xml/kit/signatures_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe ::Xml::Kit::Signatures do
let(:reference_id) { Xml::Kit::Id.generate }
spec/xml/kit/templatable_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
RSpec.describe ::Xml::Kit::Templatable do
class Item
include ::Xml::Kit::Templatable
spec/spec_helper.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'simplecov'
SimpleCov.start do
add_filter '/spec/'
Gemfile
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
source 'https://rubygems.org'
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
Rakefile
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'bundler/audit/task'
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
xml-kit.gemspec
@@ -1,4 +1,6 @@
+# frozen_string_literal: true
+
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'xml/kit/version'