code: public void set(String name, Object obj)
      throws CertificateException, IOException {
          // check if immutable
          if (readOnly)
              throw new CertificateException("cannot over-write existing"
                                             + " certificate");
  
          X509AttributeName attr = new X509AttributeName(name);
          String id = attr.getPrefix();
          if (!(id.equalsIgnoreCase(NAME))) {
              throw new CertificateException("Invalid root of attribute name,"
                             + " expected [" + NAME + "], received " + id);
          }
          attr = new X509AttributeName(attr.getSuffix());
          id = attr.getPrefix();
  
          if (id.equalsIgnoreCase(INFO)) {
              if (attr.getSuffix() == null) {
                  if (!(obj instanceof X509CertInfo)) {
                      throw new CertificateException("Attribute value should"
                                      + " be of type X509CertInfo.");
                  }
                  info = (X509CertInfo)obj;
                  signedCert = null;  //reset this as certificate data has changed
              } else {
                  info.set(attr.getSuffix(), obj);
                  signedCert = null;  //reset this as certificate data has changed
              }
          } else {
              throw new CertificateException("Attribute name not recognized or " +
                                "set() not allowed for the same: " + id);
          }
      }
docs: Set the requested attribute in the certificate.
  
  @param name the name of the attribute.
  @param obj the value of the attribute.
  @exception CertificateException on invalid attribute identifier.
  @exception IOException on encoding error of attribute.