Yujm 2021 01368
Yujm 2021 01368
net/publication/359090295
CITATIONS READS
5 41
1 author:
SEE PROFILE
All content following this page was uploaded by Min Cheol Chang on 08 March 2022.
Background: Stroke patients usually experience damage to multiple functions and a long rehabilitation period. Hence, there is a large
volume of patient clinical information. It thus takes a long time for clinicians to identify the patient’s information and essential pieces
of information may be overlooked. To solve this, we stored the essential clinical information of stroke patients in a blockchain and im-
plemented the blockchain technology using the Java programming language.
Methods: We created a mini blockchain to store the medical information of patients using the Java programming language.
Results: After generating a unique pair of public/private keys for identity verification, a patient’s identity is verified by applying the El-
liptic Curve Digital Signature Algorithm based on the generated keys. When the identity verification is complete, new medical data are
stored in the transaction list and the generated transaction is verified. When verification is completed normally, the block hash value
is derived using the transaction value and the hash value of the previous block. The hash value of the previous block is then stored in
the generated block to interconnect the blocks.
Conclusion: We demonstrated that blockchain can be used to store and deliver the patient information of stroke patients. It may be
difficult to directly implement the code that we developed in the medical field, but it can serve as a starting point for the creation of a
blockchain system to be used in the field.
Introduction without a central server, and the content can be trusted without a
third-party guarantee. The applications of blockchain have been
A blockchain, also called a distributed or shared ledger, is a tech- expanding to various fields including government, finance, and pub-
nology through which participants jointly verify, store, distribute, lic data, and its use is also being explored in the medical field [3-5].
and interconnect data without an authorized third party by gener- Currently, patient medical information is stored on hospital
ating data in blocks [1,2]. It allows participants to jointly record servers, and hospitals cannot easily exchange the patient informa-
data by distributing the data to a person-to-person (P2P) network tion stored on such servers with other hospitals because of the risk
rather than to the central server of a specific organization [1,2]. of a privacy breach [1]. Consequently, when patients are trans-
Those who are permitted to see the ledger read it according to an ferred to another hospital, they need to carry their medical infor-
agreed method, and the transactions are also recorded according to mation from one hospital to the next. Conversely, if blockchain
an agreed method. In this way, information can be stored securely were used in place of servers, the information would be generated
Received: July 28, 2021 • Revised: August 13, 2021 • Accepted: August 13, 2021
Corresponding author: Min Cheol Chang, MD
Department of Physical Medicine and Rehabilitation, Yeungnam University College of Medicine, 170 Hyeonchung-ro, Nam-gu, Daegu 42415, Korea
Tel: +82-53-620-4682 • Fax: +82-53-4231-8694 • E-mail: [email protected]
Copyright © 2022 Yeungnam University College of Medicine, Yeungnam University Institute of Medical Science
This is an Open Access article distributed under the terms of the Creative Commons Attribution Non-Commercial License (http://creativecommons.org/licenses/by-nc/4.0/)
which permits unrestricted non-commercial use, distribution, and reproduction in any medium, provided the original work is properly cited.
98
J Yeungnam Med Sci 2022;39(2):98-107
and recorded in block units and then stored on multiple nodes in a or process. However, the format in which the key data are encoded
distributed manner [6]. This would make hacking practically im- and managed can be conveniently viewed and transmitted using
possible while allowing hospitals to easily and freely share patient the Base64 algorithm (an encoding algorithm that converts binary
information with other hospitals. data to text). An encoded file is called ‘Privacy-Enhanced Mail’ and
During the rehabilitation of a stroke patient, a large amount of generally has the file extension ‘.pem’. The keys are randomly gen-
data related to the patient’s condition is generated due to the long erated using the chart number or resident registration number of
rehabilitation period [7]. Furthermore, many patients are trans- the patient.
ferred to different hospitals to receive rehabilitation treatments. Code: Generation of private and public keys
When a patient moves to another hospital, the patient or their A unique pair of private/public keys are generated for a given pa-
guardian must receive the printed patient care information from tient using the Elliptic Curve Digital Signature Algorithm (ECD-
the old hospital and deliver it to the new hospital [1,7]. Doctors SA) algorithm. The generated keys have the file extension ‘.pem’
check the current and past conditions of transferred patients based and are stored under a specific file name.
on these paper records, which takes a considerable amount of time.
Moreover, important pieces of information may be missed due to
Generation of private and public keys using the Elliptic
the large volume of information and because each hospital records
Curve Digital Signature Algorithm
patient information in its own way. We believe that blockchain can
help to solve this problem. // Private and public keys are generated using the ECDSA algo-
Based on the previous study [7], we identified the essential in- rithm and then stored.
formation for stroke patients receiving rehabilitation treatment and // For a detailed version of the ECDSA, we use sect163k1.
then used private blockchain network technology to store the in- public void generate (String privateKeyName, String publicKey-
formation of one patient through the medical information transac- Name) throws Exception {
tion process. Since the personal medical information of patients // The ECDSA algorithm of the Bouncy Castle is used.
can be transferred on the network, only the participants who were KeyPairGenerator generator = KeyPairGenerator.getInstance("-
authorized to use the private blockchain were allowed to write and ECDSA", "BC");
read the patient medical information. // sect163k1 is the algorithm used to generate the elliptic curve.
ECGenParameterSpec ecsp;
Methods ecsp = new ECGenParameterSpec("sect163k1");
generator.initialize(ecsp, new SecureRandom());
We created a mini blockchain to store the medical information of // A random pair of keys is generated using this algorithm.
patients using the Java programming language. To actually run the KeyPair keyPair = generator.generateKeyPair();
source code written in Java, we installed the Java Development Kit System.out.println("A pair of elliptic curve encryption keys was
and Eclipse, the most representative integrated Java development generated.");
environment. // The private and public keys are extracted from the generated
keys.
Results PrivateKey priv = keyPair.getPrivate();
PublicKey pub = keyPair.getPublic();
The medical information transaction process is illustrated in Fig. 1. // The private and public keys are stored under specific file names.
writePemFile(priv, "EC PRIVATE KEY", privateKeyName);
1. Patient consent writePemFile(pub, "EC PUBLIC KEY", publicKeyName);
A patient’s consent is required before sharing their personal medi- }
cal information on the network. The procedure for obtaining con-
sent is conducted through an application. Once the patient’s con- // The generated encryption key is save as a file in the .pem class.
sent has been obtained, a unique pair of public/private keys is is- private void writePemFile(Key key, String description, String file-
sued for the patient. The issued keys are stored as files: the private name) throws FileNotFoundException, IOException{
key is stored on the patient’s smartphone, and the public key is Pem pemFile = new Pem(key, description);
stored by the medical institutions that participate in the network. pemFile.write(filename);
In general, keys are stored in a byte format, which is difficult to read (Continued to the next page)
https://doi.org/10.12701/yujm.2021.01368 99
Chang. Blockchain technology in stroke rehabilitation
on 3.
a cti Tra
ns n sac
Tra
3. on tio
n
ati 6.
Ve
fic
eri ri fic
6.V a tio
n
3. Transaction
6. Verification
Medical Medical
institution B institution D
5. g
on
Ag
ree
Medical
t am ants
institution C en cip
me em arti
pa nt a A gre p
rti mo
cip ng
an 5.
ts
4. Verify transaction
Fig. 1. Application of blockchain technology to medical information: patient identities are verified using the public key-based structure,
and the medical records of the verified patients are connected as a chain through the hash value.
When the private and public keys stored in the .pem files are
opened, they have the following format. 2. Identification
The purpose of the identification process is to verify the identity of
patients using a public key-based structure (Fig. 2). The function
Format of private and public keys
of the public key-based structure is to manage passwords as pairs of
-----BEGIN EC PRIVATE KEY----- private and public keys using the ECDSA algorithm. Data encrypt-
MGwCAQAwEAYHKoZIzj0CAQYFK4EEAAEEVTBTAg ed with a private key can only be decrypted with the public key
EBBBUCoeEILPFbMQIh3CRiHo+S with which it is paired. The private key is encrypted using the pa-
3++ka8egBwYFK4EEAAGhLgMsAAQCupGyQ46vQ9dG6w- tient’s chart number or resident registration number and then de-
tab7xZtJMFdcIGu0fHQR+Z crypted by reading the public key. If the patient’s public key or pri-
OnNX8k/xYjkrRjGTBEU= vate key does not exist or has been manipulated or damaged, iden-
-----END EC PRIVATE KEY----- tity verification fails, and it is impossible to access the patient’s
medical information.
-----BEGIN EC PUBLIC KEY----- Code: Identity verification process
(Continued to) The private and public keys of a given patient are read, and their va-
100 https://doi.org/10.12701/yujm.2021.01368
J Yeungnam Med Sci 2022;39(2):98-107
Block
connection
Fig. 2. Encryption process of the public key-based structure. After the consent to use and share personal medical information is provid-
ed, a unique pair of keys (private key, public key) is issued for the patient. An identity verification process is required to read or update
medical records. The process is performed using the unique key pair assigned to the patient. Once the identity is verified normally, the
patient’s past medical records can be read, and new ones can be written. A new medical record is stored in a block, and if no abnormality
is observed through validation verification, the new medical record is linked to the previous block and stored.
Private key
Public key
Fig. 3. Distribution and agreement process of medical information transaction. The verification and agreement process for medical in-
formation transaction is shown. The patient’s identity verification process uses a public key-based structure that uses the Elliptic Curve
Digital Signature Algorithm. The public key-based structure is a method of managing passwords with a pair of private and public keys,
and facilitates the encryption of private keys using chart numbers or resident registration numbers. Data encrypted using the private key
can be decrypted by only using the paired public key.
lidity is verified. are extracted. The file is encrypted (signed) using the private key
A text string file (.pem) is read and the private and public keys and decrypted using the public key.
https://doi.org/10.12701/yujm.2021.01368 101
Chang. Blockchain technology in stroke rehabilitation
102 https://doi.org/10.12701/yujm.2021.01368
J Yeungnam Med Sci 2022;39(2):98-107
The process for adding medical information to a patient’s medi- // A transaction is generated to add to the medical record of pa-
cal record is as follows: (1) The original data (medical informa- tient 2673123.
tion) is encrypted with the patient’s own private key and electroni- transaction = new Transaction(key, patientsData.getPatientsDa-
cally signed. (2) The original data and the electronically signed ta());
data are propagated to the participating medical institutions. (3) block.addTransaction(transaction);
To verify whether the transaction is valid, the participating medical
institutions decrypt it using the patient’s public key. (4) The de- // The transaction information is reflected in the hash value of the
crypted data and original data are compared to verify the integrity block.// If the transaction information in a block is changed, the
of the data and whether there is any manipulated data. (5) If the re- hash values of all subsequent blocks are also changed.
ceived transaction is determined to be valid, the transaction is up- public String getBlockHash() {
dated in the blockchain, and the transaction is propagated to the // The block hash is created using the previous block hash.
medical institutions participating in the blockchain network. return Util.getHash(getTransaction() + previousBlockHash);
}
4. Block connection // The SHA-256 hash value, which is returned as a text string,
Whenever a transaction of medical information is performed, a passes through the function.
block that contains the transaction information is generated and // When the value of the text string changes, the hash value also
connected continuously to other blocks, and the information is changes.
stored in a distributed manner at the medical institutions partici- // For the SHA-256 hash algorithm, the Avalanche Effect method
pating in the network. Many blocks are closely interconnected is applied.
through the hash values. A hash value is data that is converted to a public static String getHash(String input) {
special text string of a fixed length in which the original data can- StringBuffer result = new StringBuffer();
not be distinguished when the hash goes through the hash func- try {
tion. The transaction information is reflected in the hash value of MessageDigest md = MessageDigest.getInstance("SHA-256");
the newly generated block. When the internal data of a specific md.update(input.getBytes());
block in the blockchain changes, the hash value automatically byte bytes[] = md.digest();
changes, which also affects other blocks. In this way, a blockchain for(int i= 0;i< bytes.lengthi++) {
allows data tampering to be easily detected. In the blockchain, the result.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).
hash value is used to add the corresponding block to the chain, and substring(1));
the hash value of the previous block is recorded in the current }
block. As a result, a connected list is created in the form of chain. } catch(Exception e) {
Therefore, in order to hack a specific block, it is necessary to tam- e.printStackTrace();
per with other blocks connected to the block of interest, making }
forgery exceedingly difficult. return result.toString();
Code: Generation of block objects }
To create a block object, a verified transaction is added to the
chain, and the transaction information is reflected in the hash value SHA, secure hash algorithm.
of the block. A new block hash is then generated using the previous
block hash. The hash value of the previous block is saved in the
https://doi.org/10.12701/yujm.2021.01368 103
Chang. Blockchain technology in stroke rehabilitation
104 https://doi.org/10.12701/yujm.2021.01368
J Yeungnam Med Sci 2022;39(2):98-107
https://doi.org/10.12701/yujm.2021.01368 105
Chang. Blockchain technology in stroke rehabilitation
106 https://doi.org/10.12701/yujm.2021.01368
J Yeungnam Med Sci 2022;39(2):98-107
21:3822. 7. Kim JK, Hau YS, Kwak S, Chang MC. Essential medical infor-
6. Fang HS, Tan TH, Tan YF, Tan CJM. Blockchain personal mation for stroke patients undergoing interhospital transfer: a
health records: systematic review. J Med Internet Res 2021; Delphi study. Am J Phys Med Rehabil 2021;100:354–8.
23:e25094.
https://doi.org/10.12701/yujm.2021.01368 107