Skip to content

Commit

Permalink
fix CMS parse funs
Browse files Browse the repository at this point in the history
  • Loading branch information
5HT committed Nov 5, 2024
1 parent c063cdf commit 89ba54e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/encryption/cms.ex
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,15 @@ defmodule CA.CMS do
end

def parseContentInfo({:ContentInfo, oid, content}, false) do
case CA.AT.oid(oid) do
case CA.AT.code(oid) do
:data -> parseData(content)
:signedData -> parseData(content)
:envelopedData -> parseEnvelopedData(content)
_ -> []
end
end
def parseContentInfo({:ContentInfo, oid, content}, true) do
case CA.AT.oid(oid) do
case CA.AT.code(oid) do
:data -> parseDataBin(content)
:signedData -> parseDataBin(content)
:envelopedData -> parseEnvelopedDataBin(content)
Expand Down
8 changes: 2 additions & 6 deletions lib/oid/at.ex
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
defmodule CA.AT do
@moduledoc "CA CSR Attributes OIDs."
def oid(x) do
case :lists.keyfind(x, 1, algorithms()) do
{_,val} -> val
false -> CA.ALG.oid(x)
end
end
def oid(x) do case :lists.keyfind(x, 1, algorithms()) do {_,val} -> val ; false -> CA.ALG.oid(x) end end
def code(x) do case :lists.keyfind(x, 2, algorithms()) do {code,_} -> code ; false -> CA.ALG.lookup(x) end end

# https://zakon.rada.gov.ua/laws/show/z0423-17

Expand Down

0 comments on commit 89ba54e

Please sign in to comment.