|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
org.globus.pkcs11
Class PKCS11Util
java.lang.Object | +--org.globus.pkcs11.PKCS11Util
- public class PKCS11Util
- extends java.lang.Object
Contains various utility methods for dealing with PKCS 11 compliant devices. This includes performing the following operations:
- Session management
- Retrieving certificates from the device
- Retrieving private keys from the device
- Loading certificates onto the device
- Loading private keys onto the device
| Constructor Summary | |
PKCS11Util()
|
|
| Method Summary | |
static void |
closeSession()
|
static void |
initiateSession(java.lang.String pin,
int flags)
Initiates a session with the PKCS11 device with the given flags, and logs in as a regular user with the given pin. |
static PKCS11Object |
instantiateUserCert(iaik.x509.X509Certificate userCert,
byte[] id)
Loads a certificate onto the PKCS11 device with a default label |
static PKCS11Object |
instantiateUserCert(iaik.x509.X509Certificate userCert,
java.lang.String label,
byte[] id)
Loads a certificate onto the PKCS11 device and labels it with the specified label |
static PKCS11Object |
instantiateUserPrivateKey(iaik.security.rsa.RSAPrivateKey userPrivateKey,
java.security.Principal subject,
byte[] id)
Loads the specified private key onto the PKCS11 device. |
static PKCS11Object |
retrieveObjectByLabel(java.lang.Integer classType,
java.lang.String label)
|
static PKCS11Object |
retrievePrivateKeyHandle(java.lang.String keyLabel)
Retrieves a handle to a private key with the given label. |
static PKCS11Object |
retrieveUserCertHandle(java.lang.String certLabel)
Retrieves a handle to a user certificate with the given label that is on the PKCS11 device. |
static iaik.x509.X509Certificate |
signCertificate(iaik.x509.X509Certificate cert,
PKCS11Object userPrivKeyHandle)
Creates a signed certificate from the passed in certificate. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
PKCS11Util
public PKCS11Util()
| Method Detail |
initiateSession
public static void initiateSession(java.lang.String pin,
int flags)
throws PKCS11Exception
- Initiates a session with the PKCS11 device with the given flags, and
logs in as a regular user with the given pin.
Also, if there happens to be more than one PKCS11 device attached,
this function will simply grab the first one it encounters.
retrieveUserCertHandle
public static PKCS11Object retrieveUserCertHandle(java.lang.String certLabel)
- Retrieves a handle to a user certificate with the given label that
is on the PKCS11 device. This
handle can be used to instantiate an X509Certificate object.
retrievePrivateKeyHandle
public static PKCS11Object retrievePrivateKeyHandle(java.lang.String keyLabel)
- Retrieves a handle to a private key with the given label. The private
key never actually leaves the ibutton device, but this handle can be
used later to initialize a signing operation.
retrieveObjectByLabel
public static PKCS11Object retrieveObjectByLabel(java.lang.Integer classType,
java.lang.String label)
signCertificate
public static iaik.x509.X509Certificate signCertificate(iaik.x509.X509Certificate cert,
PKCS11Object userPrivKeyHandle)
throws PKCS11Exception
- Creates a signed certificate from the passed in certificate. Signs the
certificate with the specified private key
instantiateUserCert
public static PKCS11Object instantiateUserCert(iaik.x509.X509Certificate userCert,
byte[] id)
throws java.security.cert.CertificateEncodingException
- Loads a certificate onto the PKCS11 device with a default label
java.security.cert.CertificateEncodingException
instantiateUserCert
public static PKCS11Object instantiateUserCert(iaik.x509.X509Certificate userCert,
java.lang.String label,
byte[] id)
throws java.security.cert.CertificateEncodingException
- Loads a certificate onto the PKCS11 device and labels it with the specified
label
java.security.cert.CertificateEncodingException
instantiateUserPrivateKey
public static PKCS11Object instantiateUserPrivateKey(iaik.security.rsa.RSAPrivateKey userPrivateKey,
java.security.Principal subject,
byte[] id)
- Loads the specified private key onto the PKCS11 device. The subject param
should be the subject of the certificate this private key is associated with.
closeSession
public static void closeSession()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||