Assinador SERPRO Frontend - Exemplos Websocket

NÃO REMOVA ESSE TEXTO, INTERFERE NA FORMATAÇÃO! Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Para testar os comandos websocket, proceda da seguinte forma:

  1. Acesse https://www.websocket.org/echo.html.
  2. Em Location digite wss://127.0.0.1:65156/signer/.
  3. Clique em Connect, em Log vai aparecer Connected.
  4. Cole os comandos dos exemplos em Message.
  5. Observe os resultados em Log.
  6. Para facilitar a visualização, sempre clique em Clear log antes de executar um comando e use a URL JSON Lint para formatar o objeto JSON de retorno.

Assinar Texto

Assinar um texto qualquer:


{"command": "sign","type": "text", "inputData": "teste"}     
      


Assinar um texto com uma política de assinatura específica:


{"command": "sign","type": "text", "inputData": "teste", "signaturePolicy":"AD_RT_CADES_2_2"}    
      


Assinar um texto com codificação encoding UTF-8:


{"command": "sign","type": "text", "inputData": "teste", "textEncoding": "UTF-8"}     
      


Embutir o texto junto à assinatura:


{"command": "sign","type": "text", "inputData": "teste atachado", "attached": "true"}
      


Resgatar o texto que foi embutido com o comando anterior:


{"command": "attached", "inputSignature": "MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgMFADCABgkqhkiG9w0BBwGggCSABA50ZXN0ZSBhdGFjaGFkbwAAAAAAAKCAMIIG7zCCBNegAwIBAgIDGJbtMA0GCSqGSIb3DQEBCwUAMIGVMQswCQYDVQQGEwJCUjETMBEGA1UECgwKSUNQLUJyYXNpbDE7MDkGA1UECwwyU2VydmljbyBGZWRlcmFsIGRlIFByb2Nlc3NhbWVudG8gZGUgRGFkb3MgLSBTRVJQUk8xNDAyBgNVBAMMK0F1dG9yaWRhZGUgQ2VydGlmaWNhZG9yYSBkbyBTRVJQUk8gRmluYWwgdjUwHhcNMTcwODMxMTM0MTI0WhcNMjAwODMwMTM0MTI0WjCBoDELMAkGA1UEBhMCQlIxEzARBgNVBAoMCklDUC1CcmFzaWwxGTAXBgNVBAsME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UyFL2BDh4W75LPTckV5Uq7lWTiZSNe8aynrdW7vb5YOMFJ4DuSSHgmi//qaQLXdcfd+kaIcDJQvTtklMdZlvhc06ViK0mCP8Tgay6KOuTnWx5nl1CR1HyqeydDZZRkZ+EZkOwBXkAAAAAAAA="}      

O objeto JSON retornado aqui terá um atributo attachedContent. Este conteúdo está em formato Base64.

Utilize uma página do tipo base64decode para decodificar para o conteúdo original.























© 2019 SERPRO.