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

[BUG] Normalizing of self-description.json fails #12

Open
ecoben opened this issue Jul 7, 2022 · 3 comments
Open

[BUG] Normalizing of self-description.json fails #12

ecoben opened this issue Jul 7, 2022 · 3 comments
Assignees
Labels
Type: Bug Something isn't working

Comments

@ecoben
Copy link

ecoben commented Jul 7, 2022

Using the SD signer tool as described in Step 2 of the gx-compliance README, fails with the following error message:

Hashed canonized SD 8562727dcf1c655dc4704935ab9d3369363a72f86ba8a81242b26c1cd6051abd
'Something went wrong:'
undefined

The input used for testing is identical to the one in this API POST:

curl --location --request POST 'https://compliance.gaia-x.eu/api/v1/normalize' \
--header 'Content-Type: application/json' \
--data-raw '{
    "@context": [
        "http://www.w3.org/ns/shacl#",
        "http://www.w3.org/2001/XMLSchema#",
        "http://w3id.org/gaia-x/participant#",
        "@nest"
    ],
    "@id": "https://www.eco.de/.well-known/self-description.json",
    "@type": [
        "VerifiableCredential",
        "LegalPerson"
    ],
    "credentialSubject": {
        "id": "did:web:eco.de",
        "gx-participant:name": {
            "@value": "eco - Verband der Internetwirtschaft",
            "@type": "xsd:string"
        },
        "gx-participant:legalName": {
            "@value": "eco - Verband der Internetwirtschaft e.V.",
            "@type": "xsd:string"
        },
        "gx-participant:registrationNumber": {
            "@value": "DE182676944",
            "@type": "xsd:string"
        },
        "gx-participant:headquarterAddress": {
            "@type": "gx-participant:Address",
            "gx-participant:country": {
                "@value": "DE",
                "@type": "xsd:string"
            },
            "gx-participant:street-address": {
                "@value": "Lichtstraße 43h",
                "@type": "xsd:string"
            },
            "gx-participant:postal-code": {
                "@value": "50825",
                "@type": "xsd:string"
            },
            "gx-participant:locality": {
                "@value": "Köln/Cologne",
                "@type": "xsd:string"
            }
        },
        "gx-participant:legalAddress": {
            "@type": "gx-participant:Address",
            "gx-participant:country": {
                "@value": "DE",
                "@type": "xsd:string"
            },
            "gx-participant:street-address": {
                "@value": "Lichtstraße 43h",
                "@type": "xsd:string"
            },
            "gx-participant:postal-code": {
                "@value": "50825",
                "@type": "xsd:string"
            },
            "gx-participant:locality": {
                "@value": "Köln/Cologne",
                "@type": "xsd:string"
            }
        }
    }
}'

When checking the above SD input using the Swagger test page at https://compliance.gaia-x.eu/docs/#/Common/CommonController_normalizeSelfDescriptionRaw , I get a response of 201 Undocumented.

The sample files provided, produce the same response:

@ecoben ecoben added the Type: Bug Something isn't working label Jul 7, 2022
@oceanByte
Copy link
Contributor

oceanByte commented Jul 7, 2022

Hi @ecoben, thanks for the report. I am trying to reproduce the error, but everything works on my end. Normalization is working as expected but the signing might fail for you? I believe it must be a problem with your keys. Did you sign any other SDs successfully yet?

If you want to get the full error message you can change line 180 console.dir(error?.response?.data, { depth: null, colors: true }); to console.dir(error, { depth: null, colors: true });.

@ecoben
Copy link
Author

ecoben commented Jul 7, 2022

Thanks @oceanByte, I will try debugging this as you suggested.

@ecoben
Copy link
Author

ecoben commented Jul 7, 2022

Okay, now I got helpful messages from jose and can confirm: my .env was not in the expected format.

I had to convert the private key from pkcs1 to pkcs8 using OpenSSL:
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in pkcs1.key -out pkcs8.key
(The -nocrypt flag seems to be deprecated these days, but I think that's how the input is needed here.)

I didn't actually know about the different formats - and didn't pick up on the subtle difference:
the example.env begins with
"PRIVATE_KEY="-----BEGIN PRIVATE KEY-----
which seems to be the case in pkcs8 format
rather than
"PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----
which was my pkcs1 version.

Maybe a hint on this could save others some time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants