Skip to content

Backend SignWiseAPI

Martin Paljak edited this page Jan 25, 2017 · 1 revision

SignWise plugin

  • As implemented by: https://www.signwise.me/p/about/plugin
  • MIME type: application/x-signwiseplugin
  • Synchronous interface
  • Calling website needs to embed the plugin invocation code into the website, with something like:
  • <object id="signwiseplugin" type="application/x-signwiseplugin"/>
  • Result of functions is available from plugin.result
  • Does not work with multiple inserted cards - expects a single card
  • Does not have user privacy (certificate is sent to the service without user consent)
  • Supports pin pad
  • Talks directly to supported cards via PC/SC

NPAPI style (synchronous)

Assumes that the plugin reference is fetched by something like:

var plugin = document.getElementById("signwiseplugin");

plugin.version

Contains the version string of the plugin (variable, not function)

  • example
    • window.alert(plugin.result);

plugin.getSigningCertificate()

Gets the signing certificate of the inserted smart card as Hex encoded string

  • arguments
    • none
  • returns
    • true or false
  • example
    • plugin.getSigningCertificate(); window.alert(plugin.result);

plugin.sign()

Asks the PIN from the user and calculates a signature of a hash

  • arguments
    • language
    • hash
    • hashype
  • returns
    • true or false
  • example
    • plugin.sign('en', '0A..0F', 'sha1'); window.alert(plugin.result);

plugin.getAuthenticationCertificate()

Gets the signing certificate of the inserted smart card as Hex encoded string

  • arguments
    • none
  • returns
    • true or false
  • example
    • plugin.getAuthenticationCertificate(); window.alert(plugin.result);

plugin.authenticate()

Asks the PIN from the user and calculates a signature of a hash with authentication key

  • arguments
    • language
    • hash
  • returns
    • true or false
  • example
    • plugin.authenticate('en', '0A..0F'); window.alert(plugin.result);

Chrome Native Messaging

Native Messaging provides the same API but with a callback with error and result arguments appended to function signatures and the functionality hidden behind a SignWiseChromePlugin() class:

  • s = new SignWiseChromePlugin();
    • s.getVersion(function(error, result))
    • s.getSigningCertificate(function(error, result))
    • s.sign(language, hash, hashtype, function(error, result))
    • s.getAuthenticationCertificate(function(error, result))
    • s.authenticate(language, hash, function(error, result))