(int secType)
| 25 | public SecurityClient() { super(secTypes); } |
| 26 | |
| 27 | public CSecurity GetCSecurity(int secType) |
| 28 | { |
| 29 | assert (CSecurity.upg != null); /* (upg == null) means bug in the viewer */ |
| 30 | assert (CSecurityTLS.msg != null); |
| 31 | |
| 32 | if (!IsSupported(secType)) |
| 33 | throw new Exception("Security type not supported"); |
| 34 | |
| 35 | switch (secType) { |
| 36 | case Security.secTypeNone: return (new CSecurityNone()); |
| 37 | case Security.secTypeVncAuth: return (new CSecurityVncAuth()); |
| 38 | case Security.secTypeVeNCrypt: return (new CSecurityVeNCrypt(this)); |
| 39 | case Security.secTypePlain: return (new CSecurityPlain()); |
| 40 | case Security.secTypeIdent: return (new CSecurityIdent()); |
| 41 | case Security.secTypeTLSNone: |
| 42 | return (new CSecurityStack(secTypeTLSNone, "TLS with no password", |
| 43 | new CSecurityTLS(true), null)); |
| 44 | case Security.secTypeTLSVnc: |
| 45 | return (new CSecurityStack(secTypeTLSVnc, "TLS with VNCAuth", |
| 46 | new CSecurityTLS(true), new CSecurityVncAuth())); |
| 47 | case Security.secTypeTLSPlain: |
| 48 | return (new CSecurityStack(secTypeTLSPlain, "TLS with Username/Password", |
| 49 | new CSecurityTLS(true), new CSecurityPlain())); |
| 50 | case Security.secTypeTLSIdent: |
| 51 | return (new CSecurityStack(secTypeTLSIdent, "TLS with username only", |
| 52 | new CSecurityTLS(true), new CSecurityIdent())); |
| 53 | case Security.secTypeX509None: |
| 54 | return (new CSecurityStack(secTypeX509None, "X509 with no password", |
| 55 | new CSecurityTLS(false), null)); |
| 56 | case Security.secTypeX509Vnc: |
| 57 | return (new CSecurityStack(secTypeX509Vnc, "X509 with VNCAuth", |
| 58 | new CSecurityTLS(false), new CSecurityVncAuth())); |
| 59 | case Security.secTypeX509Plain: |
| 60 | return (new CSecurityStack(secTypeX509Plain, "X509 with Username/Password", |
| 61 | new CSecurityTLS(false), new CSecurityPlain())); |
| 62 | case Security.secTypeX509Ident: |
| 63 | return (new CSecurityStack(secTypeX509Ident, "X509 with username only", |
| 64 | new CSecurityTLS(false), new CSecurityIdent())); |
| 65 | case Security.secTypeRA2: |
| 66 | return (new CSecurityRSAAES(secType, 128, true)); |
| 67 | case Security.secTypeRA2ne: |
| 68 | return (new CSecurityRSAAES(secType, 128, false)); |
| 69 | case Security.secTypeRA256: |
| 70 | return (new CSecurityRSAAES(secType, 256, true)); |
| 71 | case Security.secTypeRAne256: |
| 72 | return (new CSecurityRSAAES(secType, 256, false)); |
| 73 | default: |
| 74 | throw new Exception("Security type not supported"); |
| 75 | } |
| 76 | |
| 77 | } |
| 78 | |
| 79 | public static void setDefaults() |
| 80 | { |
no test coverage detected