Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smimedemo #196

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open

Smimedemo #196

wants to merge 58 commits into from

Conversation

koolsys
Copy link

@koolsys koolsys commented Oct 3, 2018

CMS S/MIME demo that's confirmed to work with an MUA.

Short basic usage video here: https://www.youtube.com/watch?v=41bdkGS8Y-c channel should also have a video tutorial for more complicated usage including MUA along with code changes.

David Koolhoven added 2 commits October 3, 2018 12:03
demo. Only works with the most up to date MUA which there
only seems to be one open source project availabe at this
time.

Offloaded many switches into a separate config file named
"smime.js". DOM operation centric routines where placed into
"dom.js"

Expanded the field which can be created in an X509
certificate or PKCS10 to include alternate_name fields,
including IP addresses. Removed email from the DN as it's
depricated.

Added nessesary parsing so multipart/signed messages can be
parsed in this demo long with opaque signed.

Expanded the amount of information extracted from included
message certificates. Fields are first returned in an object
with arrays, which are then proccessed into a table.

Certificate chain for verification is extracted from the
message at time of parsing.

On branch smimedemo
Changes to be committed:
	new file:   examples/CMSSignedEncryptComplexExample/README.md
	new file:   examples/CMSSignedEncryptComplexExample/SMIMESignEncryptionExample.xhtml
	new file:   examples/CMSSignedEncryptComplexExample/dom.js
	new file:   examples/CMSSignedEncryptComplexExample/es6.js
	new file:   examples/CMSSignedEncryptComplexExample/package.json
	new file:   examples/CMSSignedEncryptComplexExample/rollup.config.js
	new file:   examples/CMSSignedEncryptComplexExample/smime.js
 On branch smimedemo
 Changes to be committed:
	deleted:    examples/CMSSignedEncryptComplexExample/bundle.js
@rmhrisk
Copy link
Contributor

rmhrisk commented Oct 3, 2018

This is great, I have wanted to do this for some time. In-fact the idea was to take https://github.com/ebidel/polymer-gmail and create a full-featured demo application. In any event thanks for the sample .We will review it and provide feedback.

@koolsys
Copy link
Author

koolsys commented Oct 4, 2018

More to come. I forgot to make the line endings CRLF before committing. I'll have that pushed in a couple hours. In a couple days I should have a video up with a long example, and then an other one where I go over some code that even I think is a problem (that I wrote).

Changes to be committed:
	modified:   examples/CMSSignedEncryptComplexExample/README.md
	modified:   examples/CMSSignedEncryptComplexExample/SMIMESignEncryptionExample.xhtml
	modified:   examples/CMSSignedEncryptComplexExample/dom.js
	modified:   examples/CMSSignedEncryptComplexExample/es6.js
	modified:   examples/CMSSignedEncryptComplexExample/rollup.config.js
	modified:   examples/CMSSignedEncryptComplexExample/smime.js
@YuryStrozhevsky
Copy link
Collaborator

@koolsys Have you seen this example?

  1. I do like you to rename example to something like SMIMESignedEncryptComplexExample because in fact all your data is not a pure CMS, but S/MIME;
  2. Then as soon you have modified CMSSignedComplexExample you need to provide test cases for your code (at the end of es6.js) and change test name;
  3. Correct your Web page layer - field titles at the same line as field looks ugly. Also correct this table layer:
    untitled2
  4. Bad style to user var variable = .. in ES6 code. Same - bad style to use new Array instead of const ar = []. Same for new Object instead of {};
  5. Please align your code with existing ESLint rules for PKI.js. There are a lot of errors like variable already defined - re-definition in your code and stuff like that;
  6. Function this.importKey returns nothing. Not sure you planned it this way;

Later I will continue with your code. But please correct all the issues above.

@YuryStrozhevsky
Copy link
Collaborator

What is it?
that.csrcreatedcb;

And this: that.csrsignfailcb;

Are these variables or function calls? Anyway, please pass ESLint tests before you put a pull request.

@@ -0,0 +1,9 @@
{
"scripts": {
"build": "rollup -c && sed -f ../script.sed es6.js > ../../test/s_howToEncryptCMSviaCertificate.js",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to change this name: ../../test/s_howToEncryptCMSviaCertificate.js

@koolsys
Copy link
Author

koolsys commented Oct 4, 2018

Will do.

' "build": "rollup -c && sed -f ../script.sed es6.js > ../../test/s_howToEncryptCMSviaCertificate.js",' was added in so long ago I can't remember why it was anymore.

I'll get on that. I mostly just program in C, and my Javascript is a little old. So, I wasn't even familiar with JSLint.

For renaming the example, there's the older S/MIME and then CMS based S/MIME. Would something like SMIMECMSSignEncryptExample work?

@koolsys
Copy link
Author

koolsys commented Oct 4, 2018

Also, should we cancel this pull request and start over fresh to prevent junking up the git repo once it's ready?

@YuryStrozhevsky
Copy link
Collaborator

No, please continue in scope of this request - just update code in your branch.

@YuryStrozhevsky
Copy link
Collaborator

As for naming - we already have set of SMIME examples and set of CMS examples. So please rename it as having only “SMIME...” at the beginning.

David Koolhoven added 15 commits October 5, 2018 11:58
Changes to be committed:
	new file:   SMIMESignedEncryptComplexExample/README.md
	new file:   SMIMESignedEncryptComplexExample/SMIMESignEncryptionExample.xhtml
	new file:   SMIMESignedEncryptComplexExample/dom.js
	new file:   SMIMESignedEncryptComplexExample/es6.js
	new file:   SMIMESignedEncryptComplexExample/package.json
	new file:   SMIMESignedEncryptComplexExample/rollup.config.js
	new file:   SMIMESignedEncryptComplexExample/smime.js

Changes not staged for commit:
	deleted:    CMSSignedEncryptComplexExample/README.md
	deleted:    CMSSignedEncryptComplexExample/SMIMESignEncryptionExample.xhtml
	deleted:    CMSSignedEncryptComplexExample/dom.js
	deleted:    CMSSignedEncryptComplexExample/es6.js
	deleted:    CMSSignedEncryptComplexExample/package.json
	deleted:    CMSSignedEncryptComplexExample/rollup.config.js
	deleted:    CMSSignedEncryptComplexExample/smime.js
	modified:   examples/SMIMESignedEncryptComplexExample/dom.js
	modified:   examples/SMIMESignedEncryptComplexExample/es6.js
	modified:   examples/SMIMESignedEncryptComplexExample/smime.js
Changes to be committed:
	modified:   examples/SMIMESignedEncryptComplexExample/package.json
possible.

Changes to be committed:
	modified:   examples/SMIMESignedEncryptComplexExample/es6.js
Changes to be committed:
	deleted:    examples/CMSSignedEncryptComplexExample/README.md
	deleted:    examples/CMSSignedEncryptComplexExample/SMIMESignEncryptionExample.xhtml
	deleted:    examples/CMSSignedEncryptComplexExample/dom.js
	deleted:    examples/CMSSignedEncryptComplexExample/es6.js
	deleted:    examples/CMSSignedEncryptComplexExample/package.json
	deleted:    examples/CMSSignedEncryptComplexExample/rollup.config.js
	deleted:    examples/CMSSignedEncryptComplexExample/smime.js
var Blob;
var crypto;
var TextEncoder;
var TextDecoder;
var context;
var it;
var assert;

Options: Allow "this",
         Allow bitwise operators.
the functions would operate in.

Removed one variable from the global space.
tables to list Subject attribute value pairs, and alt name
rather than generating a DN string and an unordered.
certificate will now share the same localKeyID.
@koolsys
Copy link
Author

koolsys commented Oct 25, 2018

New demonstration video is up with JavaScript client to binary client email signing and encryption. It includes all setup sets, and ends with a brief code overview.

https://www.youtube.com/watch?v=jIAT29SOh7c

@koolsys
Copy link
Author

koolsys commented Oct 25, 2018

I think this is ready for code review at this point. I still need to build a proper test page.

@rmhrisk
Copy link
Contributor

rmhrisk commented Oct 26, 2018

@YuryStrozhevsky can do a review.

YuryStrozhevsky and others added 30 commits November 11, 2018 07:00
Signed-off-by: YuryStrozhevsky <yury@strozhevsky.com>
Signed-off-by: YuryStrozhevsky <yury@strozhevsky.com>
Signed-off-by: YuryStrozhevsky <yury@strozhevsky.com>
Signed-off-by: YuryStrozhevsky <yury@strozhevsky.com>
Checks for scheme type on data before decoding, this allows
us to alert the user if a key is being used where a
certificate should be. Also checks for base64 decode success
before continuing.
Removed setEngine call as issue PeculiarVentures#204 is closed upstream.
demo. Only works with the most up to date MUA which there
only seems to be one open source project availabe at this
time.

Offloaded many switches into a separate config file named
"smime.js". DOM operation centric routines where placed into
"dom.js"

Expanded the field which can be created in an X509
certificate or PKCS10 to include alternate_name fields,
including IP addresses. Removed email from the DN as it's
depricated.

Added nessesary parsing so multipart/signed messages can be
parsed in this demo long with opaque signed.

Expanded the amount of information extracted from included
message certificates. Fields are first returned in an object
with arrays, which are then proccessed into a table.

Certificate chain for verification is extracted from the
message at time of parsing.

On branch smimedemo
Changes to be committed:
	new file:   examples/CMSSignedEncryptComplexExample/README.md
	new file:   examples/CMSSignedEncryptComplexExample/SMIMESignEncryptionExample.xhtml
	new file:   examples/CMSSignedEncryptComplexExample/dom.js
	new file:   examples/CMSSignedEncryptComplexExample/es6.js
	new file:   examples/CMSSignedEncryptComplexExample/package.json
	new file:   examples/CMSSignedEncryptComplexExample/rollup.config.js
	new file:   examples/CMSSignedEncryptComplexExample/smime.js
 On branch smimedemo
 Changes to be committed:
	deleted:    examples/CMSSignedEncryptComplexExample/bundle.js
Changes to be committed:
	modified:   examples/CMSSignedEncryptComplexExample/README.md
	modified:   examples/CMSSignedEncryptComplexExample/SMIMESignEncryptionExample.xhtml
	modified:   examples/CMSSignedEncryptComplexExample/dom.js
	modified:   examples/CMSSignedEncryptComplexExample/es6.js
	modified:   examples/CMSSignedEncryptComplexExample/rollup.config.js
	modified:   examples/CMSSignedEncryptComplexExample/smime.js
Changes to be committed:
	new file:   SMIMESignedEncryptComplexExample/README.md
	new file:   SMIMESignedEncryptComplexExample/SMIMESignEncryptionExample.xhtml
	new file:   SMIMESignedEncryptComplexExample/dom.js
	new file:   SMIMESignedEncryptComplexExample/es6.js
	new file:   SMIMESignedEncryptComplexExample/package.json
	new file:   SMIMESignedEncryptComplexExample/rollup.config.js
	new file:   SMIMESignedEncryptComplexExample/smime.js

Changes not staged for commit:
	deleted:    CMSSignedEncryptComplexExample/README.md
	deleted:    CMSSignedEncryptComplexExample/SMIMESignEncryptionExample.xhtml
	deleted:    CMSSignedEncryptComplexExample/dom.js
	deleted:    CMSSignedEncryptComplexExample/es6.js
	deleted:    CMSSignedEncryptComplexExample/package.json
	deleted:    CMSSignedEncryptComplexExample/rollup.config.js
	deleted:    CMSSignedEncryptComplexExample/smime.js
	modified:   examples/SMIMESignedEncryptComplexExample/dom.js
	modified:   examples/SMIMESignedEncryptComplexExample/es6.js
	modified:   examples/SMIMESignedEncryptComplexExample/smime.js
Changes to be committed:
	modified:   examples/SMIMESignedEncryptComplexExample/package.json
possible.

Changes to be committed:
	modified:   examples/SMIMESignedEncryptComplexExample/es6.js
Changes to be committed:
	deleted:    examples/CMSSignedEncryptComplexExample/README.md
	deleted:    examples/CMSSignedEncryptComplexExample/SMIMESignEncryptionExample.xhtml
	deleted:    examples/CMSSignedEncryptComplexExample/dom.js
	deleted:    examples/CMSSignedEncryptComplexExample/es6.js
	deleted:    examples/CMSSignedEncryptComplexExample/package.json
	deleted:    examples/CMSSignedEncryptComplexExample/rollup.config.js
	deleted:    examples/CMSSignedEncryptComplexExample/smime.js
var Blob;
var crypto;
var TextEncoder;
var TextDecoder;
var context;
var it;
var assert;

Options: Allow "this",
         Allow bitwise operators.
the functions would operate in.

Removed one variable from the global space.
tables to list Subject attribute value pairs, and alt name
rather than generating a DN string and an unordered.
certificate will now share the same localKeyID.
internal variable rather than a text field in the document.
each time a new certificate is added to the textarea.
tables to the document object. Information regarding parsed
messages is cleared before new information is appended to
the document object. Message encapsulation is now included.
Added setEngine call so getCrypto will return undefined if
window.crypto.subtle is undefined.
Checks for scheme type on data before decoding, this allows
us to alert the user if a key is being used where a
certificate should be. Also checks for base64 decode success
before continuing.
Removed setEngine call as issue PeculiarVentures#204 is closed upstream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants