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

Document how to use custom CA in README (#1229) #1236

Merged
merged 3 commits into from Oct 31, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 18 additions & 6 deletions README.md
Expand Up @@ -452,12 +452,12 @@ var fs = require('fs')
var options = {
url: 'https://api.some-server.com/',
agentOptions: {
'cert': fs.readFileSync(certFile),
'key': fs.readFileSync(keyFile),
cert: fs.readFileSync(certFile),
key: fs.readFileSync(keyFile),
// Or use `pfx` property replacing `cert` and `key` when using private key, certificate and CA certs in PFX or PKCS12 format:
// 'pfx': fs.readFileSync(pfxFilePath),
'passphrase': 'password',
'securityOptions': 'SSL_OP_NO_SSLv3'
// pfx: fs.readFileSync(pfxFilePath),
passphrase: 'password',
securityOptions: 'SSL_OP_NO_SSLv3'
}
};

Expand All @@ -467,11 +467,23 @@ request.get(options);
It is able to force using SSLv3 only by specifying `secureProtocol`:

```javascript
request.get({
url: 'https://api.some-server.com/',
agentOptions: {
secureProtocol: 'SSLv3_method'
}
});
```

It is possible to accept other certificates than those signed by generally allowed Certificate Authorities (CAs).
This can be useful, for example, when using self-signed certificates.
To allow a different certificate, you can specify the signing CA by adding the contents of the CA's certificate file to the `agentOptions`:

```javascript
request.get({
url: 'https://api.some-server.com/',
agentOptions: {
'secureProtocol': 'SSLv3_method'
ca: fs.readFileSync('ca.cert.pem')
}
});
```
Expand Down