Skip to content

Instantly share code, notes, and snippets.

@koichik
Created August 9, 2011 11:55
Show Gist options
  • Save koichik/1133842 to your computer and use it in GitHub Desktop.
Save koichik/1133842 to your computer and use it in GitHub Desktop.
tls.markdown
### tls.CleartextStream
This is a stream on top of the *Encrypted* stream.
This makes it possible to read/write an encrypted data as a cleartext data.
This instance implements a duplex Stream interfaces.
It has all the common stream methods and events.
#### cleartextStream.authorized
A boolean that is `true` if the peer certificate was signed by one of the specified CAs, otherwise `false`
#### cleartextStream.authorizationError
The reason why the peer's certificate has not been verified.
This property becomes available only when `cleartextStream.authorized === false`.
#### cleartextStream.getPeerCertificate()
Returns an object representing the peer's certicicate.
The returned object has some properties corresponding to the field of the certificate.
Example:
{ subject:
{ C: 'UK',
ST: 'Acknack Ltd',
L: 'Rhys Jones',
O: 'node.js',
OU: 'Test TLS Certificate',
CN: 'localhost' },
issuer:
{ C: 'UK',
ST: 'Acknack Ltd',
L: 'Rhys Jones',
O: 'node.js',
OU: 'Test TLS Certificate',
CN: 'localhost' },
valid_from: 'Nov 11 09:52:22 2009 GMT',
valid_to: 'Nov 6 09:52:22 2029 GMT',
fingerprint: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF' }
If the peer does not provide a certificate, it returns `null` or an empty object.
@atsuya
Copy link

atsuya commented Aug 9, 2011

A boolean that is true if the peer certificate was signed by one of the specified CAs.

この文章自体は良いと思いますが、どういう時にtrueじゃないのかもあったほうがいいと思います。
A boolean that is true if the peer certificate was signed by one of the specified CAs, otherwise false. とかですかね。

The reason the peer's certificate has not been verified.
This property exists only if cleartextStream.authorized === false.

大きく問題はありませんが、私なら
The reason why the peer's certificate has not been verified.
This property becomes available only when cleartextStream.authorized === false.
とかかな。

The returning object has some properties corresponding to the field of the certificate.

The returned objectの方がいいかもです。

If the peer has not been verified, returns null

最後のところが、it returns null. の方がはっきりするかもです。

いずれにしても、私の修正なしでも全然通じますよ!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment