Search completed in 1.39 seconds.
15 results for "pl_strdup":
PL_strdup
Returns a pointer to a new memory node in the NSPR heap containing a copy of a specified string. Syntax #include <plstr.h> char *
PL_strdup(const char *s); Parameter The function has a single parameter: s The string to copy, may be NULL. Returns The function returns one of these values: If successful, a pointer to a copy of the specified string. If the memory allocation fails, NULL. Description To accommodate the terminator, the size of the allocated memory is one greater than the length of the string being copied. A NULL argument, like a zero-length argument, results in a pointer to a one-byte block of memory containing the null value. Notes The memory allocated by
PL_strdup should be freed with PL_strfree. ...
PL_strfree
Frees memory allocated by
PL_strdup. Syntax void PL_strfree(char *s); Parameter The function has these parameter: s Pointer to the string to be freed. ...
String Operations
describes some of the key NSPR functions for manipulating strings. Libraries built on top of NSPR, such as the Netscape security libraries, use these functions to manipulate strings. If you are copying or examining strings for use by such libraries or freeing strings that were allocated by such libraries, you must use these NSPR functions rather than the libc equivalents. PL_strlen PL_strcpy
PL_strdup PL_strfree ...
NSPR API Reference
ants Network Address Functions Atomic Operations PR_AtomicIncrement PR_AtomicDecrement PR_AtomicSet Interval Timing Interval Time Type and Constants Interval Functions Date and Time Types and Constants Time Parameter Callback Functions Functions Memory Management Operations Memory Allocation Functions Memory Allocation Macros String Operations PL_strlen PL_strcpy
PL_strdup PL_strfree Floating Point Number to String Conversion PR_strtod PR_dtoa PR_cnvtf Long Long (64-bit) Integers BitMaps Formatted Printing Linked Lists Linked List Types PRCList Linked List Macros PR_INIT_CLIST PR_INIT_STATIC_CLIST PR_APPEND_LINK PR_INSERT_LINK PR_NEXT_LINK PR_PREV_LINK PR_REMOVE_LINK PR_REMOVE_AND_INIT_LINK PR_INSERT_BEFORE...
NSS Sample Code Sample1
resent data that might be stored // in files or in a configuration file SECItem *mWrappedEncKey; SECItem *mWrappedMacKey; // These are the runtime keys as loaded from the files PK11SymKey *mEncKey; PK11SymKey *mMacKey; }; Server::Server(const char *serverName) : mServerName(0), mWrappedEncKey(0), mWrappedMacKey(0), mEncKey(0), mMacKey(0) { // Copy the server name mServerName =
PL_strdup(serverName); } Server::~Server() { if (mServerName) PL_strfree(mServerName); if (mWrappedEncKey) SECITEM_FreeItem(mWrappedEncKey, PR_TRUE); if (mWrappedMacKey) SECITEM_FreeItem(mWrappedMacKey, PR_TRUE); if (mEncKey) PK11_FreeSymKey(mEncKey); if (mMacKey) PK11_FreeSymKey(mMacKey); } int Server::Init() { int rv = 0; SECKEYPrivateKey *prvKey = 0; SECKEYPublicKey *pubKey = 0; PK11...
NSS Sample Code Sample_2_Initialization of NSS
rd */ char *InitSlotPassword(PK11SlotInfo *slot, PRBool retry, void *arg) { FILE *input; FILE *output; char *p0 = NULL; char *p1 = NULL; secuPWData *pwdata = (secuPWData *) arg; if (pwdata->source == PW_FROMFILE) { return FilePasswd(slot, retry, pwdata->data); } if (pwdata->source == PW_PLAINTEXT) { return
PL_strdup(pwdata->data); } /* open terminal */ input = fopen("/dev/tty", "r"); if (input == NULL) { PR_fprintf(PR_STDERR, "Error opening input terminal for read\n"); return NULL; } /* we have no password, so initialize database with one */ PR_fprintf(PR_STDERR, "Enter a password which will be used to encrypt your keys.\n" "The password should be at least 8...
NSS Sample Code Utilities_1
/PIN entered.\n"); return NULL; } switch (pwdata->source) { case PW_NONE: sprintf(prompt, "Enter Password or Pin for \"%s\":", PK11_GetTokenName(slot)); return GetPassword(stdin, stdout, prompt, CheckPassword); case PW_FROMFILE: pw = FilePasswd(slot, retry, pwdata->data); pwdata->source = PW_PLAINTEXT; pwdata->data =
PL_strdup(pw); return pw; case PW_PLAINTEXT: return
PL_strdup(pwdata->data); default: break; } PR_fprintf(PR_STDERR, "Password check failed: No password found.\n"); return NULL; } /* * GenerateRandom */ SECStatus GenerateRandom(unsigned char *rbuf, int rsize) { char meter[] = { "\r| |" }; int ...
NSS Sample Code sample4
utlen); fprintf(stderr, "Result of decryption, buf = \n%s\n", buf1); exit(0); cleanup: if (cert) CERT_DestroyCertificate(cert); if (pubkey) SECKEY_DestroyPublicKey(pubkey); if (pvtkey) SECKEY_DestroyPrivateKey(pvtkey); if (buf1) free(buf1); if (buf2) free(buf2); exit(1); } char *passwdcb(PK11SlotInfo *info, PRBool retry, void *arg) { if (!retry) return
PL_strdup("test"); else return NULL; } ...
NSS Sample Code sample6
t(slot); return; } fprintf(stderr, "Found key!\n"); fprintf(stderr, "key length of generated key is %d\n", PK11_GetKeyLength(key)); fprintf(stderr, "mechanism of key is %d (asked for %d)\n", PK11_GetMechanism(key), cipherMech); PK11_FreeSymKey(key); PK11_FreeSlot(slot); } char *passwdcb(PK11SlotInfo *info, PRBool retry, void *arg) { if (!retry) return
PL_strdup("test"); else return NULL; } ...
Initialize NSS database - sample 2
*/ char * InitSlotPassword(PK11SlotInfo *slot, PRBool retry, void *arg) { FILE *input; FILE *output; char *p0 = NULL; char *p1 = NULL; secuPWData *pwdata = (secuPWData *) arg; if (pwdata->source == PW_FROMFILE) { return FilePasswd(slot, retry, pwdata->data); } if (pwdata->source == PW_PLAINTEXT) { return
PL_strdup(pwdata->data); } /* open terminal */ input = fopen("/dev/tty", "r"); if (input == NULL) { PR_fprintf(PR_STDERR, "Error opening input terminal for read\n"); return NULL; } /* we have no password, so initialize database with one */ PR_fprintf(PR_STDERR, "Enter a password which will be used to encrypt your keys.\n" "The password should be at least 8...
Utilities for nss samples
/PIN entered.\n"); return NULL; } switch (pwdata->source) { case PW_NONE: sprintf(prompt, "Enter Password or Pin for \"%s\":", PK11_GetTokenName(slot)); return GetPassword(stdin, stdout, prompt, CheckPassword); case PW_FROMFILE: pw = FilePasswd(slot, retry, pwdata->data); pwdata->source = PW_PLAINTEXT; pwdata->data =
PL_strdup(pw); return pw; case PW_PLAINTEXT: return
PL_strdup(pwdata->data); default: break; } PR_fprintf(PR_STDERR, "Password check failed: No password found.\n"); return NULL; } /* * GenerateRandom */ SECStatus GenerateRandom(unsigned char *rbuf, int rsize) { char meter[] = { "\r| |" }; int ...
NSS PKCS11 Functions
pointer to a slot info structure. retry Set to PR_TRUE if this is a retry. This implies that the callback has previously returned the wrong password. arg A pointer supplied by the application that can be used to pass state information. Can be NULL. This callback function returns one of these values: If successful, a pointer to the password. This memory must have been allocated with PR_Malloc or
PL_strdup. If unsuccessful, returns NULL. Many tokens keep track of the number of attempts to enter a password and do not allow further attempts after a certain point. Therefore, if the retry argument is PR_TRUE, indicating that the password was tried and is wrong, the callback function should return NULL to indicate that it is unsuccessful, rather than attempting to return the same password again. Failin...
pkfnc.html
his implies that the callback has previously returned the wrong password. arg A pointer supplied by the application that can be used to pass state information. Can be NULL. This callback function returns one of these values: If successful, a pointer to the password. This memory must have been allocated with PR_Malloc or
PL_strdup. If unsuccessful, returns NULL. Many tokens keep track of the number of attempts to enter a password and do not allow further attempts after a certain point. Therefore, if the retry argument is PR_TRUE, indicating that the password was tried and is wrong, the callback function should return NULL to indicate that it is unsuccessful, rather than attempting to return the same password again. Fa...
sslintro.html
After these tasks have been performed, call NSS_Shutdown to close the certificate and key databases opened by NSS_Init, and PR_Cleanup to coordinate a graceful shutdown of NSPR. ...