com.ibm.as400.access
Class AS400CertificateUserProfileUtil

java.lang.Object
  extended by com.ibm.as400.access.AS400CertificateUtil
      extended by com.ibm.as400.access.AS400CertificateUserProfileUtil
All Implemented Interfaces:
Serializable

public class AS400CertificateUserProfileUtil
extends AS400CertificateUtil
implements Serializable

The AS400CertificateUserProfileUtil class accesses certificates in an IBM i user profile object.

See Also:
Serialized Form

Field Summary
Modifier and Type Field and Description
 
Fields inherited from class com.ibm.as400.access.AS400CertificateUtil
DEFAULT_BUFFER_SIZE, MAX_BUFFER_SIZE, MIN_BUFFER_SIZE
 
Constructor Summary
Constructor and Description
AS400CertificateUserProfileUtil()
          Constructs an AS400CertificateUserProfileUtil object.
AS400CertificateUserProfileUtil(AS400 system, String path)
          Constructs an AS400CertificateUserProfileUtil object.
 
Method Summary
Modifier and Type Method and Description
 void addCertificate(byte[] certificate)
          Adds the certificate to the user profile.
 void deleteCertificate(byte[] certificate)
          Deletes the certificate from the user profile.
 void deleteCertificateByHandle(byte[] certificateHandle)
          Deletes the certificate matching the certificate handle from the user profile.
 String findCertificateUser(byte[] certificate)
          Returns the user profile name which contains the certificate.
 String findCertificateUserByHandle(byte[] certificateHandle)
          Returns the user profile which contains the certificate with the specified handle.
 int listCertificates(AS400CertificateAttribute[] certificateAttributes, String userSpaceName)
          List certificates which match the specified attributes.
 void setPath(String path)
          Sets the path for the user profile.
 
Methods inherited from class com.ibm.as400.access.AS400CertificateUtil
addAS400CertificateListener, addPropertyChangeListener, addVetoableChangeListener, getCertificateHandle, getCertificates, getFirstCertificates, getName, getNextCertificates, getObjectInfo, getPath, getSystem, removeAS400CertificateListener, removePropertyChangeListener, removeVetoableChangeListener, setObjectInfo, setSystem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AS400CertificateUserProfileUtil

public AS400CertificateUserProfileUtil()
Constructs an AS400CertificateUserProfileUtil object.


AS400CertificateUserProfileUtil

public AS400CertificateUserProfileUtil(AS400 system,
                                       String path)
Constructs an AS400CertificateUserProfileUtil object. If the user profile specified is not the user profile that is currently running, adding and deleting certificates require *SECADM special authority for the currently running user profile and *USE and *OBJMGT authorities to the target user profile.

Parameters:
system - The system on which the user profile exists.
path - The fully qualified integrated file system path name of the user profile, for example, "/QSYS.LIB/MYLIB.LIB/MYUSRPRF.USRPRF".
Method Detail

addCertificate

public void addCertificate(byte[] certificate)
                    throws AS400SecurityException,
                           ErrorCompletingRequestException,
                           ExtendedIOException,
                           InterruptedException,
                           IOException,
                           ObjectDoesNotExistException
Adds the certificate to the user profile. Throws an ExtendedIOException if the certificate is already a member of the user profile.

Specified by:
addCertificate in class AS400CertificateUtil
Parameters:
certificate - The complete ASN.1 X.509 certificate to be added to the user profile.
Throws:
AS400SecurityException - If a security or authority error occurs.
ErrorCompletingRequestException - If an error occurs before the request is completed.
ExtendedIllegalArgumentException - If invalid certificate.
ExtendedIOException - If certificate already added and other IBM i certificate access errors.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.
ObjectDoesNotExistException - If the IBM i object does not exist.

deleteCertificate

public void deleteCertificate(byte[] certificate)
                       throws AS400SecurityException,
                              ErrorCompletingRequestException,
                              ExtendedIOException,
                              InterruptedException,
                              IOException,
                              ObjectDoesNotExistException
Deletes the certificate from the user profile. Throws an ExtendedIOException if the certificate is not present in the user profile.

Specified by:
deleteCertificate in class AS400CertificateUtil
Parameters:
certificate - The complete ASN.1 X.509 certificate to be deleted from the user profile.
Throws:
AS400SecurityException - If a security or authority error occurs.
ErrorCompletingRequestException - If an error occurs before the request is completed.
ExtendedIllegalArgumentException - If invalid certificate.
ExtendedIOException - If certificate not found and other IBM i certificate access errors.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.
ObjectDoesNotExistException - If the IBM i object does not exist.

deleteCertificateByHandle

public void deleteCertificateByHandle(byte[] certificateHandle)
                               throws AS400SecurityException,
                                      ErrorCompletingRequestException,
                                      ExtendedIOException,
                                      InterruptedException,
                                      IOException,
                                      ObjectDoesNotExistException
Deletes the certificate matching the certificate handle from the user profile. Throws ExtendedIOException if the certificate is not present in the user profile.

Specified by:
deleteCertificateByHandle in class AS400CertificateUtil
Parameters:
certificateHandle - The AS400Certificate handle of the certificate to be deleted from the user profile.
Throws:
AS400SecurityException - If a security or authority error occurs.
ErrorCompletingRequestException - If an error occurs before the request is completed.
ExtendedIllegalArgumentException - If invalid certificate handle.
ExtendedIOException - If certificate not found and other IBM i certificate access errors.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.
ObjectDoesNotExistException - If the IBM i object does not exist.

findCertificateUser

public String findCertificateUser(byte[] certificate)
                           throws AS400SecurityException,
                                  ErrorCompletingRequestException,
                                  ExtendedIOException,
                                  InterruptedException,
                                  IOException,
                                  ObjectDoesNotExistException
Returns the user profile name which contains the certificate. Throws ExtendedIOException if the certificate is not registered to any user profile on the system.

Parameters:
certificate - The ASN.1 X.509 encoded certificate to search for in the user profile.
Returns:
The user profile name containing the certificate.
Throws:
AS400SecurityException - If a security or authority error occurs.
ErrorCompletingRequestException - If an error occurs before the request is completed.
ExtendedIllegalArgumentException - If invalid certificate.
ExtendedIOException - If certificate not found and other IBM i certificate access errors.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.
ObjectDoesNotExistException - If the IBM i object does not exist.

findCertificateUserByHandle

public String findCertificateUserByHandle(byte[] certificateHandle)
                                   throws AS400SecurityException,
                                          ErrorCompletingRequestException,
                                          ExtendedIOException,
                                          InterruptedException,
                                          IOException,
                                          ObjectDoesNotExistException
Returns the user profile which contains the certificate with the specified handle. Throws ExtendedIOException if the certificate is not registered to any user profile on the system.

Parameters:
certificateHandle - The AS400Certificate handle the certificate should match.
Returns:
The user profile name containing the certificate.
Throws:
AS400SecurityException - If a security or authority error occurs.
ErrorCompletingRequestException - If an error occurs before the request is completed.
ExtendedIllegalArgumentException - If invalid certificate handle.
ExtendedIOException - If certificate not found and other IBM i certificate access errors.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.
ObjectDoesNotExistException - If the IBM i object does not exist.

listCertificates

public int listCertificates(AS400CertificateAttribute[] certificateAttributes,
                            String userSpaceName)
                     throws AS400SecurityException,
                            ErrorCompletingRequestException,
                            ExtendedIOException,
                            InterruptedException,
                            IOException,
                            ObjectDoesNotExistException
List certificates which match the specified attributes. The certificates are copied from the user profile to the specified user space. The user profile is not locked during the listCertificates operation. Certificates are stored into the user space with CERT0100 format. See the IBM i QsyListVldlCertificates (QSYLSTVC) and QsyListUserCertificates (QSYLSTUC) API's for further information.

Specified by:
listCertificates in class AS400CertificateUtil
Parameters:
certificateAttributes - The list of attributes the certificate should match. A value of null places all certificates from user profile into the user space. An empty String or empty byte array search attribute will search for certificates that do not have this attribute. For example, SUBJECT_ORGANIZATION = new String("") will search for certificates without the subject organization field. Null search attributes are ignored.
userSpaceName - The fully qualified integrated file system path name of the user space to put the list results, for example, /QSYS.LIB/MYLIB.LIB/MYUSRSPC.USRSPC. The 10 character IBM i library of the user space may also be specified as %CURLIB% or %LIBL%. See QSYSObjectPathName
Returns:
The number of certificates found matching the search attributes.
Throws:
AS400SecurityException - If a security or authority error occurs.
ErrorCompletingRequestException - If an error occurs before the request is completed.
ExtendedIllegalArgumentException - If invalid search attributes or input parameter.
ExtendedIOException - If IBM i certificate access error.
InterruptedException - If this thread is interrupted.
IOException - If an error occurs while communicating with the system.
ObjectDoesNotExistException - If the IBM i object does not exist.

setPath

public void setPath(String path)
             throws PropertyVetoException
Sets the path for the user profile.

Specified by:
setPath in class AS400CertificateUtil
Parameters:
path - The fully qualified integrated file system path name of the user profile.
Throws:
PropertyVetoException - If the change is vetoed.