Search completed in 1.20 seconds.
15 results for "spki":
Enc Dec MAC Output Public Key as CSR
PK11_MakeIDFromPubKey(cka_id); privKey = PK11_FindKeyByKeyID(slot, cka_id, pwdata); cleanup: return privKey; } /* * Generate the certificate request with subject */ static SECStatus CertReq(SECKEYPrivateKey *privk, SECKEYPublicKey *pubk, KeyType keyType, SECOidTag hashAlgTag, CERTName *subject, PRBool ascii, const char *certReqFileName) { CERTSubjectPublicKeyInfo *
spki = NULL; CERTCertificateRequest *cr = NULL; SECItem *encoding = NULL; SECOidTag signAlgTag; SECItem result; SECStatus rv = SECSuccess; PRInt32 numBytes; void *extHandle; PRArenaPool *arena = NULL; PRF...
... /* Open the certificate request file to write */ outFile = PR_Open(certReqFileName, PR_CREATE_FILE | PR_RDWR | PR_TRUNCATE, 00660); if (!outFile) { PR_fprintf(PR_STDERR, "unable to open \"%s\" for writing (%ld, %ld).\n", certReqFileName, PR_GetError(), PR_GetOSError()); goto cleanup; } /* Create info about public key */
spki = SECKEY_CreateSubjectPublicKeyInfo(pubk); if (!
spki) { PR_fprintf(PR_STDERR, "unable to create subject public key\n"); rv = SECFailure; goto cleanup; } /* Generate certificate request */ cr = CERT_CreateCertificateRequest(subject,
spki, NULL); if (!cr) { PR_fprintf(PR_STDERR, "unable to make certificate request\n"); rv = SECFailure; ...
... return SECFailure; } PR_fprintf(outFile, "\n%s\n", NS_CERTREQ_TRAILER); if (obuf) { PORT_Free(obuf); } } else { numBytes = PR_Write(outFile, result.data, result.len); if (numBytes != (int)result.len) { PR_fprintf(PR_STDERR, "write error\n"); rv = SECFailure; goto cleanup; } } cleanup: if (
spki) { SECKEY_DestroySubjectPublicKeyInfo(
spki); } if (cr) { CERT_DestroyCertificateRequest (cr); } if (arena) { PORT_FreeArena(arena, PR_FALSE); } if (outFile) { PR_Close(outFile); } return rv; } /* * Mac and Encrypt the input file content */ SECStatus EncryptAndMac(PRFileDesc *inFile, PRFileDesc *headerFile, PR...
NSS Sample Code sample5
0+k2hWnOQIhAOC4NVbo8FQhZS4yXM1M86kMl47FA9ui//OUfbhlAdw1AiEA2DBmIXnsboKB+OHver69p0gNeWlvcJc9bjDVfdLVsLcCIQCPtV3vGYJv2vdwxqZQaHC+YB4gIGAqOqBCbmjD3lyFLQIgA+VTYdUNoqwtZWvE4gRf7IzK2V5CCNhg3gR5RGwxN58CIGCcafoRrUKsM66ISg0ITI04G9V/w+wMx91wjEEB+QBz" int main(int argc, char **argv) { SECStatus rv; CERTCertificate *cert = NULL; SECKEYPublicKey *pubkey = NULL; CERTSubjectPublicKeyInfo *
spki = NULL; SECKEYPrivateKey *pvtkey = NULL; int modulus_len, i, outlen; char *buf1 = NULL; char *buf2 = NULL; char *pubkstr = BASE64_ENCODED_SUBJECTPUBLICKEYINFO; char *pvtkstr = BASE64_ENCODED_PRIVATEKEYINFO; SECItem der; SECItem nickname; PK11SlotInfo *slot = NULL; /* Initialize NSS ...
... PR_GetError()); goto cleanup; } /* get internal slot */ slot = PK11_GetInternalKeySlot(); if (slot == NULL) { fprintf(stderr, "Couldn't find slot (err %d)\n", PR_GetError()); goto cleanup; } rv = ATOB_ConvertAsciiToItem(&der, pubkstr); if (rv!= SECSuccess) { fprintf(stderr, "ATOB_ConvertAsciiToItem failed %d\n", PR_GetError()); goto cleanup; }
spki = SECKEY_DecodeDERSubjectPublicKeyInfo(&der); SECITEM_FreeItem(&der, PR_FALSE); pubkey = SECKEY_ExtractPublicKey(
spki); if (pubkey == NULL) { fprintf(stderr, "Couldn't extract public key (err %d)\n", PR_GetError()); goto cleanup; } modulus_len = SECKEY_PublicKeyStrength(pubkey); fprintf(stderr, "Public Key Modulus %d bytes\n", modulus_len); buf1 = (char *)malloc(modulus_...
...stderr, "Decrypt with Private Key failed (err %d)\n", PR_GetError()); goto cleanup; } fprintf(stderr, "Result of decryption, outlen = %d\n", outlen); fprintf(stderr, "Result of decryption, buf = \n%s\n", buf1); cleanup: if (cert) CERT_DestroyCertificate(cert); if (pubkey) SECKEY_DestroyPublicKey(pubkey); if (pvtkey) SECKEY_DestroyPrivateKey(pvtkey); if (
spki) SECKEY_DestroySubjectPublicKeyInfo(
spki); if (slot) PK11_FreeSlot(slot); if (buf1) free(buf1); if (buf2) free(buf2); exit(1); } ...
SubtleCrypto.exportKey() - Web APIs
() page for details. Keys are not exported in an encrypted format: to encrypt keys when exporting them use the SubtleCrypto.wrapKey() API instead. Syntax const result = crypto.subtle.exportKey(format, key); Parameters format is a string value describing the data format in which the key should be exported. It can be one of the following: raw: Raw format. pkcs8: PKCS #8 format.
spki: SubjectPublicKeyInfo format. jwk: JSON Web Key format. key is the CryptoKey to export. Return value result is a Promise. If format was jwk, then the promise fulfills with a JSON object containing the key. Otherwise the promise fulfills with an ArrayBuffer containing the key. Exceptions The promise is rejected when one of the following exceptions is encountered: ...
...nvert an ArrayBuffer into a string from https://developers.google.com/web/updates/2012/06/How-to-convert-ArrayBuffer-to-and-from-String */ function ab2str(buf) { return String.fromCharCode.apply(null, new Uint8Array(buf)); } /* Export the given key and write it into the "exported-key" space. ...
... then set up an event listener on the "Export" button. */ window.crypto.subtle.generateKey( { name: "RSA-OAEP", // Consider using a 4096-bit key for systems that require long-term security modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]), hash: "SHA-256", }, true, ["encrypt", "decrypt"] ).then((keyPair) => { const exportButton = document.querySelector(".
spki"); exportButton.addEventListener("click", () => { exportCryptoKey(keyPair.publicKey); }); }); JSON Web Key import This code exports an ECDSA private signing key as a JSON Web Key object. See the complete code on GitHub. /* Export the given key and write it into the "exported-key" space. */ async function exportCryptoKey(key) { const exported = await window.crypto.subtle.exportKey( ...
SubtleCrypto.wrapKey() - Web APIs
(): while wrapKey is composed of export + encrypt, unwrapKey is composed of import + decrypt. Syntax const result = crypto.subtle.wrapKey( format, key, wrappingKey, wrapAlgo ); Parameters format is a string describing the data format in which the key will be exported before it is encrypted. It can be one of the following: raw: Raw format. pkcs8: PKCS #8 format.
spki: SubjectPublicKeyInfo format. jwk: JSON Web Key format. key is the CryptoKey to wrap. wrappingkey is the CryptoKey used to encrypt the exported key. The key must have the wrapKey usage set. wrapAlgo is an object specifying the algorithm to be used to encrypt the exported key, and any required extra parameters: To use RSA-OAEP, pass an RsaOaepParams object. To use AES-CTR, pass...
... a 4096-bit key for systems that require long-term security modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]), hash: "SHA-256", }, true, ["sign", "verify"] ) .then((keyPair) => { return wrapCryptoKey(keyPair.privateKey); }) .then((wrappedKey) => { console.log(wrappedKey); }); SubjectPublicKeyInfo wrap This example wraps an RSA public encryption key. It uses "
spki" as the export format and AES-CBC, with a password-derived key, to encrypt it. See the complete code on GitHub. let salt; let iv; /* Get some key material to use as input to the deriveKey method. The key material is a password supplied by the user. */ function getKeyMaterial() { const password = window.prompt("Enter your password"); const enc = new TextEncoder(); return window.crypto.subt...
... [ "wrapKey", "unwrapKey" ] ); } /* Wrap the given key. */ async function wrapCryptoKey(keyToWrap) { // get the key encryption key const keyMaterial = await getKeyMaterial(); salt = window.crypto.getRandomValues(new Uint8Array(16)); const wrappingKey = await getKey(keyMaterial, salt); iv = window.crypto.getRandomValues(new Uint8Array(16)); return window.crypto.subtle.wrapKey( "
spki", keyToWrap, wrappingKey, { name: "AES-CBC", iv: iv } ); } /* Generate an encrypt/decrypt key pair, then wrap it. */ window.crypto.subtle.generateKey( { name: "RSA-OAEP", // Consider using a 4096-bit key for systems that require long-term security modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]), hash: "SHA-256", }, true, [...
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
t char *certReqFileName) { SECOidTag signAlgTag; SECItem result; PRInt32 numBytes; SECStatus rv = SECSuccess; PRArenaPool *arena = NULL; void *extHandle = NULL; PRFileDesc *outFile = NULL; CERTSubjectPublicKeyInfo *
spki = NULL; CERTCertificateRequest *cr = NULL; SECItem *encoding = NULL; /* If the certificate request file already exists, delete it */ if (PR_Access(certReqFileName, PR_ACCESS_EXISTS) == PR_SUCCESS) { PR_Delete(certReqFileName); } /* Open the certificate request file to write */ outFile = PR_Open(certReqFileNam...
...en the certificate request file to write */ outFile = PR_Open(certReqFileName, PR_CREATE_FILE | PR_RDWR | PR_TRUNCATE, 00660); if (!outFile) { PR_fprintf(PR_STDERR, "unable to open \"%s\" for writing (%ld, %ld).\n", certReqFileName, PR_GetError(), PR_GetOSError()); goto cleanup; } /* Create info about public key */
spki = SECKEY_CreateSubjectPublicKeyInfo(pubk); if (!
spki) { PR_fprintf(PR_STDERR, "unable to create subject public key\n"); rv = SECFailure; goto cleanup; } /* Generate certificate request */ cr = CERT_CreateCertificateRequest(subject,
spki, NULL); if (!cr) { PR_fprintf(PR_STDERR, "unable to make certificate request\n"); rv = SECFa...
sample2
certificate request with subject */ static SECStatus CertReq(SECKEYPrivateKey *privk, SECKEYPublicKey *pubk, KeyType keyType, SECOidTag hashAlgTag, CERTName *subject, PRBool ascii, const char *certReqFileName) { SECOidTag signAlgTag; SECItem result; PRInt32 numBytes; SECStatus rv = SECSuccess; PRArenaPool *arena = NULL; void *extHandle = NULL; PRFileDesc *outFile = NULL; CERTSubjectPublicKeyInfo *
spki = NULL; CERTCertificateRequest *cr = NULL; SECItem *encoding = NULL; /* If the certificate request file already exists, delete it */ if (PR_Access(certReqFileName, PR_ACCESS_EXISTS) == PR_SUCCESS) { PR_Delete(certReqFileName); } /* Open the certificate request file to write */ outFile = PR_Open(certReqFileName, PR_CREATE_FILE | PR_RDWR | PR_TRUNCATE, 00660); if (!outFile) { PR_fprintf(PR_STDERR, ...
...ReqFileName, PR_ACCESS_EXISTS) == PR_SUCCESS) { PR_Delete(certReqFileName); } /* Open the certificate request file to write */ outFile = PR_Open(certReqFileName, PR_CREATE_FILE | PR_RDWR | PR_TRUNCATE, 00660); if (!outFile) { PR_fprintf(PR_STDERR, "unable to open \"%s\" for writing (%ld, %ld).\n", certReqFileName, PR_GetError(), PR_GetOSError()); goto cleanup; } /* Create info about public key */
spki = SECKEY_CreateSubjectPublicKeyInfo(pubk); if (!
spki) { PR_fprintf(PR_STDERR, "unable to create subject public key\n"); rv = SECFailure; goto cleanup; } /* Generate certificate request */ cr = CERT_CreateCertificateRequest(subject,
spki, NULL); if (!cr) { PR_fprintf(PR_STDERR, "unable to make certificate request\n"); rv = SECFailure; goto cleanup; } arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); i...
SubtleCrypto.importKey() - Web APIs
use in the Web Crypto API. The function accepts several import formats: see Supported formats for details. Syntax const result = crypto.subtle.importKey( format, keyData, algorithm, extractable, usages ); Parameters format is a string describing the data format of the key to import. It can be one of the following: raw: Raw format. pkcs8: PKCS #8 format.
spki: SubjectPublicKeyInfo format. jwk: JSON Web Key format. keyData is an ArrayBuffer, a TypedArray, a DataView, or a JSONWebKey object containing the key in the given format. algorithm is a dictionary object defining the type of key to import and providing extra algorithm-specific parameters. For RSASSA-PKCS1-v1_5, RSA-PSS, or RSA-OAEP: Pass an RsaHashedImportParams object. For EC...
...See the complete code on GitHub. const jwkEcKey = { "crv": "P-384", "d": "wouCtU7Nw4E8_7n5C1-xBjB4xqSb_liZhYMsy8MGgxUny6Q8NCoH9xSiviwLFfK_", "ext":...
NSS_3.12_release_notes.html
g 341122: Coverity 633 SFTK_DestroySlotData uses slot->slotLock then checks it for NULL Bug 351140: Coverity 995, potential crash in ecgroup_fromNameAndHex Bug 362278: lib/util includes header files from other NSS directories Bug 228190: Remove unnecessary NSS_ENABLE_ECC defines from manifest.mn Bug 412906: remove sha.c and sha.h from lib/freebl Bug 353543: valgrind uninitialized memory read in ns
sPKIObjectCollection_AddInstances Bug 377548: NSS QA test program certutil's default DSA prime is only 512 bits Bug 333405: item cleanup is unused DEADCODE in SECITEM_AllocItem loser Bug 288730: compiler warnings in certutil Bug 337251: warning: /* within comment Bug 362967: export SECMOD_DeleteModuleEx Bug 389248: NSS build failure when NSS_ENABLE_ECC is not defined Bug 390451: Remembered passwords l...
NSS 3.46 release notes
andom during renegotiation Bug 1563258 - fips.sh fails due to non-existent "resp" directories Bug 1561598 - Remove -Wmaybe-uninitialized warning in pqg.c Bug 1560806 - Increase softoken password max size to 500 characters Bug 1568776 - Output paths relative to repository in NSS coverity Bug 1453408 - modutil -changepw fails in FIPS mode if password is an empty string Bug 1564727 - Use a PSS
SPKI when possible for delegated credentials Bug 1493916 - fix ppc64 inline assembler for clang Bug 1561588 - Remove -Wmaybe-uninitialized warning in p7env.c Bug 1561548 - Remove -Wmaybe-uninitialized warning in pkix_pl_ldapdefaultclient.c Bug 1512605 - Incorrect alert description after unencrypted Finished msg Bug 1564715 - Read /proc/cpuinfo when AT_HWCAP2 returns 0 Bug 1532194 - Remove or fix...
NSS API Guidelines
thread ID, whenever an arena is marked, and disallows any allocations or marks by any other thread. (Frees are allowed.) The ARENA_DESTRUCTOR_LIST preprocessor definition, and the code it encloses, are an effort to make the following work together: Arenas, letting you allocate stuff and then removing them all at once Lazy creation of pure-memory objects from ASN.1 blobs, for example use of NS
SPKIXCertificate doesn't drag all the code in for all constituent objects, unless they're actually being used Our agressive pointer-tracking facility All these are useful, but they don't combine well. Now some of the pointer-tracking pressure has eased off, we can drop its use when it becomes too difficult. Many routines are defined to take an NSSArena *arenaOpt argument. This means if an arena is...
SubtleCrypto.unwrapKey() - Web APIs
of decrypt + import, wrapKey is composed of encrypt + export. Syntax const result = crypto.subtle.unwrapKey( format, wrappedKey, unwrappingKey, unwrapAlgo, unwrappedKeyAlgo, extractable, keyUsages ); Parameters format is a string describing the data format of the key to unwrap. It can be one of the following: raw: Raw format. pkcs8: PKCS #8 format.
spki: SubjectPublicKeyInfo format. jwk: JSON Web Key format. wrappedKey is an ArrayBuffer containing the wrapped key in the given format. unwrappingKey is the CryptoKey to use to decrypt the wrapped key. The key must have the unwrapKey usage set. unwrapAlgo is an object specifying the algorithm to be used to encrypt the exported key, and any extra parameters as required: To use RSA-OA...
<keygen> - HTML: Hypertext Markup Language
e user's browser is configured to support cryptographic hardware (e.g. "smart cards") the user may also be given a choice of where to generate the key, i.e., in a smart card or in software and stored on disk. When the submit button is pressed, a key pair of the selected size is generated. The private key is encrypted and stored in the local key database. PublicKeyAndChallenge ::= SEQUENCE {
spki SubjectPublicKeyInfo, challenge IA5STRING } SignedPublicKeyAndChallenge ::= SEQUENCE { publicKeyAndChallenge PublicKeyAndChallenge, signatureAlgorithm AlgorithmIdentifier, signature BIT STRING } The public key and challenge string are DER encoded as PublicKeyAndChallenge, and then digitally signed with the private key to produce a SignedPublicKeyAndChallenge. The SignedPublicKeyA...
Public-Key-Pins-Report-Only - HTTP
It is possible to specify multiple pins for different public keys. Some browsers might allow other hashing algorithms than SHA-256 in the future. max-age=<expire-time> This directive is meaningless for the Public-Key-Pins-Report-Only header, it will be ignored by user agents and the header will not be cached. includeSubDomains Optional If this optional parameter is specified, th...
Public-Key-Pins - HTTP
e the HTTP Public Key Pinning article. Header type Response header Forbidden header name no Syntax Public-Key-Pins: pin-sha256="<pin-value>"; max-age=<expire-time>; includeSubDomains; report-uri="<uri>" Directives pin-sha256="<pin-value>" The quoted string is the Base64 encoded Subject Public Key Information (
SPKI) fingerprint. It is possible to specify multiple pins for different public keys. Some browsers might allow other hashing algorithms than SHA-256 in the future. max-age=<expire-time> The time, in seconds, that the browser should remember that this site is only to be accessed using one of the defined keys. includeSubDomains Optional If this optional parameter is specified, this rule applies to ...
HTTP Public Key Pinning (HPKP) - HTTP
custom root certificates all pinning violations are ignored. Enabling HPKP To enable this feature for your site, you need to return the Public-Key-Pins HTTP header when your site is accessed over HTTPS: Public-Key-Pins: pin-sha256="base64=="; max-age=expireTime [; includeSubDomains][; report-uri="reportURI"] pin-sha256 The quoted string is the Base64 encoded Subject Public Key Information (
SPKI) fingerprint. It is possible to specify multiple pins for different public keys. Some browsers might allow other hashing algorithms than SHA-256 in the future. See below on how to extract this information out of a certificate or key file. max-age The time, in seconds, that the browser should remember that this site is only to be accessed using one of the defined keys. includeSubDomains Optiona...