public bool IsValidEndorsement(Endorsement endorsement) { var signingKeyPair = KeyPairsAssertingOwnership .Where(x => x.Fingerprint == endorsement.EndorserPublicKeyFingerprint).First(); return(signingKeyPair.Verify(endorsement.AssertionContent, endorsement.SignedEndorsement)); }
public Endorsement EndorseKeyPairAsIdentityOwner(Identity endorser, Guid identityGUID, string targetFingerPrint) { IAssertion keyGuidOwnership = new OwnershipAssertion(targetFingerPrint, identityGUID.ToString()); Endorsement endorsement = new Endorsement(endorser, keyGuidOwnership); return(endorsement); }
public Identity AddNewKeyPairToExistingIdentity(Guid existingIdentityID) { Identity existingIdentity = new Identity(existingIdentityID); KeyPair newKeyPair = KeyPair.GenerateNewKeyPair(); existingIdentity.KeyPairsAssertingOwnership.Add(newKeyPair); IAssertion keyGuidOwnership = new OwnershipAssertion(newKeyPair.Fingerprint, existingIdentity.IdentityGUID.ToString()); Endorsement selfEndorsement = new Endorsement( existingIdentity, keyGuidOwnership); existingIdentity.Endorsements.Add(selfEndorsement); return(existingIdentity); }
public Identity CreateNewIdentity() { Identity newIdentity = new Identity(Guid.NewGuid()); KeyPair newKeyPair = KeyPair.GenerateNewKeyPair(); newIdentity.KeyPairsAssertingOwnership.Add(newKeyPair); IAssertion keyGuidOwnership = new OwnershipAssertion(newKeyPair.Fingerprint, newIdentity.IdentityGUID.ToString()); Endorsement selfEndorsement = new Endorsement( newIdentity, keyGuidOwnership); newIdentity.Endorsements.Add(selfEndorsement); return(newIdentity); }