r2896 - in trunk/libmsip: include/libmsip source

erik at minisip.org erik at minisip.org
Tue Nov 7 09:38:45 CET 2006


Author: erik
Date: 2006-11-07 09:38:44 +0100 (Tue, 07 Nov 2006)
New Revision: 2896

Added:
   trunk/libmsip/include/libmsip/SipSim.h
   trunk/libmsip/include/libmsip/SipSimSoft.h
   trunk/libmsip/source/SipSim.cxx
   trunk/libmsip/source/SipSimSoft.cxx
Log:

 * Compile fix: Added SipSim classes.

   Note that the interface to SipSim is likely to change/improve in the
   near future.



Added: trunk/libmsip/include/libmsip/SipSim.h
===================================================================
--- trunk/libmsip/include/libmsip/SipSim.h	2006-11-06 15:31:52 UTC (rev 2895)
+++ trunk/libmsip/include/libmsip/SipSim.h	2006-11-07 08:38:44 UTC (rev 2896)
@@ -0,0 +1,41 @@
+#ifndef _SIPSIM_H
+#define _SIPSIM_H
+
+#include<libmsip/libmsip_config.h>
+#include<libmutil/mtypes.h>
+#include<libmutil/MemObject.h>
+#include<libmcrypto/cert.h>
+
+/**
+ * Subscriber identity module used to authenticate the user.
+ * This can be used to sign MIKEY requests, use in TLS/SSL
+ * handshake.
+ *
+ * Implementations of SipSim can be a interface to a 
+ * SmartCard or do it in software.
+ */
+class LIBMSIP_API SipSim : public MObject{
+	public:
+		static const int SHA1_RSAPKCS1;
+
+		//string getSipUri();
+
+		/**
+		 * Returns the certificate for the subscriber.
+		 */
+		//virtual MRef<certificate*> getCertificate() = 0;
+
+		virtual MRef<certificate_chain *> getCertificateChain() = 0;
+		virtual MRef<ca_db *> getCAs() = 0;
+
+		/**
+		 * Puts len bytes from data into SHA1 and 
+		 * signs the resulting hash.
+		 *
+		 * @return Length of generated signature in bytes.
+		 */
+		virtual void sign(byte_t *data, uint32_t len, byte_t *out_sign, int method=SHA1_RSAPKCS1 )= 0;
+};
+
+
+#endif

Added: trunk/libmsip/include/libmsip/SipSimSoft.h
===================================================================
--- trunk/libmsip/include/libmsip/SipSimSoft.h	2006-11-06 15:31:52 UTC (rev 2895)
+++ trunk/libmsip/include/libmsip/SipSimSoft.h	2006-11-07 08:38:44 UTC (rev 2896)
@@ -0,0 +1,32 @@
+#ifndef _SIPSIMSOFT_H
+#define _SIPSIMSOFT_H
+
+#include<libmsip/SipSim.h>
+
+/**
+ *
+ * "Soft" refers to that crypto-algorithms are
+ * implemented in software (using OpenSSL or 
+ * GnuTLS), but could also be read as "soft" security
+ * compared to SmartCard hardware security devices.
+ *
+ */
+class LIBMSIP_API SipSimSoft : public SipSim{
+	public:
+		SipSimSoft(MRef<certificate_chain*> chain, MRef<ca_db*> cas);
+//		SipSimSoft(string certfilepath, string pkeyfilepath);
+
+		virtual MRef<certificate_chain*> getCertificateChain();
+
+		virtual MRef<ca_db*> getCAs();
+
+		virtual void sign(byte_t *data, uint32_t len, byte_t *out_sign, int method=SHA1_RSAPKCS1 );
+
+	private:
+		MRef<certificate_chain *> certChain;
+		MRef<ca_db *> ca_set;
+
+};
+
+
+#endif

Added: trunk/libmsip/source/SipSim.cxx
===================================================================
--- trunk/libmsip/source/SipSim.cxx	2006-11-06 15:31:52 UTC (rev 2895)
+++ trunk/libmsip/source/SipSim.cxx	2006-11-07 08:38:44 UTC (rev 2896)
@@ -0,0 +1,6 @@
+
+#include<libmsip/SipSim.h>
+
+const int SipSim::SHA1_RSAPKCS1=1;
+
+

Added: trunk/libmsip/source/SipSimSoft.cxx
===================================================================
--- trunk/libmsip/source/SipSimSoft.cxx	2006-11-06 15:31:52 UTC (rev 2895)
+++ trunk/libmsip/source/SipSimSoft.cxx	2006-11-07 08:38:44 UTC (rev 2896)
@@ -0,0 +1,28 @@
+
+#include<libmsip/SipSimSoft.h>
+
+SipSimSoft::SipSimSoft(MRef<certificate_chain*> chain, MRef<ca_db*> cas){
+	certChain = chain;
+	ca_set = cas;
+}
+
+/*
+SipSimSoft::SipSimSoft(string certfilepath, string pkeyfilepath){
+
+}
+*/
+
+MRef<certificate_chain*> SipSimSoft::getCertificateChain(){
+
+	return certChain;
+}
+
+MRef<ca_db*> SipSimSoft::getCAs(){
+	return ca_set;
+}
+
+
+void SipSimSoft::sign(byte_t *data, uint32_t len, byte_t *out_sign, int method){
+	cerr << "EEEE: ERROR: unimplemented method: SipSimSoft::sign(...)"<<endl;
+}
+



More information about the Minisip-devel mailing list