Skip to content
pubscout

xml_crypto

5.1.0, released 3 months ago by quire.io

Xml digital signature library for Dart for signing and verifying XML documents.

$ flutter pub add xml_crypto
Source repository

What it does

Allows you to sign XML documents and verify XML digital signatures using various canonicalization, transformation, hashing, and signature algorithms including RSA and ECDSA.

AI-written summary of version 5.1.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to create XML digital signatures for SOAP or other XML-based web services.
  • You need to verify signed XML documents received from external clients or services.

Skip it when

  • You are working with JSON data instead of XML.
  • You do not require cryptographic XML signatures.

Strengths

  • Supports multiple signature, hashing, and canonicalization algorithms (RSA, ECDSA, SHA, C14N).
  • Port of the established Node.js xml-crypto library.

Weaknesses

  • XML digital signature specifications can be complex and prone to subtle verification errors (implicit transforms, etc.).
  • HMAC-SHA1 is disabled by default due to key confusion risks.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
6

Not documented

import 'dart:io';
import 'package:xml_crypto/xml_crypto.dart';

final xml = "<library>" \
            "<book>" \
              "<name>Harry Potter</name>" \
            "</book>" \
          "</library>";

final sig = SignedXml()
	..addReference("//*[local-name()='book']")
	..signingKey = File("client.pem").readAsBytesSync()
	..computeSignature(xml);
File("signed.xml").writeAsStringSync(sig.signedXml);

Alternatives

Packages that do the same job and could replace xml_crypto.

  • crypto_keys

    Library for signing, verifying, encrypting and decrypting using pointycastle.

  • cryptography_plus

    Cryptographic algorithms for encryption, signatures, key agreement, and hashing across platforms.

  • cryptography

    Cross‑platform cryptographic algorithms for Dart and Flutter.

  • crypton

    A simple Dart library for asymmetric encryption and digital signatures.

Works with

Packages commonly used together with xml_crypto: ones it builds on, ones built on it, and its own family.