[613] | 1 | VAQUTL2 ;ALB/JRP - UTILITY ROUTINES;30-APR-93
|
---|
| 2 | ;;1.5;PATIENT DATA EXCHANGE;**5**;NOV 17, 1993
|
---|
| 3 | NCRYPTON(RETMTHD) ;DETERMINE IF ENCRYPTION HAS BEEN TURNED ON
|
---|
| 4 | ;INPUT : RETMTHD - Flag indicating what to return
|
---|
| 5 | ; 0 = Return pointer to default encryption (default)
|
---|
| 6 | ; Return 0 if encryption is off
|
---|
| 7 | ; 1 = Return default encryption method
|
---|
| 8 | ; Return NULL if encryption is off
|
---|
| 9 | ; 2 = Return default encryption type
|
---|
| 10 | ; Return NULL if encryption is off
|
---|
| 11 | ;OUTPUT : See definition of RETMTHD
|
---|
| 12 | ;NOTES : Existance of VAQIGNC will be checked. If it exists and is
|
---|
| 13 | ; set to 1 encryption rules will be ignored.
|
---|
| 14 | ; : Encryption off will be returned on error
|
---|
| 15 | ;
|
---|
| 16 | ;CHECK INPUT
|
---|
| 17 | S RETMTHD=+$G(RETMTHD)
|
---|
| 18 | ;IGNORE FLAG TURNED ON
|
---|
| 19 | I (+$G(VAQIGNC)) Q $S(RETMTHD:"",1:0)
|
---|
| 20 | ;DECLARE VARIABLES
|
---|
| 21 | N X,Y
|
---|
| 22 | ;GET ENTRY IN PARAMETER FILE
|
---|
| 23 | S X=$O(^VAT(394.81,0))
|
---|
| 24 | ;COULDN'T FIND ENTRY IN PARAMETER - ASSUME ENCRYPTION IS OFF
|
---|
| 25 | Q:('X) $S(RETMTHD:"",1:0)
|
---|
| 26 | ;CHECK ENCRYPTION FLAG
|
---|
| 27 | S Y=$G(^VAT(394.81,X,"ECR"))
|
---|
| 28 | ;COULDN'T FIND ENCRYPTION FLAG - ASSUME ENCRYPTION IS OFF
|
---|
| 29 | Q:('Y) $S(RETMTHD:"",1:0)
|
---|
| 30 | ;ENCRYPTION TURNED ON
|
---|
| 31 | S X=+$P(Y,"^",2)
|
---|
| 32 | ;RETURN POINTER
|
---|
| 33 | Q:('RETMTHD) X
|
---|
| 34 | ;RETURN METHOD
|
---|
| 35 | Q:(RETMTHD=1) $$ENCMTHD(X,0)
|
---|
| 36 | ;RETURN TYPE
|
---|
| 37 | Q $P($G(^VAT(394.72,X,0)),"^",1)
|
---|
| 38 | ;
|
---|
| 39 | NCRPFLD(FILE,FIELD) ;DETERMINE IF A FILE/FIELD IS MARKED FOR ENCRYPTION
|
---|
| 40 | ;INPUT : FILE - File number
|
---|
| 41 | ; FIELD - Field number
|
---|
| 42 | ; VAQIGNC - Indicates if encryption rules should be ignored
|
---|
| 43 | ; If 1, ignore encryption rules (never encrypt)
|
---|
| 44 | ; If 0 or doesn't exist, obey encryption rules (default)
|
---|
| 45 | ;OUTPUT : 1 - File/field is marked for encryption
|
---|
| 46 | ; 0 - File/field not marked for encryption
|
---|
| 47 | ;
|
---|
| 48 | ;CHECK INPUT (ASSUME NOT MARKED ON ERROR)
|
---|
| 49 | S FILE=+$G(FILE)
|
---|
| 50 | S FIELD=+$G(FIELD)
|
---|
| 51 | Q:(('FILE)!('FIELD)) 0
|
---|
| 52 | ;IGNORE FLAG TURNED ON
|
---|
| 53 | Q:(+$G(VAQIGNC)) 0
|
---|
| 54 | ;NOT MARKED FOR ENCRYPTION
|
---|
| 55 | Q:('$D(^VAT(394.73,"A-NCRYPT",FILE,FIELD))) 0
|
---|
| 56 | ;MARKED
|
---|
| 57 | Q 1
|
---|
| 58 | ;
|
---|
| 59 | ENCMTHD(ENCPTR,DCRYPT) ;RETURN ENCRYPTION/DECRYPTION METHOD
|
---|
| 60 | ;INPUT : ENCPTR - Pointer to VAQ - ENCRYPTION METHOD file
|
---|
| 61 | ; DCRYPT - Indicates which method to return
|
---|
| 62 | ; If 0, return encryption method (default)
|
---|
| 63 | ; If 1, return decryption method
|
---|
| 64 | ;OUTPUT : The encryption/decryption method
|
---|
| 65 | ; NULL - Error
|
---|
| 66 | ;
|
---|
| 67 | ;CHECK INPUT
|
---|
| 68 | S ENCPTR=+$G(ENCPTR)
|
---|
| 69 | Q:('ENCPTR) ""
|
---|
| 70 | S DCRYPT=+$G(DCRYPT)
|
---|
| 71 | ;RETURN DECRYPTION METHOD
|
---|
| 72 | Q:(DCRYPT) $G(^VAT(394.72,ENCPTR,"DCR"))
|
---|
| 73 | ;RETURN ENCRYPTION METHOD
|
---|
| 74 | Q $G(^VAT(394.72,ENCPTR,"ECR"))
|
---|
| 75 | ;
|
---|
| 76 | DEFENC(DCRYPT,POINT) ;RETURN DEFAULT ENCRYPTION/DECRYPTION METHOD
|
---|
| 77 | ;INPUT : DCRYPT - Indicates which method to return
|
---|
| 78 | ; If 0, return encryption method (default)
|
---|
| 79 | ; If 1, return decryption method
|
---|
| 80 | ; POINT - Indicates if a pointer to VAQ - ENCRYPTION METHOD
|
---|
| 81 | ; file should be returned
|
---|
| 82 | ; If 0, return method (default)
|
---|
| 83 | ; If 1, return pointer to method
|
---|
| 84 | ;OUTPUT : If method is requested
|
---|
| 85 | ; The default encryption/decryption method
|
---|
| 86 | ; NULL - Error
|
---|
| 87 | ; If pointer is requested
|
---|
| 88 | ; Pointer to VAQ - ENCRYPTION METHOD
|
---|
| 89 | ; 0 - Error
|
---|
| 90 | ;
|
---|
| 91 | ;CHECK INPUT
|
---|
| 92 | S DCRYPT=+$G(DCRYPT)
|
---|
| 93 | S POINT=+$G(POINT)
|
---|
| 94 | ;DECLARE VARIABLES
|
---|
| 95 | N X,Y
|
---|
| 96 | ;GET ENTRY IN PARAMTER FILE
|
---|
| 97 | S X=$O(^VAT(394.81,0))
|
---|
| 98 | ;COULDN'T FIND ENTRY IN PARAMETER
|
---|
| 99 | Q:('X) ""
|
---|
| 100 | ;GET POINTER TO METHOD
|
---|
| 101 | S Y=$G(^VAT(394.81,X,"ECR"))
|
---|
| 102 | S Y=+$P(Y,"^",2)
|
---|
| 103 | ;POINTER TO METHOD DIDN'T EXIST
|
---|
| 104 | Q:('Y) $S(POINT:0,1:"")
|
---|
| 105 | ;RETURN POINTER
|
---|
| 106 | Q:(POINT) Y
|
---|
| 107 | ;RETURN METHOD
|
---|
| 108 | Q $$ENCMTHD(Y,DCRYPT)
|
---|