public SenderIdentity(BaseKeyId id, TagPubKey publicKey, string?name)
 {
     Id        = id.Required();
     PublicKey = publicKey.Required();
     Name      = name;
     _reader   = new Lazy <TagReader>(() => new TagReader(Id.TextualRepresentation, PublicKey));
 }
 public UpdatableParts(KeyPurpose[] purposes, string name, byte[] encrypted, TagPubKey pubKey, string description, KeyStrength strength, BaseKeyId keyId)
     : base(purposes, name, description, pubKey, strength, keyId, null)
 {
     Version   = InterlockUpdatableSigningKeyVersion;
     Encrypted = encrypted;
     LastSignatureTimeStamp   = DateTimeOffsetExtensions.TimeZero;
     SignaturesWithCurrentKey = 0;
 }
예제 #3
0
 public Parts(string name, TagPubKey publicKey)
 {
     if (string.IsNullOrWhiteSpace(name))
     {
         throw new ArgumentException("Must provide a non-empty name for this reader", nameof(name));
     }
     Name      = name;
     PublicKey = publicKey.Required();
 }
예제 #4
0
 public static List <Claim> AddCertificate(this List <Claim> claims, X509Certificate2 certificate)
 {
     if (claims != null && certificate != null)
     {
         claims.Add(new Claim(_publicKeyClaimType, TagPubKey.Resolve(certificate).TextualRepresentation));
         claims.Add(new Claim(_senderIdClaimType, KeyId.Resolve(certificate).TextualRepresentation));
         claims.Add(new Claim(_senderNameClaimType, certificate.FriendlyName));
     }
     return(claims);
 }
 public InterlockKey(KeyPurpose[] purposes, string name, TagPubKey pubKey, BaseKeyId keyId, IEnumerable <AppPermissions> permissions, KeyStrength?strength = null, string description = null)
     : this(new Parts(purposes,
                      name,
                      description,
                      pubKey.Required(),
                      strength ?? pubKey.Strength,
                      keyId,
                      permissions))
 {
 }
 public Parts(KeyPurpose[] purposes, string name, string description, TagPubKey pubKey, KeyStrength strength, BaseKeyId keyId, IEnumerable <AppPermissions> permissions)
 {
     if (string.IsNullOrWhiteSpace(name))
     {
         throw new ArgumentNullException(nameof(name));
     }
     Version     = InterlockKeyVersion;
     Name        = name;
     Purposes    = purposes.Required();
     PublicKey   = pubKey.Required();
     Description = description;
     Strength    = strength;
     if (Actionable && permissions.None())
     {
         Purposes = Purposes.Where(pu => pu != KeyPurpose.Action).ToArray(); // Remove Action Purpose
     }
     Permissions = permissions;
     Identity    = new KeyId(TagHash.HashSha256Of(_hashable));
     Id          = keyId ?? Identity;
 }
예제 #7
0
 public bool IsSignedBy(BaseKeyId validSigner, TagPubKey validPubKey)
 => SignedContent is not null &&
예제 #8
0
 public IdentifiedSignature(TagSignature signature, BaseKeyId id, TagPubKey publicKey) : this()
 {
     Signature = signature.Required();
     SignerId  = id.Required();
     PublicKey = publicKey.Required();
 }
예제 #9
0
 public TagReader(string name, TagPubKey publicKey) :
     base(ILTagId.Reader, new Parts(name.Required(), publicKey.Required()))
 {
 }
 public InterlockUpdatableSigningKeyData(KeyPurpose[] purposes, string name, byte[] encrypted, TagPubKey pubKey, KeyStrength strength, DateTimeOffset creationTime, string description = null, BaseKeyId keyId = null)
     : this(new UpdatableParts(purposes, name, encrypted, pubKey, description, strength, keyId)) => LastSignatureTimeStamp = creationTime;
 public InterlockSigningKeyData(KeyPurpose[] purposes, IEnumerable <AppPermissions> permissions, string name, byte[] encrypted, TagPubKey pubKey, KeyStrength strength, string description = null, BaseKeyId keyId = null, EncryptedContentType encryptedContentType = EncryptedContentType.EncryptedKey)
     : this(new InterlockSigningKeyParts(purposes, permissions, name, encrypted, pubKey, description, strength, encryptedContentType, keyId))
 {
 }
 public InterlockSigningKeyParts(KeyPurpose[] purposes, IEnumerable <AppPermissions> permissions, string name, byte[] encrypted, TagPubKey pubKey, string description, KeyStrength strength, EncryptedContentType encryptedContentType, BaseKeyId keyId)
     : base(purposes, name, description, pubKey, strength, keyId, permissions)
 {
     Version              = InterlockSigningKeyVersion;
     Encrypted            = encrypted;
     EncryptedContentType = encryptedContentType;
 }
 public static TagPubKey PubKey(this X509Certificate2 certificate)
 => TagPubKey.Resolve(certificate);
예제 #14
0
 public bool Equals(TagPubKey other) => (other != null) && (Algorithm == other.Algorithm) && Data.HasSameBytesAs(other.Data);
예제 #15
0
    internal static TagPubKey Resolve(Stream s)
    {
        var pubKey = new TagPubKey(s);

        return(ResolveAs(pubKey.Algorithm, pubKey.Data));
    }
예제 #16
0
 internal static TagPubKey PublicKey(this IEnumerable <Claim> claims)
 => BuildFrom(ClaimValue(claims, _publicKeyClaimType), textual => TagPubKey.Resolve(textual));