Examples of InternalClientConnection


Examples of org.nasutekds.server.protocols.internal.InternalClientConnection

            = new LinkedHashSet<String>();
    requestedAttributes.add(
            attrPublicKeyCertificate.getNameOrOID() + ";binary");

    // Retrieve the certificate from the entry.
    final InternalClientConnection icc
            = InternalClientConnection.getRootConnection();
    byte[] certificate = null;
    try {
      for (int i = 0; i < 2; ++i) {
        try {
          /* If the entry does not exist in the instance's truststore
             backend, add it using a special object class that induces
             the backend to create the public-key certificate
             attribute, then repeat the search. */
          InternalSearchOperation searchOp = icc.processSearch(
                  entryDN,
                  SearchScope.BASE_OBJECT,
                  DereferencePolicy.NEVER_DEREF_ALIASES,
                  /* size limit */ 0, /* time limit */ 0,
                  /* types only */ false,
                  SearchFilter.createFilterFromString(
                          FILTER_OC_INSTANCE_KEY),
                  requestedAttributes);
          for (Entry e : searchOp.getSearchEntries()) {
            /* attribute ds-cfg-public-key-certificate is a MUST in
               the schema */
            certificate = e.getAttributeValue(
                  attrPublicKeyCertificate, BinarySyntax.DECODER).toByteArray();
          }
          break;
        }
        catch (DirectoryException ex) {
          if (0 == i
                  && ResultCode.NO_SUCH_OBJECT == ex.getResultCode()){
            final Entry entry = new Entry(entryDN, null, null, null);
            entry.addObjectClass(DirectoryServer.getTopObjectClass());
            entry.addObjectClass(ocCertRequest);
            AddOperation addOperation = icc.processAdd(entry.getDN(),
                    entry.getObjectClasses(),
                    entry.getUserAttributes(),
                    entry.getOperationalAttributes());
            if (ResultCode.SUCCESS != addOperation.getResultCode()) {
              throw new DirectoryException(
View Full Code Here

Examples of org.nasutekds.server.protocols.internal.InternalClientConnection

    final LinkedHashSet<String> requestedAttributes
            = new LinkedHashSet<String>();
    requestedAttributes.add("dn");

    // Check for the entry. If it does not exist, create it.
    final InternalClientConnection icc
            = InternalClientConnection.getRootConnection();
    try {
      final InternalSearchOperation searchOp
              = icc.processSearch( entryDN, SearchScope.BASE_OBJECT,
              DereferencePolicy.NEVER_DEREF_ALIASES,
              /* size limit */ 0, /* time limit */ 0,
              /* types only */ false,
              SearchFilter.createFilterFromString(
                      FILTER_OC_INSTANCE_KEY),
              requestedAttributes);
      if (0 == searchOp.getSearchEntries().size()) {
        final Entry entry = new Entry(entryDN, null, null, null);
        entry.addObjectClass(DirectoryServer.getTopObjectClass());
        entry.addObjectClass(ocInstanceKey);

        // Add the key ID attribute.
        final Attribute keyIDAttr = Attributes.create(attrKeyID,
            distinguishedValue);
        entry.addAttribute(keyIDAttr, new ArrayList<AttributeValue>(0));

        // Add the public key certificate attribute.
        AttributeBuilder builder = new AttributeBuilder(
            attrPublicKeyCertificate);
        builder.setOption("binary");
        builder.add(AttributeValues.create(
            attrPublicKeyCertificate,
            ByteString.wrap(instanceKeyCertificate)));
        final Attribute certificateAttr = builder.toAttribute();
        entry.addAttribute(certificateAttr,
                new ArrayList<AttributeValue>(0));

        AddOperation addOperation = icc.processAdd(entry.getDN(),
                entry.getObjectClasses(),
                entry.getUserAttributes(),
                entry.getOperationalAttributes());
        if (ResultCode.SUCCESS != addOperation.getResultCode()) {
          throw new DirectoryException(
View Full Code Here

Examples of org.nasutekds.server.protocols.internal.InternalClientConnection

              = new LinkedHashSet<String>();
      requestedAttributes.add(attrKeyID.getNameOrOID());
      requestedAttributes.add(
              attrPublicKeyCertificate.getNameOrOID() + ";binary");
      // Invoke the search operation.
      final InternalClientConnection icc
              = InternalClientConnection.getRootConnection();
      InternalSearchOperation searchOp = icc.processSearch(
              instanceKeysDN,
              SearchScope.SINGLE_LEVEL,
              DereferencePolicy.NEVER_DEREF_ALIASES,
              /* size limit */ 0, /* time limit */ 0,
              /* types only */ false,
View Full Code Here

Examples of org.nasutekds.server.protocols.internal.InternalClientConnection

   * @return The symmetric key value for this server, or null if
   *         none could be obtained.
   */
  private String getSymmetricKey(List<String> symmetricKeys)
  {
    InternalClientConnection internalConnection =
         InternalClientConnection.getRootConnection();
    for (String symmetricKey : symmetricKeys)
    {
      try
      {
        // Get the server instance key ID from the symmetric key.
        String[] elements = symmetricKey.split(":", 0);
        String instanceKeyID = elements[0];

        // Find the server entry from the instance key ID.
        String filter = "(" +
             ConfigConstants.ATTR_CRYPTO_KEY_ID + "=" +
             instanceKeyID + ")";
        InternalSearchOperation internalSearch =
             internalConnection.processSearch(
                  serversDN, SearchScope.SUBORDINATE_SUBTREE,
                  SearchFilter.createFilterFromString(filter));
        if (internalSearch.getResultCode() != ResultCode.SUCCESS)
          continue;

View Full Code Here

Examples of org.nasutekds.server.protocols.internal.InternalClientConnection

      secretKey = decodeSymmetricKeyAttribute(symmetricKey);
      CipherKeyEntry.importCipherKeyEntry(this, keyID, transformation,
              secretKey, keyLengthBits, ivLengthBits, isCompromised);

      // Write the value to the entry.
      InternalClientConnection internalConnection =
              InternalClientConnection.getRootConnection();
      List<Modification> modifications =
              new ArrayList<Modification>(1);
      Attribute attribute = Attributes.create(
          ConfigConstants.ATTR_CRYPTO_SYMMETRIC_KEY, symmetricKey);
      modifications.add(
              new Modification(ModificationType.ADD, attribute,
                      false));
      ModifyOperation internalModify =
              internalConnection.processModify(entry.getDN(),
                      modifications);
      if (internalModify.getResultCode() != ResultCode.SUCCESS)
      {
        throw new CryptoManagerException(
                ERR_CRYPTOMGR_IMPORT_KEY_ENTRY_FAILED_TO_ADD_KEY.get(
View Full Code Here

Examples of org.nasutekds.server.protocols.internal.InternalClientConnection

        MacKeyEntry.importMacKeyEntry(this, keyID, algorithm,
                                      secretKey, keyLengthBits,
                                      isCompromised);

        // Write the value to the entry.
        InternalClientConnection internalConnection =
             InternalClientConnection.getRootConnection();
        List<Modification> modifications =
             new ArrayList<Modification>(1);
        Attribute attribute = Attributes.create(
            ConfigConstants.ATTR_CRYPTO_SYMMETRIC_KEY, symmetricKey);
        modifications.add(
             new Modification(ModificationType.ADD, attribute,
                              false));
        ModifyOperation internalModify =
             internalConnection.processModify(entry.getDN(),
                                              modifications);
        if (internalModify.getResultCode() != ResultCode.SUCCESS)
        {
          throw new CryptoManagerException(
               ERR_CRYPTOMGR_IMPORT_KEY_ENTRY_FAILED_TO_ADD_KEY.get(
View Full Code Here

Examples of org.nasutekds.server.protocols.internal.InternalClientConnection

      userAttrs.put(attrSymmetricKey, attrList);

      // Create the entry.
      Entry entry = new Entry(entryDN, ocMap, userAttrs, opAttrs);

      InternalClientConnection connection =
           InternalClientConnection.getRootConnection();
      AddOperation addOperation = connection.processAdd(entry);
      if (addOperation.getResultCode() != ResultCode.SUCCESS)
      {
        throw new CryptoManagerException(
                ERR_CRYPTOMGR_SYMMETRIC_KEY_ENTRY_ADD_FAILED.get(
                        entry.getDN().toString(),
View Full Code Here

Examples of org.nasutekds.server.protocols.internal.InternalClientConnection

   * all group instances that it may contain and register them with this group
   * manager.
   */
  public void performBackendInitializationProcessing(Backend backend)
  {
    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();

    LinkedList<Control> requestControls = new LinkedList<Control>();
    requestControls.add(new LDAPControl(OID_INTERNAL_GROUP_MEMBERSHIP_UPDATE,
                                    false));
    for (DN configEntryDN : groupImplementations.keySet())
    {
      SearchFilter filter;
      Group groupImplementation = groupImplementations.get(configEntryDN);
      try
      {
        filter = groupImplementation.getGroupDefinitionFilter();
        if (backend.getEntryCount() > 0 && ! backend.isIndexed(filter))
        {
          logError(WARN_GROUP_FILTER_NOT_INDEXED.get(String.valueOf(filter),
                        String.valueOf(configEntryDN), backend.getBackendID()));
        }
      }
      catch (Exception e)
      {
        if (debugEnabled())
        {
          TRACER.debugCaught(DebugLogLevel.ERROR, e);
        }

        // FIXME -- Is there anything that we need to do here?
        continue;
      }


      for (DN baseDN : backend.getBaseDNs())
      {
        try
        {
          if (! backend.entryExists(baseDN))
          {
            continue;
          }
        }
        catch (Exception e)
        {
          if (debugEnabled())
          {
            TRACER.debugCaught(DebugLogLevel.ERROR, e);
          }

          // FIXME -- Is there anything that we need to do here?
          continue;
        }


        InternalSearchOperation internalSearch =
             new InternalSearchOperation(conn, conn.nextOperationID(),
                                         conn.nextMessageID(), requestControls,
                                         baseDN,
                                         SearchScope.WHOLE_SUBTREE,
                                         DereferencePolicy.NEVER_DEREF_ALIASES,
                                         0, 0, false, filter, null, null);
        LocalBackendSearchOperation localSearch =
View Full Code Here

Examples of org.nasutekds.server.protocols.internal.InternalClientConnection

      }
    } else {
      parentDN = entryDN;
    }

    InternalClientConnection conn =
      InternalClientConnection.getRootConnection();

    AddOperation addOperation =
      conn.processAdd(entry.getDN(), entry.getObjectClasses(),
      entry.getUserAttributes(), entry.getOperationalAttributes());

    try {
      ec.addEntryNoCommit(entry, addOperation, txn);
      DN contextParentDN = context.getParentDN();
View Full Code Here

Examples of org.nasutekds.server.protocols.internal.InternalClientConnection

  }


  private void searchAdminSuffix()
  {
    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
    LinkedHashSet<String> attributes = new LinkedHashSet<String>(0);

    ArrayList<Control> controls = new ArrayList<Control>(0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.