Node.js  v8.x
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine
node::crypto Namespace Reference

Data Structures

class  CipherPushContext
 
class  PBKDF2Request
 
class  RandomBytesRequest
 

Functions

void ThrowCryptoError (Environment *env, unsigned long err, const char *default_message=nullptr)
 
void CheckEntropy ()
 
bool EntropySource (unsigned char *buffer, size_t length)
 
int SSL_CTX_get_issuer (SSL_CTX *ctx, X509 *cert, X509 **issuer)
 
int SSL_CTX_use_certificate_chain (SSL_CTX *ctx, X509 *x, STACK_OF(X509) *extra_certs, X509 **cert, X509 **issuer)
 
int SSL_CTX_use_certificate_chain (SSL_CTX *ctx, BIO *in, X509 **cert, X509 **issuer)
 
void UseExtraCaCerts (const std::string &file)
 
int compar (const void *a, const void *b)
 
int IsSelfSigned (X509 *cert)
 
X509 * FindRoot (STACK_OF(X509) *sk)
 
bool CertIsStartComOrWoSign (X509_NAME *name)
 
bool CheckStartComOrWoSign (X509_NAME *root_name, X509 *cert)
 
CheckResult CheckWhitelistedServerCert (X509_STORE_CTX *ctx)
 
int VerifyCallback (int preverify_ok, X509_STORE_CTX *ctx)
 
void PBKDF2 (const FunctionCallbackInfo< Value > &args)
 
void RandomBytesWork (uv_work_t *work_req)
 
void RandomBytesCheck (RandomBytesRequest *req, Local< Value >(*argv)[2])
 
void RandomBytesAfter (uv_work_t *work_req, int status)
 
void RandomBytesProcessSync (Environment *env, RandomBytesRequest *req, Local< Value >(*argv)[2])
 
void RandomBytes (const FunctionCallbackInfo< Value > &args)
 
void RandomBytesBuffer (const FunctionCallbackInfo< Value > &args)
 
void GetSSLCiphers (const FunctionCallbackInfo< Value > &args)
 
void GetCiphers (const FunctionCallbackInfo< Value > &args)
 
void GetHashes (const FunctionCallbackInfo< Value > &args)
 
void GetCurves (const FunctionCallbackInfo< Value > &args)
 
bool VerifySpkac (const char *data, unsigned int len)
 
void VerifySpkac (const FunctionCallbackInfo< Value > &args)
 
char * ExportPublicKey (const char *data, int len, size_t *size)
 
void ExportPublicKey (const FunctionCallbackInfo< Value > &args)
 
const char * ExportChallenge (const char *data, int len)
 
void ExportChallenge (const FunctionCallbackInfo< Value > &args)
 
void TimingSafeEqual (const FunctionCallbackInfo< Value > &args)
 
void InitCryptoOnce ()
 
void SetEngine (const FunctionCallbackInfo< Value > &args)
 
void GetFipsCrypto (const FunctionCallbackInfo< Value > &args)
 
void SetFipsCrypto (const FunctionCallbackInfo< Value > &args)
 
void InitCrypto (Local< Object > target, Local< Value > unused, Local< Context > context, void *priv)
 

Function Documentation

◆ CertIsStartComOrWoSign()

bool node::crypto::CertIsStartComOrWoSign ( X509_NAME *  name)
inline

Definition at line 2776 of file node_crypto.cc.

Referenced by CheckStartComOrWoSign().

◆ CheckEntropy()

void node::crypto::CheckEntropy ( )
inline

Definition at line 288 of file node_crypto.cc.

References status.

Referenced by EntropySource(), and RandomBytesWork().

◆ CheckStartComOrWoSign()

bool node::crypto::CheckStartComOrWoSign ( X509_NAME *  root_name,
X509 *  cert 
)
inline

Definition at line 2795 of file node_crypto.cc.

References CertIsStartComOrWoSign().

Referenced by CheckWhitelistedServerCert().

◆ CheckWhitelistedServerCert()

CheckResult node::crypto::CheckWhitelistedServerCert ( X509_STORE_CTX *  ctx)
inline

Definition at line 2812 of file node_crypto.cc.

References CheckStartComOrWoSign(), compar(), FindRoot(), and IsSelfSigned().

Referenced by VerifyCallback().

◆ compar()

int node::crypto::compar ( const void *  a,
const void *  b 
)
inline

Definition at line 2755 of file node_crypto.cc.

Referenced by CheckWhitelistedServerCert().

◆ EntropySource()

bool node::crypto::EntropySource ( unsigned char *  buffer,
size_t  length 
)

◆ ExportChallenge() [1/2]

const char* node::crypto::ExportChallenge ( const char *  data,
int  len 
)

Definition at line 5911 of file node_crypto.cc.

References buf.

Referenced by ExportChallenge(), and InitCrypto().

◆ ExportChallenge() [2/2]

void node::crypto::ExportChallenge ( const FunctionCallbackInfo< Value > &  args)

◆ ExportPublicKey() [1/2]

char* node::crypto::ExportPublicKey ( const char *  data,
int  len,
size_t *  size 
)

Definition at line 5845 of file node_crypto.cc.

References buf.

Referenced by ExportPublicKey(), and InitCrypto().

◆ ExportPublicKey() [2/2]

void node::crypto::ExportPublicKey ( const FunctionCallbackInfo< Value > &  args)

◆ FindRoot()

X509* node::crypto::FindRoot ( STACK_OF(X509) *  sk)
inline

Definition at line 2766 of file node_crypto.cc.

References IsSelfSigned().

Referenced by CheckWhitelistedServerCert().

◆ GetCiphers()

void node::crypto::GetCiphers ( const FunctionCallbackInfo< Value > &  args)

Definition at line 5759 of file node_crypto.cc.

References CipherPushContext::arr, and ctx.

Referenced by InitCrypto().

◆ GetCurves()

void node::crypto::GetCurves ( const FunctionCallbackInfo< Value > &  args)

Definition at line 5775 of file node_crypto.cc.

References node::Buffer::New().

Referenced by InitCrypto().

◆ GetFipsCrypto()

void node::crypto::GetFipsCrypto ( const FunctionCallbackInfo< Value > &  args)

Definition at line 6068 of file node_crypto.cc.

Referenced by InitCrypto().

◆ GetHashes()

void node::crypto::GetHashes ( const FunctionCallbackInfo< Value > &  args)

Definition at line 5767 of file node_crypto.cc.

References CipherPushContext::arr, and ctx.

Referenced by InitCrypto().

◆ GetSSLCiphers()

void node::crypto::GetSSLCiphers ( const FunctionCallbackInfo< Value > &  args)

Definition at line 5704 of file node_crypto.cc.

References node::Buffer::New().

Referenced by InitCrypto().

◆ InitCrypto()

void node::crypto::InitCrypto ( Local< Object >  target,
Local< Value >  unused,
Local< Context >  context,
void *  priv 
)

◆ InitCryptoOnce()

void node::crypto::InitCryptoOnce ( )

Definition at line 5970 of file node_crypto.cc.

Referenced by InitCrypto().

◆ IsSelfSigned()

int node::crypto::IsSelfSigned ( X509 *  cert)
inline

Definition at line 2760 of file node_crypto.cc.

Referenced by CheckWhitelistedServerCert(), and FindRoot().

◆ PBKDF2()

void node::crypto::PBKDF2 ( const FunctionCallbackInfo< Value > &  args)

◆ RandomBytes()

void node::crypto::RandomBytes ( const FunctionCallbackInfo< Value > &  args)

◆ RandomBytesAfter()

void node::crypto::RandomBytesAfter ( uv_work_t *  work_req,
int  status 
)

Definition at line 5586 of file node_crypto.cc.

References RandomBytesCheck(), req, and RandomBytesRequest::work_req_.

Referenced by RandomBytes(), and RandomBytesBuffer().

◆ RandomBytesBuffer()

void node::crypto::RandomBytesBuffer ( const FunctionCallbackInfo< Value > &  args)

◆ RandomBytesCheck()

◆ RandomBytesProcessSync()

void node::crypto::RandomBytesProcessSync ( Environment *  env,
RandomBytesRequest req,
Local< Value >(*)  argv[2] 
)

◆ RandomBytesWork()

void node::crypto::RandomBytesWork ( uv_work_t *  work_req)

◆ SetEngine()

void node::crypto::SetEngine ( const FunctionCallbackInfo< Value > &  args)

Definition at line 6028 of file node_crypto.cc.

References ThrowCryptoError().

Referenced by InitCrypto().

◆ SetFipsCrypto()

void node::crypto::SetFipsCrypto ( const FunctionCallbackInfo< Value > &  args)

Definition at line 6076 of file node_crypto.cc.

References ThrowCryptoError().

Referenced by InitCrypto().

◆ SSL_CTX_get_issuer()

int node::crypto::SSL_CTX_get_issuer ( SSL_CTX *  ctx,
X509 *  cert,
X509 **  issuer 
)

Definition at line 523 of file node_crypto.cc.

Referenced by SSL_CTX_use_certificate_chain().

◆ SSL_CTX_use_certificate_chain() [1/2]

int node::crypto::SSL_CTX_use_certificate_chain ( SSL_CTX *  ctx,
X509 *  x,
STACK_OF(X509) *  extra_certs,
X509 **  cert,
X509 **  issuer 
)

Definition at line 541 of file node_crypto.cc.

References SSL_CTX_get_issuer().

Referenced by SSL_CTX_use_certificate_chain(), and UseExtraCaCerts().

◆ SSL_CTX_use_certificate_chain() [2/2]

int node::crypto::SSL_CTX_use_certificate_chain ( SSL_CTX *  ctx,
BIO *  in,
X509 **  cert,
X509 **  issuer 
)

Definition at line 614 of file node_crypto.cc.

References done, SSL_CTX_use_certificate_chain(), and ThrowCryptoError().

◆ ThrowCryptoError()

void node::crypto::ThrowCryptoError ( Environment *  env,
unsigned long  err,
const char *  default_message = nullptr 
)

◆ TimingSafeEqual()

void node::crypto::TimingSafeEqual ( const FunctionCallbackInfo< Value > &  args)

Definition at line 5953 of file node_crypto.cc.

References node::Buffer::Data(), node::Buffer::Length(), and THROW_AND_RETURN_IF_NOT_BUFFER.

Referenced by InitCrypto().

◆ UseExtraCaCerts()

◆ VerifyCallback()

◆ VerifySpkac() [1/2]

bool node::crypto::VerifySpkac ( const char *  data,
unsigned int  len 
)

Definition at line 5797 of file node_crypto.cc.

Referenced by InitCrypto(), and VerifySpkac().

◆ VerifySpkac() [2/2]

void node::crypto::VerifySpkac ( const FunctionCallbackInfo< Value > &  args)