当前位置:网站首页>Tencent cloud temporary secret key scheme - character recognition example
Tencent cloud temporary secret key scheme - character recognition example
2022-06-24 02:16:00 【Yuanlunqiao】
Temporary key usage guide
summary
Tencent cloud official website SecretId and SecretKey Is your important property . In the use of OCR Business needs to take advantage of SecretId and SecretKey To calculate the authentication signature , But if SecretId and SecretKey Write dead in SDK There is a great risk of leakage in the code of . therefore , While we support the use of fixed keys , Provides a way to use temporary keys .SDK The temporary key can be used for authentication signature calculation , To request OCR Identification interface . The redeemed temporary key has timeliness , Can greatly reduce SecretId and SecretKey The risk of leakage .
Temporary key exchange process
The flow chart of temporary key exchange is as follows :
As shown in the figure, the process of temporary key exchange can be roughly described as :
- The client of the user actively requests the server of the user to obtain the temporary key .
- After the user's server receives the client request , Use the fixed key stored on the server as a parameter to request CAM service , Perform temporary key exchange .
- CAM The service issues the temporary key to the user server .
- The user server is receiving CAM After the temporary key generated by the service , Distribute this temporary key to the user's client .
- After the client obtains the temporary key issued by the server , call SDK The interface provided to update the temporary key updates the temporary key . And then the client SDK Will use the updated temporary key , To request OCR service .
Reference link :https://github.com/TencentCloud/tc-ocr-sdk/tree/master/%E4%B8%B4%E6%97%B6%E5%AF%86%E9%92%A5%E5%85%91%E6%8D%A2
One 、OCR Example of requesting a temporary secret key
api Secret key address :https://console.cloud.tencent.com/cam/capi
Obtain temporary access credentials for federated identity ( Temporary secret key access document ):https://cloud.tencent.com/document/product/1312/48195
Policy Join the reference , Character recognition OCR An example of a policy is as follows :
{
"version": "2.0",
"statement": [
{
"action": [
"ocr:*"
],
"resource": "*",
"effect": "allow"
}
]
}
Be careful : The format needs to be changed before coding , Such as :
{ "version": "2.0", "statement": [{"action": ["ocr:*"],"resource": "*","effect": "allow"}]}
Conduct urlencode code :
%7b+%22version%22%3a+%222.0%22%2c+%22statement%22%3a+%5b%7b%22action%22%3a+%5b%22ocr%3a*%22%5d%2c%22resource%22%3a+%22*%22%2c%22effect%22%3a+%22allow%22%7d%5d%7dPolicy Join the reference , speech recognition ASR An example of a policy is as follows :
{
"version": "2.0",
"statement": [
{
"action": [
"asr:*"
],
"resource": "*",
"effect": "allow"
}
]
}
Be careful : The format needs to be changed before coding , Such as :
{ "version": "2.0", "statement": [{"action": ["asr:*"],"resource": "*","effect": "allow"}]}
Conduct urlencode code :
%7b+%22version%22%3a+%222.0%22%2c+%22statement%22%3a+%5b%7b%22action%22%3a+%5b%22asr%3a*%22%5d%2c%22resource%22%3a+%22*%22%2c%22effect%22%3a+%22allow%22%7d%5d%7dOn-line API Explorer Address :https://console.cloud.tencent.com/api/explorer?Product=sts&Version=2018-08-13&Action=GetFederationToken&SignVersion=
test result :
Two 、 Temporary secret key test request - An example of a character recognition service
Call with a temporary secret key ocr service :https://console.cloud.tencent.com/api/explorer?Product=ocr&Version=2018-11-19&Action=GeneralBasicOCR&SignVersion=
Need to click on more options , Enter the corresponding Token value ,Token The call was successful within the validity period ( Only older versions of api exploer Tools , Currently recommended SDK Code test )
notes :Token Valid until “ Obtain temporary access credentials for federated identity ” Interface ( Field :DurationSeconds): Default 1800 second , The maximum period of validity of the primary account can be set as 7200 second , The longest valid period of the sub account can be set as 129600 second .
Token Call after expiration OCR Failure :
It will help you , Remember to make up a praise for me !
边栏推荐
- Devops learning notes (II)
- Build your own cloud game server. What if the cloud game server is attacked
- What is vxlan? What are its advantages?
- layer 3 switch
- [expense center] demand & problem feedback week is coming! Feedback wins a good gift!
- Frequent screen flashing after VNC login - abnormal system time
- Development status of industrial Internet
- Measurement model 𞓜 pre determined variable # time Fe
- How to calculate the trademark registration fee? How much does it cost to register a trademark?
- Are cloud game servers expensive to rent? Factors to consider in cloud game server leasing
猜你喜欢

Advanced BOM tool intelligent packaging function

163 mailbox login portal display, enterprise mailbox computer version login portal

layer 3 switch

Review of AI hotspots this week: the Gan compression method consumes less than 1/9 of the computing power, and the open source generator turns your photos into hand drawn photos

Stm32g474 infrared receiving based on irtim peripherals

How to fill in and register e-mail, and open mass mailing software for free

application. Yaml configuring multiple running environments

Introduction to development model + test model

BIM model example

Leetcode969: pancake sorting (medium, dynamic programming)
随机推荐
How do I fix the iPhone green screen problem? Try these solutions
Cloud rendering: cloud exhibition hall of Tencent digital ecology Conference - open roaming mode on cloud
The difference between classless routing and classless routing
The new purchased machines with large customized images are slow to enter the system
2021-11-10:o (1) time inserts, deletes and obtains random elements. Implement ra
How to improve the success rate of trademark registration? How long does it take to register a trademark?
What is the relationship between cloud desktop and cloud server? How to understand the relationship between the two
What information should be provided for enterprise trademark registration? Is it difficult to register a trademark?
How to build an enterprise website? Is it difficult?
SAP mm Migo + 301 K can transfer vendor consignment inventory across factories
Analysis report on operation situation and development trend of global and Chinese diisobutyl aluminum hydride (Dibah) industry 2022-2028
Embedded hardware development tutorial -- Xilinx vivado HLS case (3)
Easycvr connects with Huawei IVS platform to query the foreign domain list interface definition and use sharing
Grpc: implement grpc proxy
What is a region name? Can a territory name be used for trademark registration?
layer 3 switch
What is raid? 2000 words can explain RAID 0, 1, 5 and 10 thoroughly, and collect!
Talk about 15 tips of SQL optimization
Embedded hardware development tutorial -- Xilinx vivado HLS case (process description)
Using nginscript as a file distribution service with permission