Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
5HT committed Oct 31, 2024
1 parent 87370d9 commit 4a3d430
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/encryption/cms.ex
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,10 @@ defmodule CA.CMS do
signedAttributes = :lists.map(fn {:Attribute,code,[{:asn1_OPENTYPE,b}],_} ->
CA.CRT.oid(code, b)
end, signedAttrs)
attributes = :lists.map(fn {_,code,[{:asn1_OPENTYPE,b}],_} ->
CA.CRT.oid(code, b)
end, attrs)
attributes = case attrs do
:asn1_NOVALUE -> []
_ -> :lists.map(fn {_,code,[{:asn1_OPENTYPE,b}],_} -> CA.CRT.oid(code, b) end, attrs)
end
[
resourceType: :SignerInfo,
issuer: CA.CRT.rdn(issuer),
Expand Down
6 changes: 6 additions & 0 deletions lib/services/crt.ex
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ defmodule CA.CRT do
def rdn({2, 5, 6, 8}), do: "organizationalRole"
def rdn({2, 5, 6, 9}), do: "groupOfNames"
def rdn({:rdnSequence, list}) do
:lists.map(fn [{_,oid,{_,list}}] -> {rdn(oid),"#{list}"}
{_,oid,{_,list}} -> {rdn(oid),"#{list}"}
{_,oid,list} -> {rdn(oid),"#{list}"} end, list)
end

def rdn2({:rdnSequence, list}) do
Enum.join :lists.map(fn [{_,oid,{_,list}}] -> "#{rdn(oid)}=#{list}"
{_,oid,{_,list}} -> "#{rdn(oid)}=#{list}"
{_,oid,list} -> "#{rdn(oid)}=#{list}" end, list), "/"
Expand Down

0 comments on commit 4a3d430

Please sign in to comment.