jr30072 / slowaes Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/slowaes
Automatically exported from code.google.com/p/slowaes
When encrypting 16 bytes long blocks (and multiples of 16 bytes) of
plaintext with the Javascript version of SlowAES/CBC the padding block is
not appended.
PKCS7 needs a full 16-bytes padding block made of 0x10 added to the
plaintext before encryption in such case.
Thanks for the library!
stefano
Original issue reported on code.google.com by stefano%[email protected]
on 9 Aug 2009 at 2:04
Hello-
I have a few reference implementations of AES-256-CBC in C#, Ruby, PHP, and
Flash.
I am know trying to get it to talk to JS via slow aes using the same settings.
I've been toiling for hours trying to get it to work, so I thought I'd ask to
see if anyone had any ideas.
On a working system, using the following settings:
IV = 0123456789012345
key = 67a4f45f0d1d9bc606486fc42dc49416
plaintext = yay!
Across my reference implementations, I get the following Base64 encoded output:
q/xJqqN6qbiZMXYmiQC1Fw==
I am having trouble setting up slowaes to give me the same. Can anyone give me
some pointers?
tia
Original issue reported on code.google.com by [email protected]
on 14 Nov 2012 at 6:05
What steps will reproduce the problem?
1. run code in "2." (i am running a gs script in google spreadsheets)
2.
function aesTester() {
var password = "mypw";
// generate the private key based on user's input password
var privateKey = cryptoHelpers.generatePrivateKey(password, 128);
var myplaintext = "hello plain text";
// using OPENSSL_256 key size but could use
var keysize = slowAES.aes.keySize.SIZE_256;
var mode = slowAES.modeOfOperation.CBC;
var key = cryptoHelpers.toNumbers("5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8");
// initialization vector, make this unique and RANDOM!!
var iv = cryptoHelpers.toNumbers("6bbda7892ad344e06c31e64564a69a9a");
var plaintext = cryptoHelpers.convertStringToByteArray(myplaintext);
// keysize is no longer a parameter because it auto finds size
var encrypted = slowAES.encrypt(plaintext, mode, privateKey, iv);
var base64 = cryptoHelpers.base64.encode(encrypted);
// this is the plain text
Logger.log(myplaintext);
// this is the encrypted text
Logger.log(base64);
// decryption in reverse order of encryption
var decodedText = cryptoHelpers.base64.decode(base64);
// keysize is no longer a parameter because it auto finds size
var decrypted = slowAES.decrypt(decodedText, mode, privateKey, iv);
var decryptedText = cryptoHelpers.convertByteArrayToString(decrypted);
// this is the decrypted text
Logger.log(decryptedText );
}
What is the expected output? What do you see instead?
expected output is the input but you will see an extra character at the end. I
have tracked the bug down to the "unpadBytesOut" function. it does not remove
the "=" from the string. should the unpadding be done AFTER the
decryption??!!?? or should it be removed before. (removing a decrypted "="
sounds difficult.)
What version of the product are you using? On what operating system?
not sure, i just copied the code today. running on windows 7. google chrome.
google docs as a .gs (google script). js code runs as-is.
Please provide any additional information below.
i can try to figure out the fix, but hopefully someone beats me to it.
Original issue reported on code.google.com by [email protected]
on 10 Dec 2013 at 7:33
Instead of:
if(c[3] >= 0 && c[2] < 64){
should be:
if(c[3] >= 0 && c[3] < 64){
Best regards,
Igor.
Original issue reported on code.google.com by [email protected]
on 30 Oct 2009 at 10:31
What is the expected output? What do you see instead?
A License File checked into the repository
For packaging it would be nice to have a LICENSE file stating a copy of the
license for the package.
Original issue reported on code.google.com by [email protected]
on 7 Feb 2015 at 8:48
missed an '$' there on line #326
Original issue reported on code.google.com by [email protected]
on 2 Nov 2013 at 5:30
Attachments:
What are the requirement to complete this task?
Implement PKCS7 padding as described on
http://code.google.com/p/slowaes/wiki/OpenSSLStandards
Please use labels and text to provide additional information.
Original issue reported on code.google.com by [email protected]
on 6 Aug 2008 at 12:46
"i" should be a variable and have to be written as "$i"
Original issue reported on code.google.com by [email protected]
on 8 Jul 2014 at 7:27
Attachments:
What steps will reproduce the problem?
1. Create an encrypted data with static KEY and IV
2. Once you try to decrypt the data with the same KEY and different IV the
message is displayed and only the first line is scrambled
What is the expected output? What do you see instead?
I was expecting that once the IV is changed the whole message will be scrambled
but instead it is only the first line
What version of the product are you using? On what operating system?
The last version available for download.
Original issue reported on code.google.com by [email protected]
on 5 Dec 2012 at 9:02
You need to add some example code. I was straggling with the PHP implementation
and had lot of problems. In any case the data to be send is not an array, so
please put down some examples about strings being encrypted and decrypted. I
personally need a working solution for JavaScript and PHP communicating with
each-other, but any code explaining the steps to make it work is OK. I can
contribute some examples myself if I can figure it out.
Original issue reported on code.google.com by [email protected]
on 22 Mar 2011 at 11:36
What are the requirement to complete this task?
The encrypt and decrypt methods should accept an array of bytes instead of
a string. Any conversion code within the methods should be removed under
the assumption that the conversion will occur before the method is called.
Please use labels and text to provide additional information.
Original issue reported on code.google.com by [email protected]
on 6 Aug 2008 at 12:23
def strip_PKCS7_padding(s):
"""return s stripped of PKCS7 padding"""
if len(s)%16 or not s:
raise ValueError("String of len %d can't be PCKS7-padded" % len(s))
numpads = ord(s[-1])
if numpads > 16:
raise ValueError("String ending with %r can't be PCKS7-padded" % s[-1])
return s[:-numpads]
slowaes-0.1a1
Original issue reported on code.google.com by [email protected]
on 8 Sep 2012 at 2:58
What steps will reproduce the problem?
test cases, these should both return the array [97,97]
cryptoHelpers.base64.decode(cryptoHelpers.base64.encode([97,97]))
97,97,64
cryptoHelpers.base64.decode("YWE=")
97,97,64
What do you see instead?
The array: [97,97,64]
What version of the product are you using?
revision 39 from svn, running under Mozilla Rhino
My proposed fix is attached. After this patch is applied:
js> cryptoHelpers.base64.decode(cryptoHelpers.base64.encode([97,97]))
97,97
js> cryptoHelpers.base64.decode("YWE=")
97,97
Original issue reported on code.google.com by [email protected]
on 10 Jun 2011 at 10:22
Attachments:
What are the requirement to complete this task?
The encrypt and decrypt methods should accept an array of bytes instead of
a string. Any conversion code within the methods should be removed under
the assumption that the conversion will occur before the method is called.
Please use labels and text to provide additional information.
Original issue reported on code.google.com by [email protected]
on 6 Aug 2008 at 12:24
If you take the encrypted cipher resulting from any CBC operation and
decrypt the message using the same IV, key, key size, etc, the decrypted
string is longer than expected and results in gremlins being appended to
the end of the decrypted text.
SlowAES seems to only work in a round-trip scenario where the unencrypted
text is known at the time.
Using Josh Davis' implementation, you can see the issue first hand:
http://josh-davis.org/ecmaScrypt
Password: Test001!
256 Bit
Hex Key: e8cfe0b4e39dcc886ca83116b21db375ca231eeebf1df98f0b38163221385fcd
CBC
Encrypted String:
88ff1654ef2badfc22bc7dfa6c0d5d145cbfa547bce4d87c663473b09ce8d9c3
The result you will get is 'Hello, World! This is a test' but at the end
there will be extra characters at the end.
I tried using the fix submitted here:
http://code.google.com/p/slowaes/issues/detail?id=6
which works correctly unless I pass in a 16 character hex string as the
plain text.
Original issue reported on code.google.com by [email protected]
on 12 Feb 2010 at 7:35
Hi guys.
I made an version for python 3 using bytes and bytearrays.
Attach here. Tested with some utf-8 string with åäö letters :-)
Original issue reported on code.google.com by [email protected]
on 1 Nov 2009 at 10:23
Attachments:
What are the requirement to complete this task?
Implement PKCS7 padding as described on
http://code.google.com/p/slowaes/wiki/OpenSSLStandards
Please use labels and text to provide additional information.
Original issue reported on code.google.com by [email protected]
on 6 Aug 2008 at 12:45
encryptData should take IV as an optional argument, and only generate one
randomly if None is passed in.
Original issue reported on code.google.com by [email protected]
on 15 Nov 2011 at 2:23
In
http://slowaes.googlecode.com/svn/trunk/js/cryptoHelpers.js Revision 39.
There is a couple of minor syntax issues (found when running it through JSLint).
The issues don't occur when using it in browser, as the browser auto-fixes them
for you.
But if you run it in a stricter environment (e.g. Windows Script Component),
then it complains.
I've attached a patch file.
btw. Awesome project guys, keep up the good work.
Original issue reported on code.google.com by [email protected]
on 31 Mar 2011 at 9:27
Attachments:
Small point. Your test code has a length of 15 characters, fitting in a single
block, so your example does not test the block sequencing methods at all.
How about a text string:
"This is a test with several blocks!"
Original issue reported on code.google.com by [email protected]
on 29 Sep 2010 at 9:40
See attachment for a modified version of decrypt that doesn't require
originalsize as a parameter.
Original issue reported on code.google.com by [email protected]
on 14 Oct 2009 at 4:09
Attachments:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.