Axonate eSign SDK
Python SDK for Indian eSign (Digital Signature) Integration
A comprehensive, production-ready Python SDK for integrating Indian Government's eSign service (Digital Signature) into your applications. Supports eSign API v2.1 and v3.3.
Features
✅ PDF Signing - Create placeholder signatures and embed PKCS7 signatures ✅ XML Request Builder - Generate eSign-compliant XML requests ✅ Easy Integration - Simple API, minimal configuration ✅ Type Hints - Full type annotations for better IDE support ✅ Production Ready - Used in production by multiple applications
Installation
pip install axonate-esign-sdk
For XML signing support:
pip install axonate-esign-sdk[xml-signing]
Quick Start
1. Create Placeholder PDF with Signature Field
from esign_sdk import ESignSDK
# Initialize SDK
sdk = ESignSDK()
# Create placeholder PDF with signature field
hash_value = sdk.create_placeholder(
input_pdf="document.pdf",
output_pdf="placeholder.pdf",
signer_name="John Doe",
reason="Document Approval",
location="New Delhi",
page_number=1,
coordinates=(100, 700, 300, 750) # (llx, lly, urx, ury)
)
print(f"Document Hash: {hash_value}")
2. Build eSign XML Request
# Build XML request for eSign gateway
xml_request = sdk.build_xml_request(
asp_id="your_asp_id",
transaction_id="unique_txn_id",
document_hash=hash_value,
document_info="Important Document",
callback_url="https://your-server.com/callback",
auth_mode="1" # OTP-based authentication
)
print(xml_request)
3. Embed Signature After eSign Response
# After receiving eSign gateway response with PKCS7 signature
sdk.embed_signature(
placeholder_pdf="placeholder.pdf",
output_pdf="signed.pdf",
pkcs7_signature="<base64_encoded_pkcs7>",
field_name="signature_field_1"
)
print("PDF signed successfully!")
Complete Workflow Example
from esign_sdk import ESignSDK
import requests
# Initialize SDK
sdk = ESignSDK()
# Step 1: Create placeholder
hash_value = sdk.create_placeholder(
input_pdf="contract.pdf",
output_pdf="contract_placeholder.pdf",
signer_name="Alice Johnson",
reason="Contract Signing",
location="Mumbai"
)
# Step 2: Build XML request
xml_request = sdk.build_xml_request(
asp_id="mycompany_asp",
transaction_id="TXN123456",
document_hash=hash_value,
document_info="Employment Contract",
callback_url="https://myapp.com/esign/callback"
)
# Step 3: Post to eSign gateway
response = requests.post(
"https://demo.esign.digital/esign/2.1/signdoc/",
data={'esigndoc': xml_request}
)
# Step 4: User completes OTP on eSign portal
# Step 5: Receive callback with PKCS7 signature
# Step 6: Embed signature (in callback handler)
def handle_callback(request_data):
pkcs7_sig = extract_signature_from_response(request_data)
sdk.embed_signature(
placeholder_pdf="contract_placeholder.pdf",
output_pdf="contract_signed.pdf",
pkcs7_signature=pkcs7_sig
)
return "Signature embedded successfully"
Configuration
ASP Configuration
from esign_sdk import ESignSDK, Config
config = Config(
asp_id="your_asp_id",
auth_mode="1", # 1=OTP, 2=Biometric, 3=Both
response_sig_type="PKCS7",
gateway_url="https://demo.esign.digital/esign/2.1/signdoc/"
)
sdk = ESignSDK(config)
PDF Signature Appearance
# Customize signature appearance
hash_value = sdk.create_placeholder(
input_pdf="document.pdf",
output_pdf="placeholder.pdf",
signer_name="Jane Smith",
reason="Approval",
location="Delhi",
page_number=1,
coordinates=(50, 50, 250, 150), # Position and size
lock_pdf=True, # Lock PDF after signing
visible=True # Make signature visible
)
API Reference
ESignSDK Class
Main SDK class for eSign operations.
create_placeholder()
Creates PDF with empty signature field and returns document hash.
Parameters:
input_pdf(str): Path to input PDFoutput_pdf(str): Path for output PDFsigner_name(str): Name of signerreason(str): Reason for signinglocation(str): Location of signingpage_number(int, optional): Page number (default: 1)coordinates(tuple, optional): (llx, lly, urx, ury)lock_pdf(bool, optional): Lock PDF after signingvisible(bool, optional): Make signature visible
Returns: Document hash (str)
build_xml_request()
Builds eSign-compliant XML request.
Parameters:
asp_id(str): ASP ID from eSign providertransaction_id(str): Unique transaction IDdocument_hash(str): Document hash from create_placeholder()document_info(str): Document descriptioncallback_url(str): Webhook URL for responseauth_mode(str, optional): Authentication mode (default: "1")ekyc_id(str, optional): Aadhaar number (if required)
Returns: XML request string
embed_signature()
Embeds PKCS7 signature in placeholder PDF.
Parameters:
placeholder_pdf(str): Path to placeholder PDFoutput_pdf(str): Path for signed PDFpkcs7_signature(str): Base64-encoded PKCS7 signaturefield_name(str, optional): Signature field name
Returns: None
Requirements
- Python 3.8+
- PyPDF2 >= 3.0.0
- reportlab >= 4.0.0
- lxml >= 4.9.0
- cryptography >= 41.0.0
- requests >= 2.31.0
License
MIT License
Copyright (c) 2025 Axonate Tech
Support
For support and queries:
- Email: info@axonatetech.com
- Website: https://axonatetech.com/
Contributing
Contributions are welcome! Please feel free to submit pull requests.
Changelog
v1.0.0 (2025-01-01)
- Initial release
- Support for eSign API v2.1 and v3.3
- Pure Python implementation
- PDF placeholder creation
- XML request building
- PKCS7 signature embedding
Metadata
Release files for axonate-esign-sdk 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| axonate_esign_sdk-1.2.1.tar.gz | 1.5 MB | Without provenance | Details for axonate_esign_sdk-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| axonate_esign_sdk-1.2.1-py3-none-any.whl | Python 3 | none | any | Details for axonate_esign_sdk-1.2.1-py3-none-any.whl |
Total release size: 3.0 MB
Release files / axonate_esign_sdk-1.2.1.tar.gz
| Download URL | axonate_esign_sdk-1.2.1.tar.gz |
|---|---|
| Size | 1.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00d1a2c69752d4693e8432e73e060ff6415e075877729dac37c4477731f7431e
|
|
BLAKE2b-256 checksum How to use checksums |
5ee5946cbc61efb41ddf110cd5960ebfee9d74562a45b8c6f305ba4f7770fe18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.5
|
Release files / axonate_esign_sdk-1.2.1-py3-none-any.whl
| Download URL | axonate_esign_sdk-1.2.1-py3-none-any.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
88db912062b8eb82696d2fe8560dfe16f256fd8c46b3b3ff2a8913e0a1c073c5
|
|
BLAKE2b-256 checksum How to use checksums |
7d92ec555be426815c5a4b9c478b90cf83cd4f194970381b2e7d4e027a7e165b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.5
|
Security for axonate-esign-sdk 1.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.