rokitna
2021-1-26 10:42:20

The other day, I noticed I didn’t get any GitHub search results when I looked for something until I replaced the slash in its name with a space. I guess GitHub interprets the slash in some way that interferes with searching for Racket identifiers.


soegaard2
2021-1-26 11:10:22

You can see the list of places where ffi-lib looks here: https://docs.racket-lang.org/foreign/Loading_Foreign_Libraries.html

Try for example (get-lib-search-dirs) .


soegaard2
2021-1-26 11:12:04

soegaard2
2021-1-26 11:12:48

This suggestion in particular is worth checking:


laurent.orseau
2021-1-26 11:16:15

Yeah, the slash seems to be specially treated. However, searching for "first-some prompt-loop" yields nothing, while searching for "first-some" works


anything
2021-1-26 15:02:58

When I sign a message using ECC http://rmculpepper.github.io/crypto/pk.html#%28def._%28%28lib._crypto%2Fmain..rkt%29._pk-sign%29%29\|pk-sign, I’m expecting a pair of numbers (r, s). The documentation of crypto-lib doesn’t tell me what the bytes mean. I get some 70—72 bytes in the answer, so there must be some few bytes as a header or something like that to tell me information about the signature. My crypto factory is libcrypto, that is, OpenSSL. I’m going through the documentation of OpenSSL to see if I can understand what format they use. If you can, please educate me a bit on this. I appreciate it!

I looked at the source code of pk-sign. What I found is a short procedure that boils down to invoking the method sign on the object pk, that is, (send pk sign msg dspec pad). As the introduction to the crypto-lib suggests, this is a low-level library and the bytes I’m getting are most likely the bytes produced by OpenSSL, so I might be in the right direction here, but if you happen to know which standard I should look at, that’d be great. Thank you!


jestarray
2021-1-26 16:18:27

thanks got it


ryanc
2021-1-26 16:27:50

It is common for crypto standards to use ASN.1 to define binary formats. An ECDSA signature is encoded as an Ecdsa-Sig-Value, defined in https://tools.ietf.org/html/rfc3279#section-2.2.3, among other places. (It uses the same structure from DSA.) Here’s some code to get the numbers: (require crypto crypto/all asn1) (crypto-factories libcrypto-factory) (define pk (generate-private-key 'ec '((curve secp256r1)))) (define Ecdsa-Sig-Val (SEQUENCE [r INTEGER] [s INTEGER])) (bytes->asn1 Ecdsa-Sig-Val (pk-sign pk (digest 'sha256 "hello world"))) To understand the references, you need to understand some basic ASN.1. There are some introductions on the web. Unfortunately, the references are scattered across many different documents, mostly RFCs. See crypto-lib/private/common/asn1.rkt for the Racket translations, and see the top of the file for a list of references.


rokitna
2021-1-26 18:04:26

Hmm, yeah, searching for that in quotes doesn’t work. I searched without the quotes and it worked, but of course searching for something else like define contract, where both words are common, doesn’t really assist in finding uses of define/contract.