1 package org.jacorb.security.sas; 2 3 22 23 import java.security.Provider ; 24 25 import org.ietf.jgss.GSSException ; 26 import org.ietf.jgss.GSSName ; 27 import org.ietf.jgss.Oid ; 28 29 import sun.security.jgss.spi.GSSContextSpi; 30 import sun.security.jgss.spi.GSSCredentialSpi; 31 import sun.security.jgss.spi.GSSNameSpi; 32 import sun.security.jgss.spi.MechanismFactory; 33 34 40 41 public final class GSSUPMechFactory 42 implements MechanismFactory 43 { 44 45 protected static Provider myProvider; 46 47 private Oid myMechOid; 48 private Oid [] nameTypes = 49 new Oid [] {GSSName.NT_EXPORT_NAME}; 50 51 public GSSUPMechFactory () 52 { 53 try 54 { 55 myMechOid = new Oid ("2.23.130.1.1.1"); 56 } 57 catch (GSSException e) 58 { 59 } 61 } 62 63 public Oid getMechanismOid() 64 { 65 return myMechOid; 66 } 67 68 public Provider getProvider() 69 { 70 return myProvider; 71 } 72 73 public Oid [] getNameTypes() 74 { 75 return nameTypes; 76 } 77 78 public GSSCredentialSpi getCredentialElement(GSSNameSpi name, int initLifetime, int acceptLifetime, int usage) throws GSSException 79 { 80 return new GSSUPCredentialSpi(myProvider, myMechOid, name, initLifetime, acceptLifetime, usage); 81 } 82 83 public GSSNameSpi getNameElement(String name, Oid nameTypeOid) throws GSSException 84 { 85 return getNameElement(name.getBytes(), nameTypeOid); 86 } 87 88 public GSSNameSpi getNameElement(byte[] name ,Oid nameTypeOid) throws GSSException 89 { 90 return new GSSUPNameSpi(myProvider, myMechOid, name, nameTypeOid); 91 } 92 93 public GSSContextSpi getMechanismContext(GSSNameSpi nameSpi, GSSCredentialSpi credSpi, int lifetime) throws GSSException 94 { 95 return new GSSUPContextSpi(myProvider, myMechOid, nameSpi, credSpi, lifetime); 96 } 97 98 public GSSContextSpi getMechanismContext(GSSCredentialSpi credSpi) throws GSSException 99 { 100 return new GSSUPContextSpi(credSpi.getProvider(), credSpi.getMechanism(), credSpi.getName(), credSpi, credSpi.getInitLifetime()); 101 } 102 103 public GSSContextSpi getMechanismContext(byte[] b1) throws GSSException 104 { 105 return null; 106 } 107 } 108 | Popular Tags |