Lines Matching +full:is +full:- +full:generator +full:- +full:fn
5 //! random elliptic curve. This module provides low-level features of the latter.
10 //! the curves are generally referenced by [`EcGroup`]. There are many built-in groups
41 /// Conversion from the binary value of the point on the curve is performed in one of
42 /// compressed, uncompressed, or hybrid conversions. The default is compressed, except
45 /// Further documentation is available in the [X9.62] standard.
67 /// This type acts as a boolean as to whether the `EcGroup` is named or explicit.
75 /// is included to explicitly define the curve used to calculate keys
100 fn drop = ffi::EC_GROUP_free;
105 /// using openssl binary `openssl ecparam -list_curves`. Other operations
131 /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
135 /// let nid = Nid::X9_62_PRIME256V1; // NIST P-256 curve
141 pub fn from_curve_name(nid: Nid) -> Result<EcGroup, ErrorStack> { in from_curve_name()
150 pub fn from_components( in from_components()
155 ) -> Result<EcGroup, ErrorStack> { in from_components()
172 pub fn components_gfp( in components_gfp()
178 ) -> Result<(), ErrorStack> { in components_gfp()
200 pub fn components_gf2m( in components_gf2m()
206 ) -> Result<(), ErrorStack> { in components_gf2m()
221 pub fn cofactor( in cofactor()
225 ) -> Result<(), ErrorStack> { in cofactor()
238 pub fn degree(&self) -> u32 { in degree()
245 pub fn order_bits(&self) -> u32 { in order_bits()
249 /// Returns the generator for the given curve as an [`EcPoint`].
251 pub fn generator(&self) -> &EcPointRef { in generator() method
258 /// Sets the generator point for the given curve
260 pub fn set_generator( in set_generator()
262 generator: EcPoint, in set_generator()
265 ) -> Result<(), ErrorStack> { in set_generator()
269 generator.as_ptr(), in set_generator()
279 pub fn order( in order()
283 ) -> Result<(), ErrorStack> { in order()
300 pub fn set_asn1_flag(&mut self, flag: Asn1Flag) { in set_asn1_flag()
308 pub fn asn1_flag(&self) -> Asn1Flag { in asn1_flag()
312 /// Returns the name of the curve, if a name is associated.
314 pub fn curve_name(&self) -> Option<Nid> { in curve_name()
326 fn drop = ffi::EC_POINT_free;
337 pub fn add( in add()
343 ) -> Result<(), ErrorStack> { in add()
358 pub fn mul( in mul()
365 ) -> Result<(), ErrorStack> { in mul()
379 /// Computes `generator * n`, storing the result in `self`.
381 pub fn mul_generator( in mul_generator()
387 ) -> Result<(), ErrorStack> { in mul_generator()
401 /// Computes `generator * n + q * m`, storing the result in `self`.
403 pub fn mul_full( in mul_full()
410 ) -> Result<(), ErrorStack> { in mul_full()
427 pub fn invert(&mut self, group: &EcGroupRef, ctx: &BigNumContextRef) -> Result<(), ErrorStack> { in invert()
440 pub fn to_bytes( in to_bytes()
445 ) -> Result<Vec<u8>, ErrorStack> { in to_bytes()
478 pub fn to_hex_str( in to_hex_str()
483 ) -> Result<OpensslString, ErrorStack> { in to_hex_str()
497 pub fn to_owned(&self, group: &EcGroupRef) -> Result<EcPoint, ErrorStack> { in to_owned()
501 /// Determines if this point is equal to another.
503 pub fn eq( in eq()
508 ) -> Result<bool, ErrorStack> { in eq()
524 pub fn affine_coordinates( in affine_coordinates()
530 ) -> Result<(), ErrorStack> { in affine_coordinates()
546 pub fn affine_coordinates_gfp( in affine_coordinates_gfp()
552 ) -> Result<(), ErrorStack> { in affine_coordinates_gfp()
568 pub fn set_affine_coordinates_gfp( in set_affine_coordinates_gfp()
574 ) -> Result<(), ErrorStack> { in set_affine_coordinates_gfp()
592 pub fn affine_coordinates_gf2m( in affine_coordinates_gf2m()
598 ) -> Result<(), ErrorStack> { in affine_coordinates_gf2m()
611 /// Checks if point is infinity
613 pub fn is_infinity(&self, group: &EcGroupRef) -> bool { in is_infinity()
620 /// Checks if point is on a given curve
622 pub fn is_on_curve( in is_on_curve()
626 ) -> Result<bool, ErrorStack> { in is_on_curve()
641 pub fn new(group: &EcGroupRef) -> Result<EcPoint, ErrorStack> { in new()
647 pub fn from_bytes( in from_bytes()
651 ) -> Result<EcPoint, ErrorStack> { in from_bytes()
668 pub fn from_hex_str( in from_hex_str()
672 ) -> Result<EcPoint, ErrorStack> { in from_hex_str()
689 fn drop = ffi::EC_KEY_free;
702 /// Serializes the private key to a PEM-encoded ECPrivateKey structure.
704 /// The output will have a header of `-----BEGIN EC PRIVATE KEY-----`.
707 /// Serializes the private key to a PEM-encoded encrypted ECPrivateKey structure.
709 /// The output will have a header of `-----BEGIN EC PRIVATE KEY-----`.
716 /// Serializes the private key into a DER-encoded ECPrivateKey structure.
724 pub fn private_key(&self) -> &BigNumRef { in private_key()
738 pub fn public_key(&self) -> &EcPointRef { in public_key()
746 /// Serializes the public key into a PEM-encoded SubjectPublicKeyInfo structure.
748 /// The output will have a header of `-----BEGIN PUBLIC KEY-----`.
755 /// Serializes the public key into a DER-encoded SubjectPublicKeyInfo structure.
768 pub fn group(&self) -> &EcGroupRef { in group()
777 pub fn check_key(&self) -> Result<(), ErrorStack> { in check_key()
785 fn to_owned(&self) -> EcKey<T> { in to_owned()
797 /// It will not have an associated public or private key. This kind of key is primarily useful
800 pub fn from_curve_name(nid: Nid) -> Result<EcKey<Params>, ErrorStack> { in from_curve_name()
809 pub fn from_group(group: &EcGroupRef) -> Result<EcKey<Params>, ErrorStack> { in from_group()
828 /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
849 pub fn from_public_key( in from_public_key()
852 ) -> Result<EcKey<Public>, ErrorStack> { in from_public_key()
871 pub fn from_public_key_affine_coordinates( in from_public_key_affine_coordinates()
875 ) -> Result<EcKey<Public>, ErrorStack> { in from_public_key_affine_coordinates()
894 /// Decodes a PEM-encoded SubjectPublicKeyInfo structure containing a EC key.
896 /// The input should have a header of `-----BEGIN PUBLIC KEY-----`.
904 /// Decodes a DER-encoded SubjectPublicKeyInfo structure containing a EC key.
918 /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
923 /// let nid = Nid::X9_62_PRIME256V1; // NIST P-256 curve
942 pub fn generate(group: &EcGroupRef) -> Result<EcKey<Private>, ErrorStack> { in generate()
955 pub fn from_private_components( in from_private_components()
959 ) -> Result<EcKey<Private>, ErrorStack> { in from_private_components()
984 /// Deserializes a private key from a PEM-encoded ECPrivateKey structure.
986 /// The input should have a header of `-----BEGIN EC PRIVATE KEY-----`.
990 /// Deserializes a private key from a PEM-encoded encrypted ECPrivateKey structure.
992 /// The input should have a header of `-----BEGIN EC PRIVATE KEY-----`.
996 /// Deserializes a private key from a PEM-encoded encrypted ECPrivateKey structure.
1000 /// The input should have a header of `-----BEGIN EC PRIVATE KEY-----`.
1008 /// Decodes a DER-encoded elliptic curve private key structure.
1015 /// Decodes a DER-encoded elliptic curve private key structure for the specified curve.
1018 pub fn private_key_from_der_for_group( in private_key_from_der_for_group()
1021 ) -> Result<EcKey<Private>, ErrorStack> { in private_key_from_der_for_group()
1037 fn clone(&self) -> EcKey<T> { in clone()
1043 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { in fmt()
1057 fn key_new_by_curve_name() { in key_new_by_curve_name()
1062 fn generate() { in generate()
1068 fn ec_group_from_components() { in ec_group_from_components()
1088 fn ec_point_set_affine() { in ec_point_set_affine()
1108 fn ec_group_set_generator() { in ec_group_set_generator()
1159 fn cofactor() { in cofactor()
1170 fn dup() { in dup()
1177 fn point_new() { in point_new()
1183 fn point_bytes() { in point_bytes()
1197 fn point_hex_str() { in point_hex_str()
1210 fn point_owned() { in point_owned()
1220 fn mul_generator() { in mul_generator()
1232 fn generator() { in generator() function
1234 let gen = group.generator(); in generator()
1243 fn key_from_public_key() { in key_from_public_key()
1259 fn key_from_private_components() { in key_from_private_components()
1271 fn key_from_affine_coordinates() { in key_from_affine_coordinates()
1287 fn get_affine_coordinates() { in get_affine_coordinates()
1311 fn get_affine_coordinates_gfp() { in get_affine_coordinates_gfp()
1335 fn is_infinity() { in is_infinity()
1338 let g = group.generator(); in is_infinity()
1350 fn is_on_curve() { in is_on_curve()
1353 let g = group.generator(); in is_on_curve()
1362 fn asn1_flag() { in asn1_flag()