Skip to content

Commit dfe1dfb

Browse files
save file
1 parent 728dec8 commit dfe1dfb

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

blog/26-04-26/x509-certificates-in-js---encrypt-decrypt-data/x509-certificates-in-js---encrypt-decrypt-data.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,37 @@ <h1 class=title>
8181

8282
<div class=description>
8383
<p>
84+
This blog post describes using x509 certificates to encrypt and decrypt data in a javascript environment. This
85+
can be useful since the public certificate can be made available publicly, even sent via an insecure communication
86+
channel, this public certificate can be used to encrypt data, the encrypted data can be sent to the holder
87+
of the private key, who can subsequently decode the encrypted data using the private key.
88+
</p>
89+
<p>
90+
Node.js supports both PKCS#1 and PKCS#8 private keys, while browsers only support PKCS#8.
91+
This difference comes from how each environment exposes cryptography: Node wraps OpenSSL
92+
(very flexible), while browsers expose WebCrypto (much stricter and standardized).
8493
</p>
8594
</div>
8695

96+
<div>
97+
98+
for use in the browser
99+
100+
</div>
101+
102+
<snippet-console component id=x509-browser src='ex/x509-browser.js'></snippet-console>
103+
104+
105+
<div>
106+
107+
for use in nodejs
108+
109+
</div>
110+
111+
<snippet-editor component id=x509-nodejs src='ex/x509-nodejs.js'></snippet-editor>
112+
113+
114+
87115

88116

89117

0 commit comments

Comments
 (0)