-
Notifications
You must be signed in to change notification settings - Fork 4
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
RobSinn
committed
Aug 17, 2014
1 parent
bb75be9
commit cb55818
Showing
12 changed files
with
170 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import rsa | ||
import zoo | ||
|
||
def ChangeThredds(conf,inputs,outputs): | ||
crypto = inputs["url"]["value"] | ||
|
||
privatefile = open('rsa/privateKey.pem') | ||
keydata = privatefile.read() | ||
privatekey = rsa.PrivateKey.load_pkcs1(keydata) | ||
publicfile = open('rsa/publicKey.pem') | ||
pubdata = publicfile.read() | ||
pubkey = rsa.PublicKey.load_pkcs1(pubdata) | ||
|
||
newurl = rsa.decrypt(crypto,privatekey) | ||
|
||
ThreddServer = open('ThreddServer','w') | ||
ThreddServer.write(newurl) | ||
|
||
outputs["Result"]["value"]=("New Server address is " + newurl) | ||
|
||
return zoo.SERVICE_SUCCEEDED |
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,16 @@ | ||
import rsa | ||
|
||
def ChangeThredds(conf,inputs,outputs): | ||
crypto = inputs["url"]["value"] | ||
|
||
privatefile = open('rsa/privateKey.pem') | ||
keydata = privatefile.read() | ||
privatekey = rsa.PrivateKey.load_pkcs1(keydata) | ||
publicfile = open('rsa/publicKey.pem') | ||
pubdata = publicfile.read() | ||
pubkey = rsa.PublicKey.load_pkcs1(pubdata) | ||
|
||
newurl = rsa.decrypt(crypto,privatekey) | ||
|
||
ThreddServer = open('ThreddServer','w') | ||
ThreddServer.write(newurl) |
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,48 @@ | ||
[ChangeThredds] | ||
Title = Set a new Thredds server | ||
Abstract = Set a new Thredds server | ||
processVersion = 2 | ||
storeSupported = true | ||
statusSupported = true | ||
serviceProvider = ChangeThredds | ||
serviceType = Python | ||
<MetaData> | ||
title = Demo | ||
</MetaData> | ||
<DataInputs> | ||
[url] | ||
Title = A single url such as http://115.146.84.143:8080 | ||
Abstract = Url to the Thredds server | ||
minOccurs = 1 | ||
maxOccurs = 1 | ||
<MetaData> | ||
title = Meta | ||
</MetaData> | ||
<LiteralData> | ||
DataType = string | ||
<Default> | ||
UOM = meter | ||
</Default> | ||
<Supported> | ||
UOM = meter | ||
</Supported> | ||
</LiteralData> | ||
</DataInputs> | ||
<DataOutputs> | ||
[Result] | ||
Title = Operation Service Provider | ||
Abstract = A Zoo web service that calls various operations on netcdf data. | ||
<MetaData> | ||
title = My test | ||
</MetaData> | ||
<LiteralData> | ||
DataType = string | ||
<Default> | ||
UOM = meter | ||
</Default> | ||
<Supported> | ||
UOM = meter | ||
</Supported> | ||
</LiteralData> | ||
</DataOutputs> | ||
|
Empty file.
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 @@ | ||
http://115.146.84.143:8080 |
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 @@ | ||
N���0��%����3�f�f}X��~()���2������~�'�*�K�!� ����Z�o! | ||
|
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,33 @@ | ||
import rsa | ||
import urllib | ||
import base64 | ||
|
||
def main(): | ||
test = "http://115.146.84.143:8080" | ||
privatefile = open('privateKey.pem') | ||
keydata = privatefile.read() | ||
privatekey = rsa.PrivateKey.load_pkcs1(keydata) | ||
publicfile = open('publicKey.pem') | ||
pubdata = publicfile.read() | ||
pubkey = rsa.PublicKey.load_pkcs1(pubdata) | ||
|
||
crypto = rsa.encrypt(test,pubkey) | ||
newtest = rsa.decrypt(crypto,privatekey) | ||
print crypto | ||
urlForm = urllib.quote_plus(crypto) | ||
print urlForm | ||
print newtest | ||
|
||
print rsa.decrypt(urllib.unquote_plus(urlForm),privatekey) | ||
quickTest = urllib.unquote_plus("%A0%5E%CC_V%17%B9W%E0%D3%93%BF%84%87pqg%07%FA%CC%03%B0%DB%24%99%F7%DCAe%25i%0F-%AC%CA.%B8%2C%E0s%FC%DE%2C%DE%BFF%FA%B0%60%16%D6%92%AE%9DVT%04%83%91%1F%C3%1DI%C0") | ||
print quickTest | ||
print rsa.decrypt(quickTest,privatekey) | ||
print "with utf8" | ||
#code = urllib.quote(crypto).encode("utf8") | ||
#code = HttpContext.Current.Server.UrlEncode(urllib.quote_plus(crypto)) | ||
#print rsa.decrypt(urllib.unquote_plus(code),privatekey) | ||
print rsa.decrypt(urllib.unquote_plus(base64.b64decode(base64.b64encode(urllib.quote_plus(crypto)))),privatekey) | ||
|
||
print base64.b64encode(crypto) | ||
|
||
|
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,33 @@ | ||
import rsa | ||
import urllib | ||
import base64 | ||
|
||
def main(): | ||
test = "http://115.146.84.143:8080" | ||
privatefile = open('privateKey.pem') | ||
keydata = privatefile.read() | ||
privatekey = rsa.PrivateKey.load_pkcs1(keydata) | ||
publicfile = open('publicKey.pem') | ||
pubdata = publicfile.read() | ||
pubkey = rsa.PublicKey.load_pkcs1(pubdata) | ||
|
||
crypto = rsa.encrypt(test,pubkey) | ||
newtest = rsa.decrypt(crypto,privatekey) | ||
print crypto | ||
urlForm = urllib.quote_plus(crypto) | ||
print urlForm | ||
print newtest | ||
|
||
print rsa.decrypt(urllib.unquote_plus(urlForm),privatekey) | ||
quickTest = urllib.unquote_plus("%A0%5E%CC_V%17%B9W%E0%D3%93%BF%84%87pqg%07%FA%CC%03%B0%DB%24%99%F7%DCAe%25i%0F-%AC%CA.%B8%2C%E0s%FC%DE%2C%DE%BFF%FA%B0%60%16%D6%92%AE%9DVT%04%83%91%1F%C3%1DI%C0") | ||
print quickTest | ||
print rsa.decrypt(quickTest,privatekey) | ||
print "with utf8" | ||
#code = urllib.quote(crypto).encode("utf8") | ||
#code = HttpContext.Current.Server.UrlEncode(urllib.quote_plus(crypto)) | ||
#print rsa.decrypt(urllib.unquote_plus(code),privatekey) | ||
print rsa.decrypt(urllib.unquote_plus(base64.b64decode(base64.b64encode(urllib.quote_plus(crypto)))),privatekey) | ||
|
||
print base64.b64encode(urllib.quote_plus(crypto)) | ||
|
||
|
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,15 @@ | ||
import rsa | ||
|
||
def main(): | ||
test = "http://115.146.84.143:8080" | ||
privatefile = open('privateKey.pem') | ||
keydata = privatefile.read() | ||
privatekey = rsa.PrivateKey.load_pkcs1(keydata) | ||
publicfile = open('publicKey.pem') | ||
pubdata = publicfile.read() | ||
pubkey = rsa.PublicKey.load_pkcs1(pubdata) | ||
|
||
signature = rsa.sign(test, privatekey, 'SHA-1') | ||
|
||
print rsa.verify(test, signature, pubkey) | ||
print signature |
Binary file not shown.