SharkSSL™ Embedded SSL/TLS Stack
RayCrypto API

Detailed Description

Cryptographic functions, including RSA, ECC, AES, hashing, etc..

RayCrypto offers developers a rich selection of cryptographic technologies, methods including RSA and elliptic curve, symmetric algorithms like 3DES and AES, message authentication, hashing and pseudorandom number generation.

Modules

 MD5
 MD5 cryptographic hash.
 
 SHA1
 SHA1 cryptographic hash.
 
 SHA256
 SHA256 cryptographic hash.
 
 SHA384
 SHA384 cryptographic hash.
 
 SHA512
 SHA512 cryptographic hash.
 
 HMAC
 HMAC keyed-hash message authentication code (in conjunction with: MD5,SHA1,SHA256,SHA384,SHA512)
 
 ARC4
 ARC4.
 
 DES
 DES.
 
 AES
 AES.
 
 AES-GCM
 AES-GCM.
 
 AES-CCM
 AES-CCM.
 
 POLY1305
 POLY1305.
 
 CHACHA20
 CHACHA20.
 
 ECDSA sign/verify functions
 See Signing and Verifying Binaries for an example of how to use the ECDSA ECDSA sign/verify functions.
 
 RSA encrypt/decrypt functions
 

Enumerations

enum  sharkssl_PEM_RetVal {
  SHARKSSL_PEM_OK = 0 , SHARKSSL_PEM_OK_PUBLIC = 1 , SHARKSSL_PEM_ALLOCATION_ERROR = - 3000 , SHARKSSL_PEM_KEY_PARSE_ERROR ,
  SHARKSSL_PEM_KEY_WRONG_IV , SHARKSSL_PEM_KEY_WRONG_LENGTH , SHARKSSL_PEM_KEY_PASSPHRASE_REQUIRED , SHARKSSL_PEM_KEY_UNRECOGNIZED_FORMAT ,
  SHARKSSL_PEM_KEY_UNSUPPORTED_FORMAT , SHARKSSL_PEM_KEY_UNSUPPORTED_MODULUS_LENGTH , SHARKSSL_PEM_KEY_UNSUPPORTED_EXPONENT_LENGTH , SHARKSSL_PEM_KEY_UNSUPPORTED_ENCRYPTION_TYPE ,
  SHARKSSL_PEM_KEY_CERT_MISMATCH , SHARKSSL_PEM_CERT_UNRECOGNIZED_FORMAT , SHARKSSL_PEM_CERT_UNSUPPORTED_TYPE , SHARKSSL_PEM_KEY_UNSUPPORTED_VERSION ,
  SHARKSSL_PEM_KEY_REQUIRED , SHARKSSL_PEM_KEY_PRIVATE_KEY_REQUIRED , SHARKSSL_PEM_INTERNAL_ERROR
}
 Return values from function sharkssl_PEM. More...
 

Functions

SHARKSSL_API sharkssl_PEM_RetVal sharkssl_PEM (const char *certPEM, const char *keyPEM, const char *passphrase, SharkSslCert *sharkSslCert)
 Create a SharkSslCert certificate by using a certificate and key in PEM format. More...
 

Enumeration Type Documentation

◆ sharkssl_PEM_RetVal

Return values from function sharkssl_PEM.

Enumerator
SHARKSSL_PEM_OK 

OK.

SHARKSSL_PEM_OK_PUBLIC 

OK_PUBLIC.

SHARKSSL_PEM_ALLOCATION_ERROR 

ALLOCATION_ERROR.

SHARKSSL_PEM_KEY_PARSE_ERROR 

KEY_PARSE_ERROR.

SHARKSSL_PEM_KEY_WRONG_IV 

KEY_WRONG_IV.

SHARKSSL_PEM_KEY_WRONG_LENGTH 

KEY_WRONG_LENGTH.

SHARKSSL_PEM_KEY_PASSPHRASE_REQUIRED 

KEY_PASSPHRASE_REQUIRED.

SHARKSSL_PEM_KEY_UNRECOGNIZED_FORMAT 

KEY_UNRECOGNIZED_FORMAT.

SHARKSSL_PEM_KEY_UNSUPPORTED_FORMAT 

KEY_UNSUPPORTED_FORMAT.

SHARKSSL_PEM_KEY_UNSUPPORTED_MODULUS_LENGTH 

KEY_UNSUPPORTED_MODULUS_LENGTH.

SHARKSSL_PEM_KEY_UNSUPPORTED_EXPONENT_LENGTH 

KEY_UNSUPPORTED_EXPONENT_LENGTH.

SHARKSSL_PEM_KEY_UNSUPPORTED_ENCRYPTION_TYPE 

KEY_UNSUPPORTED_ENCRYPTION_TYPE.

SHARKSSL_PEM_KEY_CERT_MISMATCH 

KEY_CERT_MISMATCH.

SHARKSSL_PEM_CERT_UNRECOGNIZED_FORMAT 

CERT_UNRECOGNIZED_FORMAT.

SHARKSSL_PEM_CERT_UNSUPPORTED_TYPE 

CERT_UNSUPPORTED_TYPE.

SHARKSSL_PEM_KEY_UNSUPPORTED_VERSION 

KEY_UNSUPPORTED_VERSION.

SHARKSSL_PEM_KEY_REQUIRED 

KEY_REQUIRED.

SHARKSSL_PEM_KEY_PRIVATE_KEY_REQUIRED 

A PRIVATE KEY IS REQUIRED.

SHARKSSL_PEM_INTERNAL_ERROR 

INTERNAL ERROR.

Function Documentation

◆ sharkssl_PEM()

SHARKSSL_API sharkssl_PEM_RetVal sharkssl_PEM ( const char *  certPEM,
const char *  keyPEM,
const char *  passphrase,
SharkSslCert sharkSslCert 
)

Create a SharkSslCert certificate by using a certificate and key in PEM format.

example:

int addMyCert(SharkSsl* shark)
{
SharkSslCert *sharkCert;
// The two following functions illustrate how a certificate and
// key can be read from a file system and inserted into an
// allocated buffer.
char* cert=readMyCertFromFileSystem();
char* key=readMyKeyFromFileSystem();
if(sharkssl_PEM(cert,key,NULL,&sharkCert))
return -1;
free(cert);
free(key);
// You may redesign the code and keep a reference to the
// SharkSslCert object if you design a system using dynamic objects
// i.e. if you later plan on releasing the SharkSSL object and
// the SharkSslCert object. You cannot release the SharkSslCert
// object before releasing the SharkSSL object.
SharkSsl_addCertificate(shark,sharkCert);
return 0;
}
SHARKSSL_API sharkssl_PEM_RetVal sharkssl_PEM(const char *certPEM, const char *keyPEM, const char *passphrase, SharkSslCert *sharkSslCert)
Create a SharkSslCert certificate by using a certificate and key in PEM format.
SHARKSSL_API U8 SharkSsl_addCertificate(SharkSsl *o, SharkSslCert cert)
Add a certificate to the SharkSsl object.
const U8 * SharkSslCert
The SharkSSL Certificate is in a binary format optimized for speed and size.
Definition: SharkSSL.h:317
A SharkSsl object is the coordinator for managing SharkSslCon objects (See SharkSsl_constructor for d...
Definition: SharkSSL.h:561