Giter VIP home page Giter VIP logo

crypto-pro-provider's Introduction

Crypto-pro-provider

Provides methods for signing xml of requests for SMEV2 and SMEV3

Documentation

You can read documentation here!

Usage

  • Import module;
import CryptoProProvider from 'crypto-pro-provider';
  • First, you need to select certificate. For it use method certificates;
  CryptoProProvider.certificates()
    .then((certificates) => {
      // list of certificates
    })
    .catch((error) => {
      // error
    });

Signature for SMEV 2:

  • Sign your message;
  // thumbprint - hash of the before selected certificate
  // base64 - message encoded to base64
  CryptoProProvider.sign(thumbprint, base64)
    .then((signature) => {
      // signed message
    })
    .catch((error) => {
      // error
    });

Signature for SMEV 3:

Signing message for SMEV 3 is more difficult, than for SMEV 2, so you should have server-side for some operations.

Before signing your message by crypto-pro-provider, you should does several actions.

Then canonicalized node send to client-side and sign by crypto-pro-provider:

  // thumbprint - hash of the before selected certificate
  // base64 - message encoded to base64
  CryptoProProvider.paramsForDetachedSignature(thumbprint, base64)
    .then((object) => {
      // {
      //   signature_value: <value of signature>,
      //   x509certificate: <value of certificate>
      // }
    })
    .catch((error) => {
      // error
    });

Received params substitute SignatureValue and X509Certificate nodes in signature template from the first step.

Save signature.

That's all!

Changelog

Changelog here!

crypto-pro-provider's People

Contributors

vmashanov avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.