Skip to content

Commit

Permalink
adjust was unexported from Dates in Julia 1.11 (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC authored Mar 4, 2024
1 parent 3a20f19 commit f1e5cec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/OpenSSL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const BIO_TYPE_SOURCE_SINK = 0x0400
BIO_TYPE_MD = 8 | BIO_TYPE_FILTER,
#
BIO_TYPE_BUFFER = 9 | BIO_TYPE_FILTER,
#
#
BIO_TYPE_CIPHER = 10 | BIO_TYPE_FILTER,
#
BIO_TYPE_BASE64 = 11 | BIO_TYPE_FILTER,
Expand Down Expand Up @@ -1748,9 +1748,9 @@ function Dates.adjust(asn1_time::Asn1Time, seconds::Second)
end
end

Dates.adjust(asn1_time::Asn1Time, days::Day) = adjust(asn1_time, Second(days))
Dates.adjust(asn1_time::Asn1Time, days::Day) = Dates.adjust(asn1_time, Second(days))

Dates.adjust(asn1_time::Asn1Time, years::Year) = adjust(asn1_time, Day(365 * years.value))
Dates.adjust(asn1_time::Asn1Time, years::Year) = Dates.adjust(asn1_time, Day(365 * years.value))

"""
EVP_PKEY, EVP Public Key interface.
Expand Down
26 changes: 13 additions & 13 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ end
@test String(Asn1Time(2)) == "Jan 1 00:00:02 1970 GMT"

asn1_time = Asn1Time()
OpenSSL.adjust(asn1_time, Dates.Second(4))
Dates.adjust(asn1_time, Dates.Second(4))

OpenSSL.free(asn1_time)
@test String(asn1_time) == "C_NULL"
Expand All @@ -72,10 +72,10 @@ end
OpenSSL.free(asn1_time)
@test String(asn1_time) == "C_NULL"

OpenSSL.adjust(asn1_time, Dates.Second(4))
OpenSSL.adjust(asn1_time, Dates.Second(4))
OpenSSL.adjust(asn1_time, Dates.Day(4))
OpenSSL.adjust(asn1_time, Dates.Year(2))
Dates.adjust(asn1_time, Dates.Second(4))
Dates.adjust(asn1_time, Dates.Second(4))
Dates.adjust(asn1_time, Dates.Day(4))
Dates.adjust(asn1_time, Dates.Year(2))

@show asn1_time
end
Expand Down Expand Up @@ -277,8 +277,8 @@ end
x509_certificate.subject_name = x509_name
x509_certificate.issuer_name = x509_name

adjust(x509_certificate.time_not_before, Second(0))
adjust(x509_certificate.time_not_after, Year(1))
Dates.adjust(x509_certificate.time_not_before, Second(0))
Dates.adjust(x509_certificate.time_not_after, Year(1))

add_extension(x509_certificate, X509Extension("basicConstraints", "CA:TRUE"))
add_extension(x509_certificate, X509Extension("keyUsage", "keyCertSign"))
Expand Down Expand Up @@ -327,8 +327,8 @@ end
x509_certificate.subject_name = x509_name
x509_certificate.issuer_name = x509_name

adjust(x509_certificate.time_not_before, Second(0))
adjust(x509_certificate.time_not_after, Year(1))
Dates.adjust(x509_certificate.time_not_before, Second(0))
Dates.adjust(x509_certificate.time_not_after, Year(1))

add_extension(x509_certificate, X509Extension("basicConstraints", "CA:TRUE"))
add_extension(x509_certificate, X509Extension("keyUsage", "keyCertSign"))
Expand Down Expand Up @@ -379,8 +379,8 @@ end
# Set public key
x509_certificate.public_key = x509_request.public_key

adjust(x509_certificate.time_not_before, Second(0))
adjust(x509_certificate.time_not_after, Year(1))
Dates.adjust(x509_certificate.time_not_before, Second(0))
Dates.adjust(x509_certificate.time_not_after, Year(1))

sign_certificate(x509_certificate, evp_pkey_ca)
end
Expand Down Expand Up @@ -441,8 +441,8 @@ end
x509_certificate.subject_name = x509_name
x509_certificate.issuer_name = x509_name

adjust(x509_certificate.time_not_before, Second(0))
adjust(x509_certificate.time_not_after, Year(1))
Dates.adjust(x509_certificate.time_not_before, Second(0))
Dates.adjust(x509_certificate.time_not_after, Year(1))

sign_certificate(x509_certificate, evp_pkey)

Expand Down

0 comments on commit f1e5cec

Please sign in to comment.