X509Req removed in pyopenssl 26.4.0
In our sandbox runs up to 2026-10-27, claude-sonnet-5-5, gemini-3.8-flash and gpt-6.1-sol wrote req = crypto.X509Req() for pyopenssl. It fails on 26.4.0 with AttributeError (changed between 26.0.0 and 26.4.0). There is no direct replacement in the new version.
- What to do
- no direct replacement
- Output
- same on one example
- Patch
- nothing to apply word for word
- Auto-apply
- not allowed
- Seen in
- 3 models
- Worked / failed
- 11 / 0
- Last verified
- 2026-10-27
What to do
Not for automatic application — format removed: there is no replacement to apply. Show this correction to the user as a lead. X509Req is not available in pyopenssl 26.4.0; remove or replace this use. The same code works on pyopenssl 26.0.0: pin a version before 26.4.0 if you cannot change the code. Release notes: csr = x509.load_pem_x509_csr(data)
Automatic application: not allowed — the patch gives not_applicable when applied word for word. Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own. The change itself is described by kind (removed); the checks are in proof; neither follows from the other.
How to tell this applies to your code
- pyopenssl version 26.4.0 or newer is installed (checked on 26.4.0; changed between 26.0.0 and 26.4.0).
- Your code uses:
crypto.X509Req - Or it already failed with:
AttributeError: module 'OpenSSL.crypto' has no attribute 'X509Req'(every correction for this error)
Old code
req = crypto.X509Req()No direct replacement: the verified example below shows code that works without it.
Error on 26.4.0:
AttributeError: module 'OpenSSL.crypto' has no attribute 'X509Req'
| Script | pyopenssl version | Result |
|---|---|---|
| Code the models wrote | 26.0.0 | works |
| Code the models wrote | 26.4.0 | fails: AttributeError |
| Verified example below | 26.4.0 | works |
| Output of the verified example | 26.4.0 | same as the original's on 26.0.0 (observed stdout of one example; not a proof of equivalent behaviour) |
| Patch applied word for word to the example | 26.4.0 | no literal patch to apply (removed or added code, or the old line is not found once) — format removed: there is no replacement to apply |
Verified example for pyopenssl 26.4.0
#!/usr/bin/env python3
import warnings
from cryptography import x509
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.x509.oid import NameOID
from OpenSSL import crypto
# X509Req APIs are deprecated in recent pyOpenSSL releases; silence the warnings.
warnings.filterwarnings("ignore", category=DeprecationWarning)
CSR_PATH = "/tmp/request.csr"
def generate_csr_file(path):
# Generate a 2048-bit RSA key
key = crypto.PKey()
key.generate_key(crypto.TYPE_RSA, 2048)
crypto_key = key.to_cryptography_key()
# Build the CSR
req = (
x509.CertificateSigningRequestBuilder()
.subject_name(
x509.Name(
[
x509.NameAttribute(NameOID.COMMON_NAME, "example.internal"),
x509.NameAttribute(NameOID.ORGANIZATION_NAME, "Acme Corp"),
]
)
)
.sign(crypto_key, hashes.SHA256())
)
# Save as PEM
pem = req.public_bytes(serialization.Encoding.PEM)
with open(path, "wb") as f:
f.write(pem)
def read_and_inspect_csr(path):
with open(path, "rb") as f:
pem_data = f.read()
req = x509.load_pem_x509_csr(pem_data)
subject = req.subject
cn = subject.get_attributes_for_oid(NameOID.COMMON_NAME)[0].value
org = subject.get_attributes_for_oid(NameOID.ORGANIZATION_NAME)[0].value
pubkey = req.public_key()
key_bits = pubkey.key_size
try:
sig_ok = bool(req.is_signature_valid)
except crypto.Error:
sig_ok = False
print(f"Subject CN: {cn}")
print(f"Subject O: {org}")
print(f"Public key size: {key_bits} bits")
print(f"Signature verifies: {sig_ok}")
def main():
generate_csr_file(CSR_PATH)
read_and_inspect_csr(CSR_PATH)
if __name__ == "__main__":
main()Source
Removed deprecated ``OpenSSL.crypto.X509Req``, ``OpenSSL.crypto.dump_certificate_request``, and ``OpenSSL.crypto.load_certificate_request``. ``cryptography.x509`` should be used instead.
Release notes · Seen in: claude-sonnet-5-5, gemini-3.8-flash, gpt-6.1-sol · First seen 2026-10-23 · Last verified 2026-10-27 · All corrections for pyopenssl
For agents
- This page as JSON:
https://formachines.ai/errata/pypi/pyopenssl/0004-x509req/index.json - Whole database in plain text:
/errata/llms-full.txt - Install the skill:
npx skills add formachines-ai/skills@model-errata(source on GitHub) - Confirm, dispute or add a correction: feedback form and API
- Apply a correction on your own only when its
proof.auto_applyis true (Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own.)