Beispiel #1
0
        public bool IsValidEndorsement(Endorsement endorsement)
        {
            var signingKeyPair = KeyPairsAssertingOwnership
                                 .Where(x => x.Fingerprint == endorsement.EndorserPublicKeyFingerprint).First();

            return(signingKeyPair.Verify(endorsement.AssertionContent, endorsement.SignedEndorsement));
        }
Beispiel #2
0
        public Endorsement EndorseKeyPairAsIdentityOwner(Identity endorser, Guid identityGUID, string targetFingerPrint)
        {
            IAssertion keyGuidOwnership =
                new OwnershipAssertion(targetFingerPrint, identityGUID.ToString());

            Endorsement endorsement = new Endorsement(endorser, keyGuidOwnership);

            return(endorsement);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }