b=169932 Replace wstring with AString in IDL

r=darin sr=alecf
This commit is contained in:
kaie%netscape.com 2002-09-23 20:17:16 +00:00
Родитель 39823e85f4
Коммит ec41544988
25 изменённых файлов: 319 добавлений и 413 удалений

Просмотреть файл

@ -179,7 +179,7 @@ NS_IMETHODIMP nsSMimeJSHelper::GetRecipientCertsInfo(
nsXPIDLString id, ed;
if (NS_SUCCEEDED(cert->GetIssuedDate(getter_Copies(id))))
if (NS_SUCCEEDED(cert->GetIssuedDate(id)))
{
*iCII = ToNewUnicode(id);
if (!*iCII) {
@ -188,7 +188,7 @@ NS_IMETHODIMP nsSMimeJSHelper::GetRecipientCertsInfo(
}
}
if (NS_SUCCEEDED(cert->GetExpiresDate(getter_Copies(ed))))
if (NS_SUCCEEDED(cert->GetExpiresDate(ed)))
{
*iCEI = ToNewUnicode(ed);
if (!*iCEI) {

Просмотреть файл

@ -42,7 +42,7 @@ interface nsIASN1Tree : nsITreeView {
void loadASN1Structure(in nsIASN1Object asn1Object);
wstring getDisplayData(in unsigned long index);
AString getDisplayData(in unsigned long index);
};

Просмотреть файл

@ -324,17 +324,14 @@ nsNSSASN1Tree::GetCellText(PRInt32 row, const PRUnichar *colID,
return NS_ERROR_FAILURE;
//There's only one column for ASN1 dump.
PRUnichar* displayName = nsnull;
rv = n->obj->GetDisplayName(&displayName); // copies
_retval = displayName; // copies again!
nsCRT::free(displayName);
rv = n->obj->GetDisplayName(_retval);
}
return rv;
}
/* wstring getDisplayData (in unsigned long index); */
NS_IMETHODIMP
nsNSSASN1Tree::GetDisplayData(PRUint32 index, PRUnichar **_retval)
nsNSSASN1Tree::GetDisplayData(PRUint32 index, nsAString &_retval)
{
myNode *n = FindNodeFromIndex(index);
if (!n)

Просмотреть файл

@ -232,7 +232,7 @@ nsNSSDialogs::UnknownIssuer(nsIInterfaceRequestor *socketInfo,
NS_IMETHODIMP
nsNSSDialogs::MismatchDomain(nsIInterfaceRequestor *socketInfo,
const PRUnichar *targetURL,
const nsACString &targetURL,
nsIX509Cert *cert, PRBool *_retval)
{
nsresult rv;
@ -245,7 +245,7 @@ nsNSSDialogs::MismatchDomain(nsIInterfaceRequestor *socketInfo,
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDialogParamBlock> dialogBlock = do_QueryInterface(block);
rv = dialogBlock->SetString(1, targetURL);
rv = dialogBlock->SetString(1, NS_ConvertUTF8toUCS2(targetURL).get());
if (NS_FAILED(rv))
return rv;
@ -311,10 +311,10 @@ nsNSSDialogs::CertExpired(nsIInterfaceRequestor *socketInfo,
nsXPIDLString message1;
nsXPIDLString title;
PRUnichar *commonName=nsnull;
nsString formattedDate;
nsAutoString commonName;
nsAutoString formattedDate;
rv = cert->GetCommonName(&commonName);
rv = cert->GetCommonName(commonName);
nsIDateTimeFormat *aDateTimeFormat;
rv = nsComponentManager::CreateInstance(kDateTimeFormatCID, NULL,
@ -324,18 +324,14 @@ nsNSSDialogs::CertExpired(nsIInterfaceRequestor *socketInfo,
aDateTimeFormat->FormatPRTime(nsnull, kDateFormatShort,
kTimeFormatNoSeconds, timeToUse,
formattedDate);
PRUnichar *formattedDatePR = ToNewUnicode(formattedDate);
const PRUnichar *formatStrings[2] = { commonName, formattedDatePR };
nsString keyString = NS_ConvertASCIItoUCS2(key);
nsString titleKeyString = NS_ConvertASCIItoUCS2(titleKey);
const PRUnichar *formatStrings[2] = { commonName.get(), formattedDate.get() };
NS_ConvertASCIItoUCS2 keyString(key);
NS_ConvertASCIItoUCS2 titleKeyString(titleKey);
mPIPStringBundle->FormatStringFromName(keyString.get(), formatStrings,
2, getter_Copies(message1));
mPIPStringBundle->FormatStringFromName(titleKeyString.get(), formatStrings,
2, getter_Copies(title));
Recycle(commonName);
Recycle(formattedDatePR);
nsCOMPtr<nsIDialogParamBlock> dialogBlock = do_QueryInterface(block);
rv = dialogBlock->SetString(1,message1);
rv = dialogBlock->SetString(2,title);
@ -363,14 +359,14 @@ nsNSSDialogs::CertExpired(nsIInterfaceRequestor *socketInfo,
NS_IMETHODIMP
nsNSSDialogs::CrlNextupdate(nsIInterfaceRequestor *socketInfo,
const PRUnichar * targetURL, nsIX509Cert *cert)
const nsACString &targetURL, nsIX509Cert *cert)
{
nsresult rv;
nsCOMPtr<nsIPKIParamBlock> block = do_CreateInstance(kPKIParamBlockCID);
nsCOMPtr<nsIDialogParamBlock> dialogBlock = do_QueryInterface(block);
rv = dialogBlock->SetString(1, targetURL);
rv = dialogBlock->SetString(1, NS_ConvertUTF8toUCS2(targetURL).get());
if (NS_FAILED(rv))
return rv;
@ -661,7 +657,6 @@ nsNSSDialogs::DownloadCACert(nsIInterfaceRequestor *ctx,
NS_IMETHODIMP
nsNSSDialogs::CACertExists(nsIInterfaceRequestor *ctx,PRBool *_canceled)
{
nsresult rv;
@ -675,8 +670,8 @@ nsNSSDialogs::CACertExists(nsIInterfaceRequestor *ctx,PRBool *_canceled)
rv = nsNSSDialogHelper::openDialog(parent,
"chrome://pippki/content/cacertexists.xul",
block);
"chrome://pippki/content/cacertexists.xul",
block);
return rv;
}
@ -708,13 +703,13 @@ nsNSSDialogs::ChooseCertificate(nsIInterfaceRequestor *ctx, const PRUnichar *cn,
if (NS_FAILED(rv)) return rv;
for (i = 0; i < count; i++) {
rv = block->SetString(i+3, certNickList[i]);
if (NS_FAILED(rv)) return rv;
rv = block->SetString(i+3, certNickList[i]);
if (NS_FAILED(rv)) return rv;
}
for (i = 0; i < count; i++) {
rv = block->SetString(i+count+3, certDetailsList[i]);
if (NS_FAILED(rv)) return rv;
rv = block->SetString(i+count+3, certDetailsList[i]);
if (NS_FAILED(rv)) return rv;
}
rv = block->SetInt(0, count);
@ -761,13 +756,13 @@ nsNSSDialogs::PickCertificate(nsIInterfaceRequestor *ctx,
block->SetNumberStrings(1+count*2);
for (i = 0; i < count; i++) {
rv = block->SetString(i, certNickList[i]);
if (NS_FAILED(rv)) return rv;
rv = block->SetString(i, certNickList[i]);
if (NS_FAILED(rv)) return rv;
}
for (i = 0; i < count; i++) {
rv = block->SetString(i+count, certDetailsList[i]);
if (NS_FAILED(rv)) return rv;
rv = block->SetString(i+count, certDetailsList[i]);
if (NS_FAILED(rv)) return rv;
}
rv = block->SetInt(0, count);
@ -794,14 +789,9 @@ nsNSSDialogs::PickCertificate(nsIInterfaceRequestor *ctx,
}
/*
* void setPKCS12FilePassword(in nsIInterfaceRequestor ctx,
* out wstring password,
* out boolean canceled);
*/
NS_IMETHODIMP
nsNSSDialogs::SetPKCS12FilePassword(nsIInterfaceRequestor *ctx,
PRUnichar **_password,
nsAString &_password,
PRBool *_canceled)
{
nsresult rv;
@ -822,19 +812,19 @@ nsNSSDialogs::SetPKCS12FilePassword(nsIInterfaceRequestor *ctx,
*_canceled = (status == 0) ? PR_TRUE : PR_FALSE;
if (!*_canceled) {
// retrieve the password
rv = block->GetString(2, _password);
PRUnichar *pw;
rv = block->GetString(2, &pw);
if (NS_SUCCEEDED(rv)) {
_password = pw;
nsMemory::Free(pw);
}
}
return rv;
}
/*
* void getPKCS12FilePassword(in nsIInterfaceRequestor ctx,
* out wstring password,
* out boolean canceled);
*/
NS_IMETHODIMP
nsNSSDialogs::GetPKCS12FilePassword(nsIInterfaceRequestor *ctx,
PRUnichar **_password,
nsAString &_password,
PRBool *_canceled)
{
nsresult rv;
@ -855,7 +845,12 @@ nsNSSDialogs::GetPKCS12FilePassword(nsIInterfaceRequestor *ctx,
*_canceled = (status == 0) ? PR_TRUE : PR_FALSE;
if (!*_canceled) {
// retrieve the password
rv = block->GetString(2, _password);
PRUnichar *pw;
rv = block->GetString(2, &pw);
if (NS_SUCCEEDED(rv)) {
_password = pw;
nsMemory::Free(pw);
}
}
return rv;
}
@ -914,8 +909,8 @@ nsNSSDialogs::ChooseToken(nsIInterfaceRequestor *aCtx, const PRUnichar **aTokenL
block->SetNumberStrings(aCount);
for (i = 0; i < aCount; i++) {
rv = block->SetString(i, aTokenList[i]);
if (NS_FAILED(rv)) return rv;
rv = block->SetString(i, aTokenList[i]);
if (NS_FAILED(rv)) return rv;
}
rv = block->SetInt(0, aCount);

Просмотреть файл

@ -65,7 +65,7 @@ interface nsIASN1Object : nsISupports {
// values above.
attribute unsigned long type;
attribute unsigned long tag;
attribute wstring displayName;
attribute wstring displayValue;
attribute AString displayName;
attribute AString displayValue;
};

Просмотреть файл

@ -49,14 +49,14 @@ interface nsIBadCertListener : nsISupports {
out short certAddType);
boolean mismatchDomain(in nsIInterfaceRequestor socketInfo,
in wstring targetURL,
in AUTF8String targetURL,
in nsIX509Cert cert);
boolean certExpired(in nsIInterfaceRequestor socketInfo,
in nsIX509Cert cert);
void crlNextupdate(in nsIInterfaceRequestor socketInfo,
in wstring targetURL, in nsIX509Cert cert);
in AUTF8String targetURL, in nsIX509Cert cert);
};

Просмотреть файл

@ -37,13 +37,13 @@
[scriptable, uuid(c185d920-4a3e-11d5-ba27-00108303b117)]
interface nsICRLInfo : nsISupports {
readonly attribute wstring org;
readonly attribute wstring orgUnit;
readonly attribute AString org;
readonly attribute AString orgUnit;
readonly attribute PRTime lastUpdate;
readonly attribute PRTime nextUpdate;
readonly attribute wstring lastUpdateLocale;
readonly attribute wstring nextUpdateLocale;
readonly attribute wstring nameInDb;
readonly attribute wstring lastFetchURL;
readonly attribute AString lastUpdateLocale;
readonly attribute AString nextUpdateLocale;
readonly attribute AString nameInDb;
readonly attribute AUTF8String lastFetchURL;
};

Просмотреть файл

@ -46,10 +46,10 @@ interface nsICertificateDialogs : nsISupports
boolean cACertExists(in nsIInterfaceRequestor ctx);
boolean setPKCS12FilePassword(in nsIInterfaceRequestor ctx,
out wstring password);
out AString password);
boolean getPKCS12FilePassword(in nsIInterfaceRequestor ctx,
out wstring password);
out AString password);
void viewCert(in nsIInterfaceRequestor ctx,
in nsIX509Cert cert);

Просмотреть файл

@ -45,25 +45,25 @@ interface nsIX509Cert : nsISupports {
/*
* attributes for certs
*/
readonly attribute wstring nickname;
readonly attribute wstring emailAddress;
readonly attribute wstring commonName;
readonly attribute wstring organization;
readonly attribute wstring organizationalUnit;
readonly attribute wstring subjectName;
readonly attribute wstring issuerName;
readonly attribute wstring serialNumber;
readonly attribute wstring rsaPubModulus;
readonly attribute wstring sha1Fingerprint;
readonly attribute wstring md5Fingerprint;
readonly attribute wstring issuedDate;
readonly attribute wstring issuedDateSortable;
readonly attribute wstring expiresDate;
readonly attribute wstring expiresDateSortable;
readonly attribute wstring tokenName;
readonly attribute wstring issuerCommonName;
readonly attribute wstring issuerOrganization;
readonly attribute wstring issuerOrganizationUnit;
readonly attribute AString nickname;
readonly attribute AString emailAddress;
readonly attribute AString commonName;
readonly attribute AString organization;
readonly attribute AString organizationalUnit;
readonly attribute AString subjectName;
readonly attribute AString issuerName;
readonly attribute AString serialNumber;
readonly attribute AString rsaPubModulus;
readonly attribute AString sha1Fingerprint;
readonly attribute AString md5Fingerprint;
readonly attribute AString issuedDate;
readonly attribute AString issuedDateSortable;
readonly attribute AString expiresDate;
readonly attribute AString expiresDateSortable;
readonly attribute AString tokenName;
readonly attribute AString issuerCommonName;
readonly attribute AString issuerOrganization;
readonly attribute AString issuerOrganizationUnit;
readonly attribute nsIX509Cert issuer;
readonly attribute nsIX509CertValidity validity;
@ -100,7 +100,7 @@ interface nsIX509Cert : nsISupports {
out unsigned long count,
[array, size_is(count)] out wstring usages);
void getPurposes(out unsigned long verified, out wstring purposes);
void getPurposes(out unsigned long verified, out AString purposes);
const unsigned long CERT_USAGE_SSLClient = 0;

Просмотреть файл

@ -61,7 +61,7 @@ interface nsIX509CertDB : nsISupports {
const unsigned long TRUSTED_OBJSIGN = 1 << 2;
nsIX509Cert getCertByNickname(in nsISupports aToken,
in wstring aNickname);
in AString aNickname);
/*
* getCertByDBKey
@ -90,10 +90,10 @@ interface nsIX509CertDB : nsISupports {
[array, size_is(count)] out wstring certNameList);
/* Get the user encryption cert */
nsIX509Cert getEmailEncryptionCert(in wstring aNickname);
nsIX509Cert getEmailEncryptionCert(in AString aNickname);
/* Get the user signing cert */
nsIX509Cert getEmailSigningCert(in wstring aNickname);
nsIX509Cert getEmailSigningCert(in AString aNickname);
/* Get a cert by email address */
nsIX509Cert getCertByEmailAddress(in nsISupports aToken,
@ -196,7 +196,7 @@ interface nsIX509CertDB : nsISupports {
in nsILocalFile aFile,
in unsigned long count,
[array, size_is(count)] in nsIX509Cert aCerts);
//[array, size_is(count)] in wstring aCertNames);
//[array, size_is(count)] in AString aCertNames);
/*
* getOCSPResponders
*

Просмотреть файл

@ -38,10 +38,10 @@
[scriptable, uuid(e701dfd8-1dd1-11b2-a172-ffa6cc6156ad)]
interface nsIX509CertValidity : nsISupports {
readonly attribute PRTime notBefore;
readonly attribute wstring notBeforeLocalTime;
readonly attribute wstring notBeforeGMT;
readonly attribute AString notBeforeLocalTime;
readonly attribute AString notBeforeGMT;
readonly attribute PRTime notAfter;
readonly attribute wstring notAfterLocalTime;
readonly attribute wstring notAfterGMT;
readonly attribute AString notAfterLocalTime;
readonly attribute AString notAfterGMT;
};

Просмотреть файл

@ -74,7 +74,7 @@ nsCRLInfo::nsCRLInfo(CERTSignedCrl *signedCrl)
nsAutoString nameInDb;
nsAutoString nextUpdateLocale;
nsAutoString lastUpdateLocale;
nsAutoString lastFetchURL;
nsCAutoString lastFetchURL;
PRTime lastUpdate;
PRTime nextUpdate;
SECStatus sec_rv;
@ -117,7 +117,7 @@ nsCRLInfo::nsCRLInfo(CERTSignedCrl *signedCrl)
char * url = signedCrl->url;
if(url) {
lastFetchURL = NS_ConvertASCIItoUCS2(url);
lastFetchURL = url;
}
mOrg.Assign(org.get());
@ -127,8 +127,7 @@ nsCRLInfo::nsCRLInfo(CERTSignedCrl *signedCrl)
mLastUpdate = lastUpdate;
mNextUpdate = nextUpdate;
mNameInDb.Assign(nameInDb.get());
mLastFetchURL.Assign(lastFetchURL.get());
mLastFetchURL = lastFetchURL;
}
nsCRLInfo::~nsCRLInfo()
@ -137,32 +136,28 @@ nsCRLInfo::~nsCRLInfo()
}
/* readonly attribute */
NS_IMETHODIMP nsCRLInfo::GetOrg(PRUnichar** aOrg)
NS_IMETHODIMP nsCRLInfo::GetOrg(nsAString & aOrg)
{
NS_ENSURE_ARG(aOrg);
*aOrg = ToNewUnicode(mOrg);
aOrg = mOrg;
return NS_OK;
}
/* readonly attribute */
NS_IMETHODIMP nsCRLInfo::GetOrgUnit(PRUnichar** aOrgUnit)
NS_IMETHODIMP nsCRLInfo::GetOrgUnit(nsAString & aOrgUnit)
{
NS_ENSURE_ARG(aOrgUnit);
*aOrgUnit = ToNewUnicode(mOrgUnit);
aOrgUnit = mOrgUnit;
return NS_OK;
}
NS_IMETHODIMP nsCRLInfo::GetLastUpdateLocale(PRUnichar** aLastUpdateLocale)
NS_IMETHODIMP nsCRLInfo::GetLastUpdateLocale(nsAString & aLastUpdateLocale)
{
NS_ENSURE_ARG(aLastUpdateLocale);
*aLastUpdateLocale = ToNewUnicode(mLastUpdateLocale);
aLastUpdateLocale = mLastUpdateLocale;
return NS_OK;
}
NS_IMETHODIMP nsCRLInfo::GetNextUpdateLocale(PRUnichar** aNextUpdateLocale)
NS_IMETHODIMP nsCRLInfo::GetNextUpdateLocale(nsAString & aNextUpdateLocale)
{
NS_ENSURE_ARG(aNextUpdateLocale);
*aNextUpdateLocale = ToNewUnicode(mNextUpdateLocale);
aNextUpdateLocale = mNextUpdateLocale;
return NS_OK;
}
@ -180,19 +175,14 @@ NS_IMETHODIMP nsCRLInfo::GetNextUpdate(PRTime* aNextUpdate)
return NS_OK;
}
/* readonly attribute */
NS_IMETHODIMP nsCRLInfo::GetNameInDb(PRUnichar** aNameInDb)
NS_IMETHODIMP nsCRLInfo::GetNameInDb(nsAString & aNameInDb)
{
NS_ENSURE_ARG(aNameInDb);
*aNameInDb = ToNewUnicode(mNameInDb);
aNameInDb = mNameInDb;
return NS_OK;
}
NS_IMETHODIMP nsCRLInfo::GetLastFetchURL(PRUnichar** aLastFetchURL)
NS_IMETHODIMP nsCRLInfo::GetLastFetchURL(nsACString & aLastFetchURL)
{
NS_ENSURE_ARG(aLastFetchURL);
*aLastFetchURL = ToNewUnicode(mLastFetchURL);
aLastFetchURL = mLastFetchURL;
return NS_OK;
}

Просмотреть файл

@ -68,7 +68,7 @@ private:
PRTime mLastUpdate;
PRTime mNextUpdate;
nsString mNameInDb;
nsString mLastFetchURL;
nsCString mLastFetchURL;
nsString mNextAutoUpdateDate;
};

Просмотреть файл

@ -210,8 +210,7 @@ done:
if(importSuccessful){
PRUnichar *updateTime;
nsCAutoString updateTimeStr;
PRUnichar *updateURL;
nsCAutoString updateURLStr;
nsCString updateURL;
PRInt32 timingTypePref;
double dayCnt;
char *dayCntStr;
@ -255,10 +254,8 @@ done:
}
//Update the url to download from, next time
crlData->GetLastFetchURL(&updateURL);
updateURLStr.AssignWithConversion(updateURL);
nsMemory::Free(updateURL);
pref->SetCharPref(updateUrlPrefStr.get(),updateURLStr.get());
crlData->GetLastFetchURL(updateURL);
pref->SetCharPref(updateUrlPrefStr.get(),updateURL.get());
pref->SetIntPref(updateErrCntPrefStr.get(),0);
pref->SavePrefFile(nsnull);

Просмотреть файл

@ -56,7 +56,7 @@ static NS_DEFINE_CID(kNSSComponentCID, NS_NSSCOMPONENT_CID);
// field from a cert) has an element in the array. The numChildren field
// stores the number of certs corresponding to that thread.
struct treeArrayElStr {
PRUnichar *orgName; /* heading for thread */
nsString orgName; /* heading for thread */
PRBool open; /* toggle open state for thread */
PRInt32 certIndex; /* index into cert array for 1st cert */
PRInt32 numChildren; /* number of chidren (certs) for thread */
@ -404,7 +404,7 @@ nsCertTree::UpdateUIContents()
nsCOMPtr<nsISupports> isupport = dont_AddRef(mCertArray->ElementAt(j));
nsCOMPtr<nsIX509Cert> orgCert = do_QueryInterface(isupport);
for (PRInt32 i=0; i<mNumOrgs; i++) {
orgCert->GetIssuerOrganization(&mTreeArray[i].orgName);
orgCert->GetIssuerOrganization(mTreeArray[i].orgName);
mTreeArray[i].open = PR_TRUE;
mTreeArray[i].certIndex = j;
mTreeArray[i].numChildren = 1;
@ -664,29 +664,32 @@ nsCertTree::GetCellText(PRInt32 row, const PRUnichar *colID,
}
nsCOMPtr<nsIX509Cert> cert = dont_AddRef(GetCertAtIndex(row));
if (cert == nsnull) return NS_ERROR_FAILURE;
char *str = NULL;
PRUnichar *wstr = NULL;
if (strcmp(col, "certcol") == 0) {
rv = cert->GetCommonName(&wstr);
if (NS_FAILED(rv) || !wstr) {
// can this be fixed to not do copying?
PRUnichar *tmp = nsnull;
rv = cert->GetNickname(&tmp);
nsAutoString nick(tmp);
char *tmps = ToNewCString(nick);
char *mark = strchr(tmps, ':');
if (mark) {
str = PL_strdup(mark + 1);
} else {
wstr = ToNewUnicode(nick);
rv = cert->GetCommonName(_retval);
if (NS_FAILED(rv)) {
// kaie: I didn't invent the idea to cut off anything before
// the first colon. :-)
nsAutoString nick;
rv = cert->GetNickname(nick);
nsAString::const_iterator start, end, end2;
nick.BeginReading(start);
nick.EndReading(end);
end2 = end;
if (FindInReadable(NS_LITERAL_STRING(":"), start, end)) {
// found. end points to the first char after the colon,
// that's what we want.
_retval = Substring(end, end2);
}
else {
_retval = nick;
}
nsMemory::Free(tmp);
nsMemory::Free(tmps);
}
} else if (strcmp(col, "tokencol") == 0) {
rv = cert->GetTokenName(&wstr);
rv = cert->GetTokenName(_retval);
} else if (strcmp(col, "emailcol") == 0) {
rv = cert->GetEmailAddress(&wstr);
rv = cert->GetEmailAddress(_retval);
} else if (strcmp(col, "purposecol") == 0 && mNSSComponent) {
PRUint32 verified;
PRBool ocspEnabled;
@ -695,45 +698,46 @@ nsCertTree::GetCellText(PRInt32 row, const PRUnichar *colID,
mNSSComponent->DisableOCSP();
}
rv = cert->GetPurposes(&verified, NULL);
nsAutoString dummyPurposes;
rv = cert->GetPurposes(&verified, dummyPurposes);
if (NS_FAILED(rv)) {
verified = nsIX509Cert::NOT_VERIFIED_UNKNOWN;
}
switch (verified) {
case nsIX509Cert::VERIFIED_OK:
rv = cert->GetPurposes(&verified, &wstr);
rv = cert->GetPurposes(&verified, _retval);
break;
case nsIX509Cert::CERT_REVOKED:
rv = mNSSComponent->GetPIPNSSBundleString(
NS_LITERAL_STRING("VerifyRevoked").get(), &wstr);
NS_LITERAL_STRING("VerifyRevoked").get(), _retval);
break;
case nsIX509Cert::CERT_EXPIRED:
rv = mNSSComponent->GetPIPNSSBundleString(
NS_LITERAL_STRING("VerifyExpired").get(), &wstr);
NS_LITERAL_STRING("VerifyExpired").get(), _retval);
break;
case nsIX509Cert::CERT_NOT_TRUSTED:
rv = mNSSComponent->GetPIPNSSBundleString(
NS_LITERAL_STRING("VerifyNotTrusted").get(), &wstr);
NS_LITERAL_STRING("VerifyNotTrusted").get(), _retval);
break;
case nsIX509Cert::ISSUER_NOT_TRUSTED:
rv = mNSSComponent->GetPIPNSSBundleString(
NS_LITERAL_STRING("VerifyIssuerNotTrusted").get(), &wstr);
NS_LITERAL_STRING("VerifyIssuerNotTrusted").get(), _retval);
break;
case nsIX509Cert::ISSUER_UNKNOWN:
rv = mNSSComponent->GetPIPNSSBundleString(
NS_LITERAL_STRING("VerifyIssuerUnknown").get(), &wstr);
NS_LITERAL_STRING("VerifyIssuerUnknown").get(), _retval);
break;
case nsIX509Cert::INVALID_CA:
rv = mNSSComponent->GetPIPNSSBundleString(
NS_LITERAL_STRING("VerifyInvalidCA").get(), &wstr);
NS_LITERAL_STRING("VerifyInvalidCA").get(), _retval);
break;
case nsIX509Cert::NOT_VERIFIED_UNKNOWN:
case nsIX509Cert::USAGE_NOT_ALLOWED:
default:
rv = mNSSComponent->GetPIPNSSBundleString(
NS_LITERAL_STRING("VerifyUnknown").get(), &wstr);
NS_LITERAL_STRING("VerifyUnknown").get(), _retval);
break;
}
@ -741,23 +745,14 @@ nsCertTree::GetCellText(PRInt32 row, const PRUnichar *colID,
mNSSComponent->EnableOCSP();
}
} else if (strcmp(col, "issuedcol") == 0) {
rv = cert->GetIssuedDate(&wstr);
rv = cert->GetIssuedDate(_retval);
} else if (strcmp(col, "expiredcol") == 0) {
rv = cert->GetExpiresDate(&wstr);
rv = cert->GetExpiresDate(_retval);
} else if (strcmp(col, "serialnumcol") == 0) {
rv = cert->GetSerialNumber(&wstr);
/*
} else if (strcmp(col, "certdbkeycol") == 0) {
rv = cert->GetDbKey(&str);
*/
rv = cert->GetSerialNumber(_retval);
} else {
return NS_ERROR_FAILURE;
}
if (str) {
nsAutoString astr = NS_ConvertASCIItoUCS2(str);
wstr = ToNewUnicode(astr);
}
_retval = wstr;
return rv;
}
@ -928,22 +923,22 @@ nsCertTree::CmpInitCriterion(nsIX509Cert *cert, CompareCacheHashEntry *entry,
switch (crit) {
case sort_IssuerOrg:
cert->GetIssuerOrganization(getter_Copies(str));
cert->GetIssuerOrganization(str);
break;
case sort_Org:
cert->GetOrganization(getter_Copies(str));
cert->GetOrganization(str);
break;
case sort_Token:
cert->GetTokenName(getter_Copies(str));
cert->GetTokenName(str);
break;
case sort_CommonName:
cert->GetCommonName(getter_Copies(str));
cert->GetCommonName(str);
break;
case sort_IssuedDateDescending:
cert->GetIssuedDateSortable(getter_Copies(str));
cert->GetIssuedDateSortable(str);
break;
case sort_Email:
cert->GetEmailAddress(getter_Copies(str));
cert->GetEmailAddress(str);
break;
case sort_None:
default:

Просмотреть файл

@ -296,35 +296,31 @@ nsNSSASN1Sequence::SetType(PRUint32 aType)
return NS_OK;
}
/* attribute wstring displayName; */
NS_IMETHODIMP
nsNSSASN1Sequence::GetDisplayName(PRUnichar * *aDisplayName)
nsNSSASN1Sequence::GetDisplayName(nsAString &aDisplayName)
{
NS_ENSURE_ARG_POINTER(aDisplayName);
*aDisplayName = ToNewUnicode(mDisplayName);
return (*aDisplayName) ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsNSSASN1Sequence::SetDisplayName(const PRUnichar * aDisplayName)
{
mDisplayName.Assign(aDisplayName);
return NS_OK;
}
/* attribute wstring displayValue; */
NS_IMETHODIMP
nsNSSASN1Sequence::GetDisplayValue(PRUnichar * *aDisplayValue)
{
NS_ENSURE_ARG_POINTER(aDisplayValue);
*aDisplayValue = ToNewUnicode(mDisplayValue);
aDisplayName = mDisplayName;
return NS_OK;
}
NS_IMETHODIMP
nsNSSASN1Sequence::SetDisplayValue(const PRUnichar * aDisplayValue)
nsNSSASN1Sequence::SetDisplayName(const nsAString &aDisplayName)
{
mDisplayValue.Assign(aDisplayValue);
mDisplayName = aDisplayName;
return NS_OK;
}
NS_IMETHODIMP
nsNSSASN1Sequence::GetDisplayValue(nsAString &aDisplayValue)
{
aDisplayValue = mDisplayValue;
return NS_OK;
}
NS_IMETHODIMP
nsNSSASN1Sequence::SetDisplayValue(const nsAString &aDisplayValue)
{
mDisplayValue = aDisplayValue;
return NS_OK;
}
@ -378,16 +374,16 @@ nsNSSASN1PrintableItem::~nsNSSASN1PrintableItem()
/* readonly attribute wstring value; */
NS_IMETHODIMP
nsNSSASN1PrintableItem::GetDisplayValue(PRUnichar * *aValue)
nsNSSASN1PrintableItem::GetDisplayValue(nsAString &aValue)
{
*aValue = ToNewUnicode(mValue);
aValue = mValue;
return NS_OK;
}
NS_IMETHODIMP
nsNSSASN1PrintableItem::SetDisplayValue(const PRUnichar * aValue)
nsNSSASN1PrintableItem::SetDisplayValue(const nsAString &aValue)
{
mValue.Assign(aValue);
mValue = aValue;
return NS_OK;
}
@ -459,17 +455,16 @@ nsNSSASN1PrintableItem::GetData(char **outData, PRUint32 *outLen)
/* attribute wstring displayName; */
NS_IMETHODIMP
nsNSSASN1PrintableItem::GetDisplayName(PRUnichar * *aDisplayName)
nsNSSASN1PrintableItem::GetDisplayName(nsAString &aDisplayName)
{
NS_ENSURE_ARG_POINTER(aDisplayName);
*aDisplayName = ToNewUnicode(mDisplayName);
return (*aDisplayName) ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsNSSASN1PrintableItem::SetDisplayName(const PRUnichar * aDisplayName)
{
mDisplayName.Assign(aDisplayName);
aDisplayName = mDisplayName;
return NS_OK;
}
NS_IMETHODIMP
nsNSSASN1PrintableItem::SetDisplayName(const nsAString &aDisplayName)
{
mDisplayName = aDisplayName;
return NS_OK;
}

Просмотреть файл

@ -73,7 +73,7 @@ ProcessVersion(SECItem *versionItem,
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpVersion").get(),
text);
rv = printableItem->SetDisplayName(text.get());
rv = printableItem->SetDisplayName(text);
if (NS_FAILED(rv))
return rv;
@ -111,7 +111,7 @@ ProcessVersion(SECItem *versionItem,
if (NS_FAILED(rv))
return rv;
rv = printableItem->SetDisplayValue(text.get());
rv = printableItem->SetDisplayValue(text);
if (NS_FAILED(rv))
return rv;
@ -137,7 +137,7 @@ ProcessSerialNumberDER(SECItem *serialItem,
if (NS_FAILED(rv))
return rv;
rv = printableItem->SetDisplayName(text.get());
rv = printableItem->SetDisplayName(text);
if (NS_FAILED(rv))
return rv;
@ -146,7 +146,7 @@ ProcessSerialNumberDER(SECItem *serialItem,
if (serialNumber == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
rv = printableItem->SetDisplayValue(NS_ConvertASCIItoUCS2(serialNumber).get());
rv = printableItem->SetDisplayValue(NS_ConvertASCIItoUCS2(serialNumber));
*retItem = printableItem;
NS_ADDREF(*retItem);
return rv;
@ -455,7 +455,7 @@ ProcessSingleExtension(CERTCertExtension *extension,
if (extensionItem == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
extensionItem->SetDisplayName(text.get());
extensionItem->SetDisplayName(text);
SECOidTag oidTag = SECOID_FindOIDTag(&extension->id);
text.Truncate();
if (extension->critical.data != nsnull) {
@ -476,7 +476,7 @@ ProcessSingleExtension(CERTCertExtension *extension,
if (NS_FAILED(rv))
return rv;
extensionItem->SetDisplayValue(text.get());
extensionItem->SetDisplayValue(text);
*retExtension = extensionItem;
NS_ADDREF(*retExtension);
return NS_OK;

Просмотреть файл

@ -82,11 +82,8 @@ NS_IMETHODIMP nsX509CertValidity::GetNotBefore(PRTime *aNotBefore)
return rv;
}
/* readonly attribute PRTime notBeforeLocalTime; */
NS_IMETHODIMP nsX509CertValidity::GetNotBeforeLocalTime(PRUnichar **aNotBeforeLocalTime)
NS_IMETHODIMP nsX509CertValidity::GetNotBeforeLocalTime(nsAString &aNotBeforeLocalTime)
{
NS_ENSURE_ARG(aNotBeforeLocalTime);
if (!mTimesInitialized)
return NS_ERROR_FAILURE;
@ -100,15 +97,12 @@ NS_IMETHODIMP nsX509CertValidity::GetNotBeforeLocalTime(PRUnichar **aNotBeforeLo
PR_ExplodeTime(mNotBefore, PR_LocalTimeParameters, &explodedTime);
dateFormatter->FormatPRExplodedTime(nsnull, kDateFormatShort, kTimeFormatSecondsForce24Hour,
&explodedTime, date);
*aNotBeforeLocalTime = ToNewUnicode(date);
aNotBeforeLocalTime = date;
return NS_OK;
}
/* readonly attribute PRTime notBeforeGMT; */
NS_IMETHODIMP nsX509CertValidity::GetNotBeforeGMT(PRUnichar **aNotBeforeGMT)
NS_IMETHODIMP nsX509CertValidity::GetNotBeforeGMT(nsAString &aNotBeforeGMT)
{
NS_ENSURE_ARG(aNotBeforeGMT);
if (!mTimesInitialized)
return NS_ERROR_FAILURE;
@ -122,7 +116,7 @@ NS_IMETHODIMP nsX509CertValidity::GetNotBeforeGMT(PRUnichar **aNotBeforeGMT)
PR_ExplodeTime(mNotBefore, PR_GMTParameters, &explodedTime);
dateFormatter->FormatPRExplodedTime(nsnull, kDateFormatShort, kTimeFormatSecondsForce24Hour,
&explodedTime, date);
*aNotBeforeGMT = ToNewUnicode(date);
aNotBeforeGMT = date;
return NS_OK;
}
@ -139,11 +133,8 @@ NS_IMETHODIMP nsX509CertValidity::GetNotAfter(PRTime *aNotAfter)
return rv;
}
/* readonly attribute PRTime notAfterLocalTime; */
NS_IMETHODIMP nsX509CertValidity::GetNotAfterLocalTime(PRUnichar **aNotAfterLocaltime)
NS_IMETHODIMP nsX509CertValidity::GetNotAfterLocalTime(nsAString &aNotAfterLocaltime)
{
NS_ENSURE_ARG(aNotAfterLocaltime);
if (!mTimesInitialized)
return NS_ERROR_FAILURE;
@ -157,15 +148,12 @@ NS_IMETHODIMP nsX509CertValidity::GetNotAfterLocalTime(PRUnichar **aNotAfterLoca
PR_ExplodeTime(mNotAfter, PR_LocalTimeParameters, &explodedTime);
dateFormatter->FormatPRExplodedTime(nsnull, kDateFormatShort, kTimeFormatSecondsForce24Hour,
&explodedTime, date);
*aNotAfterLocaltime = ToNewUnicode(date);
aNotAfterLocaltime = date;
return NS_OK;
}
/* readonly attribute PRTime notAfterGMT; */
NS_IMETHODIMP nsX509CertValidity::GetNotAfterGMT(PRUnichar **aNotAfterGMT)
NS_IMETHODIMP nsX509CertValidity::GetNotAfterGMT(nsAString &aNotAfterGMT)
{
NS_ENSURE_ARG(aNotAfterGMT);
if (!mTimesInitialized)
return NS_ERROR_FAILURE;
@ -179,6 +167,6 @@ NS_IMETHODIMP nsX509CertValidity::GetNotAfterGMT(PRUnichar **aNotAfterGMT)
PR_ExplodeTime(mNotAfter, PR_GMTParameters, &explodedTime);
dateFormatter->FormatPRExplodedTime(nsnull, kDateFormatShort, kTimeFormatSecondsForce24Hour,
&explodedTime, date);
*aNotAfterGMT = ToNewUnicode(date);
aNotAfterGMT = date;
return NS_OK;
}

Просмотреть файл

@ -219,7 +219,7 @@ nsNSSCertificate::FormatUIStrings(const nsAutoString &nickname, nsAutoString &ni
rv = NS_OK;
nsAutoString info;
PRUnichar *temp1 = 0;
nsAutoString temp1;
nickWithSerial.Append(nickname);
@ -228,18 +228,17 @@ nsNSSCertificate::FormatUIStrings(const nsAutoString &nickname, nsAutoString &ni
details.Append(NS_LITERAL_STRING("\n"));
}
if (NS_SUCCEEDED(x509Proxy->GetSubjectName(&temp1)) && temp1 && nsCharTraits<PRUnichar>::length(temp1)) {
if (NS_SUCCEEDED(x509Proxy->GetSubjectName(temp1)) && !temp1.IsEmpty()) {
details.Append(NS_LITERAL_STRING(" "));
if (NS_SUCCEEDED(nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpSubject").get(), info))) {
details.Append(info);
details.Append(NS_LITERAL_STRING(": "));
}
details.Append(temp1);
nsMemory::Free(temp1);
details.Append(NS_LITERAL_STRING("\n"));
}
if (NS_SUCCEEDED(x509Proxy->GetSerialNumber(&temp1)) && temp1 && nsCharTraits<PRUnichar>::length(temp1)) {
if (NS_SUCCEEDED(x509Proxy->GetSerialNumber(temp1)) && !temp1.IsEmpty()) {
details.Append(NS_LITERAL_STRING(" "));
if (NS_SUCCEEDED(nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpSerialNo").get(), info))) {
details.Append(info);
@ -251,7 +250,6 @@ nsNSSCertificate::FormatUIStrings(const nsAutoString &nickname, nsAutoString &ni
nickWithSerial.Append(temp1);
nickWithSerial.Append(NS_LITERAL_STRING("]"));
nsMemory::Free(temp1);
details.Append(NS_LITERAL_STRING("\n"));
}
@ -274,24 +272,22 @@ nsNSSCertificate::FormatUIStrings(const nsAutoString &nickname, nsAutoString &ni
details.Append(info);
}
if (NS_SUCCEEDED(validity->GetNotBeforeLocalTime(&temp1)) && temp1 && nsCharTraits<PRUnichar>::length(temp1)) {
if (NS_SUCCEEDED(validity->GetNotBeforeLocalTime(temp1)) && !temp1.IsEmpty()) {
details.Append(NS_LITERAL_STRING(" "));
if (NS_SUCCEEDED(nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertInfoFrom").get(), info))) {
details.Append(info);
}
details.Append(NS_LITERAL_STRING(" "));
details.Append(temp1);
nsMemory::Free(temp1);
}
if (NS_SUCCEEDED(validity->GetNotAfterLocalTime(&temp1)) && temp1 && nsCharTraits<PRUnichar>::length(temp1)) {
if (NS_SUCCEEDED(validity->GetNotAfterLocalTime(temp1)) && !temp1.IsEmpty()) {
details.Append(NS_LITERAL_STRING(" "));
if (NS_SUCCEEDED(nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertInfoTo").get(), info))) {
details.Append(info);
}
details.Append(NS_LITERAL_STRING(" "));
details.Append(temp1);
nsMemory::Free(temp1);
}
details.Append(NS_LITERAL_STRING("\n"));
@ -299,14 +295,13 @@ nsNSSCertificate::FormatUIStrings(const nsAutoString &nickname, nsAutoString &ni
}
PRUint32 tempInt = 0;
if (NS_SUCCEEDED(x509Proxy->GetPurposes(&tempInt, &temp1)) && temp1 && nsCharTraits<PRUnichar>::length(temp1)) {
if (NS_SUCCEEDED(x509Proxy->GetPurposes(&tempInt, temp1)) && !temp1.IsEmpty()) {
details.Append(NS_LITERAL_STRING(" "));
if (NS_SUCCEEDED(nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertInfoPurposes").get(), info))) {
details.Append(info);
}
details.Append(NS_LITERAL_STRING(": "));
details.Append(temp1);
nsMemory::Free(temp1);
details.Append(NS_LITERAL_STRING("\n"));
}
@ -315,14 +310,13 @@ nsNSSCertificate::FormatUIStrings(const nsAutoString &nickname, nsAutoString &ni
details.Append(NS_LITERAL_STRING("\n"));
}
if (NS_SUCCEEDED(x509Proxy->GetIssuerName(&temp1)) && temp1 && nsCharTraits<PRUnichar>::length(temp1)) {
if (NS_SUCCEEDED(x509Proxy->GetIssuerName(temp1)) && !temp1.IsEmpty()) {
details.Append(NS_LITERAL_STRING(" "));
if (NS_SUCCEEDED(nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpSubject").get(), info))) {
details.Append(info);
details.Append(NS_LITERAL_STRING(": "));
}
details.Append(temp1);
nsMemory::Free(temp1);
details.Append(NS_LITERAL_STRING("\n"));
}
@ -357,10 +351,10 @@ nsNSSCertificate::GetDbKey(char * *aDbKey)
NS_NSS_PUT_LONG(0,&key.data[NS_NSS_LONG]); // later put slotID
NS_NSS_PUT_LONG(mCert->serialNumber.len,&key.data[NS_NSS_LONG*2]);
NS_NSS_PUT_LONG(mCert->derIssuer.len,&key.data[NS_NSS_LONG*3]);
memcpy(&key.data[NS_NSS_LONG*4],mCert->serialNumber.data,
mCert->serialNumber.len);
memcpy(&key.data[NS_NSS_LONG*4], mCert->serialNumber.data,
mCert->serialNumber.len);
memcpy(&key.data[NS_NSS_LONG*4+mCert->serialNumber.len],
mCert->derIssuer.data, mCert->derIssuer.len);
mCert->derIssuer.data, mCert->derIssuer.len);
*aDbKey = NSSBase64_EncodeItem(nsnull, nsnull, 0, &key);
nsMemory::Free(key.data); // SECItem is a 'c' type without a destrutor
@ -388,35 +382,30 @@ nsNSSCertificate::GetWindowTitle(char * *aWindowTitle)
return NS_OK;
}
/* readonly attribute wstring nickname; */
NS_IMETHODIMP
nsNSSCertificate::GetNickname(PRUnichar **_nickname)
nsNSSCertificate::GetNickname(nsAString &_nickname)
{
NS_ENSURE_ARG(_nickname);
const char *nickname = (mCert->nickname) ? mCert->nickname : "(no nickname)";
*_nickname = ToNewUnicode(NS_ConvertUTF8toUCS2(nickname));
_nickname = NS_ConvertUTF8toUCS2(nickname);
return NS_OK;
}
/* readonly attribute wstring emailAddress; */
NS_IMETHODIMP
nsNSSCertificate::GetEmailAddress(PRUnichar **_emailAddress)
nsNSSCertificate::GetEmailAddress(nsAString &_emailAddress)
{
NS_ENSURE_ARG(_emailAddress);
const char *email = (mCert->emailAddr) ? mCert->emailAddr : "(no email address)";
*_emailAddress = ToNewUnicode(NS_ConvertUTF8toUCS2(email));
_emailAddress = NS_ConvertUTF8toUCS2(email);
return NS_OK;
}
NS_IMETHODIMP
nsNSSCertificate::GetCommonName(PRUnichar **aCommonName)
nsNSSCertificate::GetCommonName(nsAString &aCommonName)
{
NS_ENSURE_ARG(aCommonName);
*aCommonName = nsnull;
aCommonName.Truncate();
if (mCert) {
char *commonName = CERT_GetCommonName(&mCert->subject);
if (commonName) {
*aCommonName = ToNewUnicode(NS_ConvertUTF8toUCS2(commonName));
aCommonName = NS_ConvertUTF8toUCS2(commonName);
PORT_Free(commonName);
} /*else {
*aCommonName = ToNewUnicode(NS_LITERAL_STRING("<not set>")),
@ -426,14 +415,13 @@ nsNSSCertificate::GetCommonName(PRUnichar **aCommonName)
}
NS_IMETHODIMP
nsNSSCertificate::GetOrganization(PRUnichar **aOrganization)
nsNSSCertificate::GetOrganization(nsAString &aOrganization)
{
NS_ENSURE_ARG(aOrganization);
*aOrganization = nsnull;
aOrganization.Truncate();
if (mCert) {
char *organization = CERT_GetOrgName(&mCert->subject);
if (organization) {
*aOrganization = ToNewUnicode(NS_ConvertUTF8toUCS2(organization));
aOrganization = NS_ConvertUTF8toUCS2(organization);
PORT_Free(organization);
} /*else {
*aOrganization = ToNewUnicode(NS_LITERAL_STRING("<not set>")),
@ -443,14 +431,13 @@ nsNSSCertificate::GetOrganization(PRUnichar **aOrganization)
}
NS_IMETHODIMP
nsNSSCertificate::GetIssuerCommonName(PRUnichar **aCommonName)
nsNSSCertificate::GetIssuerCommonName(nsAString &aCommonName)
{
NS_ENSURE_ARG(aCommonName);
*aCommonName = nsnull;
aCommonName.Truncate();
if (mCert) {
char *commonName = CERT_GetCommonName(&mCert->issuer);
if (commonName) {
*aCommonName = ToNewUnicode(NS_ConvertUTF8toUCS2(commonName));
aCommonName = NS_ConvertUTF8toUCS2(commonName);
PORT_Free(commonName);
}
}
@ -458,14 +445,13 @@ nsNSSCertificate::GetIssuerCommonName(PRUnichar **aCommonName)
}
NS_IMETHODIMP
nsNSSCertificate::GetIssuerOrganization(PRUnichar **aOrganization)
nsNSSCertificate::GetIssuerOrganization(nsAString &aOrganization)
{
NS_ENSURE_ARG(aOrganization);
*aOrganization = nsnull;
aOrganization.Truncate();
if (mCert) {
char *organization = CERT_GetOrgName(&mCert->issuer);
if (organization) {
*aOrganization = ToNewUnicode(NS_ConvertUTF8toUCS2(organization));
aOrganization = NS_ConvertUTF8toUCS2(organization);
PORT_Free(organization);
}
}
@ -473,14 +459,13 @@ nsNSSCertificate::GetIssuerOrganization(PRUnichar **aOrganization)
}
NS_IMETHODIMP
nsNSSCertificate::GetIssuerOrganizationUnit(PRUnichar **aOrganizationUnit)
nsNSSCertificate::GetIssuerOrganizationUnit(nsAString &aOrganizationUnit)
{
NS_ENSURE_ARG(aOrganizationUnit);
*aOrganizationUnit = nsnull;
aOrganizationUnit.Truncate();
if (mCert) {
char *organizationUnit = CERT_GetOrgUnitName(&mCert->issuer);
if (organizationUnit) {
*aOrganizationUnit = ToNewUnicode(NS_ConvertUTF8toUCS2(organizationUnit));
aOrganizationUnit = NS_ConvertUTF8toUCS2(organizationUnit);
PORT_Free(organizationUnit);
}
}
@ -505,14 +490,13 @@ nsNSSCertificate::GetIssuer(nsIX509Cert * *aIssuer)
}
NS_IMETHODIMP
nsNSSCertificate::GetOrganizationalUnit(PRUnichar **aOrganizationalUnit)
nsNSSCertificate::GetOrganizationalUnit(nsAString &aOrganizationalUnit)
{
NS_ENSURE_ARG(aOrganizationalUnit);
*aOrganizationalUnit = nsnull;
aOrganizationalUnit.Truncate();
if (mCert) {
char *orgunit = CERT_GetOrgUnitName(&mCert->subject);
if (orgunit) {
*aOrganizationalUnit = ToNewUnicode(NS_ConvertUTF8toUCS2(orgunit));
aOrganizationalUnit = NS_ConvertUTF8toUCS2(orgunit);
PORT_Free(orgunit);
} /*else {
*aOrganizationalUnit = ToNewUnicode(NS_LITERAL_STRING("<not set>")),
@ -589,67 +573,57 @@ done:
return rv;
}
/* readonly attribute wstring subjectName; */
NS_IMETHODIMP
nsNSSCertificate::GetSubjectName(PRUnichar **_subjectName)
nsNSSCertificate::GetSubjectName(nsAString &_subjectName)
{
NS_ENSURE_ARG(_subjectName);
*_subjectName = nsnull;
_subjectName.Truncate();
if (mCert->subjectName) {
*_subjectName = ToNewUnicode(NS_ConvertUTF8toUCS2(mCert->subjectName));
_subjectName = NS_ConvertUTF8toUCS2(mCert->subjectName);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
/* readonly attribute wstring issuerName; */
NS_IMETHODIMP
nsNSSCertificate::GetIssuerName(PRUnichar **_issuerName)
nsNSSCertificate::GetIssuerName(nsAString &_issuerName)
{
NS_ENSURE_ARG(_issuerName);
*_issuerName = nsnull;
_issuerName.Truncate();
if (mCert->issuerName) {
*_issuerName = ToNewUnicode(NS_ConvertUTF8toUCS2(mCert->issuerName));
_issuerName = NS_ConvertUTF8toUCS2(mCert->issuerName);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
/* readonly attribute wstring serialNumber; */
NS_IMETHODIMP
nsNSSCertificate::GetSerialNumber(PRUnichar **_serialNumber)
nsNSSCertificate::GetSerialNumber(nsAString &_serialNumber)
{
NS_ENSURE_ARG(_serialNumber);
*_serialNumber = nsnull;
_serialNumber.Truncate();
nsXPIDLCString tmpstr; tmpstr.Adopt(CERT_Hexify(&mCert->serialNumber, 1));
if (tmpstr.get()) {
*_serialNumber = ToNewUnicode(tmpstr);
_serialNumber = NS_ConvertASCIItoUCS2(tmpstr);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
/* readonly attribute wstring rsaPubModulus; */
NS_IMETHODIMP
nsNSSCertificate::GetRsaPubModulus(PRUnichar **_rsaPubModulus)
nsNSSCertificate::GetRsaPubModulus(nsAString &_rsaPubModulus)
{
NS_ENSURE_ARG(_rsaPubModulus);
*_rsaPubModulus = nsnull;
_rsaPubModulus.Truncate();
//nsXPIDLCString tmpstr; tmpstr.Adopt(CERT_Hexify(&mCert->serialNumber, 1));
NS_NAMED_LITERAL_CSTRING(tmpstr, "not yet implemented");
if (tmpstr.get()) {
*_rsaPubModulus = ToNewUnicode(tmpstr);
_rsaPubModulus = NS_ConvertASCIItoUCS2(tmpstr);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
/* readonly attribute wstring sha1Fingerprint; */
NS_IMETHODIMP
nsNSSCertificate::GetSha1Fingerprint(PRUnichar **_sha1Fingerprint)
nsNSSCertificate::GetSha1Fingerprint(nsAString &_sha1Fingerprint)
{
NS_ENSURE_ARG(_sha1Fingerprint);
*_sha1Fingerprint = nsnull;
_sha1Fingerprint.Truncate();
unsigned char fingerprint[20];
SECItem fpItem;
memset(fingerprint, 0, sizeof fingerprint);
@ -659,18 +633,16 @@ nsNSSCertificate::GetSha1Fingerprint(PRUnichar **_sha1Fingerprint)
fpItem.len = SHA1_LENGTH;
nsXPIDLCString fpStr; fpStr.Adopt(CERT_Hexify(&fpItem, 1));
if (fpStr.get()) {
*_sha1Fingerprint = ToNewUnicode(fpStr);
_sha1Fingerprint = NS_ConvertASCIItoUCS2(fpStr);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
/* readonly attribute wstring md5Fingerprint; */
NS_IMETHODIMP
nsNSSCertificate::GetMd5Fingerprint(PRUnichar **_md5Fingerprint)
nsNSSCertificate::GetMd5Fingerprint(nsAString &_md5Fingerprint)
{
NS_ENSURE_ARG(_md5Fingerprint);
*_md5Fingerprint = nsnull;
_md5Fingerprint.Truncate();
unsigned char fingerprint[20];
SECItem fpItem;
memset(fingerprint, 0, sizeof fingerprint);
@ -680,18 +652,16 @@ nsNSSCertificate::GetMd5Fingerprint(PRUnichar **_md5Fingerprint)
fpItem.len = MD5_LENGTH;
nsXPIDLCString fpStr; fpStr.Adopt(CERT_Hexify(&fpItem, 1));
if (fpStr.get()) {
*_md5Fingerprint = ToNewUnicode(fpStr);
_md5Fingerprint = NS_ConvertASCIItoUCS2(fpStr);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
/* readonly attribute wstring issuedDate; */
NS_IMETHODIMP
nsNSSCertificate::GetIssuedDate(PRUnichar **_issuedDate)
nsNSSCertificate::GetIssuedDate(nsAString &_issuedDate)
{
NS_ENSURE_ARG(_issuedDate);
*_issuedDate = nsnull;
_issuedDate.Truncate();
nsresult rv;
PRTime beforeTime;
nsCOMPtr<nsIX509CertValidity> validity;
@ -705,30 +675,28 @@ nsNSSCertificate::GetIssuedDate(PRUnichar **_issuedDate)
nsAutoString date;
dateFormatter->FormatPRTime(nsnull, kDateFormatShort, kTimeFormatNone,
beforeTime, date);
*_issuedDate = ToNewUnicode(date);
_issuedDate = date;
return NS_OK;
}
nsresult
nsNSSCertificate::GetSortableDate(PRTime aTime, PRUnichar **_aSortableDate)
nsNSSCertificate::GetSortableDate(PRTime aTime, nsAString &_aSortableDate)
{
PRExplodedTime explodedTime;
PR_ExplodeTime(aTime, PR_GMTParameters, &explodedTime);
char datebuf[20]; // 4 + 2 + 2 + 2 + 2 + 2 + 1 = 15
if (0 != PR_FormatTime(datebuf, sizeof(datebuf), "%Y%m%d%H%M%S", &explodedTime)) {
*_aSortableDate = ToNewUnicode(nsDependentCString(datebuf));
_aSortableDate = NS_ConvertASCIItoUCS2(nsDependentCString(datebuf));
return NS_OK;
}
else
return NS_ERROR_OUT_OF_MEMORY;
}
/* readonly attribute wstring issuedDateSortable; */
NS_IMETHODIMP
nsNSSCertificate::GetIssuedDateSortable(PRUnichar **_issuedDate)
nsNSSCertificate::GetIssuedDateSortable(nsAString &_issuedDate)
{
NS_ENSURE_ARG(_issuedDate);
*_issuedDate = nsnull;
_issuedDate.Truncate();
nsresult rv;
PRTime beforeTime;
nsCOMPtr<nsIX509CertValidity> validity;
@ -739,12 +707,10 @@ nsNSSCertificate::GetIssuedDateSortable(PRUnichar **_issuedDate)
return GetSortableDate(beforeTime, _issuedDate);
}
/* readonly attribute wstring expiresDate; */
NS_IMETHODIMP
nsNSSCertificate::GetExpiresDate(PRUnichar **_expiresDate)
nsNSSCertificate::GetExpiresDate(nsAString &_expiresDate)
{
NS_ENSURE_ARG(_expiresDate);
*_expiresDate = nsnull;
_expiresDate.Truncate();
nsresult rv;
PRTime afterTime;
nsCOMPtr<nsIX509CertValidity> validity;
@ -758,16 +724,14 @@ nsNSSCertificate::GetExpiresDate(PRUnichar **_expiresDate)
nsAutoString date;
dateFormatter->FormatPRTime(nsnull, kDateFormatShort, kTimeFormatNone,
afterTime, date);
*_expiresDate = ToNewUnicode(date);
_expiresDate = date;
return NS_OK;
}
/* readonly attribute wstring expiresDateSortable; */
NS_IMETHODIMP
nsNSSCertificate::GetExpiresDateSortable(PRUnichar **_expiresDate)
nsNSSCertificate::GetExpiresDateSortable(nsAString &_expiresDate)
{
NS_ENSURE_ARG(_expiresDate);
*_expiresDate = nsnull;
_expiresDate.Truncate();
nsresult rv;
PRTime afterTime;
nsCOMPtr<nsIX509CertValidity> validity;
@ -779,10 +743,9 @@ nsNSSCertificate::GetExpiresDateSortable(PRUnichar **_expiresDate)
}
NS_IMETHODIMP
nsNSSCertificate::GetTokenName(PRUnichar **aTokenName)
nsNSSCertificate::GetTokenName(nsAString &aTokenName)
{
NS_ENSURE_ARG(aTokenName);
*aTokenName = nsnull;
aTokenName.Truncate();
if (mCert) {
// HACK alert
// When the trust of a builtin cert is modified, NSS copies it into the
@ -795,18 +758,17 @@ nsNSSCertificate::GetTokenName(PRUnichar **aTokenName)
if (mCert->slot) {
char *token = PK11_GetTokenName(mCert->slot);
if (token) {
*aTokenName = ToNewUnicode(NS_ConvertUTF8toUCS2(token));
aTokenName = NS_ConvertUTF8toUCS2(token);
}
} else {
nsresult rv;
nsAutoString tok;
nsCOMPtr<nsINSSComponent> nssComponent(
do_GetService(kNSSComponentCID, &rv));
nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(kNSSComponentCID, &rv));
if (NS_FAILED(rv)) return rv;
rv = nssComponent->GetPIPNSSBundleString(
NS_LITERAL_STRING("InternalToken").get(), tok);
if (NS_SUCCEEDED(rv))
*aTokenName = ToNewUnicode(tok);
aTokenName = tok;
}
}
return NS_OK;
@ -1007,10 +969,9 @@ nsNSSCertificate::GetUsages(PRUint32 *_verified,
return NS_OK;
}
/* void getPurposes(out PRUint32 verified, out wstring purposes); */
NS_IMETHODIMP
nsNSSCertificate::GetPurposes(PRUint32 *_verified,
PRUnichar **_purposes)
nsAString &_purposes)
{
nsresult rv;
PRUnichar *tmpUsages[13];
@ -1018,15 +979,12 @@ nsNSSCertificate::GetPurposes(PRUint32 *_verified,
PRUint32 tmpCount;
nsUsageArrayHelper uah(mCert);
rv = uah.GetUsageArray(suffix, 13, _verified, &tmpCount, tmpUsages);
nsAutoString porpoises;
_purposes.Truncate();
for (PRUint32 i=0; i<tmpCount; i++) {
if (i>0) porpoises.Append(NS_LITERAL_STRING(","));
porpoises.Append(tmpUsages[i]);
if (i>0) _purposes.Append(NS_LITERAL_STRING(","));
_purposes.Append(tmpUsages[i]);
nsMemory::Free(tmpUsages[i]);
}
if (_purposes != NULL) { // skip it for verify-only
*_purposes = ToNewUnicode(porpoises);
}
return NS_OK;
}
@ -1043,24 +1001,24 @@ ProcessSECAlgorithmID(SECAlgorithmID *algID,
nsString text;
GetOIDText(&algID->algorithm, nssComponent, text);
if (!algID->parameters.len || algID->parameters.data[0] == nsIASN1Object::ASN1_NULL) {
sequence->SetDisplayValue(text.get());
sequence->SetDisplayValue(text);
sequence->SetProcessObjects(PR_FALSE);
} else {
nsCOMPtr<nsIASN1PrintableItem> printableItem = new nsNSSASN1PrintableItem();
printableItem->SetDisplayValue(text.get());
printableItem->SetDisplayValue(text);
nsCOMPtr<nsISupportsArray>asn1Objects;
sequence->GetASN1Objects(getter_AddRefs(asn1Objects));
asn1Objects->AppendElement(printableItem);
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpAlgID").get(),
text);
printableItem->SetDisplayName(text.get());
printableItem->SetDisplayName(text);
printableItem = new nsNSSASN1PrintableItem();
asn1Objects->AppendElement(printableItem);
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpParams").get(),
text);
printableItem->SetDisplayName(text.get());
printableItem->SetDisplayName(text);
ProcessRawBytes(&algID->parameters,text);
printableItem->SetDisplayValue(text.get());
printableItem->SetDisplayValue(text);
}
*retSequence = sequence;
NS_ADDREF(*retSequence);
@ -1102,8 +1060,8 @@ ProcessTime(PRTime dispTime, const PRUnichar *displayName,
if (printableItem == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
printableItem->SetDisplayValue(text.get());
printableItem->SetDisplayName(displayName);
printableItem->SetDisplayValue(text);
printableItem->SetDisplayName(nsDependentString(displayName));
nsCOMPtr<nsISupportsArray> asn1Objects;
parentSequence->GetASN1Objects(getter_AddRefs(asn1Objects));
asn1Objects->AppendElement(printableItem);
@ -1123,7 +1081,7 @@ ProcessSubjectPublicKeyInfo(CERTSubjectPublicKeyInfo *spki,
nsString text;
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpSPKI").get(),
text);
spkiSequence->SetDisplayName(text.get());
spkiSequence->SetDisplayName(text);
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpSPKIAlg").get(),
text);
@ -1132,7 +1090,7 @@ ProcessSubjectPublicKeyInfo(CERTSubjectPublicKeyInfo *spki,
getter_AddRefs(sequenceItem));
if (NS_FAILED(rv))
return rv;
sequenceItem->SetDisplayName(text.get());
sequenceItem->SetDisplayName(text);
nsCOMPtr<nsISupportsArray> asn1Objects;
spkiSequence->GetASN1Objects(getter_AddRefs(asn1Objects));
asn1Objects->AppendElement(sequenceItem);
@ -1149,10 +1107,10 @@ ProcessSubjectPublicKeyInfo(CERTSubjectPublicKeyInfo *spki,
if (printableItem == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
printableItem->SetDisplayValue(text.get());
printableItem->SetDisplayValue(text);
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpSubjPubKey").get(),
text);
printableItem->SetDisplayName(text.get());
printableItem->SetDisplayName(text);
asn1Objects->AppendElement(printableItem);
parentSequence->GetASN1Objects(getter_AddRefs(asn1Objects));
@ -1172,7 +1130,7 @@ ProcessExtensions(CERTCertExtension **extensions,
nsString text;
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpExtensions").get(),
text);
extensionSequence->SetDisplayName(text.get());
extensionSequence->SetDisplayName(text);
PRInt32 i;
nsresult rv;
nsCOMPtr<nsIASN1PrintableItem> newExtension;
@ -1289,7 +1247,7 @@ nsNSSCertificate::CreateTBSCertificateASN1Struct(nsIASN1Sequence **retSequence,
nsString text;
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpCertificate").get(),
text);
sequence->SetDisplayName(text.get());
sequence->SetDisplayName(text);
nsCOMPtr<nsIASN1PrintableItem> printableItem;
nsCOMPtr<nsISupportsArray> asn1Objects;
@ -1317,7 +1275,7 @@ nsNSSCertificate::CreateTBSCertificateASN1Struct(nsIASN1Sequence **retSequence,
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpSigAlg").get(),
text);
algID->SetDisplayName(text.get());
algID->SetDisplayName(text);
asn1Objects->AppendElement(algID);
nsXPIDLString value;
@ -1330,13 +1288,13 @@ nsNSSCertificate::CreateTBSCertificateASN1Struct(nsIASN1Sequence **retSequence,
printableItem->SetDisplayValue(value);
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpIssuer").get(),
text);
printableItem->SetDisplayName(text.get());
printableItem->SetDisplayName(text);
asn1Objects->AppendElement(printableItem);
nsCOMPtr<nsIASN1Sequence> validitySequence = new nsNSSASN1Sequence();
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpValidity").get(),
text);
validitySequence->SetDisplayName(text.get());
validitySequence->SetDisplayName(text);
asn1Objects->AppendElement(validitySequence);
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpNotBefore").get(),
text);
@ -1364,7 +1322,7 @@ nsNSSCertificate::CreateTBSCertificateASN1Struct(nsIASN1Sequence **retSequence,
if (printableItem == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
printableItem->SetDisplayName(text.get());
printableItem->SetDisplayName(text);
ProcessName(&mCert->subject, nssComponent,getter_Copies(value));
printableItem->SetDisplayValue(value);
asn1Objects->AppendElement(printableItem);
@ -1389,10 +1347,10 @@ nsNSSCertificate::CreateTBSCertificateASN1Struct(nsIASN1Sequence **retSequence,
if (printableItem == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
printableItem->SetDisplayValue(text.get());
printableItem->SetDisplayValue(text);
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpIssuerUniqueID").get(),
text);
printableItem->SetDisplayName(text.get());
printableItem->SetDisplayName(text);
asn1Objects->AppendElement(printableItem);
}
@ -1409,10 +1367,10 @@ nsNSSCertificate::CreateTBSCertificateASN1Struct(nsIASN1Sequence **retSequence,
if (printableItem == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
printableItem->SetDisplayValue(text.get());
printableItem->SetDisplayValue(text);
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpSubjectUniqueID").get(),
text);
printableItem->SetDisplayName(text.get());
printableItem->SetDisplayName(text);
asn1Objects->AppendElement(printableItem);
}
@ -1430,7 +1388,7 @@ nsNSSCertificate::CreateTBSCertificateASN1Struct(nsIASN1Sequence **retSequence,
void
DumpASN1Object(nsIASN1Object *object, unsigned int level)
{
PRUnichar *dispNameU, *dispValU;
nsAutoString dispNameU, dispValU;
unsigned int i;
nsCOMPtr<nsISupportsArray> asn1Objects;
nsCOMPtr<nsISupports> isupports;
@ -1441,7 +1399,7 @@ DumpASN1Object(nsIASN1Object *object, unsigned int level)
for (i=0; i<level; i++)
printf (" ");
object->GetDisplayName(&dispNameU);
object->GetDisplayName(dispNameU);
nsCOMPtr<nsIASN1Sequence> sequence(do_QueryInterface(object));
if (sequence) {
printf ("%s ", NS_ConvertUCS2toUTF8(dispNameU).get());
@ -1456,17 +1414,14 @@ DumpASN1Object(nsIASN1Object *object, unsigned int level)
DumpASN1Object(currObject, level+1);
}
} else {
object->GetDisplayValue(&dispValU);
object->GetDisplayValue(dispValU);
printf("= %s\n", NS_ConvertUCS2toUTF8(dispValU).get());
PR_Free(dispValU);
}
} else {
object->GetDisplayValue(&dispValU);
object->GetDisplayValue(dispValU);
printf("%s = %s\n",NS_ConvertUCS2toUTF8(dispNameU).get(),
NS_ConvertUCS2toUTF8(dispValU).get());
PR_Free(dispValU);
}
PR_Free(dispNameU);
}
#endif
@ -1485,7 +1440,7 @@ nsNSSCertificate::CreateASN1Struct()
nsXPIDLCString title;
GetWindowTitle(getter_Copies(title));
mASN1Structure->SetDisplayName(NS_ConvertASCIItoUCS2(title).get());
mASN1Structure->SetDisplayName(NS_ConvertASCIItoUCS2(title));
// This sequence will be contain the tbsCertificate, signatureAlgorithm,
// and signatureValue.
nsresult rv;
@ -1508,12 +1463,12 @@ nsNSSCertificate::CreateASN1Struct()
nsString text;
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpSigAlg").get(),
text);
algID->SetDisplayName(text.get());
algID->SetDisplayName(text);
asn1Objects->AppendElement(algID);
nsCOMPtr<nsIASN1PrintableItem>printableItem = new nsNSSASN1PrintableItem();
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpCertSig").get(),
text);
printableItem->SetDisplayName(text.get());
printableItem->SetDisplayName(text);
// The signatureWrap is encoded as a bit string.
// The function ProcessRawBytes expects the
// length to be in bytes, so let's convert the
@ -1523,7 +1478,7 @@ nsNSSCertificate::CreateASN1Struct()
temp.len = mCert->signatureWrap.signature.len / 8;
text.Truncate();
ProcessRawBytes(&temp,text);
printableItem->SetDisplayValue(text.get());
printableItem->SetDisplayValue(text);
asn1Objects->AppendElement(printableItem);
return NS_OK;
}

Просмотреть файл

@ -76,7 +76,7 @@ private:
nsresult CreateASN1Struct();
nsresult CreateTBSCertificateASN1Struct(nsIASN1Sequence **retSequence,
nsINSSComponent *nssComponent);
nsresult GetSortableDate(PRTime aTime, PRUnichar **_aSortableDate);
nsresult GetSortableDate(PRTime aTime, nsAString &_aSortableDate);
};
#define NS_NSS_LONG 4

Просмотреть файл

@ -90,7 +90,7 @@ nsNSSCertificateDB::~nsNSSCertificateDB()
NS_IMETHODIMP
nsNSSCertificateDB::GetCertByNickname(nsISupports *aToken,
const PRUnichar *nickname,
const nsAString &nickname,
nsIX509Cert **_rvCert)
{
CERTCertificate *cert = NULL;
@ -289,11 +289,11 @@ nsNSSCertificateDB::handleCACertDownload(nsISupportsArray *x509Certs,
nsXPIDLString cert1SubjectName;
nsXPIDLString cert1IssuerName;
cert0->GetIssuerName(getter_Copies(cert0IssuerName));
cert0->GetSubjectName(getter_Copies(cert0SubjectName));
cert0->GetIssuerName(cert0IssuerName);
cert0->GetSubjectName(cert0SubjectName);
cert1->GetIssuerName(getter_Copies(cert1IssuerName));
cert1->GetSubjectName(getter_Copies(cert1SubjectName));
cert1->GetIssuerName(cert1IssuerName);
cert1->GetSubjectName(cert1SubjectName);
if (nsCRT::strcmp(cert1IssuerName.get(), cert0SubjectName.get()) == 0) {
// In this case, the first cert in the list signed the second,
@ -1073,15 +1073,14 @@ nsNSSCertificateDB::EnableOCSP()
/* nsIX509Cert getDefaultEmailEncryptionCert (); */
NS_IMETHODIMP
nsNSSCertificateDB::GetEmailEncryptionCert(const PRUnichar* aNickname, nsIX509Cert **_retval)
nsNSSCertificateDB::GetEmailEncryptionCert(const nsAString &aNickname, nsIX509Cert **_retval)
{
if (!aNickname || !_retval)
if (!_retval)
return NS_ERROR_FAILURE;
*_retval = 0;
nsDependentString aDepNickname(aNickname);
if (aDepNickname.IsEmpty())
if (aNickname.IsEmpty())
return NS_OK;
nsresult rv = NS_OK;
@ -1089,7 +1088,7 @@ nsNSSCertificateDB::GetEmailEncryptionCert(const PRUnichar* aNickname, nsIX509Ce
nsCOMPtr<nsIInterfaceRequestor> ctx = new PipUIContext();
nsNSSCertificate *nssCert = nsnull;
char *asciiname = NULL;
NS_ConvertUCS2toUTF8 aUtf8Nickname(aDepNickname);
NS_ConvertUCS2toUTF8 aUtf8Nickname(aNickname);
asciiname = NS_CONST_CAST(char*, aUtf8Nickname.get());
/* Find a good cert in the user's database */
@ -1113,15 +1112,14 @@ loser:
/* nsIX509Cert getDefaultEmailSigningCert (); */
NS_IMETHODIMP
nsNSSCertificateDB::GetEmailSigningCert(const PRUnichar* aNickname, nsIX509Cert **_retval)
nsNSSCertificateDB::GetEmailSigningCert(const nsAString &aNickname, nsIX509Cert **_retval)
{
if (!aNickname || !_retval)
if (!_retval)
return NS_ERROR_FAILURE;
*_retval = 0;
nsDependentString aDepNickname(aNickname);
if (aDepNickname.IsEmpty())
if (aNickname.IsEmpty())
return NS_OK;
nsresult rv = NS_OK;
@ -1129,7 +1127,7 @@ nsNSSCertificateDB::GetEmailSigningCert(const PRUnichar* aNickname, nsIX509Cert
nsCOMPtr<nsIInterfaceRequestor> ctx = new PipUIContext();
nsNSSCertificate *nssCert = nsnull;
char *asciiname = NULL;
NS_ConvertUCS2toUTF8 aUtf8Nickname(aDepNickname);
NS_ConvertUCS2toUTF8 aUtf8Nickname(aNickname);
asciiname = NS_CONST_CAST(char*, aUtf8Nickname.get());
/* Find a good cert in the user's database */

Просмотреть файл

@ -1237,23 +1237,19 @@ nsNSSComponent::VerifySignature(const char* aRSABuf, PRUint32 aRSABufLen,
}
}
//-- Create a certificate principal with id and organization data
PRUnichar* fingerprint;
rv2 = pCert->GetSha1Fingerprint(&fingerprint);
nsCAutoString fingerprintStr;
fingerprintStr.AssignWithConversion(fingerprint);
PR_FREEIF(fingerprint);
nsAutoString fingerprint;
rv2 = pCert->GetSha1Fingerprint(fingerprint);
NS_LossyConvertUCS2toASCII fingerprintStr(fingerprint);
if (NS_FAILED(rv2)) return rv2;
rv2 = mScriptSecurityManager->GetCertificatePrincipal(fingerprintStr.get(), aPrincipal);
if (NS_FAILED(rv2) || !*aPrincipal) return rv2;
nsCOMPtr<nsICertificatePrincipal> certPrincipal = do_QueryInterface(*aPrincipal, &rv2);
if (NS_FAILED(rv2)) return rv2;
PRUnichar* orgName;
rv2 = pCert->GetOrganization(&orgName);
nsAutoString orgName;
rv2 = pCert->GetOrganization(orgName);
if (NS_FAILED(rv2)) return rv2;
nsCAutoString orgNameStr;
orgNameStr.AssignWithConversion(orgName);
PR_FREEIF(orgName);
NS_LossyConvertUCS2toASCII orgNameStr(orgName);
rv2 = certPrincipal->SetCommonName(orgNameStr.get());
if (NS_FAILED(rv2)) return rv2;
}

Просмотреть файл

@ -1243,7 +1243,7 @@ nsContinueDespiteCertError(nsNSSSocketInfo *infoObject,
{
nsXPIDLCString url; url.Adopt(SSL_RevealURL(sslSocket));
NS_ASSERTION(url.get(), "could not find valid URL in ssl socket");
rv = badCertHandler->MismatchDomain(csi, NS_ConvertASCIItoUCS2(url).get(),
rv = badCertHandler->MismatchDomain(csi, url,
callBackCert, &retVal);
if (NS_SUCCEEDED(rv) && retVal) {
rv = CERT_AddOKDomainName(peerCert, url);
@ -1262,7 +1262,7 @@ nsContinueDespiteCertError(nsNSSSocketInfo *infoObject,
{
nsXPIDLCString url; url.Adopt(SSL_RevealURL(sslSocket));
NS_ASSERTION(url, "could not find valid URL in ssl socket");
rv = badCertHandler->CrlNextupdate(csi, NS_ConvertASCIItoUCS2(url).get(), callBackCert);
rv = badCertHandler->CrlNextupdate(csi, url, callBackCert);
if (NS_SUCCEEDED(rv) && retVal) {
rv = CERT_AddOKDomainName(peerCert, url.get());
}

Просмотреть файл

@ -31,7 +31,7 @@
* may use your version of this file under either the MPL or the
* GPL.
*
* $Id: nsPKCS12Blob.cpp,v 1.30 2002/09/17 18:51:14 kaie%netscape.com Exp $
* $Id: nsPKCS12Blob.cpp,v 1.31 2002/09/23 20:17:13 kaie%netscape.com Exp $
*/
#include "prmem.h"
@ -425,7 +425,7 @@ finish:
// a buffer of octets. Must handle byte order correctly.
// TODO: Is there a mozilla way to do this? In the string lib?
void
nsPKCS12Blob::unicodeToItem(PRUnichar *uni, SECItem *item)
nsPKCS12Blob::unicodeToItem(const PRUnichar *uni, SECItem *item)
{
int len = 0;
int i = 0;
@ -449,16 +449,16 @@ nsresult
nsPKCS12Blob::newPKCS12FilePassword(SECItem *unicodePw)
{
nsresult rv = NS_OK;
PRUnichar *password;
nsAutoString password;
PRBool canceled;
nsCOMPtr<nsICertificateDialogs> certDialogs;
rv = ::getNSSDialogs(getter_AddRefs(certDialogs),
NS_GET_IID(nsICertificateDialogs),
NS_CERTIFICATEDIALOGS_CONTRACTID);
if (NS_FAILED(rv)) return rv;
rv = certDialogs->SetPKCS12FilePassword(mUIContext, &password, &canceled);
rv = certDialogs->SetPKCS12FilePassword(mUIContext, password, &canceled);
if (NS_FAILED(rv) || canceled) return rv;
unicodeToItem(password, unicodePw);
unicodeToItem(password.get(), unicodePw);
return NS_OK;
}
@ -470,16 +470,16 @@ nsresult
nsPKCS12Blob::getPKCS12FilePassword(SECItem *unicodePw)
{
nsresult rv = NS_OK;
PRUnichar *password;
nsAutoString password;
PRBool canceled;
nsCOMPtr<nsICertificateDialogs> certDialogs;
rv = ::getNSSDialogs(getter_AddRefs(certDialogs),
NS_GET_IID(nsICertificateDialogs),
NS_CERTIFICATEDIALOGS_CONTRACTID);
if (NS_FAILED(rv)) return rv;
rv = certDialogs->GetPKCS12FilePassword(mUIContext, &password, &canceled);
rv = certDialogs->GetPKCS12FilePassword(mUIContext, password, &canceled);
if (NS_FAILED(rv) || canceled) return rv;
unicodeToItem(password, unicodePw);
unicodeToItem(password.get(), unicodePw);
return NS_OK;
}

Просмотреть файл

@ -31,7 +31,7 @@
* may use your version of this file under either the MPL or the
* GPL.
*
* $Id: nsPKCS12Blob.h,v 1.8 2002/09/17 18:51:14 kaie%netscape.com Exp $
* $Id: nsPKCS12Blob.h,v 1.9 2002/09/23 20:17:14 kaie%netscape.com Exp $
*/
#ifndef _NS_PKCS12BLOB_H_
@ -86,7 +86,7 @@ private:
nsresult getPKCS12FilePassword(SECItem *);
nsresult newPKCS12FilePassword(SECItem *);
nsresult inputToDecoder(SEC_PKCS12DecoderContext *, nsILocalFile *);
void unicodeToItem(PRUnichar *, SECItem *);
void unicodeToItem(const PRUnichar *, SECItem *);
PRBool handleError(int myerr = 0);
nsresult ImportFromFileHelper(nsILocalFile *file, PRBool &aWantRetry);