⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wap_crpt.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 2 页
字号:
 * or must be retrieved from a certificate passed to this routine.
 * This function performs an ECDH calculation based on the given
 * public key and a private key kept in the crypto library.
 *
 * Shared secret: set the pre-master secret to be a pre-defined secret key.
 * Note, that if the library attempts to support the Shared Secret
 * key exchange method, it is required that the routine
 * CRYPTa_getClientKeyExchangeIds pair the method indicator
 * (KEY_EXCH_SHARED_SECRET) with a suitable identifier. That is,
 * an identifier that the gateway can use to retrieve the correct
 * secret key. "identifier" is a copy of that same identifying string.
 * The Crypto Library uses this parameter to select the appropriate
 * secret key.
 *
 * Null: set the pre-master secret to be the empty string.
 *
 */
VOID CRYPTa_keyExchange (
                         UINT16 id, 
                         KeyExchangeParameters param,
                         HashAlgorithm alg,
                         const BYTE *randval
                        )
{
  CRYPTc_keyExchangeResponse (id, CRV_UNSUPPORTED_METHOD, 0, 0, 0);
}

/***********************************************************************
 * Key generation
 ***********************************************************************/

/*
 * Calculate the Pseudo-Random Function defined in section
 * 11.3.2 in the WTLS spec.
 * If the master secret is to be used as first parameter,
 * then "secret" is NULL, and "masterSecretID" indicates which
 * master secret to use. Otherwise, "secret" is provided explicitly.
 * The parameter "label" is a null-terminated character string.
 * The parameter "alg" is the secure hash algorithm to be used,
 * and "outputLen" is the number of bytes of output to produce.
 * The response should be delivered by a call to the connector function
 * CRYPTc_PRFResponse. The first parameter, "id", should be
 * passed back in this response.
 */
VOID CRYPTa_PRF (
                 UINT16 id, HashAlgorithm alg,
                 UINT8 masterSecretID,
                 BYTE *secret, UINT16 seclen,
                 BYTE *label,
                 BYTE *seed, UINT16 seedLen,
                 UINT16 outputLen
                )
{
  CRYPTc_PRFResponse (id, CRV_UNSUPPORTED_METHOD, NULL, 0);
}


/***********************************************************************
 * Certificates
 ***********************************************************************/

/*
 * Verify a chain of certificates.
 * The buffer, "buf", contains a chain of certificates. See section
 * 10.5.2 in the WTLS specification.
 * The response should be delivered by a call to the connector function
 * CRYPTc_verifyCertificateChainResponse. The first parameter, "id",
 * should be passed back in this response.
 */
VOID CRYPTa_verifyCertificateChain (
                                    UINT16 id,
                                    const BYTE *buf, 
                                    UINT16 bufLen,
                                    const BYTE *addr, 
                                    UINT16 addrLen,
                                    const CHAR *domain, 
                                    UINT16 domainLenUINT16
                                   )
{
  CRYPTc_verifyCertificateChainResponse (id, CRV_UNSUPPORTED_METHOD);
}

/*
 * Retrieve a client certificate.
 * The buffer, "buf", contains a list of acceptable certificate
 * authorities, as byte encoded KeyExchangeId:s. See section 10.5.4
 * in the WTLS specification.
 * The response should be delivered by a call to the connector function
 * CRYPTc_getClientCertificateResponse. The first parameter, "id",
 * should be passed back in this response.
 */
VOID CRYPTa_getClientCertificate (
                                  UINT16 id, 
                                  const BYTE *buf, 
                                  UINT16 bufLen
                                 )
{
  CRYPTc_getClientCertificateResponse (id, CRV_UNSUPPORTED_METHOD,
                                       NULL, 0, NULL, 0);
}

/*
 * Compute a digital signature.
 * The buffer, "buf", contains the data to be signed, and the key
 * identifier, "keyId", contains a byte-encoded Identifier.
 * This latter value is either fetched from the Key Exchange Ids
 * passed back in CRYPTc_getMethodsResponse, or is the value
 * passed back in CRYPTc_getClientCertificateResponse (provided that
 * this function has been used). The keyId value indicates
 * which key must be used for signing.
 * The response should be delivered by a call to the connector function
 * CRYPTc_computeSignatureResponse. The first parameter, "id",
 * should be passed back in this response.
 */
VOID CRYPTa_computeSignature (
                              UINT16 id, 
                              const BYTE *keyId, 
                              UINT16 keyIdLen,
                              const BYTE *buf, 
                              UINT16 bufLen
                             )
{
  CRYPTc_computeSignatureResponse (id, CRV_UNSUPPORTED_METHOD, NULL, 0);
}


/***********************************************************************
 * Random number generation
 ***********************************************************************/

/*
 * Generate random (or pseudo-random) data. "randomData" points to
 * the location that receives the data and "randomLen" is the number
 * of bytes of data to be generated.
 */
INT16 CRYPTa_generateRandom (
                             BYTE *randomData, 
                             UINT16 randomLen
                            )
{
  return CRV_UNSUPPORTED_METHOD;
}


/***********************************************************************
 * Session cache
 ***********************************************************************/

/*
 * Initialize the session cache.
 */
VOID CRYPTa_sessionInit (VOID)
{
}

/*
 * Close the session cache.
 */
VOID CRYPTa_sessionClose (VOID)
{
}

/************************************************************
 * 'Peers' methods
 ************************************************************/

/*
 * Delete all peer entries that link to the indicated
 * master secret.
 */
VOID CRYPTa_peerDeleteLinks (UINT8 masterSecretIndex)
{
}

/*
 * Add a peer entry that links to the given master secret.
 * If such an entry already exists, overwite it.
 */
VOID CRYPTa_peerLinkToSession (
                               BYTE *address, UINT16 addrlen,
                               UINT16 portnum,
                               UINT8 masterSecretIndex
                              )
{
}

/*
 * Find a peer with matching address and port number.
 * If none exists, try matching just the address.
 * The result, a master secret index, is returned in
 * CRYPTc_peerLookupResponse.
 */
VOID CRYPTa_peerLookup (
                        UINT16 id,
                        BYTE *address, UINT16 addrlen,
                        UINT16 portnum
                       )
{
  CRYPTc_peerLookupResponse (id, CRV_NOT_FOUND, 0);
}

/************************************************************
 * 'Sessions' methods
 ************************************************************/

/*
 * If "isActive" != 0, then mark the indicated session slot
 * as being "active". Otherwise, mark it as not active.
 * A session slot that is "active", SHOULD NOT be reused.
 * WTLS will keep a session marked as "active" as long as
 * any WTLS connection that is based upon that session is active.
 */
VOID CRYPTa_sessionActive (
                           UINT8 masterSecretIndex, 
                           UINT8 isActive
                          )
{
}

/*
 * Mark a session entry as non-resumable.
 */
VOID CRYPTa_sessionInvalidate (UINT8 masterSecretIndex)
{
}

/*
 * Mark all entries in 'Sessions' as non-resumable.
 */
VOID CRYPTa_sessionClear (VOID)
{
}

/*
 * Fetch the contents of the indicated session entry.
 * The result is returned in CRYPTc_sessionFetchResponse.
 */
VOID CRYPTa_sessionFetch (
                          UINT16 id, 
                          UINT8 masterSecretIndex
                         )
{
  CRYPTc_sessionFetchResponse (id, CRV_NOT_FOUND,
                               0, 0, 0, 0, 0, 0, 0, 0);
}

/*
 * Store new values for a session entry.
 */
VOID CRYPTa_sessionUpdate(
                          UINT8 masterSecretIndex,
                          UINT8 sessionOptions,
                          BYTE *sessionId, UINT8 sessionIdLen,
                          UINT8 macAlg,
                          UINT8 cipherAlg,
                          UINT8 compressionAlg,
                          BYTE *privateKeyId,
                          UINT32 creationTime
                         )
{
}


/*
 * Called when a WTLS connection has been terminated.
 */

void CRYPTa_connectionTerminated (UINT8 objectId, UINT8 channelId)
{
}

void CRYPTa_connectionEstablished(UINT8 objectId, UINT8 channelId,UINT8 masterSecretId)
{
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -