summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMichael Steinert <mike.steinert@gmail.com>2012-08-30 16:08:23 -0600
committerAlan Antonuk <alan.antonuk@gmail.com>2013-04-09 15:53:03 -0700
commit09eccb1c0832713f377235c941716007085b47fc (patch)
treebd2124d29547fb740e5b7d6e51870f1a57d43788 /examples
parent15a80404bec02e6fbf47108f306f6b3020bc078d (diff)
downloadrabbitmq-c-github-ask-09eccb1c0832713f377235c941716007085b47fc.tar.gz
Add API to load SSL keys from a buffer
Signed-off-by: Michael Steinert <mike.steinert@gmail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/amqps_bind.c11
-rw-r--r--examples/amqps_consumer.c9
-rw-r--r--examples/amqps_exchange_declare.c9
-rw-r--r--examples/amqps_listen.c11
-rw-r--r--examples/amqps_listenq.c11
-rw-r--r--examples/amqps_producer.c11
-rw-r--r--examples/amqps_sendstring.c11
-rw-r--r--examples/amqps_unbind.c11
8 files changed, 70 insertions, 14 deletions
diff --git a/examples/amqps_bind.c b/examples/amqps_bind.c
index 3255e70..04db414 100644
--- a/examples/amqps_bind.c
+++ b/examples/amqps_bind.c
@@ -75,10 +75,17 @@ int main(int argc, char const * const *argv) {
}
}
+ if (argc > 7) {
+ status = amqp_ssl_socket_set_key(socket, argv[7]);
+ if (status) {
+ die("setting client key");
+ }
+ }
+
if (argc > 8) {
- status = amqp_ssl_socket_set_key(socket, argv[7], argv[8]);
+ status = amqp_ssl_socket_set_cert(socket, argv[8]);
if (status) {
- die("setting client key/cert");
+ die("setting client cert");
}
}
diff --git a/examples/amqps_consumer.c b/examples/amqps_consumer.c
index cb47dff..86c9d9f 100644
--- a/examples/amqps_consumer.c
+++ b/examples/amqps_consumer.c
@@ -148,12 +148,19 @@ int main(int argc, char const * const *argv) {
}
if (argc > 4) {
- status = amqp_ssl_socket_set_key(socket, argv[5], argv[5]);
+ status = amqp_ssl_socket_set_key(socket, argv[4]);
if (status) {
die("setting client key/cert");
}
}
+ if (argc > 5) {
+ status = amqp_ssl_socket_set_cert(socket, argv[5]);
+ if (status) {
+ die("setting client key");
+ }
+ }
+
status = amqp_socket_open(socket, hostname, port);
if (status) {
die("opening SSL/TLS connection");
diff --git a/examples/amqps_exchange_declare.c b/examples/amqps_exchange_declare.c
index 1310235..12c814b 100644
--- a/examples/amqps_exchange_declare.c
+++ b/examples/amqps_exchange_declare.c
@@ -73,8 +73,15 @@ int main(int argc, char const * const *argv) {
}
}
+ if (argc > 6) {
+ status = amqp_ssl_socket_set_key(socket, argv[6]);
+ if (status) {
+ die("setting client key/cert");
+ }
+ }
+
if (argc > 7) {
- status = amqp_ssl_socket_set_key(socket, argv[6], argv[7]);
+ status = amqp_ssl_socket_set_cert(socket, argv[7]);
if (status) {
die("setting client key/cert");
}
diff --git a/examples/amqps_listen.c b/examples/amqps_listen.c
index c6344bd..876bad9 100644
--- a/examples/amqps_listen.c
+++ b/examples/amqps_listen.c
@@ -77,10 +77,17 @@ int main(int argc, char const * const *argv) {
}
}
+ if (argc > 6) {
+ status = amqp_ssl_socket_set_key(socket, argv[6]);
+ if (status) {
+ die("setting client key");
+ }
+ }
+
if (argc > 7) {
- status = amqp_ssl_socket_set_key(socket, argv[6], argv[7]);
+ status = amqp_ssl_socket_set_cert(socket, argv[7]);
if (status) {
- die("setting client key/cert");
+ die("setting client cert");
}
}
diff --git a/examples/amqps_listenq.c b/examples/amqps_listenq.c
index 0a9c687..9d910c9 100644
--- a/examples/amqps_listenq.c
+++ b/examples/amqps_listenq.c
@@ -73,10 +73,17 @@ int main(int argc, char const * const *argv) {
}
}
+ if (argc > 5) {
+ status = amqp_ssl_socket_set_key(socket, argv[5]);
+ if (status) {
+ die("setting client key");
+ }
+ }
+
if (argc > 6) {
- status = amqp_ssl_socket_set_key(socket, argv[5], argv[6]);
+ status = amqp_ssl_socket_set_cert(socket, argv[5]);
if (status) {
- die("setting client key/cert");
+ die("setting client cert");
}
}
diff --git a/examples/amqps_producer.c b/examples/amqps_producer.c
index 43649ad..18f0b3f 100644
--- a/examples/amqps_producer.c
+++ b/examples/amqps_producer.c
@@ -137,10 +137,17 @@ int main(int argc, char const * const *argv) {
}
}
+ if (argc > 6) {
+ status = amqp_ssl_socket_set_key(socket, argv[6]);
+ if (status) {
+ die("setting client key");
+ }
+ }
+
if (argc > 7) {
- status = amqp_ssl_socket_set_key(socket, argv[6], argv[7]);
+ status = amqp_ssl_socket_set_cert(socket, argv[7]);
if (status) {
- die("setting client key/cert");
+ die("setting client cert");
}
}
diff --git a/examples/amqps_sendstring.c b/examples/amqps_sendstring.c
index a888da8..1133dcf 100644
--- a/examples/amqps_sendstring.c
+++ b/examples/amqps_sendstring.c
@@ -75,10 +75,17 @@ int main(int argc, char const * const *argv) {
}
}
+ if (argc > 7) {
+ status = amqp_ssl_socket_set_key(socket, argv[7]);
+ if (status) {
+ die("setting client key");
+ }
+ }
+
if (argc > 8) {
- status = amqp_ssl_socket_set_key(socket, argv[7], argv[8]);
+ status = amqp_ssl_socket_set_cert(socket, argv[8]);
if (status) {
- die("setting client key/cert");
+ die("setting client cert");
}
}
diff --git a/examples/amqps_unbind.c b/examples/amqps_unbind.c
index e9f4317..5c8a4b5 100644
--- a/examples/amqps_unbind.c
+++ b/examples/amqps_unbind.c
@@ -75,10 +75,17 @@ int main(int argc, char const * const *argv) {
}
}
+ if (argc > 7) {
+ status = amqp_ssl_socket_set_key(socket, argv[7]);
+ if (status) {
+ die("setting client key");
+ }
+ }
+
if (argc > 8) {
- status = amqp_ssl_socket_set_key(socket, argv[7], argv[8]);
+ status = amqp_ssl_socket_set_cert(socket, argv[8]);
if (status) {
- die("setting client key/cert");
+ die("setting client cert");
}
}