expanding key_type to with EC support
This commit is contained in:
parent
aff7ad7ea2
commit
4923157dc2
|
@ -9,9 +9,10 @@ from datetime import timedelta
|
||||||
|
|
||||||
import arrow
|
import arrow
|
||||||
from cryptography import x509
|
from cryptography import x509
|
||||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
from cryptography.hazmat.primitives.asymmetric import rsa, ec
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
from idna.core import InvalidCodepoint
|
from idna.core import InvalidCodepoint
|
||||||
|
from lemur.common.utils import get_key_type_from_ec_curve
|
||||||
from sqlalchemy import (
|
from sqlalchemy import (
|
||||||
event,
|
event,
|
||||||
Integer,
|
Integer,
|
||||||
|
@ -302,6 +303,8 @@ class Certificate(db.Model):
|
||||||
return "RSA{key_size}".format(
|
return "RSA{key_size}".format(
|
||||||
key_size=self.parsed_cert.public_key().key_size
|
key_size=self.parsed_cert.public_key().key_size
|
||||||
)
|
)
|
||||||
|
elif isinstance(self.parsed_cert.public_key(), ec.EllipticCurvePublicKey):
|
||||||
|
return get_key_type_from_ec_curve(self.parsed_cert.public_key().curve.name)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def validity_remaining(self):
|
def validity_remaining(self):
|
||||||
|
|
Loading…
Reference in New Issue