Skip to content

Commit 3ffcc5f

Browse files
committed
Added fix for 1.10.
1 parent 3c8e85d commit 3ffcc5f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/LibCrypto.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,13 @@ end
899899

900900
function read_pkcs12(fn::AbstractString, pw::SecretBuffer)
901901
data = read(fn)
902+
# Should use cconvert, but Julia 1.10 does not do null termination so added
903+
# selectively here only.
904+
if pw.data[end] != 0x00
905+
seekend(pw)
906+
write(pw, 0x0)
907+
seekstart(pw)
908+
end
902909
p12 = ccall((:d2i_PKCS12, libcrypto), Ptr{Cvoid},
903910
(Ptr{Cvoid}, Ptr{Ptr{Cuchar}}, Clong),
904911
C_NULL, Ref(pointer(data)), length(data))
@@ -909,7 +916,7 @@ function read_pkcs12(fn::AbstractString, pw::SecretBuffer)
909916
ret = ccall((:PKCS12_parse, libcrypto), Cint,
910917
(Ptr{Cvoid}, Ptr{Cstring},
911918
Ptr{Ptr{Cvoid}}, Ptr{Ptr{Cvoid}}, Ptr{Ptr{Cvoid}}),
912-
p12, cconvert(Cstring, pw), xkey, xcert, xca)
919+
p12, pointer(pw.data), xkey, xcert, xca)
913920
openssl_error(ret)
914921
return Cert(xcert[]), PKey(xkey[])
915922
end

0 commit comments

Comments
 (0)