source: FOIAVistA/tag/r/IFCAP-PRC-PRX--PRCA--PRCN/PRCFAES2.m@ 1742

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

initial load of FOIAVistA 6/30/08 version

File size: 2.5 KB
Line 
1PRCFAES2 ;WISC/LEM-ESIG MAINTENANCE ROUTINE ;5/20/93 9:29 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 9 (RERELEASE E SIG), 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,"^",3)
12 S PERSON=+$P(RECORD,"^",8)
13 I VERSION'="",VERSION'=1 Q ""
14 S SIG=$P(RECORD,"^",9)
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,"^",8)
28 I OLDUSER>0,+$P(RECORD05,"^",4)<1,$P(RECORD,"^",9)'="" 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,"^",4)
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,"^",8)=USERNUM
35 S:$P(RECORD,"^",7)="" $P(RECORD,"^",7)=$$NOW^PRCUESIG
36 S CHECKSUM=$$SUM^PRCUESIG(LEVEL0_"^"_$$STRING(RECORD))
37 S $P(RECORD,"^",9)=$$ENCODE^PRCUESIG(SIGBLOCK,USERNUM,CHECKSUM)
38 S $P(RECORD05,"^",3,4)="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,"^",7,9)="^^"
48 S $P(RECORD05,"^",4)=""
49 S ^PRCF(421.2,LEVEL0,0)=RECORD
50 S ^PRCF(421.2,LEVEL0,.5)=RECORD05
51 QUIT
52VERIFY(LEVEL0) ;extrinsic function to verify version 1 signature. Returns 1 if valid, 0 if not valid
53 NEW RECORD05,VERSION,SIGBLOCK
54 ;get record variables
55 S RECORD05=$G(^PRCF(421.2,LEVEL0,.5))
56 S VERSION=$P(RECORD05,"^",3),SIGBLOCK=$P(RECORD05,"^",4)
57 I VERSION_SIGBLOCK="" QUIT 1
58 QUIT ($$DECODE(LEVEL0)=SIGBLOCK)
59STRING(X) ;Build String of critical fields
60 NEW RECORD
61 Q $P(X,"^",1)_"^"_$P(X,"^",7)
Note: See TracBrowser for help on using the repository browser.