SystemLead Einvoice Project
  • Introduction
  • 中文版摘要說明
    • API傳送格式
    • e首發票API清單
    • 簽章值計算
    • 查詢發票字軌與期號
    • 空白發票號上傳
    • 已開立發票資料上傳
    • B2B存證發票範本
    • B2C存證發票範本
    • 發票作廢上傳格式
    • 折讓單上傳格式
    • 作廢折讓單上傳格式
    • 查詢發票處理狀態
    • 查詢發票上傳狀態
    • 上傳空白發票號
  • English Version Summary
    • API delivery format
    • e-Invoice API List
    • Signature Value Calculation
    • Inquiry authorization invoice track and period number
    • Update the blank invoice number
    • Batch upload for multiple invoice
    • B2B certificate of invoice
    • B2C certificate of invoice
    • Void Invoice Upload Format
    • Discount Invoice Upload Format
    • Query process status of invoices
    • Query upload status of invoices
    • Upload the Blank Invoice Number
Powered by GitBook
On this page
  1. English Version Summary

Signature Value Calculation

Creating method of Signature value:

Step 1、Combination string String formation:

    {TimeStamp}{Exclusive encryption Salt}

Example: TimeStamp:1490714051 (Tue, 28 Mar 2017 15:14:11 GMT) Exclusive encryption Salt provided by e-Invoice: ABCDEFGHIJKLMNOPQRSTUVWXYZ

    1490714051ABCDEFGHIJKLMNOPQRSTUVWXYZ

Step 2、Use the SHA256 hash with the string

Step 3、Byte[] to Hex String

Result of Example: 42AFE0433C4EB08B9266E3B50C72A9D11D4946DC79B7AFD4B73AE9175185644B

Example for C#

// Get the signature verification value
public string GetInvoiceSignature(string TimeStamp, string Data, string HashSalt)
{
      string _hashString = string.Format("{0}{1}", TimeStamp, HashSalt);
      return SHA256Encrypt(_hashString);
}

// Using SHA256 encryption
public string SHA256Encrypt(string NonEncryptString)
{
    SHA256 sha256 = new SHA256CryptoServiceProvider();//Building SHA256
    byte[] source = Encoding.ASCII.GetBytes(NonEncryptString);//String to Byte[]
    byte[] crypto = sha256.ComputeHash(source);//Encryption with SHA256
    string result = BitConverter.ToString(crypto).Replace("-", string.Empty);//Change the encrypted string from Byte [] to string
    return result;//Output the result
}
Previouse-Invoice API ListNextInquiry authorization invoice track and period number

Last updated 6 years ago