/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
/**
* Callback for acquiring a Public Key Infrastructure (PKI) private key
* and its corresponding certificate chain.
* This Callback may be used by client or server authentication modules
* to obtain private keys or private key references, from key
* repositories available to the CallbackHandler that processes the Callback.
*
* @version %I%, %G%
*/
/**
* Marker interface for private key request types.
*/
public static interface Request { };
/**
* Request type for private keys that are identified using an alias.
*/
/**
* Construct an AliasRequest with an alias.
*
* <p> The alias is used to directly identify the private key
* to be returned. The corresponding certificate chain for the
* private key is also returned.
*
* <p> If the alias is null,
* the handler of the callback relies on its own default.
*
* @param alias Name identifier for the private key, or null.
*/
}
/**
* Get the alias.
*
* @return The alias, or null.
*/
return alias;
}
}
/**
* Request type for private keys that are identified using a SubjectKeyID
*/
private byte[] id;
/**
* Construct a SubjectKeyIDRequest with an subjectKeyID.
*
* <p> The subjectKeyID is used to directly identify the private key
* to be returned. The corresponding certificate chain for the
* private key is also returned.
*
* <p> If the subjectKeyID is null,
* the handler of the callback relies on its own default.
*
* @param subjectKeyID Identifier for the private key, or null.
*/
if (subjectKeyID != null) {
}
}
/**
* Get the subjectKeyID.
*
* @return The subjectKeyID, or null.
*/
public byte[] getSubjectKeyID() {
return id;
}
}
/**
* Request type for private keys that are identified using an
*/
/**
*
* public key certificate. The corresponding private key
* is returned in the callback. The corresponding certificate chain
* for the private key is also returned.
*
* If the issuer/serialNumber parameters are null,
* the handler of the callback relies on its own defaults.
*
* @param issuer The X500Principal name of the certificate issuer,
* or null.
*
* @param serialNumber The serial number of the certificate,
* or null.
*/
this.serialNum = serialNumber;
}
/**
* Get the issuer.
*
* @return The issuer, or null.
*/
return issuer;
}
/**
* Get the serial number.
*
* @return The serial number, or null.
*/
return serialNum;
}
}
/**
* Request type for private keys that are identified using a
* certificate digest or thumbprint.
*/
private byte[] digest;
/**
* Constructs a DigestRequest with a digest value and algorithm
* identifier.
*
* <p> The digest of the certificate whose private key is returned
* must match the provided digest. The certificate digest is computed
* by applying the specified algorithm to the bytes of the certificate.
* For example:
* <code>
* MessageDigest.getInstance(algorithm).digest(cert.getEncoded())
</code>. The corresponding certificate chain for the private key is
* also returned.
*
* If the digest or algorithm parameters are null,
* the handler of the callback relies on its own defaults.
*
* @param digest The digest value to use to select the corresponding
* certificate and private key (or null).
*
* @param algorithm A string value identifying the digest algorithm.
* The value passed to this parameter may be null. If it is not null,
* it must conform to the requirements for the algorithm parameter of
* <code>java.security.MessageDigest.getInstance()</code>.
*/
}
/**
* Get the digest value.
*
* @return The digest value which must match the digest of the
* certificate corresponding to the returned private key.
*/
public byte[] getDigest() {
return digest;
}
/**
* Get the algorithm identifier.
*
* @return The identifer of the algorithm used to compute the digest.
*/
return algorithm;
}
}
/**
* Constructs this PrivateKeyCallback with a private key Request object.
*
* <p> The <i>request</i> object identifies the private key
* to be returned. The corresponding certificate chain for the
* private key is also returned.
*
* <p> If the <i>request</i> object is null,
* the handler of the callback relies on its own default.
*
* @param request Identifier for the private key, or null.
*/
}
/**
* Used by the CallbackHandler to
* get the Request object that identifies the private key to be returned.
*
* @return The Request object which identifies the private key
* to be returned, or null. If null, the handler of the callback
* relies on its own default.
*/
return request;
}
/**
* Used by the CallbackHandler to set the requested private key and
* the corresponding certificate chain within the Callback.
*
* <p> If the requested private key or chain could not be found,
* then both values must be set to null.
*
* @param key The private key, or null.
*
* @param chain The corresponding certificate chain, or null.
*/
}
/**
* Used to obtain the private key set within the Callback.
*
* @return The private key, or null if the key could not be found.
*/
return key;
}
/**
* Used to obtain the certicicate chain set within the Callback.
*
* @return The certificate chain, or null if the chain could not be found.
*/
return chain;
}
}