Package org.globus.gsi.gssapi

# Class GlobusGSSCredentialImpl

java.lang.Object
org.globus.gsi.gssapi.GlobusGSSCredentialImpl

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `ExtendedGSSCredential`, `GSSCredential`

public class GlobusGSSCredentialImpl extends Object implements ExtendedGSSCredential, Serializable
An implementation of `GlobusGSSCredential`.

See Also:
  - Serialized Form

## Field Summary

### Fields inherited from interface org.gridforum.jgss.ExtendedGSSCredential

`IMPEXP_MECH_SPECIFIC, IMPEXP_OPAQUE`

### Fields inherited from interface org.ietf.jgss.GSSCredential

`ACCEPT_ONLY, DEFAULT_LIFETIME, INDEFINITE_LIFETIME, INITIATE_AND_ACCEPT, INITIATE_ONLY`

## Constructor Summary

Constructors
Constructor
Description
`GlobusGSSCredentialImpl()`
Creates anonymous credential.
`GlobusGSSCredentialImpl(X509Credential cred, int usage)`
Creates regular credential from specified X509Credential object.

## Method Summary

Modifier and Type
Method
Description
`void`
`add(GSSName aName, int initLifetime, int acceptLifetime, Oid mech, int usage)`
Currently not implemented.
`void`
`dispose()`
`boolean`
`equals(Object obj)`
`byte[]`
`export(int option)`
Exports this credential so that another process might import it.
`byte[]`
`export(int option, Oid mech)`
Exports this credential so that another process might import it.
`X509Certificate[]`
`getCertificateChain()`
Returns certificate chain of this credential (if any).
`Oid[]`
`getMechs()`
`GSSName`
`getName()`
`GSSName`
`getName(Oid mech)`
`PrivateKey`
`getPrivateKey()`
Returns the private key of this credential (if any).
`int`
`getRemainingAcceptLifetime(Oid mech)`
`int`
`getRemainingInitLifetime(Oid mech)`
`int`
`getRemainingLifetime()`
`int`
`getUsage()`
`int`
`getUsage(Oid mech)`
`X509Credential`
`getX509Credential()`
Returns actual X509Credential object represented by this credential (if any).
`int`
`hashCode()`
`Object`
`inquireByOid(Oid oid)`
Retrieves arbitrary data about this credential.

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### GlobusGSSCredentialImpl

public GlobusGSSCredentialImpl()
Creates anonymous credential.

### GlobusGSSCredentialImpl

public GlobusGSSCredentialImpl(X509Credential cred, int usage) throws GSSException
Creates regular credential from specified X509Credential object.

Parameters:
  `cred` - the credential
  `usage` - credential usage
Throws:
  `GSSException`

## Method Details

### hashCode

public int hashCode()

Specified by:
  `hashCode` in interface `GSSCredential`
Overrides:
  `hashCode` in class `Object`

### equals

public boolean equals(Object obj)

Specified by:
  `equals` in interface `GSSCredential`
Overrides:
  `equals` in class `Object`

### dispose

public void dispose() throws GSSException

Specified by:
  `dispose` in interface `GSSCredential`
Throws:
  `GSSException`

### getName

public GSSName getName() throws GSSException

Specified by:
  `getName` in interface `GSSCredential`
Throws:
  `GSSException`

### getName

public GSSName getName(Oid mech) throws GSSException

Specified by:
  `getName` in interface `GSSCredential`
Throws:
  `GSSException`

### add

public void add(GSSName aName, int initLifetime, int acceptLifetime, Oid mech, int usage) throws GSSException
Currently not implemented.

Specified by:
  `add` in interface `GSSCredential`
Throws:
  `GSSException`

### getUsage

public int getUsage() throws GSSException

Specified by:
  `getUsage` in interface `GSSCredential`
Throws:
  `GSSException`

### getUsage

public int getUsage(Oid mech) throws GSSException

Specified by:
  `getUsage` in interface `GSSCredential`
Throws:
  `GSSException`

### getRemainingLifetime

public int getRemainingLifetime() throws GSSException

Specified by:
  `getRemainingLifetime` in interface `GSSCredential`
Throws:
  `GSSException`

### getRemainingInitLifetime

public int getRemainingInitLifetime(Oid mech) throws GSSException

Specified by:
  `getRemainingInitLifetime` in interface `GSSCredential`
Throws:
  `GSSException`

### getRemainingAcceptLifetime

public int getRemainingAcceptLifetime(Oid mech) throws GSSException

Specified by:
  `getRemainingAcceptLifetime` in interface `GSSCredential`
Throws:
  `GSSException`

### getMechs

public Oid[] getMechs() throws GSSException

Specified by:
  `getMechs` in interface `GSSCredential`
Throws:
  `GSSException`

### export

public byte[] export(int option) throws GSSException
Description copied from interface: `ExtendedGSSCredential`
Exports this credential so that another process might import it. The exported credential might be imported again using the `ExtendedGSSManager.createCredential` method.

Specified by:
  `export` in interface `ExtendedGSSCredential`
Parameters:
  `option` - The export type. If set to `ExtendedGSSCredential.IMPEXP_OPAQUE` exported buffer is an opaque buffer suitable for storage in memory or on disk or passing to another process. If set to `ExtendedGSSCredential.IMPEXP_MECH_SPECIFIC` exported buffer is a buffer filled with mechanism-specific information that the calling application can use to pass the credential to another process that is not written to the GSS-API.
Returns:
  The buffer containing the credential
Throws:
  `GSSException` - containing the following major error codes: `GSSException.CREDENTIAL_EXPIRED, GSSException.UNAVAILABLE, GSSException.FAILURE`

### export

public byte[] export(int option, Oid mech) throws GSSException
Description copied from interface: `ExtendedGSSCredential`
Exports this credential so that another process might import it. The exported credential might be imported again using the `ExtendedGSSManager.createCredential` method.

Specified by:
  `export` in interface `ExtendedGSSCredential`
Parameters:
  `option` - The export type. If set to `ExtendedGSSCredential.IMPEXP_OPAQUE` exported buffer is an opaque buffer suitable for storage in memory or on disk or passing to another process. If set to `ExtendedGSSCredential.IMPEXP_MECH_SPECIFIC` exported buffer is a buffer filled with mechanism-specific information that the calling application can use to pass the credential to another process that is not written to the GSS-API.
  `mech` - Desired mechanism for exported credential, may be null to indicate system default.
Returns:
  The buffer containing the credential
Throws:
  `GSSException` - containing the following major error codes: `GSSException.CREDENTIAL_EXPIRED, GSSException.UNAVAILABLE, GSSException.BAD_MECH, GSSException.FAILURE`

### inquireByOid

public Object inquireByOid(Oid oid) throws GSSException
Retrieves arbitrary data about this credential. Currently supported oid:

- `GSSConstants.X509_CERT_CHAIN` returns certificate chain of this credential (`X509Certificate[]`).

Specified by:
  `inquireByOid` in interface `ExtendedGSSCredential`
Parameters:
  `oid` - the oid of the information desired.
Returns:
  the information desired. Might be null.
Throws:
  `GSSException` - containing the following major error codes: `GSSException.FAILURE`

### getX509Credential

public X509Credential getX509Credential()
Returns actual X509Credential object represented by this credential (if any).

Returns:
  The credential object. Might be null if this is an anonymous credential.

### getPrivateKey

public PrivateKey getPrivateKey() throws GSSException
Returns the private key of this credential (if any).

Returns:
  The private key. Might be null if this is an anonymous credential.
Throws:
  `GSSException`

### getCertificateChain

public X509Certificate[] getCertificateChain()
Returns certificate chain of this credential (if any).

Returns:
  The certificate chain. Might be null if this is an anonymous credential.