Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy plugin tests #34

Merged
merged 4 commits into from
Apr 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -460,15 +460,9 @@ end

# https://www.openssl.org/docs/man3.0/man7/OSSL_PROVIDER-legacy.html
@testset "Encrypt" begin
if OpenSSL.version_number() ≥ v"3"
OpenSSL.load_legacy_provider()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The load_legacy_provider function and associated code would go away, I suppose.

end
evp_ciphers = [
EvpEncNull(),
EvpBlowFishCBC(), # legacy
EvpBlowFishECB(), # legacy
#EvpBlowFishCFB(), // not supported
EvpBlowFishOFB(), # legacy
EvpAES128CBC(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EvpAES128CBC, EvpAES128ECB and EvpAES128OFB aren't marked as legacy and should remain.

EvpAES128ECB(),
#EvpAES128CFB(), // not supported
Expand Down Expand Up @@ -503,38 +497,6 @@ end
end
end

@testset "EncryptCustomKey" begin
# EvpBlowFishECB is legacy, consider using EvpAES128ECB instead

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of being removed, this test could be moved to a non-legacy cipher as suggested in the comment.

if OpenSSL.version_number() ≥ v"3"
OpenSSL.load_legacy_provider()
end
evp_cipher = EvpBlowFishECB()
sym_key = random_bytes(evp_cipher.key_length ÷ 2)
init_vector = random_bytes(evp_cipher.init_vector_length ÷ 2)

enc_evp_cipher_ctx = EvpCipherContext()
encrypt_init(enc_evp_cipher_ctx, evp_cipher, sym_key, init_vector)

dec_evp_cipher_ctx = EvpCipherContext()
decrypt_init(dec_evp_cipher_ctx, evp_cipher, sym_key, init_vector)

in_string = "OpenSSL Julia"
in_data = IOBuffer(in_string)
enc_data = IOBuffer()

cipher(enc_evp_cipher_ctx, in_data, enc_data)
seek(enc_data, 0)
@show String(read(enc_data))
seek(enc_data, 0)

dec_data = IOBuffer()
cipher(dec_evp_cipher_ctx, enc_data, dec_data)
out_data = take!(dec_data)
out_string = String(out_data)

@test in_string == out_string
end

@testset "StackOf{X509Extension}" begin
ext1 = X509Extension("subjectAltName", "DNS:openssl.jl.com")
ext2 = X509Extension("keyUsage", "digitalSignature, keyEncipherment, keyAgreement")
Expand Down
Loading