neicnordic / crypt4gh

Crypt4GH standard implementation
https://pkg.go.dev/github.com/neicnordic/crypt4gh
MIT License
8 stars 4 forks source link

Encryption fails when private signing key is used #38

Closed jbygdell closed 1 year ago

jbygdell commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

crypt4gh encrypt -f test -p user2.pub.pem -s user1.sec.pem 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x613089]

goroutine 1 [running]:
github.com/neicnordic/crypt4gh/keys.ReadPrivateKey({0x6e67e0?, 0xc0000a8068?}, {0x0, 0x0, 0x0})
        /home/runner/work/crypt4gh/crypt4gh/keys/keys.go:97 +0x189
main.readPrivateKey({0x7ffff5c32f48, 0xd})
        /home/runner/work/crypt4gh/crypt4gh/main.go:117 +0x76
main.encryptOp({0x0, 0x0})
        /home/runner/work/crypt4gh/crypt4gh/main.go:321 +0x2ca
main.main()
        /home/runner/work/crypt4gh/crypt4gh/main.go:87 +0x495

Expected behavior File should be encrypted and signed with users private key (user1.sec.pem )

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

blankdots commented 1 year ago

is there anything special about the user1.sec.pem, can we get an example to replicate ?

jbygdell commented 1 year ago

This is the environment where it failed: https://github.com/neicnordic/sda-dashboard/pull/7/files

Although I can not replicate it with the current crypt4gh master branch.

blankdots commented 1 year ago

@jbygdell if we cannot replicate I propose we close this issue.