source: WorldVistAEHR/trunk/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCFAES1.m@ 1581

Last change on this file since 1581 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.5 KB
RevLine 
[613]1PRCFAES1 ;WISC/LEM-ESIG MAINTENANCE ROUTINE ;5/20/93 9:27 AM
2V ;;5.1;IFCAP;;Oct 20, 2000
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;ROUTINE FOR MAINTAINING FIELD 5.5 (ELECTRONIC SIGNATURE) FILE 421.2
5DECODE(LEVEL0) ;Extrinsic Function to return hashed electronic sig to readable form.
6 ;returns "" if unsuccessful
7 NEW RECORD,RECORD05,VERSION,PERSON,SIG,CHECKSUM
8 ;get record and check version
9 S RECORD=$G(^PRCF(421.2,LEVEL0,0)) I RECORD="" QUIT ""
10 S RECORD05=$G(^PRCF(421.2,LEVEL0,.5))
11 S VERSION=$P(RECORD05,"^",1)
12 S PERSON=+$P(RECORD,"^",5)
13 I VERSION'="",VERSION'=1 Q ""
14 S SIG=$P(RECORD,"^",6)
15D1 ;decode e signature for version 1
16 S RECORD=$G(^PRCF(421.2,LEVEL0,0))
17 S CHECKSUM=$$SUM^PRCUESIG(LEVEL0_"^"_$$STRING(RECORD))
18 QUIT $$DECODE^PRCUESIG(SIG,PERSON,CHECKSUM)
19ENCODE(LEVEL0,USERNUM,Y) ;Encode e signature for version 1 only
20 ;Parameter passing entry point
21 NEW RECORD,RECORD05,SIGBLOCK,CHECKSUM,OLDUSER
22 ;get record
23 S USERNUM=+USERNUM
24 S RECORD=$G(^PRCF(421.2,LEVEL0,0))
25 S RECORD05=$G(^PRCF(421.2,LEVEL0,.5))
26 I RECORD="" S Y=-1 QUIT ;-1 no transaction record
27 S OLDUSER=+$P(RECORD,"^",5)
28 I OLDUSER>0,+$P(RECORD05,"^",1)<1,$P(RECORD,"^",6)'="" S Y=-4 QUIT ;-4 cannot re-sign record with version <1
29 I OLDUSER>0 S USERNUM=OLDUSER
30 I USERNUM=0 S Y=-3 QUIT ;-3 no usernumber for filing
31 S SIGBLOCK=$P(RECORD05,"^",2)
32 I SIGBLOCK="" S SIGBLOCK=$P($G(^VA(200,USERNUM,20)),"^",2)
33 I SIGBLOCK="" S Y=-2 QUIT ;-2 = no signature block in file 200
34 I OLDUSER=0 S $P(RECORD,"^",5)=USERNUM
35 S:$P(RECORD,"^",10)="" $P(RECORD,"^",10)=$$NOW^PRCUESIG
36 S CHECKSUM=$$SUM^PRCUESIG(LEVEL0_"^"_$$STRING(RECORD))
37 S $P(RECORD,"^",6)=$$ENCODE^PRCUESIG(SIGBLOCK,USERNUM,CHECKSUM)
38 S $P(RECORD05,"^",1,2)="1^"_SIGBLOCK
39 S ^PRCF(421.2,LEVEL0,0)=RECORD
40 S ^PRCF(421.2,LEVEL0,.5)=RECORD05
41 S Y=1 QUIT
42REMOVE(LEVEL0) ;Entry point to remove e signature from record
43 ;NOT an extrinsic function
44 NEW RECORD,RECORD05
45 S RECORD=$G(^PRCF(421.2,LEVEL0,0))
46 S RECORD05=$G(^PRCF(421.2,LEVEL0,.5))
47 S $P(RECORD,"^",5,6)="^"
48 S $P(RECORD,"^",10)=""
49 S $P(RECORD05,"^",2)=""
50 S ^PRCF(421.2,LEVEL0,0)=RECORD
51 S ^PRCF(421.2,LEVEL0,.5)=RECORD05
52 QUIT
53VERIFY(LEVEL0) ;extrinsic function to verify version 1 signature. Returns 1 if valid, 0 if not valid
54 NEW RECORD05,VERSION,SIGBLOCK
55 ;get record variables
56 S RECORD05=$G(^PRCF(421.2,LEVEL0,.5))
57 S VERSION=$P(RECORD05,"^",1),SIGBLOCK=$P(RECORD05,"^",2)
58 I VERSION_SIGBLOCK="" QUIT 1
59 QUIT ($$DECODE(LEVEL0,TRANS)=SIGBLOCK)
60STRING(X) ;Build String of critical fields
61 NEW RECORD
62 Q $P(X,"^",1)_"^"_$P(X,"^",10)
Note: See TracBrowser for help on using the repository browser.