Skip to content
This repository has been archived by the owner on Dec 9, 2023. It is now read-only.

Commit

Permalink
Use correct session instances
Browse files Browse the repository at this point in the history
  • Loading branch information
jariq committed Jun 29, 2017
1 parent 19be373 commit 179003b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Pkcs11Interop.PDF/Pkcs11RsaSignature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public byte[] GetSigningCertificate()
if (_ckaId != null)
searchTemplate.Add(new ObjectAttribute(CKA.CKA_ID, _ckaId));

List<ObjectHandle> foundObjects = _session.FindAllObjects(searchTemplate);
List<ObjectHandle> foundObjects = session.FindAllObjects(searchTemplate);
if (foundObjects.Count < 1)
throw new ObjectNotFoundException(string.Format("Certificate with label \"{0}\" and id \"{1}\" was not found", _ckaLabel, (_ckaId == null) ? null : ConvertUtils.BytesToHexString(_ckaId)));
else if (foundObjects.Count > 1)
Expand All @@ -220,7 +220,7 @@ public byte[] GetSigningCertificate()
List<CKA> attributes = new List<CKA>();
attributes.Add(CKA.CKA_VALUE);

List<ObjectAttribute> certificateAttributes = _session.GetAttributeValue(foundObjects[0], attributes);
List<ObjectAttribute> certificateAttributes = session.GetAttributeValue(foundObjects[0], attributes);
_signingCertificate = certificateAttributes[0].GetValueAsByteArray();
}
}
Expand Down Expand Up @@ -251,10 +251,10 @@ public List<byte[]> GetAllCertificates()
List<CKA> attributes = new List<CKA>();
attributes.Add(CKA.CKA_VALUE);

List<ObjectHandle> foundObjects = _session.FindAllObjects(searchTemplate);
List<ObjectHandle> foundObjects = session.FindAllObjects(searchTemplate);
foreach (ObjectHandle foundObject in foundObjects)
{
List<ObjectAttribute> objectAttributes = _session.GetAttributeValue(foundObject, attributes);
List<ObjectAttribute> objectAttributes = session.GetAttributeValue(foundObject, attributes);
certificates.Add(objectAttributes[0].GetValueAsByteArray());
}
}
Expand Down Expand Up @@ -444,7 +444,7 @@ private ObjectHandle FindPrivateKey(string ckaLabel, byte[] ckaId)
if (ckaId != null)
searchTemplate.Add(new ObjectAttribute(CKA.CKA_ID, ckaId));

List<ObjectHandle> foundObjects = _session.FindAllObjects(searchTemplate);
List<ObjectHandle> foundObjects = session.FindAllObjects(searchTemplate);
if (foundObjects.Count < 1)
throw new ObjectNotFoundException(string.Format("Private key with label \"{0}\" and id \"{1}\" was not found", ckaLabel, (ckaId == null) ? null : ConvertUtils.BytesToHexString(ckaId)));
else if (foundObjects.Count > 1)
Expand Down

0 comments on commit 179003b

Please sign in to comment.