Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VerifyPKCS1v15 fails indeterministicly #30

Closed
2bitProgammer opened this issue Mar 16, 2015 · 2 comments
Closed

VerifyPKCS1v15 fails indeterministicly #30

2bitProgammer opened this issue Mar 16, 2015 · 2 comments

Comments

@2bitProgammer
Copy link

This is probably related to issue #19

I have the following method:

func (s myConf) Verify(data []byte, sig []byte) (bool, error) {
    digest, err := openssl.SHA256(data)
    if err != nil {
        return false, err
    }

    if err := (*(s.public)).VerifyPKCS1v15(openssl.SHA256_Method, digest[:], signature); err != nil {
        return false, err
    } else {
        return true, nil
    }
}

I just recently noticed that my unit tests usually pass, though occasionally they will fail with the error:

verifypkcs1v15: failed to finalize verify

Maybe every 3rd or 4th time I run it is fails. If I click run again, it will pass.

@jtolio
Copy link
Member

jtolio commented Mar 17, 2015

Oh, did you figure it out @JoeBruner ? what was the issue?

@2bitProgammer
Copy link
Author

Well, I discovered that I had a different issue. My code was generating a signature for a structure that contained a map[string]bool. I was doing a:

for k, _ := range m {
   buf.WriteString(k)
}

but that is wrong, as the ordering of keys returned is (intentionally) randomized by Go. I need to first sort the keys before adding to the buffer. Until I fix that problem, I'm closing the issue. If I still have problems, I'll re-open the issue.

nathan454 pushed a commit to nathan454/openssl that referenced this issue Nov 30, 2022
Install mingw toolchain on windows machines for go test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants