Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XOBWSSL

XOBWSSL.m

Go to the documentation of this file.
  1. XOBWSSL ;ALB/MJK - HWSC :: SSL Integration Tools ; 09/13/10 4:00pm
  1. ;;1.0;HwscWebServiceClient;;September 13, 2010;Build 31
  1. ;
  1. QUIT
  1. ;
  1. CHKNAME(XOBCFGN) ; -- match configuration name / used by input transform (18.12 : 3.02)
  1. QUIT:$$CACH2008() 1 ; skip match checking if Cache 2008/higher, can't check oustide %SYS
  1. NEW MATCH,STATUS,RS,MORE
  1. SET MATCH=0
  1. SET RS=##class(%ResultSet).%New("%Net.SSL.Configuration:ListNames")
  1. IF $system.Status.IsError(RS.Execute()) GOTO CHKNAMEQ
  1. ; -- see if there is a match
  1. FOR SET MORE=RS.Next(.STATUS) QUIT:'MORE!($system.Status.IsError(STATUS)) DO QUIT:MATCH
  1. . IF XOBCFGN=$GET(RS.Data("Name")) SET MATCH=1 QUIT
  1. CHKNAMEQ ; -- check name quit point
  1. QUIT MATCH
  1. ;
  1. DISPLAY ; -- display list of SSL configuration names / used by XECUTABLE HELP (18.12 :3.02)
  1. QUIT:$$CACH2008() ; skip display if Cache 2008/higher, can't check oustide %SYS
  1. NEW COUNT,RS,STATUS
  1. SET COUNT=0
  1. DO EN^DDIOL("Possible SSL configurations are the following:")
  1. SET RS=##class(%ResultSet).%New("%Net.SSL.Configuration:ListNames")
  1. IF $system.Status.IsError(RS.Execute()) GOTO DISPLAYQ
  1. ; -- display the names
  1. FOR SET MORE=RS.Next(.STATUS) QUIT:'MORE!($system.Status.IsError(STATUS)) DO
  1. . DO EN^DDIOL("- "_$GET(RS.Data("Name")),"","!?5")
  1. . SET COUNT=COUNT+1
  1. DISPLAYQ ; -- display list quit point
  1. IF COUNT=0 DO EN^DDIOL("<No SSL configurations defined>","","!?5")
  1. QUIT
  1. ;
  1. GETCFG(XOBCFGN) ; -- get %Net.SSL.Configuration instance
  1. NEW STATUS,RS,MORE,CFG
  1. SET CFG=""
  1. SET RS=##class(%ResultSet).%New("%Net.SSL.Configuration:Extent")
  1. IF $system.Status.IsError(RS.Execute()) GOTO GETCFGQ
  1. ; -- see if there is a match
  1. FOR SET MORE=RS.Next(.STATUS) QUIT:'MORE!($system.Status.IsError(STATUS)) DO QUIT:CFG]""
  1. . SET CFG=##class(%Net.SSL.Configuration).%OpenId(RS.Data("ID"))
  1. . IF XOBCFGN=CFG.Name QUIT
  1. . SET CFG=""
  1. GETCFGQ ; -- get SSL config instance exit point
  1. QUIT CFG
  1. ;
  1. SHOW(XOBCFGN) ; -- simple display of SSL Configuration
  1. QUIT:$$CACH2008() ; skip if Cache 2008/higher, can't check oustide %SYS
  1. NEW CFG
  1. SET CFG=$$GETCFG(XOBCFGN)
  1. IF CFG="" GOTO SHOWQ
  1. WRITE !,"SSL Configuration Name: ",!?5," > ",CFG.Name
  1. WRITE !,"File containing X.509 certificate(s) of trusted CAs: ",!?5," > ",$$GETSTR(CFG.CAFile)
  1. WRITE !,"Directory containing file(s) with X.509 certificate(s) of trusted CA: ",!?5," > ",$$GETSTR(CFG.CAPath)
  1. WRITE !,"File containing this configuration's X.509 certificate: ",!?5," > ",$$GETSTR(CFG.CertificateFile)
  1. WRITE !,"Ciphersuites: ",!?5," > ",$$GETSTR(CFG.CipherList)
  1. WRITE !,"File containing this configuration's private key: ",!?5," > ",$$GETSTR(CFG.PrivateKeyFile)
  1. WRITE !,"Private key type: ",!?5," > ",$$GETSTR($SELECT(CFG.PrivateKeyType=1:"DSA",CFG.PrivateKeyType=2:"RSA",1:""))
  1. WRITE !,"Intended role for this configuration: ",!?5," > ",$$GETSTR($SELECT(CFG.Role=0:"client",CFG.Role=1:"server",1:""))
  1. WRITE !,"Peer certificate verification level: " DO
  1. . ; -- client role
  1. . IF CFG.Role=0 WRITE !?5," > ",$$GETSTR($SELECT(CFG.VerifyPeer=0:"none",CFG.VerifyPeer=1:"required",1:"")) QUIT
  1. . ; -- server role
  1. . IF CFG.Role=1 WRITE !?5," > ",$$GETSTR($SELECT(CFG.VerifyPeer=0:"none",CFG.VerifyPeer=1:"request",CFG.VerifyPeer=3:"required",1:"")) QUIT
  1. WRITE !,"Maximum number of CA certificates allowed in peer certificate chain: ",!?5," > ",$$GETSTR(CFG.VerifyDepth)
  1. SHOWQ ;
  1. QUIT
  1. ;
  1. GETSTR(STR) ;
  1. QUIT $SELECT(STR]"":STR,1:"<null>")
  1. ;
  1. CACH2008() ; quit 1 if OS is 2008 or higher
  1. NEW XOBVER
  1. SET XOBVER=$$VERSION^%ZOSV()
  1. IF +$P(XOBVER,".")>2007 QUIT 1
  1. QUIT 0