Revert "gtlscertificate: Add certificate-bytes and private-key-bytes props"

* In order to add contstruct properties to an abstract base
   calls, and retain ABI stability, the base class must add a
   default implementation of those properties.
 * We cannot add a default implementation of certificate-bytes
   or private-key-bytes since certificate and private-key properties
   are writable on construct-only.

This reverts commit 541c985869.

https://bugzilla.gnome.org/show_bug.cgi?id=682081
This commit is contained in:
Stef Walter 2012-08-21 13:26:27 +02:00
parent a8c784df58
commit 7518f7a674
3 changed files with 11 additions and 58 deletions

View File

@ -105,10 +105,8 @@ enum
PROP_CERTIFICATE_0,
PROP_CERT_CERTIFICATE,
PROP_CERT_CERTIFICATE_BYTES,
PROP_CERT_CERTIFICATE_PEM,
PROP_CERT_PRIVATE_KEY,
PROP_CERT_PRIVATE_KEY_BYTES,
PROP_CERT_PRIVATE_KEY_PEM,
PROP_CERT_ISSUER
};
@ -150,10 +148,8 @@ g_dummy_tls_certificate_class_init (GDummyTlsCertificateClass *certificate_class
gobject_class->set_property = g_dummy_tls_certificate_set_property;
g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE, "certificate");
g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE_BYTES, "certificate-bytes");
g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE_PEM, "certificate-pem");
g_object_class_override_property (gobject_class, PROP_CERT_PRIVATE_KEY, "private-key");
g_object_class_override_property (gobject_class, PROP_CERT_PRIVATE_KEY_BYTES, "private-key-bytes");
g_object_class_override_property (gobject_class, PROP_CERT_PRIVATE_KEY_PEM, "private-key-pem");
g_object_class_override_property (gobject_class, PROP_CERT_ISSUER, "issuer");
}

View File

@ -58,10 +58,8 @@ enum
PROP_0,
PROP_CERTIFICATE,
PROP_CERTIFICATE_BYTES,
PROP_CERTIFICATE_PEM,
PROP_PRIVATE_KEY,
PROP_PRIVATE_KEY_BYTES,
PROP_PRIVATE_KEY_PEM,
PROP_ISSUER
};
@ -101,9 +99,8 @@ g_tls_certificate_class_init (GTlsCertificateClass *class)
* GTlsCertificate:certificate:
*
* The DER (binary) encoded representation of the certificate.
* This property and the #GTlsCertificate:certificate-bytes contain
* the same data. The #GTlsCertificate:certificate-pem property
* represents the same data, just in different forms.
* This property and the #GTlsCertificate:certificate-pem property
* represent the same data, just in different forms.
*
* Since: 2.28
*/
@ -115,30 +112,12 @@ g_tls_certificate_class_init (GTlsCertificateClass *class)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
/**
* GTlsCertificate:certificate-bytes:
*
* The DER (binary) encoded representation of the certificate as
* a #GBytes. The #GTlsCertificate:certificate property contains
* the same data. The #GTlsCertificate:certificate-pem property
* contains the same data as this property in a different form.
*
* Since: 2.34
*/
g_object_class_install_property (gobject_class, PROP_CERTIFICATE_BYTES,
g_param_spec_boxed ("certificate-bytes",
P_("Certificate Bytes"),
P_("The DER representation of the certificate"),
G_TYPE_BYTES,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
/**
* GTlsCertificate:certificate-pem:
*
* The PEM (ASCII) encoded representation of the certificate.
* The #GTlsCertificate:certificate and #GTlsCertificate:certificate-bytes
* properties represent the same data, just in a different form.
* This property and the #GTlsCertificate:certificate
* property represent the same data, just in different forms.
*
* Since: 2.28
*/
@ -173,23 +152,6 @@ g_tls_certificate_class_init (GTlsCertificateClass *class)
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
/**
* GTlsCertificate:private-key-bytes:
*
* The DER (binary) encoded representation of the certificate's
* private key. This property and the #GtlsCertificate:private-key
* property contain the same data.
*
* Since: 2.34
*/
g_object_class_install_property (gobject_class, PROP_PRIVATE_KEY_BYTES,
g_param_spec_boxed ("private-key-bytes",
P_("Private key bytes"),
P_("The DER representation of the certificate's private key"),
G_TYPE_BYTES,
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
/**
* GTlsCertificate:private-key-pem:
*
@ -617,19 +579,20 @@ gboolean
g_tls_certificate_is_same (GTlsCertificate *cert_one,
GTlsCertificate *cert_two)
{
GBytes *b1, *b2;
GByteArray *b1, *b2;
gboolean equal;
g_return_val_if_fail (G_IS_TLS_CERTIFICATE (cert_one), FALSE);
g_return_val_if_fail (G_IS_TLS_CERTIFICATE (cert_two), FALSE);
g_object_get (cert_one, "certificate-bytes", &b1, NULL);
g_object_get (cert_two, "certificate-bytes", &b2, NULL);
g_object_get (cert_one, "certificate", &b1, NULL);
g_object_get (cert_two, "certificate", &b2, NULL);
equal = g_bytes_equal (b1, b2);
equal = (b1->len == b2->len &&
memcmp (b1->data, b2->data, b1->len) == 0);
g_bytes_unref (b1);
g_bytes_unref (b2);
g_byte_array_unref (b1);
g_byte_array_unref (b2);
return equal;
}

View File

@ -81,10 +81,8 @@ enum
PROP_CERTIFICATE_0,
PROP_CERT_CERTIFICATE,
PROP_CERT_CERTIFICATE_BYTES,
PROP_CERT_CERTIFICATE_PEM,
PROP_CERT_PRIVATE_KEY,
PROP_CERT_PRIVATE_KEY_BYTES,
PROP_CERT_PRIVATE_KEY_PEM,
PROP_CERT_ISSUER
};
@ -135,9 +133,7 @@ g_test_tls_certificate_set_property (GObject *object,
cert->key_pem = g_value_dup_string (value);
break;
case PROP_CERT_CERTIFICATE:
case PROP_CERT_CERTIFICATE_BYTES:
case PROP_CERT_PRIVATE_KEY:
case PROP_CERT_PRIVATE_KEY_BYTES:
case PROP_CERT_ISSUER:
/* ignore */
break;
@ -166,10 +162,8 @@ g_test_tls_certificate_class_init (GTestTlsCertificateClass *certificate_class)
gobject_class->finalize = g_test_tls_certificate_finalize;
g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE, "certificate");
g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE_BYTES, "certificate-bytes");
g_object_class_override_property (gobject_class, PROP_CERT_CERTIFICATE_PEM, "certificate-pem");
g_object_class_override_property (gobject_class, PROP_CERT_PRIVATE_KEY, "private-key");
g_object_class_override_property (gobject_class, PROP_CERT_PRIVATE_KEY_BYTES, "private-key-bytes");
g_object_class_override_property (gobject_class, PROP_CERT_PRIVATE_KEY_PEM, "private-key-pem");
g_object_class_override_property (gobject_class, PROP_CERT_ISSUER, "issuer");
}