aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/pk_keys.h
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-11-12 01:53:56 -0500
committerJack Lloyd <[email protected]>2016-11-12 01:53:56 -0500
commit9c72dabc9dc73e2603c22dfce48611b5b626238b (patch)
treebda4f84f78bfbdd28e2199ee8f9998b08cc3c634 /src/lib/pubkey/pk_keys.h
parent618f890fd7ede74c728612ca8bc590c72ee353f1 (diff)
Pubkey cleanups
Add Public_Key::key_length usable for policy checking (as in TLS::Policy::check_peer_key_acceptable) Remove Public_Key::max_input_bits because it didn't make much sense for most algorithms actually. Remove message_parts and message_part_size from PK_Ops
Diffstat (limited to 'src/lib/pubkey/pk_keys.h')
-rw-r--r--src/lib/pubkey/pk_keys.h50
1 files changed, 33 insertions, 17 deletions
diff --git a/src/lib/pubkey/pk_keys.h b/src/lib/pubkey/pk_keys.h
index 8ebad48e7..613fbb7dd 100644
--- a/src/lib/pubkey/pk_keys.h
+++ b/src/lib/pubkey/pk_keys.h
@@ -44,6 +44,14 @@ class BOTAN_DLL Public_Key
virtual size_t estimated_strength() const = 0;
/**
+ * Return an integer value best approximating the length of the
+ * primary security parameter. For example for RSA this will be
+ * the size of the modulus, for ECDSA the size of the ECC group,
+ * and for McEliece the size of the code will be returned.
+ */
+ virtual size_t key_length() const = 0;
+
+ /**
* Get the OID of the underlying public key scheme.
* @return OID of the public key scheme
*/
@@ -59,23 +67,6 @@ class BOTAN_DLL Public_Key
virtual bool check_key(RandomNumberGenerator& rng,
bool strong) const = 0;
- /**
- * Find out the number of message parts supported by this scheme.
- * @return number of message parts
- */
- virtual size_t message_parts() const { return 1; }
-
- /**
- * Find out the message part size supported by this scheme/key.
- * @return size of the message parts in bits
- */
- virtual size_t message_part_size() const { return 0; }
-
- /**
- * Get the maximum message size in bits supported by this public key.
- * @return maximum message size in bits
- */
- virtual size_t max_input_bits() const = 0;
/**
* @return X.509 AlgorithmIdentifier for this key
@@ -90,6 +81,31 @@ class BOTAN_DLL Public_Key
// Internal or non-public declarations follow
/**
+ * Returns more than 1 if the output of this algorithm
+ * (ciphertext, signature) should be treated as more than one
+ * value. This is used for algorithms like DSA and ECDSA, where
+ * the (r,s) output pair can be encoded as either a plain binary
+ * list or a TLV tagged DER encoding depending on the protocol.
+ *
+ * This function is public but applications should have few
+ * reasons to ever call this.
+ *
+ * @return number of message parts
+ */
+ virtual size_t message_parts() const { return 1; }
+
+ /**
+ * Returns how large each of the message parts refered to
+ * by message_parts() is
+ *
+ * This function is public but applications should have few
+ * reasons to ever call this.
+ *
+ * @return size of the message parts in bits
+ */
+ virtual size_t message_part_size() const { return 0; }
+
+ /**
* This is an internal library function exposed on key types.
* In almost all cases applications should use wrappers in pubkey.h
*