Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2005, 2008 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation /
 
 package org.eclipse.osgi.service.security;
 
A TrustEngine is used to establish the authenticity of a java.security.cert.Certificate chain.

Clients may implement this interface.

Since:
3.4
 
 public abstract class TrustEngine {
Returns the certificate trust anchor contained in the specified chain which was used to establish the authenticity of the chain. If no trust anchor is found in the chain then null is returned.

Parameters:
chain - a complete or incomplete certificate chain, implementations *MAY* complete chains
Returns:
- the certificate trust anchor used to establish authenticity
Throws:
java.io.IOException if there is a problem connecting to the backing store
 
 	public abstract Certificate findTrustAnchor(Certificate[] chainthrows IOException;

Add a trust anchor point to this trust engine. A trust anchor implies that a certificate, and any of its children, is to be considered trusted. If null is used as the alias then an alias will be generated based on the trust anchor certificate.

Parameters:
anchor - the certificate to add as an anchor point
alias - a unique and human-readable 'friendly name' which can be used to reference the certificate. A null value may be used.
Returns:
the alias used to store the entry
Throws:
java.io.IOException if there is a problem connecting to the backing store
java.security.GeneralSecurityException if there is a certificate problem
java.lang.IllegalArgumentException if the alias or anchor already exist in this trust engine
 
 		String storedAlias = doAddTrustAnchor(anchoralias);
 		TrustEngineListener listener = TrustEngineListener.getInstance();
 		if (listener != null)
 			listener.addedTrustAnchor(anchor);
 		return storedAlias;
 	}

Add a trust anchor point to this trust engine. A trust anchor implies that a certificate, and any of its children, is to be considered trusted. If null is used as the alias then an alias will be generated based on the trust anchor certificate.

Parameters:
anchor - the certificate to add as an anchor point
alias - a unique and human-readable 'friendly name' which can be used to reference the certificate. A null value may be used.
Returns:
the alias used to store the entry
Throws:
java.io.IOException if there is a problem connecting to the backing store
java.security.GeneralSecurityException if there is a certificate problem
java.lang.IllegalArgumentException if the alias or anchor already exist in this trust engine
 
 	protected abstract String doAddTrustAnchor(Certificate anchorString aliasthrows IOExceptionGeneralSecurityException;

Remove a trust anchor point from the engine, based on the certificate itself.

Parameters:
anchor - the certificate to be removed
Throws:
java.io.IOException if there is a problem connecting to the backing store
java.security.GeneralSecurityException if there is a certificate problem
 
 	public final void removeTrustAnchor(Certificate anchorthrows IOExceptionGeneralSecurityException {
 		TrustEngineListener listener = TrustEngineListener.getInstance();
 		if (listener != null)
 			listener.removedTrustAnchor(anchor);
 	}

Remove a trust anchor point from the engine, based on the certificate itself.

Parameters:
anchor - the certificate to be removed
Throws:
java.io.IOException if there is a problem connecting to the backing store
java.security.GeneralSecurityException if there is a certificate problem
 
 	protected abstract void doRemoveTrustAnchor(Certificate anchorthrows IOExceptionGeneralSecurityException;

Remove a trust anchor point from the engine, based on the human readable "friendly name"

Parameters:
alias - the name of the trust anchor
Throws:
java.io.IOException if there is a problem connecting to the backing store
java.security.GeneralSecurityException if there is a certificate problem
 
 	public void removeTrustAnchor(String aliasthrows IOExceptionGeneralSecurityException {
 		Certificate existing = getTrustAnchor(alias);
		if (existing != null) {
			TrustEngineListener listener = TrustEngineListener.getInstance();
			if (listener != null)
				listener.removedTrustAnchor(existing);
		}
	}

Remove a trust anchor point from the engine, based on the human readable "friendly name"

Parameters:
alias - the name of the trust anchor
Throws:
java.io.IOException if there is a problem connecting to the backing store
java.security.GeneralSecurityException if there is a certificate problem
	protected abstract void doRemoveTrustAnchor(String aliasthrows IOExceptionGeneralSecurityException;

Return the certificate associated with the unique "friendly name" in the engine.

Parameters:
alias - the friendly name
Returns:
the associated trust anchor
Throws:
java.io.IOException if there is a problem connecting to the backing store
java.security.GeneralSecurityException if there is a certificate problem
Return the list of friendly name aliases for the TrustAnchors installed in the engine.

Returns:
string[] - the list of friendly name aliases
Throws:
java.io.IOException if there is a problem connecting to the backing store
java.security.GeneralSecurityException if there is a certificate problem
	public abstract String[] getAliases() throws IOExceptionGeneralSecurityException;

Return a value indicate whether this trust engine is read-only.

Returns:
true if this trust engine is read-only false otherwise.
	public abstract boolean isReadOnly();

Return a representation string of this trust engine

Returns:
a string
	public abstract String getName();
New to GrepCode? Check out our FAQ X