Mercurial > pidgin.yaz
comparison libpurple/plugins/ssl/ssl-gnutls.c @ 19079:05ae340c42cc
- Add unique_id and issuer_unique_id constructions (defined as Distinguished
Names) for ssl-gnutls x509
author | William Ehlhardt <williamehlhardt@gmail.com> |
---|---|
date | Tue, 07 Aug 2007 20:29:35 +0000 |
parents | daa68185a018 |
children | 2c7c934bfb4e |
comparison
equal
deleted
inserted
replaced
19078:3987f76c0e4b | 19079:05ae340c42cc |
---|---|
728 | 728 |
729 return hash; | 729 return hash; |
730 } | 730 } |
731 | 731 |
732 static gchar * | 732 static gchar * |
733 x509_cert_dn (PurpleCertificate *crt) | |
734 { | |
735 gnutls_x509_crt_t cert_dat; | |
736 gchar *dn = NULL; | |
737 size_t dn_size; | |
738 | |
739 g_return_val_if_fail(crt, NULL); | |
740 g_return_val_if_fail(crt->scheme == &x509_gnutls, NULL); | |
741 | |
742 cert_dat = X509_GET_GNUTLS_DATA(crt); | |
743 | |
744 /* TODO: Note return values? */ | |
745 | |
746 /* Figure out the length of the Distinguished Name */ | |
747 /* Claim that the buffer is size 0 so GnuTLS just tells us how much | |
748 space it needs */ | |
749 dn_size = 0; | |
750 gnutls_x509_crt_get_dn(cert_dat, dn, &dn_size); | |
751 | |
752 /* Now allocate and get the Distinguished Name */ | |
753 dn = g_new0(gchar, dn_size); | |
754 gnutls_x509_crt_get_dn(cert_dat, dn, &dn_size); | |
755 | |
756 return dn; | |
757 } | |
758 | |
759 static gchar * | |
760 x509_issuer_dn (PurpleCertificate *crt) | |
761 { | |
762 gnutls_x509_crt_t cert_dat; | |
763 gchar *dn = NULL; | |
764 size_t dn_size; | |
765 | |
766 g_return_val_if_fail(crt, NULL); | |
767 g_return_val_if_fail(crt->scheme == &x509_gnutls, NULL); | |
768 | |
769 cert_dat = X509_GET_GNUTLS_DATA(crt); | |
770 | |
771 /* TODO: Note return values? */ | |
772 | |
773 /* Figure out the length of the Distinguished Name */ | |
774 /* Claim that the buffer is size 0 so GnuTLS just tells us how much | |
775 space it needs */ | |
776 dn_size = 0; | |
777 gnutls_x509_crt_get_issuer_dn(cert_dat, dn, &dn_size); | |
778 | |
779 /* Now allocate and get the Distinguished Name */ | |
780 dn = g_new0(gchar, dn_size); | |
781 gnutls_x509_crt_get_issuer_dn(cert_dat, dn, &dn_size); | |
782 | |
783 return dn; | |
784 } | |
785 | |
786 static gchar * | |
733 x509_common_name (PurpleCertificate *crt) | 787 x509_common_name (PurpleCertificate *crt) |
734 { | 788 { |
735 gnutls_x509_crt_t cert_dat; | 789 gnutls_x509_crt_t cert_dat; |
736 gchar *cn = NULL; | 790 gchar *cn = NULL; |
737 size_t cn_size; | 791 size_t cn_size; |
818 x509_export_certificate, /* Certificate export function */ | 872 x509_export_certificate, /* Certificate export function */ |
819 x509_copy_certificate, /* Copy */ | 873 x509_copy_certificate, /* Copy */ |
820 x509_destroy_certificate, /* Destroy cert */ | 874 x509_destroy_certificate, /* Destroy cert */ |
821 x509_certificate_signed_by, /* Signature checker */ | 875 x509_certificate_signed_by, /* Signature checker */ |
822 x509_sha1sum, /* SHA1 fingerprint */ | 876 x509_sha1sum, /* SHA1 fingerprint */ |
823 NULL, /* Unique ID */ | 877 x509_cert_dn, /* Unique ID */ |
824 NULL, /* Issuer Unique ID */ | 878 x509_issuer_dn, /* Issuer Unique ID */ |
825 x509_common_name, /* Subject name */ | 879 x509_common_name, /* Subject name */ |
826 x509_check_name, /* Check subject name */ | 880 x509_check_name, /* Check subject name */ |
827 x509_times /* Activation/Expiration time */ | 881 x509_times /* Activation/Expiration time */ |
828 }; | 882 }; |
829 | 883 |