当前位置:网站首页>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 !
边栏推荐
- Fulleventlogview does not display some event ID contents
- How does SAP retail view which Po the allocation table is created with reference to?
- WordPress site quickly integrates Tencent's digital identity management and control platform CIAM to realize login authentication without development
- Thoroughly explain the details of the simple factory that you haven't paid attention to
- NTP synchronization clock server server and client settings
- Select problem set 3
- How to build a cloud game server what needs to be considered to build a cloud game server
- What information should be provided for enterprise trademark registration? Is it difficult to register a trademark?
- Evaluation index of machine learning model
- Dry goods collection | the heaviest content collection of Tencent digital ecology Conference!
猜你喜欢

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

BIM model example

Introduction to development model + test model

layer 3 switch

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

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

Advanced BOM tool intelligent packaging function

Leetcode969: pancake sorting (medium, dynamic programming)

Stm32g474 infrared receiving based on irtim peripherals

If there are enumerations in the entity object, the conversion of enumerations can be carried out with @jsonvalue and @enumvalue annotations
随机推荐
WordPress site quickly integrates Tencent's digital identity management and control platform CIAM to realize login authentication without development
layer 3 switch
LeetCode 120. Triangle minimum path sum
In only three steps, this large manufacturing enterprise has achieved full operational improvement with data
What about registered domain names? How long does it take to register a domain name?
Dry goods collection | the heaviest content collection of Tencent digital ecology Conference!
Analysis report on development trends and prospects of China's pyrolytic boron nitride (PBN) component industry 2022-2028
A complete collection of SQL commands. Each command has an example. Xiaobai can become a God after reading it!
Is it illegal to use someone else's trademark to register a domain name? What should we pay attention to when registering a domain name?
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
[technical grass planting] how to batch check your server status? Cloud probe panel setup tutorial
application. Yaml configuring multiple running environments
What is ITF barcode
My eight year relationship with the message queue
Comparison of four dynamic routes: Rip, OSPF, Isis, BGP
What are the categories of code signing certificates? What are the differences between different types of certificates?
Custom form dynamic form form designer process engine design scheme
BIM model example
Using nginscript as a file distribution service with permission
A review of Nature Neuroscience: dynamic representation in networked nervous system