when I use the private.pem in Add private key page got an error
Invalid Private key file or Public key not included.
the error happened in as2.py
`
def load_key(key_str: bytes, key_pass: str):
"""Function to load password protected key file in p12 or pem format."""
try:
# First try to parse as a p12 file
key, cert, _ = asymmetric.load_pkcs12(key_str, key_pass)
except ValueError as e: **#'Error parsing asn1crypto.pkcs12.Pfx - tag should have been 16, but 13 was found'** _I don't understand this error means_
# If it fails due to invalid password raise error here
if e.args[0] == "Password provided is invalid":
raise AS2Exception("Password not valid for Private Key.") from e
# if not try to parse as a pem file
key, cert = None, None
for kc in split_pem(key_str):
try:
cert = asymmetric.load_certificate(kc)
except (ValueError, TypeError) as e:
try:
key = asymmetric.load_private_key(kc, key_pass)
except OSError:
raise AS2Exception(
"Invalid Private Key or password is not correct."
) from e
if not key or not cert:
raise AS2Exception("Invalid Private key file or Public key not included.")
return key, cert
`
the cert is always None, is there anything I make wrong?
I generate the pem file as instruction:
openssl req -x509 -newkey rsa:2048 -sha256 -keyout private.pem -out public.pem -days 365
cat public.pem >> private.pem
when I use the private.pem in Add private key page got an error
Invalid Private key file or Public key not included.
the error happened in as2.py ` def load_key(key_str: bytes, key_pass: str): """Function to load password protected key file in p12 or pem format."""
` the cert is always None, is there anything I make wrong?
Thank you