aboutsummaryrefslogtreecommitdiffstats
path: root/src/ssl/cert_req.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-09-15 14:45:43 +0000
committerlloyd <[email protected]>2010-09-15 14:45:43 +0000
commit8de40eb3955a964aa822b01b5092edeed73364c9 (patch)
tree5ea0b42d13add07431704e5571f132dd4831f565 /src/ssl/cert_req.cpp
parentca0cdf81ebac6b04164766df46e8c03d454af962 (diff)
Add a helper function for encoding TLS values with length tagging
Diffstat (limited to 'src/ssl/cert_req.cpp')
-rw-r--r--src/ssl/cert_req.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/ssl/cert_req.cpp b/src/ssl/cert_req.cpp
index f30bc2fd7..e72ffe735 100644
--- a/src/ssl/cert_req.cpp
+++ b/src/ssl/cert_req.cpp
@@ -6,6 +6,7 @@
*/
#include <botan/internal/tls_messages.h>
+#include <botan/internal/tls_reader.h>
#include <botan/der_enc.h>
#include <botan/ber_dec.h>
#include <botan/loadstor.h>
@@ -37,20 +38,13 @@ SecureVector<byte> Certificate_Req::serialize() const
{
SecureVector<byte> buf;
- buf.push_back(types.size());
- for(u32bit i = 0; i != types.size(); i++)
- buf.push_back(types[i]);
+ append_tls_length_value(buf, types, 1);
DER_Encoder encoder;
for(u32bit i = 0; i != names.size(); i++)
encoder.encode(names[i]);
- SecureVector<byte> der_names = encoder.get_contents();
- u16bit names_size = der_names.size();
-
- buf.push_back(get_byte(0, names_size));
- buf.push_back(get_byte(1, names_size));
- buf += der_names;
+ append_tls_length_value(buf, encoder.get_contents(), 2);
return buf;
}