summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/spec_helper.rb1
-rw-r--r--spec/support/platform_helpers.rb4
-rw-r--r--spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb2
-rw-r--r--spec/unit/encrypted_data_bag_item_spec.rb4
4 files changed, 8 insertions, 3 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index e282a88100..d29215f5fe 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -133,6 +133,7 @@ RSpec.configure do |config|
config.filter_run_excluding :ruby_gte_20_and_openssl_gte_101 => true unless (ruby_gte_20? && openssl_gte_101?)
config.filter_run_excluding :openssl_lt_101 => true unless openssl_lt_101?
config.filter_run_excluding :ruby_lt_20 => true unless ruby_lt_20?
+ config.filter_run_excluding :aes_256_gcm_only => true unless aes_256_gcm?
running_platform_arch = `uname -m`.strip
diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb
index f8cad6de7f..8d17af3993 100644
--- a/spec/support/platform_helpers.rb
+++ b/spec/support/platform_helpers.rb
@@ -165,3 +165,7 @@ end
def openssl_lt_101?
!openssl_gte_101?
end
+
+def aes_256_gcm?
+ OpenSSL::Cipher.ciphers.include?("aes-256-gcm")
+end
diff --git a/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb b/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb
index 1da5efb36e..87cdd39ef5 100644
--- a/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb
+++ b/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb
@@ -83,7 +83,7 @@ describe Chef::EncryptedDataBagItem::CheckEncrypted do
end
end
- context "when encryption version is 3", :ruby_20_only do
+ context "when encryption version is 3", :aes_256_gcm_only do
include_examples "encryption detected" do
let(:version) { 3 }
let(:encryptor) { Chef::EncryptedDataBagItem::Encryptor::Version3Encryptor }
diff --git a/spec/unit/encrypted_data_bag_item_spec.rb b/spec/unit/encrypted_data_bag_item_spec.rb
index 9335889ef3..109852db56 100644
--- a/spec/unit/encrypted_data_bag_item_spec.rb
+++ b/spec/unit/encrypted_data_bag_item_spec.rb
@@ -97,7 +97,7 @@ describe Chef::EncryptedDataBagItem::Encryptor do
Chef::Config[:data_bag_encrypt_version] = 3
end
- context "on supported platforms", :ruby_gte_20_and_openssl_gte_101 do
+ context "on supported platforms", :aes_256_gcm_only do
it "creates a version 3 encryptor" do
encryptor.should be_a_instance_of(Chef::EncryptedDataBagItem::Encryptor::Version3Encryptor)
@@ -182,7 +182,7 @@ describe Chef::EncryptedDataBagItem::Decryptor do
context "when decrypting a version 3 (JSON+aes-256-gcm+random iv+auth tag) encrypted value" do
- context "on supported platforms", :ruby_gte_20_and_openssl_gte_101 do
+ context "on supported platforms", :aes_256_gcm_only do
let(:encrypted_value) do
Chef::EncryptedDataBagItem::Encryptor::Version3Encryptor.new(plaintext_data, encryption_key).for_encrypted_item