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

Signature compliant to http://www.w3.org/2007/05/xmldsig-more#sha256-rsa-MGF1 #1039

Open
rahxam opened this issue Jun 29, 2023 · 0 comments
Open

Comments

@rahxam
Copy link

rahxam commented Jun 29, 2023

I am trying to create a http://www.w3.org/2007/05/xmldsig-more#sha256-rsa-MGF1 Signature as described in rfc6931 RSASSA-PSS without Parameters here: https://www.rfc-editor.org/rfc/rfc6931.html#section-2.3.10

Unfortunately, the result does not seem to be compliant with the standard. Any help what I am doing wrong?

    forge = require('node-forge')
    var md = forge.md.sha256.create();
    md.update(signedInfo, 'utf8');
    var pss = forge.pss.create({
      md: forge.md.sha1.create(),
      mgf: forge.mgf.mgf1.create(forge.md.sha1.create()),
      saltLength: 20
    });
    
    var privateKey = forge.pki.privateKeyFromPem(signingKey);

    var signature = privateKey.sign(md, pss);
    signature = forge.util.encode64(signature);

Thanks in advance,
Maximilian

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

1 participant