8 * Copyright (C) 2013 OEMR 501c3 www.oemr.org
10 * LICENSE: This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 3
13 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
22 * @author Ken Chapple <ken@mi-squared.com>
23 * @author Medical Information Integration, LLC
24 * @link http://www.open-emr.org
27 require_once $GLOBALS['srcdir'].'/ESign/SignatureIF.php';
28 require_once $GLOBALS['srcdir'].'/ESign/Utils/Verification.php';
30 class Signature
implements SignatureIF
32 private $id; // id of the signature
35 private $isLock = null; // flag signifying whether the signable object is locked
36 private $uid; // user id of the signer
37 private $firstName; // first name of signer
38 private $lastName; // last name of signer
39 private $datetime; // date and time of the signature
40 private $hash; // hash of the thing being signed on (SignableIF)
41 private $signatureHash = null; // hash of data in this signature
42 private $amendment = null; // note about the signature, if any
44 private $_verification = null;
46 public function __construct( $id, $tid, $table, $isLock, $uid, $firstName, $lastName, $datetime, $hash, $amendment = null, $signatureHash = null )
50 $this->table
= $table;
51 $this->isLock
= $isLock;
53 $this->firstName
= $firstName;
54 $this->lastName
= $lastName;
55 $this->datetime
= $datetime;
57 $this->amendment
= $amendment;
58 $this->signatureHash
= $signatureHash;
60 $this->_verification
= new Utils_Verification();
63 public function getClass()
66 if ( $this->isLock() === true ) {
73 public function getId()
78 public function getUid()
83 public function setUid($uid)
88 public function getFirstName()
90 return $this->firstName
;
93 public function getLastName()
95 return $this->lastName
;
98 public function getDatetime()
100 return $this->datetime
;
103 public function isLock()
105 if ( $this->isLock
> 0 ) {
112 public function getAmendment()
114 return $this->amendment
;
117 public function getData()
119 $data = array( $this->tid
, $this->table
, $this->uid
, $this->isLock
, $this->hash
, $this->amendment
);
123 public function verify()
125 return $this->_verification
->verify( $this->getData(), $this->signatureHash
);