Registry / security / spiffe-tls

spiffe-tls

JSON →
library0.3.2pypypi✓ verified 80d ago

Library for TLS authentication using SPIFFE identities in Python. Requires Python >=3.10. Current version: 0.3.2, released irregularly.

pip install spiffe-tls
INSTALL
IMPORT
SIG · SPIFFE-TLS
S
spiffe-tls
securitypythonv0.3.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ClientTlsMode
from spiffetls import ClientTlsMode
from spiffetls import Identity
ServerTlsMode
from spiffetls import ServerTlsMode
create_ssl_context
from spiffetls import create_ssl_context

Initialize SPIFFE identity from environment and create mTLS connection config.

import os from spiffetls import Identity, MTLSConnection from spiffetls import config def test_connection(): # Create identity from environment or default path identity = Identity( spiffe_id="spiffe://example.org/workload", socket_path=os.environ.get("SPIFFE_ENDPOINT_SOCKET", "/run/spire/agent.sock") ) # Create TLS config tls_config = config.TLSClientConfig( spiffe_id_matcher=lambda id: id.trust_domain == "example.org", identity=identity ) conn = MTLSConnection(tls_config) # Use conn to establish TLS connections print("Configuration ready") test_connection()
Debug
Known issues
breakingThe API changed significantly between 0.2.x and 0.3.x. In 0.3.x, MTLSConnection expects a config object instead of multiple parameters.
fix
Update imports from spiffetls.TLS to spiffetls and use config.TLSClientConfig.
affects: 0.3.0 and later
gotchaThe SPIFFE identity is not automatically fetched from the default Workload API socket. You must specify socket_path or set SPIFFE_ENDPOINT_SOCKET environment variable.
fix
Ensure the SPIFFE workload API is running and the socket path is correct.
affects: All
gotchaThe library requires Python >=3.10. Using it with older Python versions will cause import errors.
fix
Upgrade to Python 3.10+.
affects: All
deprecatedThe spiffetls.TLS module is deprecated in favor of top-level spiffetls.
fix
Use from spiffetls import ... instead of from spiffetls.TLS import ...
affects: 0.3.0+
Upgrade
Version history
0.3.2latest on PyPI · released May 11, 2026
Audit
Dependencies
py-spifferequiredCore SPIFFE workload API and identity representation
cryptographyrequiredTLS certificate handling
grpciorequiredgRPC transport for workload API (used internally by py-spiffe)
Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
1
Resources
spiffe-tls — pip install spiffe-tls · libregistry