/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Set the Description field if (mIsInternalCryptoSlot) {
nsresult rv; if (PK11_IsFIPS()) {
rv = GetPIPNSSBundleString("Fips140SlotDescription", mSlotDesc);
} else {
rv = GetPIPNSSBundleString("SlotDescription", mSlotDesc);
} if (NS_FAILED(rv)) { return rv;
}
} elseif (mIsInternalKeySlot) {
rv = GetPIPNSSBundleString("PrivateSlotDescription", mSlotDesc); if (NS_FAILED(rv)) { return rv;
}
} else { constchar* ccDesc =
mozilla::BitwiseCast<char*, CK_UTF8CHAR*>(slotInfo.slotDescription);
mSlotDesc.Assign(ccDesc, strnlen(ccDesc, sizeof(slotInfo.slotDescription)));
mSlotDesc.Trim(" ", false, true);
}
// Set the Manufacturer field if (mIsInternalCryptoSlot || mIsInternalKeySlot) {
rv = GetPIPNSSBundleString("ManufacturerID", mSlotManufacturerID); if (NS_FAILED(rv)) { return rv;
}
} else { constchar* ccManID =
mozilla::BitwiseCast<char*, CK_UTF8CHAR*>(slotInfo.manufacturerID);
mSlotManufacturerID.Assign(
ccManID, strnlen(ccManID, sizeof(slotInfo.manufacturerID)));
mSlotManufacturerID.Trim(" ", false, true);
}
// Set the Hardware Version field
mSlotHWVersion.Truncate();
mSlotHWVersion.AppendInt(slotInfo.hardwareVersion.major);
mSlotHWVersion.Append('.');
mSlotHWVersion.AppendInt(slotInfo.hardwareVersion.minor);
// Set the Firmware Version field
mSlotFWVersion.Truncate();
mSlotFWVersion.AppendInt(slotInfo.firmwareVersion.major);
mSlotFWVersion.Append('.');
mSlotFWVersion.AppendInt(slotInfo.firmwareVersion.minor);
// Convert the UTF8 internal name of the module to how it should appear to the // user. In most cases this involves simply passing back the module's name. // However, the builtin roots module has a non-localized name internally that we // must map to the localized version when we display it to the user. static nsresult NormalizeModuleNameOut(constchar* moduleNameIn,
nsACString& moduleNameOut) { // Easy case: this isn't the builtin roots module. if (strnlen(moduleNameIn, kRootModuleName.Length() + 1) !=
kRootModuleName.Length() ||
strncmp(kRootModuleName.get(), moduleNameIn, kRootModuleName.Length()) !=
0) {
moduleNameOut.Assign(moduleNameIn); return NS_OK;
}
nsresult rv = CheckForSmartCardChanges(); if (NS_FAILED(rv)) { return rv;
}
nsCOMPtr<nsIMutableArray> array = do_CreateInstance(NS_ARRAY_CONTRACTID); if (!array) { return NS_ERROR_FAILURE;
}
/* applications which allow new slot creation (which Firefox now does * since it uses the WaitForSlotEvent call) need to hold the * ModuleList Read lock to prevent the slot array from changing out
* from under it. */
mozilla::AutoSECMODListReadLock lock; for (int i = 0; i < mModule->slotCount; i++) { if (mModule->slots[i]) {
nsCOMPtr<nsIPKCS11Slot> slot = new nsPKCS11Slot(mModule->slots[i]);
rv = array->AppendElement(slot); if (NS_FAILED(rv)) { return rv;
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.