openssh_key.key_params.ecdsa.ECDSAPrivateKeyParams¶
- class openssh_key.key_params.ecdsa.ECDSAPrivateKeyParams(params)¶
Bases:
openssh_key.key_params.common.PrivateKeyParams,openssh_key.key_params.ecdsa.ECDSAPublicKeyParamsThe parameters comprising a private key in the Elliptic Curve Digital Signature Algorithm cryptosystem.
The names and iteration order of parameters of a private ECDSA key are:
d: The private key (int).
- Parameters
params (
Mapping[str,Any]) – The values with which to initialize this parameters object. All given values are saved, even those that do not exist in the format instructions for this key type.- Raises
UserWarning – A parameter value from the above list is missing from
paramsor does not have the correct type.
- __init__(params)¶
Methods
__init__(params)Checks whether the values within this parameters object conform to the format instructions, whether the curve identifier encoded in the public key corresponds to the key type, and whether the point lies on the elliptic curve indicated by the identifier.
clear()Conversion functions for key objects of the following types:
convert_from(key_object)Constructs and initializes a parameters object for this key type from attributes contained in the given object.
convert_to(destination_class)Creates and initializes an object of the given type containing the values of this parameters object.
copy()fromkeys(iterable[, value])generate_private_params(**kwargs)Constructs and initializes a ECDSA private key parameters object with generated values.
get(k[,d])The identifier, as specified in RFC 5656, of a set of elliptic curve domain parameters.
The name of the elliptic curve domain parameters that corresponds to
CURVE_IDENTIFIER.The X.509 object identifier of the elliptic curve domain parameters that corresponds to
CURVE_IDENTIFIER.The Pascal-style byte stream format instructions for the parameters of a key of this type.
items()keys()pop(k[,d])If key is not found, d is returned if given, otherwise KeyError is raised.
popitem()as a 2-tuple; but raise KeyError if D is empty.
setdefault(k[,d])update([E, ]**F)If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
values()Attributes
CURVE_IDENTIFIERThe identifier, as specified in RFC 5656, of a set of elliptic curve domain parameters.
CURVE_NAMEThe name of the elliptic curve domain parameters that corresponds to
CURVE_IDENTIFIER.CURVE_OIDThe X.509 object identifier of the elliptic curve domain parameters that corresponds to
CURVE_IDENTIFIER.FORMAT_INSTRUCTIONS_DICTThe Pascal-style byte stream format instructions for the parameters of a key of this type.
- check_params_are_valid()¶
Checks whether the values within this parameters object conform to the format instructions, whether the curve identifier encoded in the public key corresponds to the key type, and whether the point lies on the elliptic curve indicated by the identifier.
- Raises
UserWarning – A parameter value is missing or does not have a type that matches the format instructions for this key type, the curve identifier encoded in the public key corresponds to the key type, or the point does not lie on the elliptic curve indicated by the identifier.
- Return type
- clear() None. Remove all items from D.¶
- classmethod conversion_functions()¶
Conversion functions for key objects of the following types:
- Return type
- Returns
A
typing.Mappingfrom the above types of key objects to functions that take key objects of these types and return parameter values.
- classmethod convert_from(key_object)¶
Constructs and initializes a parameters object for this key type from attributes contained in the given object.
This classmethod searches
conversion_functionsfor a class that is a superclass ofkey_object. If one is found, it returns the parameters object from thetyping.Mappingreturned by the correspondingobject_to_mappingfunction. Otherwise, it searches its subclasses’conversion_functions, traversing pre-order.- Parameters
key_object (
Any) – An object containing key parameter values.- Raises
NotImplementedError –
key_objectis not of a supported type, or it does not contain the attributes necessary to construct a parameters object of this class.- Return type
- convert_to(destination_class)¶
Creates and initializes an object of the given type containing the values of this parameters object.
This method searches
conversion_functionsfor a class that is a subclass ofkey_object. If one is found, it passes this parameters object to the correspondingmapping_to_object. Otherwise, it searches its superclasses’conversion_functionsin the same way, in method resolution order, up to and includingPublicKeyParams.- Parameters
destination_class (
Type[Any]) – The type of the object to which the values of this parameters object are to be converted.- Raises
ValueError –
destination_classis not a class.ImportError –
destination_classcannot be imported.NotImplementedError – Converting this parameters object to an object of type
destination_classis not supported.
- Return type
- classmethod generate_private_params(**kwargs)¶
Constructs and initializes a ECDSA private key parameters object with generated values. If called on the
ECDSAPrivateKeyParamsclass, delegates toECDSA_NISTP256_PrivateKeyParams.- Parameters
kwargs (
Any) – Keyword arguments consumed to generate parameter values.- Return type
Union[TypeVar(ECDSAPrivateKeyParamsTypeVar, bound=ECDSAPrivateKeyParams),ECDSA_NISTP256_PrivateKeyParams]- Returns
A private key parameters object with generated values valid for a ECDSA private key.
- get(k[, d]) D[k] if k in D, else d. d defaults to None.¶
- abstract static get_curve_identifier()¶
The identifier, as specified in RFC 5656, of a set of elliptic curve domain parameters.
- Return type
- abstract static get_curve_name()¶
The name of the elliptic curve domain parameters that corresponds to
CURVE_IDENTIFIER.- Return type
- abstract static get_curve_oid()¶
The X.509 object identifier of the elliptic curve domain parameters that corresponds to
CURVE_IDENTIFIER.- Return type
- classmethod get_format_instructions_dict()¶
The Pascal-style byte stream format instructions for the parameters of a key of this type.
- items() a set-like object providing a view on D's items¶
- keys() a set-like object providing a view on D's keys¶
- pop(k[, d]) v, remove specified key and return the corresponding value.¶
If key is not found, d is returned if given, otherwise KeyError is raised.
- popitem() (k, v), remove and return some (key, value) pair¶
as a 2-tuple; but raise KeyError if D is empty.
- setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D¶
- update([E, ]**F) None. Update D from mapping/iterable E and F.¶
If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
- values() an object providing a view on D's values¶