Summary of the invention
In view of the drawbacks of the prior art, it is an object of the invention to solve prior art cloud Data Audit dependent on third
Side lacks the technical issues of audit to cloud data manipulation behavior.
To achieve the above object, in a first aspect, the embodiment of the invention provides under a kind of cloud storage environment based on block
The log behavior auditing method of chain, method includes the following steps:
S1. data owner and cloud service provider confer an intelligent contract jointly, and the intelligent contract is deployed to
In block chain network, if deployment success, it is transferred to step S2, otherwise, is terminated;
S2. for data owner, after uploading data file to cloud storage service device end, call intelligent contract to block
Chain network adds log recording;
S3. for ordinary user, intelligent contract input is called to want the behaviour carried out to data file on cloud storage service device
Make solicited message, intelligent contract returns to the metadata information of data file described in ordinary user, is transferred to step S4;
S4. ordinary user initiates operation requests simultaneously to cloud storage service device according to operation requests information and metadata information
Log recording is sent, judges that the operation requests are that read operation request or write operation requests are then transferred to if write operation requests
Step S5;If read operation request, then step S6 is transferred to;
S5. cloud storage provider calls intelligent contract to authenticate the log recording, writes described in intelligent contract agreement receiving
After the feedback of operation requests, corresponding write operation is executed according to the write operation requests, and call intelligent contract to block chain
Log recording is added in network;
S6. cloud storage provider calls intelligent contract to authenticate the log recording, agrees to the reading receiving intelligent contract
After the feedback of operation requests, corresponding read operation is executed according to the read operation request, the data file of request is returned to
Ordinary user, and intelligent contract is called to add log recording into block chain network, it is transferred to step S7;
S7. the data file obtained when the data file of cloud storage service device return and before by intelligent contract is inconsistent
When, ordinary user calls intelligent contract to initiate audit request to the data file.
More specifically, the intelligence contract includes multiple interfaces, it is specific as follows:
Upload: data owner will upload to the metadata of the data file of cloud service provider by the interface
Information is recorded to block chain network, and generates the initial access record of the data file, the log note after being signed by private key for user
Record is broadcasted in block chain network, and is packed up in block and is reached common understanding in block chain network;
Getfile: user obtains data file in the address L of cloud storage service device by this interface, and user is in Xiang Yuncun
When storing up the server end long-range read/write requests of sending, need to obtain address and an interim token by the interface;
VerifyRequest: the interface is supplied to cloud storage provider and uses and can only be called by cloud storage provider, when
It when cloud storage provider receives the operation requests of user, calls whether interface polls user has access authority first, simultaneously should
Interface can obtain the accessing request information of user, and be stored in block chain network as log recording;
Grant: ordinary user is arranged to the number oneself deposited on cloud storage service device by the interface in data owner
According to access authority, the interface for give ordinary user authorization, that is, assign the user to the access limit of data file;
Revoke: data owner deposits in cloud storage service to oneself by assigning ordinary user before interface revocation
The access limit of data file on device;
Audit: audit user by the interface track data file life cycle, that is, know the data file when by
Creation and destroy, when by ordinary user access and be performed which operation;
Logging: the interface is used to broadcast ordinary user in block chain network and accesses data file generation access log
Record, and the log recording is stored to the addition of block chain, it is completed jointly by above-mentioned interface.
More specifically, the address L is url.
More specifically, step S2 is specific as follows:
S201. data owner is that each data file to be uploaded creates a number fid, and by the data file
It is uploaded to cloud storage provider;
S202. data owner calls the Upload interface of intelligent contract to record the metadata information of data file to area
Block chain network;
S203. data owner sends the log recording (uid, fid, type, H (X0), OPM, ts, sign) after signature
Give cloud storage provider;
S204. cloud storage provider audit log records the correctness of each field, if all correct, calls intelligent conjunction
Log recording is added in block chain network by Logging interface about, otherwise, terminates process;
Wherein, uid is user's unique identification number of remote access data, and fid is the unique of accessed data file
Mark, type are action type of the user to data file, and H (X0) is by preoperative data cryptographic Hash;Ts is current time
Stamp;Sign is the signature that the user of current accessed data generates access record using its private key;OPM is that open data are traced to the source
Model.
More specifically, the operation requests information is (type, fid), wherein type is operation of the user to data file
Type, type have tri- kinds of Create, Read, Write, respectively indicate and upload data, read data and write data;Fid is accessed
Data file unique identification;The metadata information of the data file includes ground of the data file on cloud storage service device
Location L, data file are by preoperative cryptographic Hash and token token.
More specifically, the read operation request be (read, L, H (X0), token), the write operation requests be (write,
L,H(Xn),token);Log recording described in step S4 by access record (uid, fid, type, H (X0), H (Xn), OPM,
Ts, sign) private key signature generation;
Wherein, uid is user's unique identification number of remote access data, and fid is the unique of accessed data file
Mark, type are action type of the user to data file, and H (X0) is by preoperative data cryptographic Hash;H (Xn) is to be operated
Data cryptographic Hash afterwards;Ts is current time stamp;Sign is that the user of current accessed data gives birth to access record using its private key
At signature;OPM is that open data are traced to the source model.
More specifically, step S5 is specific as follows:
S501. after cloud storage provider receives the request of ordinary user, audit log records the correctness of each field,
If all correct, it is transferred to step S502, otherwise, terminates process;
S502. the VerifyRequest interface of intelligent contract is called to verify the identity of ordinary user, in intelligent conjunction
The about access control policy of internal queries corresponding data file agrees to the request if user identity is eligible, and is transferred to step
Rapid S503 refuses the request of user if not meeting, and terminates process;
S503. cloud storage provider is after receiving intelligent contract and agreeing to the feedback of the write operation requests, according to user's
Request executes corresponding write operation;
S504. the log recording is added in block chain network by intelligent contract.
More specifically, step S6 is specific as follows:
S601. after cloud storage provider receives the request of user, audit log records the correctness of each field, if
It is all correct, then it is transferred to step S602, otherwise, terminates process;
S602. the VerifyRequest interface of intelligent contract is called to verify the identity of the user, in intelligent contract
The access control policy of internal queries corresponding data file agrees to the request, and be transferred to step if user identity is eligible
Otherwise S603 refuses the request of user, and terminate process;
S603. cloud storage provider is after receiving intelligent contract and agreeing to the feedback of the read operation request, according to user's
Request executes corresponding read operation, and the data file of request is returned to ordinary user;
S604. the log recording is added in block chain network by intelligent contract, is transferred to step S7.
More specifically, step S7 is specific as follows:
Ordinary user first calculates its hash value after the data file for receiving the transmission of cloud storage service device, then with before
The newest hash value H (X0) of the data file obtained by intelligent contract is compared, and if they are the same, then proves the data file read
It is correctly, otherwise, to illustrate that data file is tampered or is not newest version, user can call the Audit of intelligent contract
Interface initiates audit request to the data file.
Second aspect, the embodiment of the invention provides a kind of computer readable storage medium, the computer-readable storage mediums
Computer program is stored in matter, which realizes log behavior described in above-mentioned first aspect when being executed by processor
Auditing method.
In general, through the invention it is contemplated above technical scheme is compared with the prior art, have below beneficial to effect
Fruit:
1. the present invention is transferred to block chain by storing cloud log from cloud storage provider, center is gone to using block chain
The features such as changing, going trustization and high reliability, ensure that the safety and integrality of daily record data.
2. the present invention makes block chain network provide the read-write interface and audit structure of log using intelligent contract, and is directed to
Interaction design between user and cloud service provider data access process, it is ensured that user and cloud storage both sides can be by days
Will is fully recorded in block chain network, and can not log recording be denied and be distorted.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, with reference to the accompanying drawings and embodiments, right
The present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, and
It is not used in the restriction present invention.
Fig. 1 is the log behavior audit model signal based on block chain under a kind of cloud storage environment provided by the invention
Figure.As shown in Figure 1, the log behavior audit model includes consisting of part:
Cloud storage user: being made of data owner and ordinary user's these two types, can be individual or tissue.Data are gathered around The person of havingData can be uploaded to cloud storage provider, while broadcast this upload operation in block chain network and being remembered by block chain
Record the lower operation log;Ordinary userThen mainly cloud data are written and read, while being broadcasted in block chain network
And record its operation note.
Cloud storage provider: according to the demand of user, the resource virtualized is with memory resource pool by cloud storage provider
Mode be supplied to user and freely use.User can upload data to cloud data server and carry out remote read-write behaviour to data
Make, while cloud storage provider is added block chain network and verifies together with user to log recording.
Block chain network: user and cloud storage provider are as the entire block chain network of node composition, each node equality
Ground receives the information of the operation note of user node broadcast, enters block for information package is recorded by digging mine algorithm.Entire block chain
Network stores operation behavior log as a distributed data base.
Auditing by third party person: possessing professional knowledge not available for user and ability, can represent user's periodical audit and deposit
The integrality for storing up all data in cloud storage service device, so that the mode of more simple economy is provided for user, to ensure it
Data can be correctly stored in cloud.
Log recording cannot be denied to make cloud storage user and cloud storage provider both sides, at record one
The confirmation for needing to obtain both sides when log, the present invention provides the log behaviors based on block chain under a kind of cloud storage environment to examine
Meter method, each interface needed for this method process are write by intelligent contract, guarantee that both sides can not deny its behavior, from
And the log recording in block chain network is made to be completely believable.
Fig. 2 is the log behavior auditing method process based on block chain under a kind of cloud storage environment provided by the invention
Figure.As shown in Fig. 2, method includes the following steps:
S1. data owner and cloud service provider confer an intelligent contract jointly, and the intelligent contract is deployed to
In block chain network, if deployment success, it is transferred to step S2, otherwise, is terminated;
S2. for data owner, after uploading data file to cloud storage service device end, call intelligent contract to block
Chain network adds log recording;
S3. for ordinary user, intelligent contract input is called to want the behaviour carried out to data file on cloud storage service device
Make solicited message, intelligent contract returns to the metadata information of data file described in ordinary user, is transferred to step S4;
S4. ordinary user initiates operation requests simultaneously to cloud storage service device according to operation requests information and metadata information
Log recording is sent, judges that the operation requests are that read operation request or write operation requests are then transferred to if write operation requests
Step S5;If read operation request, then step S6 is transferred to;
S5. cloud storage provider calls intelligent contract to authenticate the log recording, writes described in intelligent contract agreement receiving
After the feedback of operation requests, corresponding write operation is executed according to the write operation requests, and call intelligent contract to block chain
Log recording is added in network;
S6. cloud storage provider calls intelligent contract to authenticate the log recording, agrees to the reading receiving intelligent contract
After the feedback of operation requests, corresponding read operation is executed according to the read operation request, the data file of request is returned to
Ordinary user, and intelligent contract is called to add log recording into block chain network, it is transferred to step S7;
S7. the data file obtained when the data file of cloud storage service device return and before by intelligent contract is inconsistent
When, ordinary user calls intelligent contract to initiate audit request to the data file.
Step S1. data owner and cloud service provider confer an intelligent contract jointly, by the intelligent contract portion
In administration to block chain network, if deployment success, it is transferred to step S2, otherwise, is terminated.
Firstly, system is initialized, an intelligent contract rule is conferred by user and cloud service provider jointly,
Then this contract is deployed in block chain network, the process of contract deployment is to initiate one to receive the transaction that address is 0, the friendship
Easy data field can include the contract code for being compiled into bytecode.The transaction is broadcasted in block chain network, by node
It receives and is packaged into block, a unique contract address can be obtained at this time, we can pass through this call by location contract.Due to
Transaction comprising contract code is packed up in block, and reaches common understanding in the whole network, thus contract code cannot be tampered, we
It can trust that this section of code is bound to go to run according to the rule that we are worked out.The process can be provided to user terminal and cloud service
Side returns to intelligent contract address.
Intelligent contract includes multiple interfaces, and user, cloud storage provider and evidence obtaining investigation side with lower interface by being realized
Log recording and audit work:
Upload: data owner will upload to the metadata of the data file of cloud service provider by the interface
Information is recorded to block chain network, and generates the initial access record of the data file, the log note after being signed by private key for user
Record is broadcasted in block chain network, and is packed up in block and is reached common understanding in block chain network.
Log recording is considered transaction data and is packaged into block.
Getfile: user obtains data file in the address L of cloud storage service device by this interface, and user is in Xiang Yuncun
When storing up the server end long-range read/write requests of sending, need to obtain address and an interim token by the interface.
Preferably, the address L is url.Intelligent contract will record this behavior as one after receiving the request and ask in advance
Log is asked, is audited for subsequent to user's operation behavior, while token can prevent user from directly calling using last
The url that Getfile interface obtains files a request to cloud storage service device.
VerifyRequest: the interface is supplied to cloud storage provider and uses and can only be called by cloud storage provider, when
It when cloud storage provider receives the operation requests of user, calls whether interface polls user has access authority first, simultaneously should
Interface can obtain the accessing request information of user, and be stored in block chain network as log recording.
Grant: ordinary user is arranged to the number oneself deposited on cloud storage service device by the interface in data owner
According to access authority, the interface for give ordinary user authorization, that is, assign the user to the access limit of data file.
Revoke: data owner deposits in cloud storage service to oneself by assigning ordinary user before interface revocation
The access limit of data file on device.
Audit: audit user by the interface track data file life cycle, that is, know the data file when by
Creation and destroy, when by ordinary user access and be performed which operation.
Logging: the interface is used to broadcast ordinary user in block chain network and accesses data file generation access log
Record, and the log recording is stored to the addition of block chain, it is completed jointly by above-mentioned interface.
Step S2. is for data owner, after uploading data file to cloud storage service device end, call intelligent contract to
Block chain network adds log recording.
Create access operation of the step S2 corresponding data owner to data.After contract deployment success, system is i.e.
Initialization is completed.Next, can all call the Upload interface of intelligent contract after data owner uploads data to cloud
It uploads file metadata and a log recording is written, calling the process of intelligent contract is to broadcast one in block chain network
The process of transaction, this transaction receive address as intelligent contract address, contain the parameter of sender's offer in data field,
Transaction simultaneously includes the signature of sender and can be by other node verification.
When transaction will execute this intelligent contract by the reception of other nodes and save corresponding state variable, quilt of then trading
Be packaged into block, and reach common understanding in the whole network, this intelligent postrun state of contract is just confirmed by the whole network, therefore file metadata and
Log recording can be written into block chain and can not be tampered.
Data owner can also be paper formulation access control policy by Grant interface and Revoke interface.When this
In the broadcast of block chain network, receiving node can verify the signature of transaction and only data owner can formulate plan for transaction
Slightly, otherwise this time calling can be considered as invalid operation.
Fig. 3 is the flow chart of step S2 provided by the invention.As shown in figure 3, step S2 is specific as follows:
S201. data owner is that each data file to be uploaded creates a number fid, and by the data file
It is uploaded to cloud storage provider;
S202. data owner calls the Upload interface of intelligent contract to record the metadata information of data file to area
Block chain network.
S203. data owner sends the log recording (uid, fid, type, H (X0), OPM, ts, sign) after signature
Give cloud storage provider.
Subsidiary user's signature may insure that user can not deny this operation behavior on log recording.
S204. cloud storage provider audit log records the correctness of each field, if all correct, calls intelligent conjunction
Log recording is added in block chain network by Logging interface about, otherwise, terminates process;
Wherein, uid is user's unique identification number of remote access data, and fid is the unique of accessed data file
Mark, type are action type of the user to data file, and H (X0) is by preoperative data cryptographic Hash;Ts is current time
Stamp;Sign is the signature that the user of current accessed data generates access record using its private key;OPM is that open data are traced to the source
Model.
For example, checking whether user uid is correct, and whether action type corresponds to, then verifies the validity of user's signature, finally
Whether the cryptographic Hash for calculating data file is identical as H (X0), if being all that correctly, can call the Logging of intelligent contract
Log recording is written in block chain network interface.
Step S3. calls intelligent contract input to want to carry out data file on cloud storage service device ordinary user
Operation requests information, intelligent contract returns to the metadata information of data file described in ordinary user, is transferred to step S4;
Specifically, the operation requests information is (type, fid), wherein type is operation class of the user to data file
Type, type have tri- kinds of Create, Read, Write, respectively indicate and upload data, read data and write data;Fid is accessed
The unique identification of data file.The metadata information of the data file includes address of the data file on cloud storage service device
L, data file is by preoperative cryptographic Hash and token token.File owners are further comprised to specified by file simultaneously
Access control policy is realized using an accesses control list in the present system.
Step S4. ordinary user initiates operation to cloud storage service device and asks according to operation requests information and metadata information
Log recording is sought and sent, judges that the operation requests are read operation request or write operation requests, if write operation requests, then
It is transferred to step S5;If read operation request, then step S6 is transferred to.
Specifically, read operation request be (read, L, H (X0), token), write operation requests be (write, L, H (Xn),
token);Log recording described in step S4 is private by access record (uid, fid, type, H (X0), H (Xn), OPM, ts, sign)
Key signature generates;
Wherein, uid is user's unique identification number of remote access data, and fid is the unique of accessed data file
Mark, type are action type of the user to data file, and H (X0) is by preoperative data cryptographic Hash;H (Xn) is to be operated
Data cryptographic Hash afterwards;Ts is current time stamp;Sign is that the user of current accessed data gives birth to access record using its private key
At signature;OPM is that open data are traced to the source model.
Step S5. cloud storage provider calls intelligent contract to authenticate the log recording, agrees to institute receiving intelligent contract
After the feedback for stating write operation requests, corresponding write operation is executed according to the write operation requests, and call intelligent contract to area
Log recording is added in block chain network.
Fig. 4 is the flow chart provided by the invention that the data for being stored in cloud storage service device are carried out with long-range write operation.Such as
Shown in Fig. 4, step S5 is specific as follows:
S501. after cloud storage provider receives the request of ordinary user, audit log records the correctness of each field,
If all correct, it is transferred to step S502, otherwise, terminates process;
S502. the VerifyRequest interface of intelligent contract is called to verify the identity of ordinary user, in intelligent conjunction
The about access control policy of internal queries corresponding data file agrees to the request if user identity is eligible, and is transferred to step
Rapid S503 refuses the request of user if not meeting, and terminates process;
S503. cloud storage provider is after receiving intelligent contract and agreeing to the feedback of the write operation requests, according to user's
Request executes corresponding write operation;
S504. the log recording is added in block chain network by intelligent contract.
Step S6. cloud storage provider calls intelligent contract to authenticate the log recording, agrees to institute receiving intelligent contract
After the feedback for stating read operation request, corresponding read operation is executed according to the read operation request, the data file of request is returned
Back to ordinary user, and intelligent contract is called to add log recording into block chain network, is transferred to step S7.
Fig. 5 is the flow chart provided by the invention that the data for being stored in cloud storage service device are carried out with long-range read operation.Such as
Shown in Fig. 5, step S6 is specific as follows:
S601. after cloud storage provider receives the request of user, audit log records the correctness of each field, if
It is all correct, then it is transferred to step S602, otherwise, terminates process;
S602. the VerifyRequest interface of intelligent contract is called to verify the identity of the user, in intelligent contract
The access control policy of internal queries corresponding data file agrees to the request, and be transferred to step if user identity is eligible
Otherwise S603 refuses the request of user, and terminate process;
S603. cloud storage provider is after receiving intelligent contract and agreeing to the feedback of the read operation request, according to user's
Request executes corresponding read operation, and the data file of request is returned to ordinary user;
S604. the log recording is added in block chain network by intelligent contract, is transferred to step S7.
Step S7. works as the data file that cloud storage service device returns and passes through the data file of intelligent contract acquisition before not
When consistent, ordinary user calls intelligent contract to initiate audit request to the data file.
Ordinary user first calculates its hash value after the data for receiving the transmission of cloud storage service device, then with pass through before
The newest hash value H (X0) of data that intelligent contract obtains is compared, if they are the same, then prove the data read be it is correct, it is no
Then, illustrate that data are tampered or are not newest versions, at this point, user can call the Audit interface of intelligent contract to this
Data file initiates audit request.
Only can just be concerned about whether data are destroyed or malice is distorted when reading data, there is no this to need when writing data
It asks, but intelligent contract is also provided with interface, user can carry out integrality audit to data by the interface at any time.
It can be based on the extraction and analysis to log recording to the audit of data operation behavior.Call intelligence first when there is audit demand
The audit interface of contract, returns result to the user to file a request after being examined by intelligent contract log recording.
The present invention provides three audit functions, and it is open to all users to can be used as public audit interface Audit.It can
To be called by auditing by third party person, it is also possible to other any users.These three audit functions are respectively: obtaining file Life Cycle
Phase, inquiry illegal user and verifying file integrality.
It obtains file life cycle one data file is provided and be deleted all operation notes experienced from uploading to.
Which user inquiry illegal user, which is provided with, attempts to carry out illegal operation, so as to take one to these users
A little punitive measures or the in time permission of revocation malicious user.By comparing the Getfile request issued and VerifyRequest
Whether the request of sending is consistent, and illustrates that user has initiated illegal request if the request of the two operation is inconsistent, should
User is illegal user.
Verifying file integrality be supplied to user's checking its obtain file whether be tampered with.By by the Kazakhstan of data
Uncommon value is compared with the data cryptographic Hash in state-of-the-art record, if it is inconsistent, illustrating that the integrality of data is destroyed.
More than, the only preferable specific embodiment of the application, but the protection scope of the application is not limited thereto, and it is any
Within the technical scope of the present application, any changes or substitutions that can be easily thought of by those familiar with the art, all answers
Cover within the scope of protection of this application.Therefore, the protection scope of the application should be subject to the protection scope in claims.