Skip to content

Commit a2f7c11

Browse files
committed
fix: Traditional Open SSL
Signed-off-by: exploreriii <[email protected]>
1 parent dc2db79 commit a2f7c11

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

examples/keys_private_der.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def example_serialize_ed25519_der() -> None:
1313
privkey = PrivateKey.generate("ed25519")
1414
print("Generated Ed25519 key:", privkey)
1515

16-
# This emits PKCS#8 DER by default
16+
# This emits Traditional Open SSL DER by default
1717
der_bytes = privkey.to_bytes_der()
1818
print("DER bytes length =", len(der_bytes))
1919

src/hiero_sdk_python/crypto/private_key.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def _try_load_ecdsa(key_bytes: bytes) -> Optional[ec.EllipticCurvePrivateKey]:
179179
@staticmethod
180180
def _try_load_der(key_bytes: bytes) -> Optional[Union[ed25519.Ed25519PrivateKey, ec.EllipticCurvePrivateKey]]:
181181
"""
182-
Attempt to parse the bytes as a DER-encoded private key (PKCS#8 or TraditionalOpenSSL).
182+
Attempt to parse the bytes as a DER-encoded private key.
183183
Auto-detect Ed25519 vs. ECDSA(secp256k1). Return None on failure.
184184
"""
185185
try:
@@ -227,7 +227,7 @@ def from_bytes_ecdsa(cls, scalar_32: bytes) -> "PrivateKey":
227227
@classmethod
228228
def from_der(cls, der_data: bytes) -> "PrivateKey":
229229
"""
230-
Interpret bytes as a DER-encoded private key (PKCS#8 or TraditionalOpenSSL).
230+
Interpret bytes as a DER-encoded private key.
231231
Auto-detect Ed25519 vs. ECDSA(secp256k1).
232232
"""
233233
try:
@@ -310,11 +310,11 @@ def to_bytes_ecdsa_raw(self) -> bytes:
310310

311311
def to_bytes_der(self) -> bytes:
312312
"""
313-
Return the DER-encoded private key PKCS8.
313+
Return the DER-encoded private key.
314314
"""
315315
return self._private_key.private_bytes(
316316
encoding=serialization.Encoding.DER,
317-
format=serialization.PrivateFormat.PKCS8,
317+
format=serialization.PrivateFormat.TraditionalOpenSSL,
318318
encryption_algorithm=serialization.NoEncryption()
319319
)
320320

0 commit comments

Comments
 (0)