BankID C Server
 All Files Functions Typedefs Macros
Macros | Typedefs | Functions
BIDCSERVER.h File Reference
#include "constants.h"

Go to the source code of this file.

Macros

#define BIDCSERVER_API   __declspec(dllimport)
 
#define BIDCALLCONV   __cdecl
 

Typedefs

typedef int SESSION_HANDLE
 

Functions

BIDCSERVER_API int BIDCALLCONV BID_Initialize ()
 
BIDCSERVER_API int BIDCALLCONV BID_HSMInitialize (const char *pkcs11driver)
 
BIDCSERVER_API int BIDCALLCONV BID_Finalize ()
 
BIDCSERVER_API int BIDCALLCONV BID_OpenSession (SESSION_HANDLE *sessioncontext, const char *keylocation, const char *password, const char *configlocation, const char *webaddress, const char *tagcache, const char *trustedstore, const char *grantedpolicies, const char *proxyserver, const char *proxyport)
 
BIDCSERVER_API int BIDCALLCONV BID_HSMOpenSession (SESSION_HANDLE *sessioncontext, const char *keylocation, const char *password, const char *configlocation, const char *webaddress, const char *tagcache, const char *trustedstore, const char *grantedpolicies, const char *proxyserver, const char *proxyport, const char *pkcs11password, const int slot)
 
BIDCSERVER_API int BIDCALLCONV BID_RAHSMOpenSession (SESSION_HANDLE *sessioncontext, const char *keylocation, const char *password, const char *pkcs11password, const int slot)
 
BIDCSERVER_API int BIDCALLCONV BID_CloseSession (SESSION_HANDLE sessioncontext)
 
BIDCSERVER_API int BIDCALLCONV BID_SignData (const SESSION_HANDLE sessioncontext, const unsigned char *data, const size_t datalen, char **pkcs7)
 
BIDCSERVER_API int BIDCALLCONV BID_SignXML (const int sessioncontext, const unsigned char *xml, const size_t xmllen, const unsigned char *xsl, const size_t xsllen, char **pkcs7, char **data)
 
BIDCSERVER_API int BIDCALLCONV BID_SignDataP1 (const SESSION_HANDLE sessioncontext, const unsigned char *data, const size_t datalen, char **pkcs1)
 
BIDCSERVER_API int BIDCALLCONV BID_CreateXMLDSIG (const SESSION_HANDLE sessioncontext, const char *c14nxmlorder, char **xmldsig, int *certexpiresin)
 
BIDCSERVER_API int BIDCALLCONV BID_VerifyData (const SESSION_HANDLE sessioncontext, const char *pkcs7, const unsigned char *data, const size_t datalen)
 
BIDCSERVER_API int BIDCALLCONV BID_HashVerifyData (const SESSION_HANDLE sessioncontext, const char *pkcs7, const char *hash, const int auth)
 
BIDCSERVER_API int BIDCALLCONV BID_AuthenticateClient (const SESSION_HANDLE sessioncontext, const char *pkcs7, const char *serverchallenge)
 
BIDCSERVER_API int BIDCALLCONV BID_AuthenticateServer (const SESSION_HANDLE sessioncontext, char **pkcs7, char **serverchallenge, const char *clientchallenge, const char *authenticationheader, const char *prepareText)
 
BIDCSERVER_API int BIDCALLCONV BID_HashData (const SESSION_HANDLE sessioncontext, char **hash, const int hashalgorithm, const char *data)
 
BIDCSERVER_API int BIDCALLCONV BID_GetRandom (const SESSION_HANDLE sessioncontext, char **rand, const size_t randlen)
 
BIDCSERVER_API int BIDCALLCONV BID_Base64Encode (const SESSION_HANDLE sessioncontext, const unsigned char *in, const size_t inlen, char **out)
 
BIDCSERVER_API int BIDCALLCONV BID_Base64Decode (const SESSION_HANDLE sessioncontext, const char *in, unsigned char **out, size_t *outlen)
 
BIDCSERVER_API int BIDCALLCONV BID_RemoveCRLF (const SESSION_HANDLE sessioncontext, const char *in, char **out)
 
BIDCSERVER_API int BIDCALLCONV BID_GetPKCS7Info (const SESSION_HANDLE sessioncontext, const char *pkcs7, const int infoitem, char **out)
 
BIDCSERVER_API int BIDCALLCONV BID_SetInfoItem (const SESSION_HANDLE sessioncontext, const char *key, const char *value)
 
BIDCSERVER_API int BIDCALLCONV BID_GetInfoItem (const SESSION_HANDLE sessioncontext, const char *key, char **value)
 
BIDCSERVER_API int BIDCALLCONV BID_RemoveInfoItems (const SESSION_HANDLE sessioncontext)
 
BIDCSERVER_API int BIDCALLCONV BID_GetCertStatus (const SESSION_HANDLE sessioncontext, const char *pkcs7, char **ocspresponse)
 
BIDCSERVER_API int BIDCALLCONV BID_GetOwnCertStatus (const SESSION_HANDLE sessioncontext, char **ocspresponse)
 
BIDCSERVER_API int BIDCALLCONV BID_CreateSDO (const SESSION_HANDLE sessioncontext, BID_SEIDSDO **sdo, const char *data, const char *datatype, const char *datadescription, const char *clientpkcs7, const char *serverpkcs7, const char *clientocspresponse, const char *serverocspresponse)
 
BIDCSERVER_API int BIDCALLCONV BID_CreateDynamicSDO (const SESSION_HANDLE sessioncontext, BID_SEIDSDO **sdo, const char *data, const char *datatype, const char *datadescription, const BID_Signature *signatures)
 
BIDCSERVER_API int BIDCALLCONV BID_SDOToXMLEx (const SESSION_HANDLE sessioncontext, const BID_SEIDSDO *sdo, char **sdoxml)
 
BIDCSERVER_API int BIDCALLCONV BID_DynamicSDOValidate (const SESSION_HANDLE sessioncontext, const BID_SEIDSDO *sdo, const char *data, const int numsignatures, const int sealcheck)
 
BIDCSERVER_API int BIDCALLCONV BID_SDOValidate (const SESSION_HANDLE sessioncontext, const BID_SEIDSDO *sdo, const int verifydata)
 
BIDCSERVER_API int BIDCALLCONV BID_SDOXMLValidate (const SESSION_HANDLE sessioncontext, const char *sdo, const int verifydata)
 
BIDCSERVER_API int BIDCALLCONV BID_SDOFree (const SESSION_HANDLE sessioncontext, BID_SEIDSDO *sdo)
 
BIDCSERVER_API int BID_SignaturesFree (const SESSION_HANDLE sessioncontext, BID_Signature *signature)
 
BIDCSERVER_API int BIDCALLCONV BID_SDOAddData (const SESSION_HANDLE sessioncontext, BID_SEIDSDO *sdo, const char *data)
 
BIDCSERVER_API int BIDCALLCONV BID_SDOSeal (const SESSION_HANDLE sessioncontext, BID_SEIDSDO *sdo, const char *ocsp, const char *data)
 
BIDCSERVER_API int BIDCALLCONV BID_SDOAddSignature (const SESSION_HANDLE sessioncontext, BID_SEIDSDO *sdo, const BID_Signature *signatures, const char *data)
 
BIDCSERVER_API int BIDCALLCONV BID_Free (char *allocated)
 
BIDCSERVER_API int BIDCALLCONV BID_GetRecentError (const SESSION_HANDLE sessioncontext, char **error)
 
BIDCSERVER_API int BIDCALLCONV BID_XMLToSDOEx (const SESSION_HANDLE sessioncontext, const char *sdoxml, BID_SEIDSDO **sdo)
 
BIDCSERVER_API int BIDCALLCONV BID_CreateSecureChannel (const SESSION_HANDLE sessioncontext, const char *pkcs7, char **channelpkcs7, char **channeldata)
 
BIDCSERVER_API int BIDCALLCONV BID_AssymetricDecrypt (const SESSION_HANDLE sessioncontext, const char *keylocation, const char *password, const char *encrypted, char **decrypted)
 
BIDCSERVER_API int BIDCALLCONV BID_GetCertStatusWithNonce (const SESSION_HANDLE sessioncontext, const char *pkcs7, char **ocspresponse, char **nonce)
 
BIDCSERVER_API int BIDCALLCONV BID_GetSessionStoreInfo (const SESSION_HANDLE sessioncontext, BID_SessionInfo **sessioninfo)
 
BIDCSERVER_API int BIDCALLCONV BID_FreeSessionStoreInfo (const SESSION_HANDLE sessioncontext, BID_SessionInfo *sessioninfo)
 
BIDCSERVER_API int BIDCALLCONV BID_RequestMobileAction (const SESSION_HANDLE sessioncontext, char **transactionreference)
 
BIDCSERVER_API int BIDCALLCONV BID_PushSms (const SESSION_HANDLE sessioncontext, const char *transactionreference, const char *text)
 
BIDCSERVER_API int BIDCALLCONV BID_GetSigners (const SESSION_HANDLE sessioncontext, BID_Signature *signatures, char **signers)
 
BIDCSERVER_API int BIDCALLCONV BID_DynamicSDOGetSigners (const SESSION_HANDLE sessioncontext, const BID_SEIDSDO *sdo, char **signers)
 
BIDCSERVER_API int BIDCALLCONV BID_DynamicSDOXMLGetSigners (const SESSION_HANDLE sessioncontext, const char *sdo, char **signers)
 
BIDCSERVER_API int BIDCALLCONV BID_SimpleDynamicSDOXMLValidate (const SESSION_HANDLE sessioncontext, const char *sdo, const int minnumsignatures)
 
BIDCSERVER_API int BIDCALLCONV BID_RequestMobileStatus (const SESSION_HANDLE sessioncontext, const char *transactionreference, char **transactionstatus)
 
BIDCSERVER_API int BIDCALLCONV BID_GenerateMerchantReference (const int sessioncontext, const char *locale, char **merchantreference)
 
BIDCSERVER_API int BIDCALLCONV BID_DecryptTransactionData (const int sessioncontext, const char *enckey, const char *encdata, const char *encauth, const char *operation, const char *sid, char **data, char **key)
 
BIDCSERVER_API int BIDCALLCONV BID_InitTransaction (const int sessioncontext, const char *enckey, const char *encdata, const char *encauth, const char *operation, const char *sid, char **response)
 
BIDCSERVER_API int BIDCALLCONV BID_VerifyTransactionRequest (const int sessioncontext, const char *enckey, const char *encdata, const char *encauth, const char *operation, const char *sid)
 
BIDCSERVER_API int BIDCALLCONV BID_VerifyTransactionResponse (const int sessioncontext, char **response)
 
BIDCSERVER_API int BIDCALLCONV BID_SDOXMLExtractSignatures (const int sessioncontext, const char *sdoxml, char **data, char **datatype, char **datadescription, BID_Signature **signatures)
 
BIDCSERVER_API int BIDCALLCONV BID_GetTransactionInfo (const int sessioncontext, const char *key, const char *oids, const char *timeout)
 
BIDCSERVER_API int BIDCALLCONV BID_InitSession (const int sessioncontext, char **helperuri, char **traceid, char **clientid)
 
BIDCSERVER_API int BIDCALLCONV BID_GetVersionInfo (char **versioninfo)
 
BIDCSERVER_API int BIDCALLCONV BID_AddDocumentText (const int sessioncontext, const char *data, const char *dataDescription)
 
BIDCSERVER_API int BIDCALLCONV BID_AddDocumentXML (const int sessioncontext, const char *xml, const char *xsl, const char *dataDescription)
 
BIDCSERVER_API int BIDCALLCONV BID_AddDocumentPDF (const int sessioncontext, const char *data, const char *dataDescription)
 
BIDCSERVER_API int BIDCALLCONV BID_AddDocumentPDFSerialSign (const int sessioncontext, const char *data, const char *dataDescription, BID_SerialSigningKind kind, BID_VisualSealPosition *merchant_seal_position, BID_VisualSealPosition *end_user_seal_position)
 
BIDCSERVER_API int BIDCALLCONV BID_InitTransactionSelfAssembler (const int sessioncontext, const char *enc_key, const char *enc_data, const char *enc_auth, const char *operation, const char *sid, BID_VisualSealBuilder merchant_visual_seal_builder, char **response)
 
BIDCSERVER_API int BIDCALLCONV BID_InitSignBuildEndUserSeal (const int sessioncontext, const char *enckey, const char *encdata, const char *encauth, const char *operation, const char *sid, BID_VisualSealBuilder end_user_visual_seal_builder, char **response)
 
BIDCSERVER_API int BIDCALLCONV BID_InitSignSignMerchantSeal (const int sessioncontext, const char *enckey, const char *encdata, const char *encauth, const char *operation, const char *sid, char **response)
 
BIDCSERVER_API int BIDCALLCONV BID_VerifySignAddDSS (const int sessioncontext, const char *enckey, const char *encdata, const char *encauth, const char *operation, const char *sid, char **response)
 
BIDCSERVER_API int BIDCALLCONV BID_VerifyTransactionRequestSelfAssembler (const int sessioncontext, const char *enckey, const char *encdata, const char *encauth, const char *operation, const char *sid, BID_ValidationBuilder validation_increment_builder)
 
BIDCSERVER_API int BIDCALLCONV BID_GetSerialSignedData (const int sessioncontext, const int docnum, BID_SerialSigningData **serial_signing_data)
 
BIDCSERVER_API int BIDCALLCONV BID_GetSerialSignedPdf (const int sessioncontext, const int docnum, char **pdfDataB64)
 
BIDCSERVER_API int BIDCALLCONV BID_SetSerialSignedData (const int sessioncontext, const BID_SerialSigningData *serial_signing_data)
 
BIDCSERVER_API int BIDCALLCONV BID_Free_SerialSigningData (BID_SerialSigningData *allocated)
 
BIDCSERVER_API int BIDCALLCONV BID_GetSignedData (const int sessioncontext, const int docnum, char **signed_data, char **signature)
 
BIDCSERVER_API int BIDCALLCONV BID_SetSignedData (const int sessioncontext, const char *data)
 
BIDCSERVER_API int BIDCALLCONV BID_GetSignatureAndOCSP (const int sessioncontext, const int docnum, char **signature, char **ocsp)
 
BIDCSERVER_API int BIDCALLCONV BID_GetSignatureAndFullOCSP (const int sessioncontext, const int docnum, char **signature, char **fullocsp)
 
BIDCSERVER_API int BIDCALLCONV BID_GetReportData (const int sessioncontext, const char *key, char **out)
 
BIDCSERVER_API int BIDCALLCONV BID_Byterange_gap_start_index (BID_ByteRange const *b, int *out)
 
BIDCSERVER_API int BIDCALLCONV BID_Byterange_gap_offset (BID_ByteRange const *b, int *out)
 
BIDCSERVER_API int BIDCALLCONV BID_Byterange_gap_len (BID_ByteRange const *b, int *out)
 
BIDCSERVER_API int BIDCALLCONV BID_Byterange_len_excl_gap (BID_ByteRange const *b, int *out)
 
BIDCSERVER_API int BIDCALLCONV BID_Byterange_len_incl_gap (BID_ByteRange const *b, int *out)
 
BIDCSERVER_API int BIDCALLCONV BID_Byterange_set (BID_ByteRange *br, int low0, int len0, int low1, int len1)
 
BIDCSERVER_API int BIDCALLCONV BID_Byterange_set_simple (BID_ByteRange *br, int len)
 
BIDCSERVER_API int BIDCALLCONV BID_Byterange_set_offset (BID_ByteRange *br, BID_ByteRange const *src, int len)
 
BIDCSERVER_API int BIDCALLCONV BID_Byterange_set_empty (BID_ByteRange *br)
 
BIDCSERVER_API void BIDCALLCONV BID_Brwd_free (BID_ByteRangeWithData *br)
 
BIDCSERVER_API BID_ByteRangeWithData *BIDCALLCONV BID_Brwd_create (unsigned char *data, BID_ByteRange const *br)
 
BIDCSERVER_API BID_ByteRangeWithData *BIDCALLCONV BID_Brwd_create_copy (BID_ByteRangeWithData *brwd)
 
BIDCSERVER_API BID_ByteRangeWithData *BIDCALLCONV BID_Brwd_create_simple (unsigned char *data, int len)
 
BIDCSERVER_API BID_ByteRangeWithData *BIDCALLCONV BID_Brwd_create_empty ()
 
BIDCSERVER_API BID_ByteRangeWithData *BIDCALLCONV BID_Brwd_concat (BID_ByteRangeWithData *first, BID_ByteRangeWithData *second)
 
BIDCSERVER_API BID_ByteRangeWithData *BIDCALLCONV BID_Brwd_get_data_without_gap (BID_ByteRangeWithData *brwd)
 
BIDCSERVER_API BID_ByteRangeWithData *BIDCALLCONV BID_Brwd_strip_off_prefix (BID_ByteRangeWithData *brwd, int prefixlen)
 
BIDCSERVER_API int BIDCALLCONV BID_Brwd_insert_signature_in_gap (BID_ByteRangeWithData *dest, unsigned char *data, int data_len)
 

Macro Definition Documentation

#define BIDCALLCONV   __cdecl
#define BIDCSERVER_API   __declspec(dllimport)

Typedef Documentation

typedef int SESSION_HANDLE

Function Documentation

BIDCSERVER_API int BIDCALLCONV BID_AddDocumentPDF ( const int  sessioncontext,
const char *  data,
const char *  dataDescription 
)

BID_AddDocumentPDF is used to add a pdf document to be signed in BankID 2.1, it should not be used for serial signing

Parameters
sessioncontextThe context handle for the current merchant
dataThe bytes of the pdf to be signed.
dataDescriptionThe description of the document
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_AddDocumentPDFSerialSign ( const int  sessioncontext,
const char *  data,
const char *  dataDescription,
BID_SerialSigningKind  kind,
BID_VisualSealPosition *  merchant_seal_position,
BID_VisualSealPosition *  end_user_seal_position 
)

BID_AddDocumentPDF is used to add a pdf document to be signed in BankID 2.1 using serial signing When doing serial signing there should be only PDFs and they should all be signed serially. For selfassembler mode, the seal_positions should be set to tell the BankID ClientProxy server what page to refresh when seals are placed.

Parameters
sessioncontextThe context handle for the current merchant
dataThe bytes of the pdf to be signed as a B64 String
dataDescriptionThe description of the document
kindThe kind of serial signing to do, BID_SERIAL or BID_SERIAL_END_USER_ONLY
merchant_seal_positionwhere to place the seal or null if default values shall be used
end_user_seal_positionwhere to place the seal or null if default values shall be used
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_AddDocumentText ( const int  sessioncontext,
const char *  data,
const char *  dataDescription 
)

BID_AddDocumentText is used to add a text document to be signed in BankID 2.1

Parameters
sessioncontextThe context handle for the current merchant
dataThe bytes of the document to be signed in base 64 format
dataDescriptionThe dataDescription for the document to be signed
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_AddDocumentXML ( const int  sessioncontext,
const char *  xml,
const char *  xsl,
const char *  dataDescription 
)

BID_AddDocumentXML is used to add a xml document to be signed in BankID 2.1

Parameters
sessioncontextThe context handle for the current merchant
xmlThe xml bytes to be signed
xslThe xsl transformation to be applied to the xml (for viewing)
dataDescriptionThe description of the document
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_AssymetricDecrypt ( const SESSION_HANDLE  sessioncontext,
const char *  keylocation,
const char *  password,
const char *  encrypted,
char **  decrypted 
)

BID_AssymetricDecrypt decrypts PKCS#8 encoded data using the passed private key.

Parameters
sessioncontextThis is the context handle for the current merchant
keylocationThis is the location of the PKCS#8 private key.
passwordThe password for the PKCS#8 private key.
encryptedEncrypted data
decryptedDecrypted data
Returns
Returns zero if BankID C Server was able to release the memory absorbed. If an error occurs during the free operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_AuthenticateClient ( const SESSION_HANDLE  sessioncontext,
const char *  pkcs7,
const char *  serverchallenge 
)

BID_AuthenticateClient verifies a PKCS#7 retrieved from the client during the authentication process.

Parameters
sessioncontextThis is the context handle for the current merchant
pkcs7This is a BASE64 encoded PKCS#7 structure to verify.
serverchallengeThe data that apparently is signed when the PKCS#7 signature was created. During an authentication procedure the signed data is the challenge created earlier by the BankID C Server using BID_AuthenticateServer.
Returns
Returns zero if BankID C Server was able to authenticate the clients signature against the serverchallenge. If an error occurs during the client authentication process an error code is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_AuthenticateServer ( const SESSION_HANDLE  sessioncontext,
char **  pkcs7,
char **  serverchallenge,
const char *  clientchallenge,
const char *  authenticationheader,
const char *  prepareText 
)

BID_AuthenticateServer creates a signature on behalf of the server that is proprietary to the authentication mechanism.

Parameters
sessioncontextThis is the context handle for the current merchant
pkcs7This is a reference to a pointer where BankID C Server will allocate memory and fill in a BASE64 encoded PKCS#7
serverchallengeThis is a reference to a pointer whereBankID C Server will allocate memory and fill in a generated serverchallenge
clientchallengeThis is an incoming clientchallenge generated by the client BankID Applet. The signature is created based on these data.
authenticationheaderThe authentication header received from the COI if the BankID operation is triggered by a mobile phone
prepareTextThe prepareText value received from the COI if the BankID operation is triggered by a mobile phone
Returns
Returns zero if BankID C Server was create a signature over the clientchallenge and generate a serverchallenge. If an error occurs during the server authentication process an error code is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_Base64Decode ( const SESSION_HANDLE  sessioncontext,
const char *  in,
unsigned char **  out,
size_t *  outlen 
)

BID_Base64Encode basically BASE64 decodes the incoming data.

Parameters
sessioncontextThis is the context handle for the current merchant
inThis is the incoming BASE64 encoded data to decode.
outThis is a reference to a pointer where BankID C Server will allocate memory and fill in the BASE64 decoded data
outlenThis is the length of the BASE64 decoded data.
Returns
Returns zero if BankID C Server was able to BASE64 decode the data If an error occurs during the decode operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_Base64Encode ( const SESSION_HANDLE  sessioncontext,
const unsigned char *  in,
const size_t  inlen,
char **  out 
)

BID_Base64Encode basically BASE64 encodes the incoming data.

Parameters
sessioncontextThis is the context handle for the current merchant
inThis is the incoming data to encode
inlenThis is the length of the incoming data
outThis is a reference to a pointer where BankID C Server will allocate memory and fill in the BASE64 encoded data.
Returns
Returns zero if BankID C Server was able to BASE64 encode the data If an error occurs during the encoding operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API BID_ByteRangeWithData* BIDCALLCONV BID_Brwd_concat ( BID_ByteRangeWithData *  first,
BID_ByteRangeWithData *  second 
)

BID_Brwd_concat is used to join to byteranges into a new freshly allocated

Byteranges must be concatenable, i.e. second must start at end of first byterange, or one or both shall be empty. Will allocate a new byterange with data, allocates its data element big enough to hold the sum of first and second. The resulting byterange will start at first's low0 and end at seconds low1 + len1, gap preserved will be seconds gap. If either first or second is empty, the result with be the other.

Result should be freed using bid_brwd_free.

Parameters
firstthe "leftmost" byte range with data, should not be null
secondthe "rightmont" byte range with data, must strictly follow first or either be null or empty.
Returns
a byterange with data struct where data is the concatenation of first and seconds data element, byterange gap is seconds gap or NULL on out of memory
BIDCSERVER_API BID_ByteRangeWithData* BIDCALLCONV BID_Brwd_create ( unsigned char *  data,
BID_ByteRange const *  br 
)

BID_Brwd_create is used to create a byterange with data. It copies both data and br.

Parameters
datapointer to data to hold
brbyterange describing data, bid_byterange_len_incl_gap(br) should equal length of data
Returns
brwd_create(brwd->data, brwd->byte_range) or NULL on out of memory
BIDCSERVER_API BID_ByteRangeWithData* BIDCALLCONV BID_Brwd_create_copy ( BID_ByteRangeWithData *  brwd)

BID_Brwd_create_copy is used to create a copy of another byterange, i.e. allocate memory and copy content

Parameters
brwdbyterange with data to take a copy of, != NULL
Returns
brwd_create(brwd->data, brwd->byte_range) or NULL on out of memory
BIDCSERVER_API BID_ByteRangeWithData* BIDCALLCONV BID_Brwd_create_empty ( )

BID_Brwd_create_empty is used to create an empty byterange with data

An empty byterange may be concatenated commutatively with any other byterange X, the result is X. Holds no data.

Returns
brwd_create(NULL, byterange_create_empty()) or NULL on out of memory
BIDCSERVER_API BID_ByteRangeWithData* BIDCALLCONV BID_Brwd_create_simple ( unsigned char *  data,
int  len 
)

BID_Brwd_create_simple is used to create a byterange with data holding some data with a given length

Parameters
datapointer to data to hold
lenlength of data
Returns
brwd_create(data, byterange_create_simple(len)) or NULL on out of memory
BIDCSERVER_API void BIDCALLCONV BID_Brwd_free ( BID_ByteRangeWithData *  br)

BID_Brwd_free is used to free memory allocated by a byterange with data

Frees memory for data element, then frees memory for the byterange itself.

Parameters
brthe reference to the byterange to be freed, if null, no action
BIDCSERVER_API BID_ByteRangeWithData* BIDCALLCONV BID_Brwd_get_data_without_gap ( BID_ByteRangeWithData *  brwd)

BID_Brwd_get_data_without_gap is used to join the first and second array of bytes described by a byterange into one.

This function is used to extract the data to be signed out of a byterange with data structure. The result is again a byterange with data structure where the right part has zero length and the left part has length byterange_len_excl_gap(brwd->byte_range).

Result should be freed using bid_brwd_free. It always copies the data, even if there is no gap in brwd.

Parameters
brwdthe byterange with data to handle
Returns
a byterange with data struct or NULL on out of memory
BIDCSERVER_API int BIDCALLCONV BID_Brwd_insert_signature_in_gap ( BID_ByteRangeWithData *  dest,
unsigned char *  data,
int  data_len 
)

BID_Brwd_insert_signature_in_gap is used to insert a signature (pkcs7 DER encoding) into a byterange with data's gap area.

This method is mostly for internal usage. The length of the byterange with data's gap should be at least twice data_len since signature will be written hexEncoded, see details at http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf page 476

Parameters
brwdthe byterange with data to handle
datapkcs7 data to insert,
data_lennumber of bytes in pkcs7
Returns
0 if OK, else error code, especially SERIALSIGN_GAP_TOO_SMALL
BIDCSERVER_API BID_ByteRangeWithData* BIDCALLCONV BID_Brwd_strip_off_prefix ( BID_ByteRangeWithData *  brwd,
int  prefixlen 
)

BID_Brwd_strip_off_prefix is used to remove an initial part from a byte range with data

Result should be freed using bid_brwd_free.

Parameters
brwdthe byterange with data to handle
Returns
a byterange with data struct or NULL on out of memory or illegal prefixlen
BIDCSERVER_API int BIDCALLCONV BID_Byterange_gap_len ( BID_ByteRange const *  b,
int *  out 
)

BID_Byterange_gap_len is used to get the length between end of first dataelement and start of second.

Parameters
bthe byterange to use
outb.low1 - (b.low0 + b.len0)
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_Byterange_gap_offset ( BID_ByteRange const *  b,
int *  out 
)

BID_Byterange_gap_offset is used to get the offset of the gap internal to the byterange

Parameters
bthe byterange to use
outb.len0 unless an error occurs
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_Byterange_gap_start_index ( BID_ByteRange const *  b,
int *  out 
)

BID_Byterange_gap_start_index is used to get the byterange's offseted index of byterange's gap

Parameters
bthe byterange to use
outb.low0 + b.len0 unless an error occurs
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_Byterange_len_excl_gap ( BID_ByteRange const *  b,
int *  out 
)

BID_Byterange_len_excl_gap is used to get the length of the databuffer minus length of an eventual gap

Parameters
bthe byterange to use
outb.len0 + b.len1 unless an error occurs
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_Byterange_len_incl_gap ( BID_ByteRange const *  b,
int *  out 
)

BID_Byterange_len_incl_gap is used to get the length of whole databuffer

Parameters
bthe byterange to use
outbid_byterange_len_excl_gap(b) + bid_byterange_gap_len(b) unless an error occurs
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_Byterange_set ( BID_ByteRange *  br,
int  low0,
int  len0,
int  low1,
int  len1 
)

BID_ByteRange_set is used to set values into a provided byterange structure. The range will be normalized

Normalizing a byterange sets the byterange to all zeroes if both length are zero. Normalizing a byterange moves the second part to the first part if length of first is zero and gap is zero. len1 will be set to zero.

There is no memory allocation here.

Parameters
brThe byterange to modify
low0index of first part in byterange, >= 0
len0length of first part, >= 0
low1index of second part of byterange, >= low0 + len0
len1length of second part, >= 0
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_Byterange_set_empty ( BID_ByteRange *  br)

BID_Byterange_set_empty is used to set a byterange to all zeros

An empty byterange may be concatenated commutatively with any other byterange X, the result is X.

Parameters
brThe byterange to modify
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_Byterange_set_offset ( BID_ByteRange *  br,
BID_ByteRange const *  src,
int  len 
)

BID_Byterange_set_offset is used to turn one byterange into a copy of another, offset by a given number

Parameters
brThe byterange to modify
srcSource byterange
lenlength to offset the src
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_Byterange_set_simple ( BID_ByteRange *  br,
int  len 
)

BID_ByteRange_set_simple is used to set a byterange to a given length. Equivalent to bid_byterange_set(br, 0, len, len, 0).

Parameters
brThe byterange to modify
lenlength of data to hold
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_CloseSession ( SESSION_HANDLE  sessioncontext)

BID_CloseSession must be called for every merchant that wants to take down a merchantsession towards the library. When BID_CloseSession returns no more actions must be taken towards the library with the closes dession handle..

Parameters
sessioncontextThis is the reference to the merchant's session
Returns
Returns zero if BankID C Server was able to close a session for the merchant. If an error occurs during session creation an error code is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_CreateDynamicSDO ( const SESSION_HANDLE  sessioncontext,
BID_SEIDSDO **  sdo,
const char *  data,
const char *  datatype,
const char *  datadescription,
const BID_Signature *  signatures 
)

BID_CreateDynamicSDO creates an unsealed SDO. The SDO will consist of all signatures applied in the function call. The data itself will not be embedded in the SDO. The merchant must call BID_SEIDSDOAddData to embed the data in the SDO. The SDO will not be sealed. The merchant must call BID_SealSDO to seal all signatures.

Parameters
sessioncontextThis is the context handle for the current merchant
sdoThis a reference to a pointer to a BID_SEIDSDO structure where BankID C Server will allocate memory and fill in the SDO.
dataThis is the data (the contract) itself.
datatypeThe datatype of the signed data This must be either SDODATA_TEXT or SDODATA_PDF.
datadescriptionThe datadescription of the signed data.
signaturesThe list of all signatures that will be embedded in the SDO.
Returns
Returns zero if BankID C Server was able to create the Signed Data Object. If an error occurs during the contract building operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_CreateSDO ( const SESSION_HANDLE  sessioncontext,
BID_SEIDSDO **  sdo,
const char *  data,
const char *  datatype,
const char *  datadescription,
const char *  clientpkcs7,
const char *  serverpkcs7,
const char *  clientocspresponse,
const char *  serverocspresponse 
)

BID_CreateSDO creates a Signed Data Object that is a mutual contract between a merchant and an end user. The data itself will not be embedded in the SDO. The merchant must call BID_SEIDSDOAddData to embed the data in the SDO.

Parameters
sessioncontextThis is the context handle for the current merchant
sdoThis a reference to a pointer to a BID_SEIDSDO structure where BankID C Server will allocate memory and fill in the SDO.
dataThis is the data (the contract) itself.
datatypeThe datatype of the signed data This must be either SDODATA_TEXT or SDODATA_PDF.
datadescriptionThe datadescription of the signed data.
clientpkcs7This is a BASE64 encoded client PKCS#7 apparently containing a signature over the incoming data.
serverpkcs7This is a BASE64 encoded serverPKCS#7 apparently containing a signature over the incoming data.
clientocspresponseThis is a BASE64 encoded OCSP response from an earlier BID_GetCertStatus request for the clients certificate. Set the parameter to NULL if no OCSP response is supplied If supplied and all constraints are satisfied no VA lookup on client certificate will be done.
serverocspresponseThis is a BASE64 encoded OCSP response from an earlier BID_GetCertStatus request for the server certificate. Set the parameter to NULL if no OCSP response is supplied If supplied and all constraints are satisfied no VA lookup on server certificate will be done.
Returns
Returns zero if BankID C Server was able to create the Signed Data Object. If an error occurs during the contract building operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_CreateSecureChannel ( const SESSION_HANDLE  sessioncontext,
const char *  pkcs7,
char **  channelpkcs7,
char **  channeldata 
)

BID_CreateSecureChannel is used by the merchant to create a message directly to the COI. The channel is at present used to inform the COI about the demands currently set on the client. If the merchant demands that the client enteres a new OTP for the current transaction this function, The messages (key,value) are set by calling BID_SetInfoItem prior to calling this method.

Parameters
sessioncontextThis is the context handle for the current merchant
pkcs7The merchants own pkcs7 for the current transaction.
channelpkcs7The signed channel
channeldataThe channeldata that was signed
Returns
Returns zero if BankID C Server was able to release the memory absorbed. If an error occurs during the free operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_CreateXMLDSIG ( const SESSION_HANDLE  sessioncontext,
const char *  c14nxmlorder,
char **  xmldsig,
int *  certexpiresin 
)

BID_CreateXMLDSIG creates an enveloping XMLDSIG structure.

Parameters
sessioncontextThis is the context handle for the current merchant
c14nxmlorderA c14n canonicalized ODS order wrapped in an "Object" element.
xmldsigThis is a reference to a pointer where BankID C Server will alloate memory and store the XMLDSIG structure.
certexpiresinThis is a reference to a pointer where BankID C Server will store how many days it is until the certificate expires.
Returns
Returns zero if BankID C Server was able to create an XMLDSIG for the merchant If an error occurs during the operation an error code is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_DecryptTransactionData ( const int  sessioncontext,
const char *  enckey,
const char *  encdata,
const char *  encauth,
const char *  operation,
const char *  sid,
char **  data,
char **  key 
)

BID_DecryptTransactionData can be used by the merchant to decrypt the transaction data used during BankID communication, both the request from the client and the response genererated by BankID Server.

Parameters
sessioncontextThis is the context handle for the current merchant
enckeyThe encryption key
encdataThe encrypted data
encauthThe MAC of the encrypted data
operationThe operation parameter
sidThe sid
dataThe decrypted data
keyThe key to use for communication
Returns
Returns zero if the decryption was successfull If an error occurs during the dedcryption an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_DynamicSDOGetSigners ( const SESSION_HANDLE  sessioncontext,
const BID_SEIDSDO *  sdo,
char **  signers 
)

BID_DynamicSDOGetSigners retrieves the signers of the SEIDSDO SDO structure. The output string is semicolon separated and used by the netcentric client during the multisigning process.

Parameters
sessioncontextThis is the context handle for the current merchant.
sdoThis is the SDO that should contain the singatures
signersThe string containing information about the signers
Returns
Returns zero if BankID C Server was able to retrieve the signer informations If an error occurs during the BID_DynamicSDOGetSigners operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_DynamicSDOValidate ( const SESSION_HANDLE  sessioncontext,
const BID_SEIDSDO *  sdo,
const char *  data,
const int  numsignatures,
const int  sealcheck 
)

BID_SDODynamicValidate will validate an SDO. If the data itself should be verified the verifydata flag must be set.

Parameters
sessioncontextThis is the context handle for the current merchant
sdoThis is the constructed SDO structure.
dataThis is the data (the contract) itself.
numsignaturesThe expected number of signatures in the SDO.
sealcheck0: Must be present and verified 1: Must not be present, 2: Can be present, verify if present.
Returns
Returns zero if BankID C Server was able to verify the SDO. If an error occurs during the verification operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_DynamicSDOXMLGetSigners ( const SESSION_HANDLE  sessioncontext,
const char *  sdo,
char **  signers 
)

BID_DynamicSDOXMLGetSigners retrieves the signers of the SEIDSDO XML. The output string is semicolon separated and used by the netcentric client during the multisigning process.

Parameters
sessioncontextThis is the context handle for the current merchant.
sdoThis is the SDO XML that should contain the singatures
signersThe string containing information about the signers
Returns
Returns zero if BankID C Server was able to retrieve the signer informations If an error occurs during the BID_DynamicSDOXMLGetSigners operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_Finalize ( )

BID_Finalize cleans up the BankID resources. It is called after all sessions are closed.

Returns
Returns zero if the uninitialization of BankID C Server was successfull. If an error occurs during initialization an error code is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_Free ( char *  allocated)

BID_Free frees memory allocated by BankID C Server.

Parameters
allocatedThis is a pointer to data previosly allocated by BankID C Server.
Returns
Returns zero if BankID C Server was able to release the memory absorbed. If an error occurs during the free operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_Free_SerialSigningData ( BID_SerialSigningData *  allocated)

BID_Free_SerialSigningData frees memory allocated by BankID C Server.

Parameters
allocatedThis is a pointer to data previosly allocated by BankID C Server.
Returns
Returns zero if BankID C Server was able to release the memory absorbed. If an error occurs during the free operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_FreeSessionStoreInfo ( const SESSION_HANDLE  sessioncontext,
BID_SessionInfo *  sessioninfo 
)

BID_FreeSessionStoreInfo freees the sessionstoreinfo structure list.

Parameters
sessioncontextThis is the context handle for the current merchant.
sessioninfoThe linked list to free.
Returns
Returns zero if BankID C Server was able to free the data. If an error occurs during the freesessionstore operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_GenerateMerchantReference ( const int  sessioncontext,
const char *  locale,
char **  merchantreference 
)

BID_GenerateMerchantReference generates the reference to show to the user during mobile authentication.

Parameters
sessioncontextThis is the context handle for the current merchant
localeThe locale to use. Supported values: no_NO, en_GB
merchantreferenceThis is text to be displayed to the user on the merchant site
Returns
Returns zero if reference was generated OK If an error occurs during the reference generation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_GetCertStatus ( const SESSION_HANDLE  sessioncontext,
const char *  pkcs7,
char **  ocspresponse 
)

BID_GetCertStatus accepts a PKCS#7 structure, retrieves the signing certificate and requests a certificate status towards the Validation Authority. If a pcks#7 is not present in the call, a VA lookup on the merchant itself is done.

Parameters
sessioncontextThis is the context handle for the current merchant
pkcs7This is the BASE64 encoded signature in which the certificate in request resides.
ocspresponseThis is a reference to a pointer where BankID C Server will allocate storage and fill in the OCSP response from the VA. If the parameter is NULL, the OCSP response will not be supplied.
Returns
Returns zero if BankID C Server successfully called getcertstatus. If an error occurs during the getcertstatus operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_GetCertStatusWithNonce ( const SESSION_HANDLE  sessioncontext,
const char *  pkcs7,
char **  ocspresponse,
char **  nonce 
)

BID_GetCertStatusWithNonce accepts a PKCS#7 structure, retrieves the signing certificate and requests a certificate status towards the Validation Authority. If a pcks#7 is not present in the call, a VA lookup on the merchant itself is done.

Parameters
sessioncontextThis is the context handle for the current merchant
pkcs7This is the BASE64 encoded signature in which the certificate in request resides.
ocspresponseThis is a reference to a pointer where BankID C Server will allocate storage and fill in the OCSP response from the VA.
nonceThis is a reference to a pointer where BankID C Server will allocate storage and fill in the OCSP request nonce sent to the VA. If the parameter is NULL, the OCSP response will not be supplied.
Returns
Returns zero if BankID C Server successfully called getcertstatus. If an error occurs during the getcertstatus operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_GetInfoItem ( const SESSION_HANDLE  sessioncontext,
const char *  key,
char **  value 
)

BID_GetInfoItem is used by the merchant to retrieve a value stored in the merchants session under the corresponding key.

Parameters
sessioncontextThis is the context handle for the current merchant
keyThis is the key for where to find the value.
valueThis is a reference to a pointer where BankID C Server will allocate memory and fill in the value for the requested key.
Returns
Returns zero if BankID C Server was able to retrieve the value parameter in the merchant session. If an error occurs during the get operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_GetOwnCertStatus ( const SESSION_HANDLE  sessioncontext,
char **  ocspresponse 
)

BID_GetOwnCertStatus will do a Validation Authority lookup on the merchants own signing certificate.

Parameters
sessioncontextThis is the context handle for the current merchant
ocspresponseThis is a reference to a pointer where BankID C Server will allocate storage and fill in the OCSP response from the VA. If the parameter is NULL, the OCSP response will not be supplied.
Returns
Returns zero if BankID C Server successfully called getcertstatus. If an error occurs during the getcertstatus operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_GetPKCS7Info ( const SESSION_HANDLE  sessioncontext,
const char *  pkcs7,
const int  infoitem,
char **  out 
)

BID_GetPKCS7Info is a method for retrieving the specified information item from a PKCS#7 structure.

Parameters
sessioncontextThis is the context handle for the current merchant
pkcs7This a BASE64 encoded PKCS#7 structure to retrieve information from.
infoitemThis is the requested information item. The valid items are: ISSUERNAME, SUBJECTNAME, VALIDFROMDATE, VALIDTODATE, VERSIONNUMBER, SERIALNUMBER, KEYALGORITHM, KEYSIZE, UNIQUEID, ORIGINATOR, BANKNAME, DATEOFBIRTH, POLICYOID
outThis is a reference to a pointer where BankID C Server will allocate memory and fill the requested dataitem.
Returns
Returns zero if BankID C Server was able to retrieve the information from the PKCS#7 If an error occurs during the information retrieval operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_GetRandom ( const SESSION_HANDLE  sessioncontext,
char **  rand,
const size_t  randlen 
)

BID_GetRandom creates the specified length of random bytes.

Parameters
sessioncontextThis is the context handle for the current merchant
randThis is a reference to a pointer where BankID C Server will allocate memory and fill in the random data.
randlenThis parameter specifies how many random bytes that must be generated.
Returns
Returns zero if BankID C Server was able to create the requested number of random bytes. If an error occurs during the random operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_GetRecentError ( const SESSION_HANDLE  sessioncontext,
char **  error 
)

BID_GetRecentError.

Parameters
sessioncontextThis is the context handle for the current merchant
errorThis a reference to a char pointer with a description of the very last error that occured in BankID Server.
BIDCSERVER_API int BIDCALLCONV BID_GetReportData ( const int  sessioncontext,
const char *  key,
char **  out 
)

BID_GetReportData is used to fetch the new report elements from bankid server. Data returned from this method is UTF-8 encoded.

Parameters
sessioncontextThis is the context handle for the current merchant
keyThe key to request data for.
outThe data is returned here.
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_GetSerialSignedData ( const int  sessioncontext,
const int  docnum,
BID_SerialSigningData **  serial_signing_data 
)

BID_GetSerialSignedData is used to get the signed data and the incremental updates for a signed document in BankID 2.1. The method acts the same as BID_GetSignedData but gets the serial_signing_data instead. It's purpose is to make it possible to hold these data between the different callbacks from webclient.

Parameters
sessioncontextThis is the context handle for the current merchant.
docnumThe number of the document to fetch signed data for. 0 is the first document.
serial_signing_datacopy of serial signing data so far, data inside this element should be freed using BID_Free_SerialSigningData()
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_GetSerialSignedPdf ( const int  sessioncontext,
const int  docnum,
char **  pdfDataB64 
)

BID_GetSerialSignedPdf is used to get the complete serial signed pdf document.

Parameters
sessioncontextThis is the context handle for the current merchant
docnumThe number of the document to fetch signed data for. 0 is the first document. this must be a serial signed document
pdfDataB64Pointer to a char which holds the result. Should be freed by BID_Free
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_GetSessionStoreInfo ( const SESSION_HANDLE  sessioncontext,
BID_SessionInfo **  sessioninfo 
)

BID_GetSessionStoreInfo extracts key information about all registered sessions for the BankID Server runtime.

Parameters
sessioncontextThis is the context handle for the current merchant.
sessioninfothis is a linked list of all registered sessions with session information.
Returns
Returns zero if BankID C Server was able to get sessioninfo If an error occurs during the sessioninfo operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_GetSignatureAndFullOCSP ( const int  sessioncontext,
const int  docnum,
char **  signature,
char **  fullocsp 
)

BID_GetSignatureAndFullOCSP is used to get client signature and full ocsp after a call to BID_VerifyTransactionRequest.

Parameters
sessioncontextThis is the context handle for the current merchant
docnumThe document number to fetch signature and ocsp for. 0 is the first document.
signatureThe client signature is returned here
fullocspThe client full ocsp is returned here
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_GetSignatureAndOCSP ( const int  sessioncontext,
const int  docnum,
char **  signature,
char **  ocsp 
)

BID_GetSignatureAndOCSP is used to get client signature and ocsp after a call to BID_VerifyTransactionRequest.

Parameters
sessioncontextThis is the context handle for the current merchant
docnumThe document number to fetch signature and ocsp for. 0 is the first document.
signatureThe client signature is returned here
ocspThe client ocsp is returned here
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_GetSignedData ( const int  sessioncontext,
const int  docnum,
char **  signed_data,
char **  signature 
)

BID_GetSignedData is used to get the signed data and the merchant signature for a signed document in BankID 2.1

Parameters
sessioncontextThis is the context handle for the current merchant
docnumThe number of the document to fetch signed data for. 0 is the first document.
signed_dataThe data was signed.
signatureThe merchant pkcs7 for this data.
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_GetSigners ( const SESSION_HANDLE  sessioncontext,
BID_Signature *  signatures,
char **  signers 
)

BID_GetSigners retrieves the signers from the linked list of signatures. The output string is semicolon separated and used by the netcentric client during the multisigning process.

Parameters
sessioncontextThis is the context handle for the current merchant.
signaturesThe linked list of signatures to be parsed
signersThe string containing information about the signers
Returns
Returns zero if BankID C Server was able to retrieve the signer informations If an error occurs during the BID_GetSigners operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_GetTransactionInfo ( const int  sessioncontext,
const char *  key,
const char *  oids,
const char *  timeout 
)

BID_GetTransactionInfo is used to request additional information about a transaction.

Parameters
sessioncontextThis is the context handle for the current merchant
keyThis is the transaction id to request information for
oidsThis is a comma separated list of oids that identify the information the merchant is allowed to request
timeoutThis is the maximum time to wait for data to become ready
Returns
Returns zero if the request was processed OK and a response was generated. If an error occurs an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_GetVersionInfo ( char **  versioninfo)

BID_GetVersionInfo is used to get information about the BankID C Server library.

Parameters
versioninfoThe version information is returned in this char**
Returns
Returns zero on success, a errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_HashData ( const SESSION_HANDLE  sessioncontext,
char **  hash,
const int  hashalgorithm,
const char *  data 
)

BID_HashData creates a hash of the incoming data. The hashalgorithm to use is specified by the hashalgorithm parameter.

Parameters
sessioncontextThis is the context handle for the current merchant
hashThis is a reference to a pointer where BankID C Server will allocate memory and fill in the digest of the incoming data.
hashalgorithmThis is either SHA1 or MD5, which are defined in this headerfile.
dataThis is the data that BankID C Server must create a digest of.
Returns
Returns zero if BankID C Server was able to create a digest of the incoming data. If an error occurs during the digest operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_HashVerifyData ( const SESSION_HANDLE  sessioncontext,
const char *  pkcs7,
const char *  hash,
const int  auth 
)

BID_HashVerifyData verifies a PKCS#7 structure against incoming hashed data.

Parameters
sessioncontextThis is the context handle for the current merchant
pkcs7This is a BASE64 encoded PKCS#7 structure to verify.
hashThe hash of the data that apparently is signed when the PKCS#7 signature was created This can be a usual string or raw bytes.
authIs this a verification with signing or authentication certificate
Returns
Returns zero if BankID C Server was able to verify the PKCS#7 structure successfully. If an error occurs during the verification process an error code is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_HSMInitialize ( const char *  pkcs11driver)

BID_Initialize is the first method a merchant must call in order to initialize the BankID C Server. The method initializes internal structures.

Parameters
pkcs11driverThe full patth to the PKCS#11 implementation to be used.
Returns
Returns zero if the initialization of BankID C Server was successfull. If an error occurs during initialization an error code is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_HSMOpenSession ( SESSION_HANDLE sessioncontext,
const char *  keylocation,
const char *  password,
const char *  configlocation,
const char *  webaddress,
const char *  tagcache,
const char *  trustedstore,
const char *  grantedpolicies,
const char *  proxyserver,
const char *  proxyport,
const char *  pkcs11password,
const int  slot 
)

BID_HSMOpenSession must be called for every merchant that wants to create a merchantsession towards the library where the private keys are stored in a HSM. When BID_HSMOpenSession returns a context is created which must be used in all future calls for services.

Parameters
sessioncontextThis is a reference to a variable where BankID C Server will store the context for the merchant
keylocationThis must be the full path to the merchants keystore file.
passwordThis is the password for the merchants keystore file.
configlocationThis must contain the full path to the merchants configuration file, or NULL if not supplied
webaddressThe web addresses and ip addresses used for MITM.
tagcacheThe full path to where to store cached tags.
trustedstoreThe full path to where the trusted ca certificates are located for ssl communication
grantedpoliciesList of policyOIDs which are granted to be used with BankID Server.
proxyserverThe ip address of an http proxy server.
proxyportThe port of the http proxy server.
pkcs11passwordThe password of the HSM where the keys reside
slotThe slot in the hsm to use.
Returns
Returns zero if BankID C Server was able to open a session for the merchant. If an error occurs during session creation an error code is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_Initialize ( )

BID_Initialize is the first method a merchant must call in order to initialize the BankID C Server. The method initializes internal structures.

Returns
Returns zero if the initialization of BankID C Server was successfull. If an error occurs during initialization an error code is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_InitSession ( const int  sessioncontext,
char **  helperuri,
char **  traceid,
char **  clientid 
)

BID_InitSession is used to initialize a session between a merchant and a javascript client.

The following infoitems must be set before this method is invoked:

  • useragent, url, timeout, sid, action
Parameters
sessioncontextThis is the context handle for the current merchant
helperuriThe source to be loaded in a separate iframe
traceidThe traceid for this session.
clientidThe clientid for the generated BankID 2.0 client.
Returns
Returns zero on success, a errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_InitSignBuildEndUserSeal ( const int  sessioncontext,
const char *  enckey,
const char *  encdata,
const char *  encauth,
const char *  operation,
const char *  sid,
BID_VisualSealBuilder  end_user_visual_seal_builder,
char **  response 
)

BID_InitSignBuildEndUserSeal is used by the merchant in self assembling flow to create the merchant part incremental update of the document. the method is used for serial signed documents, may be called more than once pr. session. Should be called by merchant when operation equals "initSignBuildEndUserSeal" Note: Serial signing demands that cmsFormat "PKCS7_ISO320001" and ocspFormat OCSP_RFC6960_COMPATIBLE" is set in infoitems

Parameters
sessioncontextThis is the context handle for the current merchant
enckeyThe encryption key
encdataThe encrypted request
encauthThe MAC of the encrypted data
operationThe operation parameter sent from the BankID Client
sidThe sid parameter sent from the BankID Client.
end_user_visual_seal_builderThe callback to use to add the visual seal to the pdf serial documents, cannot be null, must be a valid function pointer
responseThe encrypted response
Returns
Returns zero if the encrypted response was created succsessfully. If an error occurs during the response creation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification
BIDCSERVER_API int BIDCALLCONV BID_InitSignSignMerchantSeal ( const int  sessioncontext,
const char *  enckey,
const char *  encdata,
const char *  encauth,
const char *  operation,
const char *  sid,
char **  response 
)

BID_InitSignSignMerchantSeal is used by the merchant in turn key flow after the client has created the visual representation of the merchant seal. The method is used for serial signed documents, will be called at most once pr. session. Should be called by merchant when operation equals "initSignSignMerchantSeal" Note: Serial signing demands that cmsFormat "PKCS7_ISO320001" and ocspFormat OCSP_RFC6960_COMPATIBLE" is set in infoitems

Parameters
sessioncontextThis is the context handle for the current merchant
enckeyThe encryption key
encdataThe encrypted request
encauthThe MAC of the encrypted data
operationThe operation parameter sent from the BankID Client
sidThe sid parameter sent from the BankID Client.
responseThe encrypted response
Returns
Returns zero if the encrypted response was created succsessfully. If an error occurs during the response creation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification
BIDCSERVER_API int BIDCALLCONV BID_InitTransaction ( const int  sessioncontext,
const char *  enckey,
const char *  encdata,
const char *  encauth,
const char *  operation,
const char *  sid,
char **  response 
)

BID_InitTransaction is used by the merchant to create the encrypted response to the initAuth/Sign operation from the encrypted request of the BankID client. In addition to the encrypted response, a number of infoitems are available using BID_SetInfoItem(). See the the BankID C Server Interface Specification for the details.

Note: Serial signing demands that cmsFormat "PKCS7_ISO320001" and ocspFormat OCSP_RFC6960_COMPATIBLE" is set in infoitems

Parameters
sessioncontextThis is the context handle for the current merchant
enckeyThe encryption key
encdataThe encrypted request
encauthThe MAC of the encrypted data
operationThe operation parameter sent from the BankID Client
sidThe sid parameter sent from the BankID Client.
responseThe encrypted response
Returns
Returns zero if the encrypted response was created successfully. If an error occurs during the response creation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification
BIDCSERVER_API int BIDCALLCONV BID_InitTransactionSelfAssembler ( const int  sessioncontext,
const char *  enc_key,
const char *  enc_data,
const char *  enc_auth,
const char *  operation,
const char *  sid,
BID_VisualSealBuilder  merchant_visual_seal_builder,
char **  response 
)

BID_InitTransactionSelfAssembler is used by the merchant to create the encrypted response to the initSign operation when doing self-assembling serial signing. The method is used for self-assembled serial signed documents only. Note: Serial signing demands that cmsFormat "PKCS7_ISO320001" and ocspFormat OCSP_RFC6960_COMPATIBLE" is set in infoitems Note: The merchant_visual_seal_builder will be called for BID_SERIAL documents only, not for BID_SERIAL_END_USER_ONLY documents.

Parameters
sessioncontextThis is the context handle for the current merchant
enckeyThe encryption key
encdataThe encrypted request
encauthThe MAC of the encrypted data
operationThe operation parameter sent from the BankID Client
sidThe sid parameter sent from the BankID Client.
merchant_visual_seal_builderThe callback to use to add the visual seal to the pdf serial documents, must be null if turnkey solution, a valid function pointer if self assembling merchant
responseThe encrypted response
Returns
Returns zero if the encrypted response was created succsessfully. If an error occurs during the response creation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification
BIDCSERVER_API int BIDCALLCONV BID_OpenSession ( SESSION_HANDLE sessioncontext,
const char *  keylocation,
const char *  password,
const char *  configlocation,
const char *  webaddress,
const char *  tagcache,
const char *  trustedstore,
const char *  grantedpolicies,
const char *  proxyserver,
const char *  proxyport 
)

BID_OpenSession must be called for every merchant that wants to create a merchantsession towards the library. When BID_OpenSession returns a context is created which must be used in all future calls for services.

Parameters
sessioncontextThis is a reference to a variable where BankID C Server will store the context for the merchant
keylocationThis must be the full path to the merchants keystore file.
passwordThis is the password for the merchants keystore file.
configlocationThis must contain the full path to the merchants configuration file, or NULL if not supplied
webaddressThe web addresses and ip addresses used for MITM.
tagcacheThe full path to where to store cached tags.
trustedstoreThe full path to where the trusted ca certificates are located for ssl communication
grantedpoliciesList of policyOIDs which are granted to be used with BankID Server.
proxyserverThe ip address of an http proxy server.
proxyportThe port of the http proxy server.
Returns
Returns zero if BankID C Server was able to open a session for the merchant. If an error occurs during session creation an error code is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_PushSms ( const SESSION_HANDLE  sessioncontext,
const char *  transactionreference,
const char *  text 
)

BID_PushSms can be used to send the mobile user an SMS upon receiving a transaction reference from BID_RequestMobileAction

Parameters
sessioncontextThis is the context handle for the current merchant
transactionreferenceThe reference returned after a successfull mobile action
textThe text to send to the mobile user
Returns
Returns zero if the SMS request was delivered to the MGMFE succesfully If an error occurs during the communication an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_RAHSMOpenSession ( SESSION_HANDLE sessioncontext,
const char *  keylocation,
const char *  password,
const char *  pkcs11password,
const int  slot 
)

BID_RAHSMOpenSession must be called for every bank that wants to create an RA session towards the library where their private keys are stored in an HSM. BID_RAHSMOpenSession is called for banks who need to run BankID Server in RA mode. RA mode means that the server is used to sign and build a dsig xml which is further sent to the ODS system. When BID_RAHSMOpenSession returns, a context is created which must be used in all future calls for services.

Parameters
sessioncontextThis is a reference to a variable where BankID C Server will store the context for the merchant
keylocationThis must be the full path to the merchants keystore file.
passwordThis is the password for the merchants keystore file.
pkcs11passwordThe password of the HSM where the keys reside
slotThe slot in the hsm to use.
Returns
Returns zero if BankID C Server was able to open a session for the bank. If an error occurs during session creation an error code is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_RemoveCRLF ( const SESSION_HANDLE  sessioncontext,
const char *  in,
char **  out 
)

BID_RemoveCRLF is basically a utility method for removing "\r" and "\n" characters in the incoming string.

Parameters
sessioncontextThis is the context handle for the current merchant
inThis is the incoming string to strip for "\r" and "\n" characters.
outThis is a reference to a pointer where BankID C Server will allocate memory and fill the incoming string stripped for "\r" and "\n"
Returns
Returns zero if BankID C Server was able to strip the incoming data for "\r" and "\n" If an error occurs during the stripping operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_RemoveInfoItems ( const SESSION_HANDLE  sessioncontext)

BID_RemoveInfoItems will clear all stored key/value parameters for the merchant session.

Parameters
sessioncontextThis is the context handle for the current merchant
Returns
Returns zero if BankID C Server was able to clear the key/value storage for the merchant session If an error occurs during the clear operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_RequestMobileAction ( const SESSION_HANDLE  sessioncontext,
char **  transactionreference 
)

BID_RequestMobileAction is used by the merchant to perform a BankID operation using the mobile phone of the user. The parameteres must be set in the merchants session prior to calling this method by using BID_SetInfoItem(). These parameters include the action, the URL for the communication, the phone number and other parameters.

Parameters
sessioncontextThis is the context handle for the current merchant
transactionreferenceThis is a transaction reference for the performed operation. This can later be used for sending the user an SMS using BID_PushSms
Returns
Returns zero if mobile user successfully performed the action If an error occurs during the mobile operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_RequestMobileStatus ( const SESSION_HANDLE  sessioncontext,
const char *  transactionreference,
char **  transactionstatus 
)

BID_RequestMobileStatus retrieves the status from an earlier initialized BID_RequestMobileAction.

Parameters
sessioncontextThis is the context handle for the current merchant
transactionreferenceThe reference returned after a successfull mobile action
transactionstatusThe reference status returned after a successfull mobile action
Returns
Returns zero if the status was retrieved and is OK If an error occurs during the communication, or the status is not OK an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_SDOAddData ( const SESSION_HANDLE  sessioncontext,
BID_SEIDSDO *  sdo,
const char *  data 
)

BID_SDOAddData adds a contract to the SDO.

Parameters
sessioncontextThis is the context handle for the current merchant.
sdoThis is the SDO that should contain the contract.
dataThe contract to add base64 encoded.
Returns
Returns zero if BankID C Server was able to add the contract. If an error occurs during the sdoadddata operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_SDOAddSignature ( const SESSION_HANDLE  sessioncontext,
BID_SEIDSDO *  sdo,
const BID_Signature *  signatures,
const char *  data 
)

BID_SDOAddSignature adds signatures to an existing SDO

Parameters
sessioncontextThis is the context handle for the current merchant.
sdoThis is the SDO that should contain the contract.
signaturesAll signatures that sould be put into the SDO.
dataThe contract that is signed.
Returns
Returns zero if BankID C Server was able to add the signature(s). If an error occurs during the sdoaddsignature operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_SDOFree ( const SESSION_HANDLE  sessioncontext,
BID_SEIDSDO *  sdo 
)

BID_SDOFree frees all memory absorbed by the SEIDSDO structure.

Parameters
sessioncontextThis is the context handle for the current merchant
sdoThis is the constructed SEIDSDO structure.
Returns
Returns zero if BankID C Server was able to release the memory absorbed by the SDO If an error occurs during the free operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_SDOSeal ( const SESSION_HANDLE  sessioncontext,
BID_SEIDSDO *  sdo,
const char *  ocsp,
const char *  data 
)

BID_SDOSeal seals an SDO.

Parameters
sessioncontextThis is the context handle for the current merchant.
sdoThis is the SDO to be sealed
ocspA newly created OCSP response for the merchant itself
dataThe contract that has been signed in the SDO
Returns
Returns zero if BankID C Server was able to add the contract. If an error occurs during the sdoadddata operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_SDOToXMLEx ( const SESSION_HANDLE  sessioncontext,
const BID_SEIDSDO *  sdo,
char **  sdoxml 
)

BID_SDOToXMLEx will take an SDO structure and create an XML string of it. The XML string can afterwards be saved as a regular textfile. The output is encoded as UTF-8.

Parameters
sessioncontextThis is the context handle for the current merchant
sdoThis is the constructed SDO structure.
sdoxmlThis is a reference to a pointer where BankID C Server will allocate memory and fill in the SDO XML.
Returns
Returns zero if BankID C Server was able to construct the XML. If an error occurs during the construction operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_SDOValidate ( const SESSION_HANDLE  sessioncontext,
const BID_SEIDSDO *  sdo,
const int  verifydata 
)

BID_SDOValidate will validate an SDO.

Parameters
sessioncontextThis is the context handle for the current merchant
sdoThis is the constructed SDO structure.
verifydataIf ==0, the data in the SDO will not be verified. If <>0, the data (BID_SDOAddData() must previously have been called) will be verified.
Returns
Returns zero if BankID C Server was able to verify the SDO. If an error occurs during the verification operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_SDOXMLExtractSignatures ( const int  sessioncontext,
const char *  sdoxml,
char **  data,
char **  datatype,
char **  datadescription,
BID_Signature **  signatures 
)

BID_SDOXMLExtractSignatures is used by the merchant to extract all relevant data for sdo xml structures created by earlier versions of BankID Server.

Parameters
sessioncontextThis is the context handle for the current merchant
sdoxmlThe SDO XML
dataThe data in the sdo will be put here
datatypeThe datatype in the sdo will be put here
datadescriptionThe datadescription in the sdo will be put here
signaturesThe signatures in the sdo will be put here
Returns
Returns zero if the signatures were created successfully. If an error occurs during the response creation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification
BIDCSERVER_API int BIDCALLCONV BID_SDOXMLValidate ( const SESSION_HANDLE  sessioncontext,
const char *  sdo,
const int  verifydata 
)

BID_SDOXMLValidate will validate an SDO. If the data itself should be verified the verifydata flag must be set.

Parameters
sessioncontextThis is the context handle for the current merchant
sdoThis is the constructed SDO structure.
verifydataIf ==0, the data in the SDO will not be verified. If <>0, the data (BID_SDOAddData() must previously have been called) will be verified.
Returns
Returns zero if BankID C Server was able to verify the SDO. If an error occurs during the verification operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_SetInfoItem ( const SESSION_HANDLE  sessioncontext,
const char *  key,
const char *  value 
)

BID_SetInfoItem is used by the merchant to store key/value pairs in its own session. The key/value pairs will reside in the merchants session until the merchant itself calls BID_RemoveInfoItems().

Parameters
sessioncontextThis is the context handle for the current merchant
keyThis is the key to use for the value parameter.
valueThis is the value to store under the corresponding key.
Returns
Returns zero if BankID C Server was able to store the key/value pair in the merchant session. If an error occurs during the insertion operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_SetSerialSignedData ( const int  sessioncontext,
const BID_SerialSigningData *  serial_signing_data 
)

BID_SetSignedData is used to set the data that was signed before a call to BID_VerifyTransactionRequest. Note: The data is copied from the parameters, so freeing data and serial_signing_data is your responsibility. Note: use BID_FreeSerialSigningData for serial_signing_data.

Parameters
sessioncontextThis is the context handle for the current merchant
serial_signing_dataThe serial_signing_data (obtained with BID_GetSerialSignedData after a successful call to BID_InitTransaction, BID_InitSignSignMerchantSeal, BID_InitSignBuildEndUserSeal)
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BIDCALLCONV BID_SetSignedData ( const int  sessioncontext,
const char *  data 
)

BID_SetSignedData is used to set the data that was signed before a call to BID_VerifyTransactionRequest

Parameters
sessioncontextThis is the context handle for the current merchant
dataThe signed data (obtained with BID_GetSignedData after a successful call to BID_InitTransaction)
Returns
Returns zero on success, an errorcode if something went wrong.
BIDCSERVER_API int BID_SignaturesFree ( const SESSION_HANDLE  sessioncontext,
BID_Signature *  signature 
)

BID_SignaturesFree frees all memory allocated by a BID_Signature structure.

Parameters
sessioncontextThis is the context handle to be used.
signatureThis is the BID_Signature structure to free
Returns
Returns zero on success If an error occurs during the free operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_SignData ( const SESSION_HANDLE  sessioncontext,
const unsigned char *  data,
const size_t  datalen,
char **  pkcs7 
)

BID_SignData creates a PKCS#7 signature on behalf of the merchant.

Parameters
sessioncontextThis is the context handle for the current merchant
dataThe data to be signed. This can be a usual text or just raw bytes.
datalenThe length of the data to be signed
pkcs7This is a reference to a pointer where BankID C Server will allloate memory and store the PKCS#7 structure in BASE64 format.
Returns
Returns zero if BankID C Server was able to create a signature for the merchant. If an error occurs during the signing operation an error code is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_SignDataP1 ( const SESSION_HANDLE  sessioncontext,
const unsigned char *  data,
const size_t  datalen,
char **  pkcs1 
)

BID_SignData creates a PKCS#1 signature on behalf of the merchant.

Parameters
sessioncontextThis is the context handle for the current merchant
dataThe data to be signed. This can be a usual text or just raw bytes.
datalenThe length of the data to be signed
pkcs1This is a reference to a pointer where BankID C Server will allloate memory and store the PKCS#1 structure in BASE64 format.
Returns
Returns zero if BankID C Server was able to create a signature for the merchant. If an error occurs during the signing operation an error code is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_SignXML ( const int  sessioncontext,
const unsigned char *  xml,
const size_t  xmllen,
const unsigned char *  xsl,
const size_t  xsllen,
char **  pkcs7,
char **  data 
)

BID_SignXML creates a PKCS#7 signature over an XSL stylesheet and an XML

Parameters
sessioncontextThis is the context handle for the current merchant
xmlThe xml that should be signed.
xmllenThe length of the xml that should be signed.
xslThe xml that should be signed.
xsllenThe length of the xsl that should be signed.
pkcs7This is a reference to a pointer where BankID C Server will allloate memory and store the PKCS#7 structure in BASE64 format.
dataThis is a reference to a pointer where BankID C Server will allloate memory and store the the data that was actually signed.
Returns
Returns zero if BankID C Server was able to create a signature for the merchant. If an error occurs during the signing operation an error code is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_SimpleDynamicSDOXMLValidate ( const SESSION_HANDLE  sessioncontext,
const char *  sdo,
const int  minnumsignatures 
)

BID_SimpleDynamicSDOXMLValidate will do a simple validation of a dynamic SDO. It only checks that the dynamic SDO is sealed and contains at least n signatures.

Parameters
sessioncontextThis is the context handle for the current merchant
sdoThis is the SDO XML that should contain the singatures.
minnumsignaturesThe minimum number of signatures expected in the SDO.
Returns
Returns zero if BankID C Server was able to verify the SDO. If an error occurs during the verification operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_VerifyData ( const SESSION_HANDLE  sessioncontext,
const char *  pkcs7,
const unsigned char *  data,
const size_t  datalen 
)

BID_VerifyData verifies a PKCS#7 structure against incoming data.

Parameters
sessioncontextThis is the context handle for the current merchant
pkcs7This is a BASE64 encoded PKCS#7 structure to verify.
dataThe data that apparently is signed when the PKCS#7 signature was created
datalenThe length of the data that apparently is signed when the PKCS#7 signature was created
Returns
Returns zero if BankID C Server was able to verify the PKCS#7 structure successfully. If an error occurs during the verification process an error code is returned. The errorcode is documented in the BankID C Server Interface Specification.
BIDCSERVER_API int BIDCALLCONV BID_VerifySignAddDSS ( const int  sessioncontext,
const char *  enckey,
const char *  encdata,
const char *  encauth,
const char *  operation,
const char *  sid,
char **  response 
)

BID_VerifySignAddDSS is used by the merchant in turn key flow for adding clientproxy packed validation data to the PDFs The method is used for serial signed documents, will be called at most once pr. session. Should be called by merchant when operation equals "verifySignAddDSS" Note: Serial signing demands that cmsFormat "PKCS7_ISO320001" and ocspFormat OCSP_RFC6960_COMPATIBLE" is set in infoitems

Parameters
sessioncontextThis is the context handle for the current merchant
enckeyThe encryption key
encdataThe encrypted request
encauthThe MAC of the encrypted data
operationThe operation parameter sent from the BankID Client
sidThe sid parameter sent from the BankID Client.
responseThe encrypted response
Returns
Returns zero if the encrypted response was created succsessfully. If an error occurs during the response creation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification
BIDCSERVER_API int BIDCALLCONV BID_VerifyTransactionRequest ( const int  sessioncontext,
const char *  enckey,
const char *  encdata,
const char *  encauth,
const char *  operation,
const char *  sid 
)

BID_VerifyTransactionRequest is used by the merchant to handle the verifyAuth/verifySign/handleError operation from the encrypted request of the BankID client.

If the operation is 'handleError', BID_VerifyTransactionRequestSelfAssembler and BID_VerifyTransactionRequest are interchangable.

In addition to the encrypted request, some infoitems must be set prior to calling this method using BID_SetInfoItem(). Some infoitems will also be available using BID_GetInfoItem() after calling this method. See the the BankID C Server Interface Specification for the details.

Note: Serial signing demands that cmsFormat "PKCS7_ISO320001" and ocspFormat OCSP_RFC6960_COMPATIBLE" is set in infoitems

Parameters
sessioncontextThis is the context handle for the current merchant
enckeyThe encryption key
encdataThe encrypted request
encauthThe MAC of the encrypted data
operationThe operation parameter sent from the BankID Client
sidThe sid parameter sent from the BankID Client.
Returns
Returns zero if the verification of the request was successfull. If an error occurs during the dedcryption an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification
BIDCSERVER_API int BIDCALLCONV BID_VerifyTransactionRequestSelfAssembler ( const int  sessioncontext,
const char *  enckey,
const char *  encdata,
const char *  encauth,
const char *  operation,
const char *  sid,
BID_ValidationBuilder  validation_increment_builder 
)

BID_VerifyTransactionRequestSelfAssembler is used by the merchant to handle the verifySign/handleError operation from the encrypted request of the BankID client when doing self-assembled serial signing.

If the operation is 'handleError', BID_VerifyTransactionRequestSelfAssembler and BID_VerifyTransactionRequest are interchangable.

In addition to the encrypted request, some infoitems must be set prior to calling this method using BID_SetInfoItem(). Some infoitems will also be available using BID_GetInfoItem() after calling this method. See the the BankID C Server Interface Specification for the details.

Note: Serial signing demands that cmsFormat "PKCS7_ISO320001" and ocspFormat OCSP_RFC6960_COMPATIBLE" is set in infoitems.

Parameters
sessioncontextThis is the context handle for the current merchant
enckeyThe encryption key
encdataThe encrypted request
encauthThe MAC of the encrypted data
operationThe operation parameter sent from the BankID Client
sidThe sid parameter sent from the BankID Client.
validation_increment_buildernull for turnkey validation building, valid function pointer for selfassembler.
Returns
Returns zero if the verification of the request was successfull. If an error occurs during the dedcryption an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification
BIDCSERVER_API int BIDCALLCONV BID_VerifyTransactionResponse ( const int  sessioncontext,
char **  response 
)

BID_VerifyTransactionResponse is used by the merchant to create the encrypted response for the verifyAuth/verifySign/handleError operation or sending an error message should an error occur. Some infoitems must be set prior to calling this method using BID_SetInfoItem(). See the the BankID C Server Interface Specification for the details.

Parameters
sessioncontextThis is the context handle for the current merchant
responseThe encrypted response
Returns
Returns zero if the encrypted response was created succsessfully. If an error occurs during the response creation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification
BIDCSERVER_API int BIDCALLCONV BID_XMLToSDOEx ( const SESSION_HANDLE  sessioncontext,
const char *  sdoxml,
BID_SEIDSDO **  sdo 
)

BID_XMLToSDOEx takes an SDO XML previosly created by BID_SDOToXML() and parses it into an SDO structure. The sdoxml must be valid UTF-8 encoded text.

Parameters
sessioncontextThis is the context handle for the current merchant
sdoxmlThis is the xml representation of an SDO.
sdoThis is the reference to the pointer that BankID C Server will fill with an SDO struct.
Returns
Returns zero if BankID C Server was able to release the memory absorbed. If an error occurs during the free operation an errorcode is returned. The errorcode is documented in the BankID C Server Interface Specification.