main
1# frozen_string_literal: true
2
3RSpec.describe ::Xml::Kit::Crypto::RsaCipher do
4 subject { described_class.new('', private_key) }
5
6 let(:key_pair) { ::Xml::Kit::KeyPair.generate(use: :encryption) }
7 let(:private_key) { key_pair.private_key }
8 let(:uuid) { SecureRandom.uuid }
9
10 describe '#encrypt' do
11 specify { expect(subject.decrypt(subject.encrypt(uuid))).to eql(uuid) }
12 end
13
14 describe '#decrypt' do
15 let(:cipher_text) { private_key.public_encrypt(uuid) }
16
17 specify { expect(subject.decrypt(cipher_text)).to eql(uuid) }
18 end
19end