The identity used to form the signature. see base -19 p. 54
예제 #1
0
    public Signature FromReader(BinaryReader reader, long reload_msg_size) {
        var ascii = new ASCIIEncoding();
        var hashAlg = (HashAlgorithm)reader.ReadByte();
        var signatureAlg = (SignatureAlgorithm)reader.ReadByte();
        algorithm = new SignatureAndHashAlgorithm(hashAlg, signatureAlg);
        /* Read SignerIdentity */
        var type = (SignerIdentityType)reader.ReadByte();
        UInt16 length = (UInt16)IPAddress.NetworkToHostOrder(reader.ReadInt16());
        /* Read SignerIdentityValue */
        hashAlg = (HashAlgorithm)reader.ReadByte();
        length -= 1;
        ushort hashLen = (ushort)reader.ReadByte();
        byte[] bHash = reader.ReadBytes(hashLen);
        /* Create SignerIdentityValue */
        var signerIdVal = new SignerIdentityValue(type, hashAlg, bHash);
        /* Create SignerIdentity */
        identity = new SignerIdentity(type, signerIdVal);
        /* Read SignatureValue */
        UInt16 sigLen = (UInt16)IPAddress.NetworkToHostOrder(reader.ReadInt16());
        signatureValue = reader.ReadBytes(sigLen);

        return this;
    }
예제 #2
0
    /// <summary>
    /// Creates a signer identity.
    /// </summary>
    public SignerIdentity(SignerIdentityType type, SignerIdentityValue value) {
      identityType = type;
      identity = value;

      length = (UInt16)(1 + value.CertificateHash.Length); 
    }
예제 #3
0
    public AccessController(ReloadConfig rc) {
      var ascii = new ASCIIEncoding();
      m_ReloadConfig = rc;
      storedPKCs = new Dictionary<string, GenericCertificate>();
      ACPs = new Dictionary<String, IAccessControlPolicy>();
      ACPmap = new Dictionary<UInt32, String>();
      /* Convert My TEIX509Certificate to opaque string*/
      /* SignerIdValue*/
      var sha256 = new SHA256Managed();
      byte[] myCert;
      //m_ReloadConfig.MyCertificate.SaveToBuffer(out myCert);
      //myCert = m_ReloadConfig.MySSLCertificate.DER;
      myCert = m_ReloadConfig.MyCertificate.GetRawCertData();
      byte[] bHash = sha256.ComputeHash(myCert);
      var signIdVal = new SignerIdentityValue(SignerIdentityType.cert_hash,
        ReloadGlobals.HashAlg, bHash);

      /* Publish my Id and my PKC */
      var myGenCert = new GenericCertificate(myCert);
      myIdentity = new SignerIdentity(SignerIdentityType.cert_hash, signIdVal);
      string strHash = String.Join(String.Empty, bHash.Select(b => b.ToString("x2")));
      storedPKCs.Add(strHash, myGenCert);
    }