Skip to content

Commit

Permalink
ukm
Browse files Browse the repository at this point in the history
  • Loading branch information
5HT committed Jul 5, 2023
1 parent 45ad9c6 commit 15dc897
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/sec.ex
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,23 @@ defmodule CA.CRYPTO do
def shared(pub, key, scheme), do: :crypto.compute_key(:ecdh, pub, key, scheme)

def test() do
scheme = :secp384r1
scheme = :prime256v1
{maximK,key} = privat "maxim"
{maximP,pub} = public "maxim"
cms = testCMSX509

Check warning on line 57 in lib/sec.ex

View workflow job for this annotation

GitHub Actions / build

variable "testCMSX509" does not exist and is being expanded to "testCMSX509()", please use parentheses to remove the ambiguity or change the variable name
:io.format '~p~n', [cms]
{_,{:ContentInfo,_,{:EnvelopedData,_,_,x,{:EncryptedContentInfo,_,{_,_,{_,iv}},msg},_}}} = cms
[{:kari,{_,:v3,{_,{_,_,publicKey}},_,_,[{_,_,encryptedKey}]}}|y] = x
[{:kari,{_,:v3,{_,{_,_,publicKey}},ukm,_,[{_,_,encryptedKey}]}}|y] = x

Check warning on line 60 in lib/sec.ex

View workflow job for this annotation

GitHub Actions / build

variable "y" is unused (if the variable is not meant to be used, prefix it with an underscore)
encryptedKey2 = :binary.part(encryptedKey, 2, 16)

Check warning on line 61 in lib/sec.ex

View workflow job for this annotation

GitHub Actions / build

variable "encryptedKey2" is unused (if the variable is not meant to be used, prefix it with an underscore)
# maximS = shared(maximP,maximK,scheme)
maximS = shared(publicKey,maximK,scheme)
derived = kdf(:sha256, maximS, 256)
# unwrap = :aes_kw.unwrap(derived, encryptedKey)
maximS = shared(maximP,maximK,scheme)
derived = kdf(:sha256, maximS, :erlang.size(maximS))

Check warning on line 63 in lib/sec.ex

View workflow job for this annotation

GitHub Actions / build

variable "derived" is unused (if the variable is not meant to be used, prefix it with an underscore)
# unwrap = :aes_kw.unwrap(encryptedKey, derived)
[ cert: pub,
priv: key,
publicKey: maximP,
privateKey: maximK,
sharedKey: maximS,
ukm: ukm,
senderPublic: publicKey,
encryptedKey: encryptedKey,
encryptedMessage: msg,
Expand Down

0 comments on commit 15dc897

Please sign in to comment.