Skip to content

Get publicKey from cert #155

@lpinkas-ecosistemas

Description

@lpinkas-ecosistemas

Hello and first of all thank you for this amazing package!
I need help signing and verifying with the provided cert and private key, which are already configured in the token (safenet 5110 etoken).
I already managed to sign using the private key identifier, but I can't figure out how to get the public key from the certificate to verify the signature.

const privateKeys = session.find({
        class: graphene.ObjectClass.PRIVATE_KEY,
      });
      const privateKey = privateKeys.items(0);
      const sign = session.createSign('SHA256_RSA_PKCS', privateKey);
      sign.update('simple text 1');
      sign.update('simple text 2');
      const signature = sign.final();
      console.log('Signature RSA-SHA1:', signature.toString('hex')); // Signature RSA-SHA1: 6102a66dc0d97fadb5...

var verify = session.createVerify("SHA256_RSA_PKCS", ?????????);
      verify.update("simple text 1");
      verify.update("simple text 2");
      var verify_result = verify.final(signature);
      console.log("Signature RSA-SHA1 verify:", verify_result);      // Signature RSA-SHA1 verify: true

Any help would be greatly appreciated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions