Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
5HT committed Nov 13, 2024
1 parent 76c08a2 commit f79d5ec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/oid/rdn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ defmodule CA.RDN do
"#{alg}"
end

def parseSubj(csr) do
def encodeAttrsCSR(csr) do
{:CertificationRequest, {:CertificationRequestInfo, v, subj, x, y}, b, c} = csr
{:CertificationRequest, {:CertificationRequestInfo, v, encodeAttrs(subj), x, y}, b, c}
end

def parseUnSubj(csr) do
def decodeAttrsCSR(csr) do
{:CertificationRequest, {:CertificationRequestInfo, v, subj, x, y}, b, c} = csr
{:CertificationRequest, {:CertificationRequestInfo, v, decodeAttrs(subj), x, y}, b, c}
end
Expand Down
4 changes: 2 additions & 2 deletions lib/services/cmp.ex
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ defmodule CA.CMP do
{:ok, _} = :"PKCS-10".encode(:CertificationRequest, csr)

:file.write_file("#{CA.CSR.dir(profile)}/#{cn}.csr",
X509.CSR.to_pem(CA.RDN.parseSubj(csr)))
X509.CSR.to_pem(CA.RDN.encodeAttrsCSR(csr)))

:file.write_file("#{CA.CSR.dir(profile)}/#{cn}.cer",
X509.Certificate.to_pem(cert))
Expand Down Expand Up @@ -132,7 +132,7 @@ defmodule CA.CMP do
{ca_key, ca} = CA.CSR.read_ca(profile)
subject = X509.CSR.subject(csr)
:logger.info 'TCP P10CR from ~tp~n', [CA.RDN.rdn(subject)]
true = X509.CSR.valid?(CA.RDN.parseSubj(csr))
true = X509.CSR.valid?(CA.RDN.encodeAttrsCSR(csr))
cert = X509.Certificate.new(X509.CSR.public_key(csr), CA.RDN.encodeAttrs(subject), ca, ca_key,
extensions: [subject_alt_name: X509.Certificate.Extension.subject_alt_name(["synrc.com"]) ])

Expand Down
2 changes: 1 addition & 1 deletion lib/services/http/post.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defmodule CA.EST.Post do
subject = X509.CSR.subject(csr)
:logger.info 'HTTP P10CR from ~tp template ~tp profile ~p~n', [CA.RDN.rdn(subject), template, CA.RDN.profile(csr)]

true = X509.CSR.valid?(CA.RDN.parseSubj(csr))
true = X509.CSR.valid?(CA.RDN.encodeAttrsCSR(csr))
cert = X509.Certificate.new(X509.CSR.public_key(csr), CA.RDN.encodeAttrs(subject), ca, ca_key,
extensions: [subject_alt_name: X509.Certificate.Extension.subject_alt_name(["synrc.com"]) ])

Expand Down

0 comments on commit f79d5ec

Please sign in to comment.