]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
*** empty log message ***
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 1 Dec 2003 08:04:23 +0000 (08:04 +0000)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 1 Dec 2003 08:04:23 +0000 (08:04 +0000)
doc/tex/ex-serv-export.tex
doc/tex/ex-serv-srp.tex
doc/tex/preface.tex

index c34b612dda65b3db41215404c6fb69d87702a3a4..3b5e33f83984343a0ea3a752d4e1b48329b91305 100644 (file)
@@ -27,7 +27,7 @@
 #define DH_BITS 1024
 
 /* These are global */
-gnutls_certificate_credentials x509_cred;
+gnutls_certificate_credentials cert_cred;
 
 static void wrap_db_init(void);
 static void wrap_db_deinit(void);
@@ -47,7 +47,7 @@ gnutls_session initialize_tls_session()
     */
    gnutls_set_default_export_priority(session);
 
-   gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, x509_cred);
+   gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, cert_cred);
 
    /* request client certificate if any.
     */
@@ -118,15 +118,15 @@ int main()
     */
    gnutls_global_init();
 
-   gnutls_certificate_allocate_credentials(&x509_cred);
+   gnutls_certificate_allocate_credentials(&cert_cred);
 
-   gnutls_certificate_set_x509_trust_file(x509_cred, CAFILE,
+   gnutls_certificate_set_x509_trust_file(cert_cred, CAFILE,
                                           GNUTLS_X509_FMT_PEM);
 
-   gnutls_certificate_set_x509_crl_file(x509_cred, CRLFILE,
+   gnutls_certificate_set_x509_crl_file(cert_cred, CRLFILE,
                                           GNUTLS_X509_FMT_PEM);
 
-   gnutls_certificate_set_x509_key_file(x509_cred, CERTFILE, KEYFILE,
+   gnutls_certificate_set_x509_key_file(cert_cred, CERTFILE, KEYFILE,
                                         GNUTLS_X509_FMT_PEM);
 
    generate_dh_params();
@@ -136,8 +136,8 @@ int main()
       wrap_db_init();
    }
 
-   gnutls_certificate_set_dh_params(x509_cred, dh_params);
-   gnutls_certificate_set_rsa_export_params(x509_cred, rsa_params);
+   gnutls_certificate_set_dh_params(cert_cred, dh_params);
+   gnutls_certificate_set_rsa_export_params(cert_cred, rsa_params);
 
    /* Socket operations
     */
@@ -211,7 +211,7 @@ int main()
    }
    close(listen_sd);
 
-   gnutls_certificate_free_credentials(x509_cred);
+   gnutls_certificate_free_credentials(cert_cred);
 
    gnutls_global_deinit();
 
index 11acbb1abad549b2045a9bd742c33e54a6ebb14a..553c2deed65f6d4173f8a15fc2a26fa4352ec6bc 100644 (file)
 #define SRP_PASSWD "tpasswd"
 #define SRP_PASSWD_CONF "tpasswd.conf"
 
+#define KEYFILE "key.pem"
+#define CERTFILE "cert.pem"
+#define CAFILE "ca.pem"
+
 /* This is a sample TLS-SRP echo server.
  */
 
 
 /* These are global */
 gnutls_srp_server_credentials srp_cred;
+gnutls_certificate_credentials cert_cred;
 
 gnutls_session initialize_tls_session()
 {
    gnutls_session session;
-   const int kx_priority[] = { GNUTLS_KX_SRP, 0 };
+   const int kx_priority[] = { GNUTLS_KX_SRP, GNUTLS_KX_SRP_DSS,
+      GNUTLS_KX_SRP_RSA, 0 };
 
    gnutls_init(&session, GNUTLS_SERVER);
 
@@ -37,6 +43,9 @@ gnutls_session initialize_tls_session()
    gnutls_kx_set_priority(session, kx_priority);
 
    gnutls_credentials_set(session, GNUTLS_CRD_SRP, srp_cred);
+   /* for the certificate authenticated ciphersuites.
+    */
+   gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, cert_cred);
 
    /* request client certificate if any.
     */
@@ -70,6 +79,10 @@ int main()
    gnutls_srp_allocate_server_credentials(&srp_cred);
    gnutls_srp_set_server_credentials_file(srp_cred, SRP_PASSWD, SRP_PASSWD_CONF);
 
+   gnutls_certificate_allocate_credentials(&cert_cred);
+   gnutls_certificate_set_x509_trust_file(cert_cred, CAFILE, GNUTLS_X509_FMT_PEM);
+   gnutls_certificate_set_x509_key_file(cert_cred, CERTFILE, KEYFILE,
+                                        GNUTLS_X509_FMT_PEM);
 
    /* TCP socket operations
     */
@@ -146,6 +159,7 @@ int main()
    close(listen_sd);
 
    gnutls_srp_free_server_credentials(srp_cred);
+   gnutls_certificate_free_credentials(cert_cred);
 
    gnutls_global_deinit();
 
index 01aa48ba0335d0367b24ad04426b2a154d684918..a06f76d9b7249258cd39be26da5cec4a4e32dbd7 100644 (file)
@@ -8,9 +8,10 @@ the \gnutls{} purpose and actual offerings.
 Even if \gnutls{} is a typical library software, it operates over several
 security and cryptographic protocols, which require the programmer
 to make careful and correct usage of them. Otherwise he risks to offer
-just a false sense of security. Also note that a program should not be
-considered secure just because it uses \gnutls{} or any other cryptographic library.
-There are several ways to compromise a program or a communication line
+just a false sense of security. Security is a very general term for computer
+software and cannot be restricted to a single cryptographic library.
+A program should not be considered secure just because it uses \gnutls{},
+there are several ways to compromise a program or a communication line
 and \gnutls{} only helps with some of them. 
 \par
 This document tries to be self contained, although basic