Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <link href=";600&display=swap" rel="stylesheet">

<!-- Babel Polyfill -->
<script defer src=""></script>

<!-- Components -->
<script defer type="module" src=""></script>
<link rel="stylesheet" href="">

<!-- Crypto -->
<script defer src=""></script>
<script defer src=""></script>
<script defer src=""></script>

<!-- XAdES -->
<script defer src=""></script>

  body {
    height: 100vh;
    background: #6D7D87;
  section {
    max-width: 660px;
    width: calc(100% - 20px);
    margin: 20px auto;
  textarea {
    width: 100%;

  <textarea id="output" cols="60" rows="10"></textarea>

    Verify XML signed document online on
    <a href=""

  function formatPEM (raw, tag) {
    var pemString = pvtsutils.Convert.ToBase64(raw);
    var stringLength = pemString.length;
    var resultString = "";

    for (var i = 0, count = 0; i < stringLength; i++, count++) {
      if (count > 63) {
        resultString = resultString + '\n';
        count = 0;

      resultString = resultString + pemString[i];

    return '-----BEGIN ' + tag.toUpperCase() + '-----\n' + resultString + '\n-----END ' + tag.toUpperCase() + '-----\n';

  async function continueHandler(event) {
    try {
      var demoData = `<xml>
        <text>Demo message</text>
      var provider = await event.detail.socketProvider.getCrypto(event.detail.providerId);

      XAdES.Application.setEngine("Fortify", provider);
      var xml = XAdES.Parse(demoData);
      var signedXml = new XAdES.SignedXml();

      var cert = await provider.certStorage.getItem(event.detail.certificateId);
      var privateKey = await provider.keyStorage.getItem(event.detail.privateKeyId);
      var certRawData = await provider.certStorage.exportCert('raw', cert);
      var x509 = pvtsutils.Convert.ToBase64(certRawData);
      var signature = await signedXml.Sign(
        // Signing document
        privateKey, // key
        xml, // document
          // options
          keyValue: cert.publicKey,
          x509: [x509],
          references: [{ hash: "SHA-1", transforms: ["enveloped"] }],
          signingCertificate: x509,
      output.innerHTML = new XMLSerializer().serializeToString(xml);
    } catch (error) {
      alert('Failed to sign XML');
  var fortifyCertificates = document.createElement('peculiar-fortify-certificates');
  // All possible propertiest you can find on the documentation page
  fortifyCertificates.debug = true;
  fortifyCertificates.filters = {
    //   onlySmartcards: false,
    //   expired: false,
    onlyWithPrivateKey: true,
    //   subjectDNMatch: 'apple',
    //   subjectDNMatch: new RegExp(/apple/),
    //   issuerDNMatch: 'demo',
    //   issuerDNMatch: new RegExp(/demo/),
    //   providerNameMatch: 'MacOS',
    //   providerNameMatch: new RegExp(/MacOS/),
    //   keyUsage: ['digitalSignature'],
    //   certificateIdMatch: 'test',

  fortifyCertificates.addEventListener('selectionCancel', function() {

  fortifyCertificates.addEventListener('selectionSuccess', continueHandler);