-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb6dd6f
commit c068ae3
Showing
8 changed files
with
168 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem | ||
openssl pkcs12 -inkey key.pem -in certificate.pem -export -out certificate.p12 | ||
|
||
cat key.pem certificate.pem > temp.pem | ||
openssl pkcs12 -export -in temp.pem -out server.p12 -name localhost | ||
|
||
keytool -importkeystore -destkeystore keystore.jks -srckeystore server.p12 -srcstoretype PKCS12 -alias localhost | ||
|
||
rm temp.pem | ||
rm server.p12 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIDBjCCAe4CCQDOJtxfR2JVSzANBgkqhkiG9w0BAQsFADBFMQswCQYDVQQGEwJC | ||
UjELMAkGA1UECAwCUlMxFTATBgNVBAcMDFBvcnRvIEFsZWdyZTESMBAGA1UEAwwJ | ||
bG9jYWxob3N0MB4XDTE4MDMyNDE5MzQ0MFoXDTE5MDMyNDE5MzQ0MFowRTELMAkG | ||
A1UEBhMCQlIxCzAJBgNVBAgMAlJTMRUwEwYDVQQHDAxQb3J0byBBbGVncmUxEjAQ | ||
BgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB | ||
AKyDrrJNIvfvZxOyKmzrQfImoGHOeb1RQHAHLnCwcu5QblSxHS59HSkZ5kDqc4EA | ||
sMNR1vYUm+ikXKpKBXT/BgikHpDA+ZXP/3A/VDif9L8J77DvZeV4/TI9yU2Wq/rm | ||
31cByxOWRpaLIhdpE+IdfU7xbwD39o7iQlFp2E9z+ObtQ3MXFPLWCIiMoqgruDJ6 | ||
K1z+a2Eav5TwixeXRhpHLB1SFx0YQB1PeRMyEaHybGLJgetTOFjC15mv2R1J7M3C | ||
bK2fdAfK2FMvY8FF0fElSMt6N7PACe4DTDDCvNxVZlz2wyhLUND2tTvlC5UbzuMq | ||
orZ2hR3B8SwhO+/ghm4TvD0CAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAXIS2cNaF | ||
Nqm7+bSw2r/pH3aR87uFUDZsRno2/S/Xr75LtrRquJcWH7olTrWqTk8Bt1sUb+9I | ||
6aTRPeTT+dMPypIYWeT5OwHrUiJ+OqJhuBhbOdSOfeMVTa51LgsSUximdBGGpz9B | ||
6plYvMis8VFd0JEenOOU9eHlR86eSVh4suxorsJWIjN1IX54GU6QT8e3aWdIBRmE | ||
f5Hsbw2ZrVPhO1nlx7sdOR73GRbg8rQbi14a5tTUaxwgkk7owdyhcSkCeu30rzJE | ||
3dfVpqkRHXChbrmI2DftwEyxZoMccgd++3GmjMbSmuEkmv49wLqJe9OG44jqooc2 | ||
UCI+cBVJZ4jvmQ== | ||
-----END CERTIFICATE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-----BEGIN PRIVATE KEY----- | ||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCsg66yTSL372cT | ||
sips60HyJqBhznm9UUBwBy5wsHLuUG5UsR0ufR0pGeZA6nOB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ZH29vfWXiKjM0sy8V4j1TiYIz1bgPU/eVQIq9Nd/sW | ||
tIGdtPSW0XCxIl4xZwu0HeFB4JvDa3WY/fkPHWlbNiiYSIm/kMRXJvmkCJLS1tmy | ||
7jeKvw87tj3z5Br+FpjY7DQVy/Fk8sMg6aXiBnofyg1fgZ1nGOfWJESlAoGBAIiJ | ||
g7Rv3fqJMxQj93P2zs38TCmfwsj0NXKRtd2a8b7Cy/bhc+fiTmAf/v9rz0jZnRUP | ||
/gntEwWP/Fx1IPTnwooKnIj8Z1ijmSRo8ghZfGbUL5i7fHTb4nBKsBj2HGU1mvll | ||
vdKzSfYyF1cihmF5eu9V/Ed4UsKiAOopi1aHgmv7AoGBAI8DvTZBnHI2kKckh2ih | ||
KW45ig0oj6C0vlNZQ11WJsjbLx3tBCFEu6XSpNM96rbvUvrwbZZxoZmH+zEypcpv | ||
+yKRRwVlleTjFtkcbYVeniyXZBYQV46C+0lHgh5PN6axjZhpAMmTQDTsgM/0YIac | ||
j81cZoXmdlXZndIW1ZV76ntm | ||
-----END PRIVATE KEY----- |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Self-signed key: | ||
# | ||
# openssl req -x509 -newkey rsa:2048 -keyout selfsigned.key -nodes\ | ||
# -out selfsigned.cert -sha256 -days 1000 | ||
# | ||
# Use 'localhost' as Common Name | ||
|
||
|
||
import sys | ||
import logging | ||
import asyncio | ||
import ssl | ||
try: | ||
import tornado | ||
except ImportError: | ||
pass | ||
|
||
from aiostomp import AioStomp | ||
|
||
|
||
logging.basicConfig( | ||
format="%(asctime)s - %(filename)s:%(lineno)d - " | ||
"%(levelname)s - %(message)s", | ||
level='DEBUG') | ||
|
||
|
||
async def on_message(frame, message): | ||
print(message) | ||
return True | ||
|
||
|
||
async def report_error(error): | ||
print('report_error', error) | ||
|
||
|
||
async def run(): | ||
ssl_context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH, | ||
cafile='certificate.pem') | ||
|
||
client = AioStomp('localhost', 61612, | ||
error_handler=report_error, | ||
ssl_context=ssl_context) | ||
|
||
client.subscribe('/queue/test', handler=on_message) | ||
await client.connect() | ||
|
||
await asyncio.sleep(10) | ||
client.subscribe('/queue/test', handler=on_message) | ||
|
||
client.send('/queue/test', body=u'Pedro Kiefer', headers={}) | ||
|
||
await asyncio.sleep(10) | ||
|
||
|
||
def main(args): | ||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(run()) | ||
loop.run_forever() | ||
|
||
|
||
def tornado_main(args): | ||
from tornado.platform.asyncio import AsyncIOMainLoop | ||
AsyncIOMainLoop().install() | ||
|
||
loop = tornado.ioloop.IOLoop.instance() | ||
loop.add_callback(lambda: run()) | ||
loop.start() | ||
|
||
|
||
if __name__ == '__main__': | ||
main(sys.argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters