rubo / flame Goto Github PK
View Code? Open in Web Editor NEWFlame is an ActionScript library that provides a number of useful UI controls, collections, cryptographic services, and utilities to work with the Flex SDK.
License: Other
Flame is an ActionScript library that provides a number of useful UI controls, collections, cryptographic services, and utilities to work with the Flex SDK.
License: Other
Issue in line 277, class RSA. I replaced:
_isKeyParametersGenerated = _d != null || _useCRT;
by:
_isKeyParametersGenerated = true;
Hello, I couldn't find any SHA-3 library for ActionScript. Is there any exist or do you know any ?
It seems that RSAPKCS1KeyExchangeFormatter encrypts data using the public key.
In my use case, I only want one "provider" to be able to send several "consumers" encrypted messages. Thus, I want the "provider" (i.e. my flash app) to encrypt data using the private key and my "consumers" to decrypt data using the public key.
Is there a straightforward way I can create a cipher using the private RSA key instead of the public key?
Thanks!
Main question:
What padding strategy do the RSA encrpyt/decrypt methods use in flame? Is it PKCS1_PADDING by default? Something else?
--- Context ---
I have successfully generated RSA key pair using your library and have tested it successfully in flash by encrypting/decrypting various strings. I am now try to encrypt a string using the flame library and decrypt the result using Ruby's OpenSSL::RSA library.
Flash:
sample string = "testfootest"
Base64 urlsafe encoded result:
"Zi1e8kz9TVb99EU0aZQ7heY4ecN7v6WFeR8Il6tKYnsuSF9MUZq8ReY2a9lslMNALBggi7Wzneq2LDTdeNPllA=="
Ruby:
I create the RSA key pair using the private key generated by flame.
When I try to decrypt the encrypted result, I get the following error:
OpenSSL::PKey::RSAError: padding check failed
from (irb):12:in public_decrypt' from (irb):12 from /Users/dhracker/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands/console.rb:47:in
start'
from /Users/dhracker/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in start' from /Users/dhracker/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:41:in
<top (required)>'
from script/rails:6:in require' from script/rails:6:in
hey, I see a from/to xml conversion method, but I would like to generate a key pair using your library and get the pem output like the following:
"-----BEGIN RSA PRIVATE KEY-----\nMIIBPAIBAAJBALjIM++FdT3DtzOf9Z0TOBFJrbPdo6aU2xXtuNdURZbEdeTKO2SH\n2tMoijOy+X66U7aNwvzblvSq/PPJcxJkFz0CAwEAAQJBAKjYn8R1cc1Pgp8Uwo2W\nWzxI1AWwOHLmQE+IWsfARJpfOTw8nhw3Jbknw9rd2RaKpjXv0EzKanjxrXi3iVtp\n8o0CIQDw+v1JpEP6/V8vWgJYVgHJwi03lht0dyg9bjDorHkG8wIhAMRMh3JK4opS\n42OEXooiDIYaztodtiOULf9L+8kTilUPAiAFhOoaLq3z6KuubPRSy5183nqkpEZ6\ns2PzjDuIiLK46wIhAJYlMzTosn67B9KG3QkrIgkxWCbdswNjxAsSQ3R5zcVhAiEA\n2Y+g+iMEQdp4lSXJ7jCkI0lb5URrH2gUQpvx3aoTvs4=\n-----END RSA PRIVATE KEY-----\n"
any ideas on how I can do this?
thanks
Using Flame, here is a sample public key generated:
-----BEGIN PUBLIC KEY-----
MEoCAQACQLbkpbDFbZ54bM5ybwwdCqsUHjxWQF4B0Q1sAOBFEYdpxZJZ8dAzycPz
IgSlPc8yqjeqwJQtvCpktrntALpX1ksCAwEAAQ==
-----END PUBLIC KEY-----
Using Ruby OpenSSL, here is a sample public key generated:
-----BEGIN PUBLIC KEY-----
MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMiZRXRL+l/m+HSu+QIikirFDTyTtXo4
PJZ2WU3nXYOFHsLrdwrBTR7KDYs+/w64TI7PuiuKXyKDqtRjf0UxHvUCAwEAAQ==
-----END PUBLIC KEY-----
OpenSSL::PKey::RSA.new(512).public_key
Why is there a difference in the length?
I couldn't find any test-cases or examples with your ECDSA code, so maybe I'm missing something, but I don't think so. The code below produces an invalid signature (even though it uses the same ECDSA instance for signature and verification, supposedly using the private/public keypair generated when the object is instantiated). I've tried compiling from the source code, and using the SWC as well - same result. RSA works fine.
var ba:ByteArray = new ByteArray();
ba.writeUTF("testing123");
var sha256:SHA256 = new SHA256();
var hash:ByteArray = sha256.computeHash(ba);
var ecdsa:ECDSA = new ECDSA(256);
var signature:ByteArray = ecdsa.signHash(hash);
var valid:Boolean = ecdsa.verifyHash(hash, signature);
trace('signature valid: ' + valid); // signature valid: false
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.