Commit e06c3651 authored by Felipe Gomes's avatar Felipe Gomes
Browse files

Bug 1429148 - Add nsIPK11Token.isInternalKeyToken. r=keeler,MattN

MozReview-Commit-ID: Gdd7MxDXoTC
parent 37090201
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@ interface nsIPK11Token : nsISupports
  readonly attribute AUTF8String tokenName;
  [must_use]
  readonly attribute AUTF8String tokenLabel;
  [must_use]
  readonly attribute boolean isInternalKeyToken;
  /**
   * Manufacturer ID of the token.
   */
+8 −0
Original line number Diff line number Diff line
@@ -106,6 +106,14 @@ nsPK11Token::GetTokenLabel(/*out*/ nsACString& tokenLabel)
  return GetAttributeHelper(mTokenLabel, tokenLabel);
}

NS_IMETHODIMP
nsPK11Token::GetIsInternalKeyToken(/*out*/ bool* _retval)
{
  NS_ENSURE_ARG_POINTER(_retval);
  *_retval = PK11_IsInternalKeySlot(mSlot.get());
  return NS_OK;
}

NS_IMETHODIMP
nsPK11Token::GetTokenManID(/*out*/ nsACString& tokenManufacturerID)
{
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ function run_test() {
  notEqual(testToken, null, "getToken() should succeed");
  equal(testToken.tokenLabel, "Test PKCS11 Tokeñ 2 Label",
        "Spot check: the actual and expected test token labels should be equal");
  ok(!testToken.isInternalKeyToken, "This token is not the internal key token");

  testSlot = testModule.findSlotByName("Empty PKCS11 Slot");
  equal(testSlot.tokenName, null, "Empty slot is empty");
+1 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ function run_test() {
                  .getService(Ci.nsIPK11TokenDB);
  let token = tokenDB.getInternalKeyToken();
  notEqual(token, null, "The internal token should be present");
  ok(token.isInternalKeyToken, "The internal token should be represented as such");

  checkBasicAttributes(token);

+1 −0
Original line number Diff line number Diff line
@@ -399,6 +399,7 @@ PK11_IsFIPS
PK11_IsFriendly
PK11_IsHW
PK11_IsInternal
PK11_IsInternalKeySlot
PK11_IsLoggedIn
PK11_IsPresent
PK11_IsReadOnly