| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2007-2009 Sun Microsystems, Inc. |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.admin.ads; |
| | |
| | | |
| | | /* search for public-key certificate entry in ADS DIT */ |
| | | final String attrIDs[] = { "ds-cfg-key-id" }; |
| | | NamingEnumeration<SearchResult> results = null; |
| | | try |
| | | { |
| | | final NamingEnumeration<SearchResult> results = ctx.search( |
| | | ADSContext.getInstanceKeysContainerDN(), keyAttrs, attrIDs); |
| | | results = ctx.search(ADSContext.getInstanceKeysContainerDN(), keyAttrs, |
| | | attrIDs); |
| | | if (results.hasMore()) { |
| | | final Attribute keyIdAttr = |
| | | results.next().getAttributes().get(attrIDs[0]); |
| | |
| | | throw new ADSContextException( |
| | | ADSContextException.ErrorType.ERROR_UNEXPECTED, cme); |
| | | } |
| | | finally |
| | | { |
| | | handleCloseNamingEnumeration(results); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | /* search for public-key certificate entry in ADS DIT */ |
| | | final String attrIDs[] = { "ds-cfg-key-id" }; |
| | | NamingEnumeration<SearchResult> results = null; |
| | | try |
| | | { |
| | | final NamingEnumeration<SearchResult> results = ctx.search( |
| | | results = ctx.search( |
| | | ADSContext.getInstanceKeysContainerDN(), keyAttrs, attrIDs); |
| | | if (results.hasMore()) { |
| | | SearchResult res = results.next(); |
| | |
| | | throw new ADSContextException( |
| | | ADSContextException.ErrorType.ERROR_UNEXPECTED, ne); |
| | | } |
| | | finally |
| | | { |
| | | handleCloseNamingEnumeration(results); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | return ConfigConstants.ATTR_CRYPTO_KEY_COMPROMISED_TIME; |
| | | } |
| | | |
| | | private void handleCloseNamingEnumeration(NamingEnumeration<?> ne) |
| | | throws ADSContextException |
| | | { |
| | | if (ne != null) |
| | | { |
| | | try |
| | | { |
| | | ne.close(); |
| | | } |
| | | catch (NamingException ex) |
| | | { |
| | | throw new ADSContextException( |
| | | ADSContextException.ErrorType.ERROR_UNEXPECTED, ex); |
| | | } |
| | | } |
| | | } |
| | | } |