The identity used to form the signature. see base -19 p. 54
コード例 #1
0
ファイル: Signature.cs プロジェクト: RELOAD-NET/RELOAD.NET
    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
ファイル: Signature.cs プロジェクト: RELOAD-NET/RELOAD.NET
    /// <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);
    }