aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/x509_key.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-06-15 01:49:04 +0000
committerlloyd <[email protected]>2010-06-15 01:49:04 +0000
commit7573a3442d39044073a1794d7cc86cac935c4720 (patch)
treedfcadd8fe5004ba1424aafecf403575084189f81 /src/pubkey/x509_key.h
parente9e13fcf62ef8c71576d6bebaa3e8c6b361ec935 (diff)
New BER encoding funcs for PKCS and X.509. Remove Private_Key dep here
Diffstat (limited to 'src/pubkey/x509_key.h')
-rw-r--r--src/pubkey/x509_key.h35
1 files changed, 24 insertions, 11 deletions
diff --git a/src/pubkey/x509_key.h b/src/pubkey/x509_key.h
index 13f11646e..d9e9f2d7c 100644
--- a/src/pubkey/x509_key.h
+++ b/src/pubkey/x509_key.h
@@ -1,6 +1,6 @@
/*
* X.509 Public Key
-* (C) 1999-2007 Jack Lloyd
+* (C) 1999-2010 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
@@ -16,18 +16,16 @@
namespace Botan {
/**
-* This namespace contains functions for handling X509 objects.
+* This namespace contains functions for handling X.509 public keys
*/
namespace X509 {
/**
-* Encode a key into a pipe.
+* BER encode a key
* @param key the public key to encode
-* @param pipe the pipe to feed the encoded key into
-* @param enc the encoding type to use
+* @return the BER encoding of this key
*/
-BOTAN_DLL void encode(const Public_Key& key, Pipe& pipe,
- X509_Encoding enc = PEM);
+BOTAN_DLL MemoryVector<byte> BER_encode(const Public_Key& key);
/**
* PEM encode a public key into a string.
@@ -44,11 +42,11 @@ BOTAN_DLL std::string PEM_encode(const Public_Key& key);
BOTAN_DLL Public_Key* load_key(DataSource& source);
/**
-* Create a public key from a string.
-* @param enc the string containing the PEM encoded key
+* Create a public key from a file
+* @param file pathname to the file to load
* @return the new public key object
*/
-BOTAN_DLL Public_Key* load_key(const std::string& enc);
+BOTAN_DLL Public_Key* load_key(const std::string& filename);
/**
* Create a public key from a memory region.
@@ -73,10 +71,25 @@ BOTAN_DLL Public_Key* copy_key(const Public_Key& key);
* @return the combination of key type specific constraints and
* additional limits
*/
-
BOTAN_DLL Key_Constraints find_constraints(const Public_Key& pub_key,
Key_Constraints limits);
+/**
+* Encode a key into a pipe. This function is deprecated.
+* @param key the public key to encode
+* @param pipe the pipe to feed the encoded key into
+* @param encoding the encoding type to use
+*/
+inline void encode(const Public_Key& key,
+ Pipe& pipe,
+ X509_Encoding encoding = PEM)
+ {
+ if(encoding == PEM)
+ pipe.write(X509::PEM_encode(key));
+ else
+ pipe.write(X509::BER_encode(key));
+ }
+
}
}