public abstract class PKCS11Spec
extends java.lang.Object
implements java.security.spec.KeySpec
Modifier and Type | Field and Description |
---|---|
protected TokenManager |
tokenManager_
The manager to handle the token.
|
protected static int |
USE_PUBLIC_ROLE
The Constant USE_PUBLIC_ROLE.
|
static boolean |
USE_PUBLIC_SESSION
Deprecated.
|
static boolean |
USE_READ_ONLY_SESSION
Deprecated.
|
static boolean |
USE_READ_WRITE_SESSION
Deprecated.
|
protected static int |
USE_SO_ROLE
The Constant USE_SO_ROLE.
|
protected static int |
USE_USER_ROLE
The Constant USE_USER_ROLE.
|
static boolean |
USE_USER_SESSION
Deprecated.
|
protected char[] |
usePin_
The pin_.
|
protected int |
useRole_
The role_.
|
protected boolean |
useROSession_
Indicates, if the key should be generated using a read-only session.
|
Constructor and Description |
---|
PKCS11Spec() |
PKCS11Spec(TokenManager tokenManager,
boolean useROSession,
boolean useUserSession)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
char[] |
getPin()
Gets the pin.
|
protected int |
getRole()
Gets the role.
|
TokenManager |
getTokenManager()
Get the manager to handle the token.
|
boolean |
isUseAnonymousRole()
Checks if the task should use an anonymous session.
|
boolean |
isUseROSession()
Check if the key should be generated using a read-only session.
|
boolean |
isUseRwSession()
Checks if the task should use a rw session.
|
boolean |
isUseSORole()
Checks if the task should use a Security Officer (SO) session.
|
boolean |
isUseUserRole()
Checks if the task should use a user session.
|
boolean |
isUseUserSession()
Check if the key should be generated using a user session.
|
PKCS11Spec |
setPin(char[] pin)
Allows to preset the required pin for User and SO session types.
|
protected void |
setRole(int role)
Sets the role.
|
PKCS11Spec |
setTokenManager(TokenManager tokenManager)
When there are multiple PKCS11-tokens in use, use this method to specify which
TokenManager should be used. |
PKCS11Spec |
setUseAnonymousRole(boolean rwAccess)
Use an anonymous (aka public) session when performing the task.
|
PKCS11Spec |
setUseSORole()
Use a Security Officer (SO) session when performing the task.
|
PKCS11Spec |
setUseUserRole(boolean rwAccess)
Use a user session when performing the task.
|
public static boolean USE_READ_ONLY_SESSION
useROSession_
property. Tells that a read-only session shall be
used.public static boolean USE_READ_WRITE_SESSION
useROSession_
property. Tells that a read-write session shall be
used.public static boolean USE_USER_SESSION
useUserSession_
property. Tells that an user session shall be
used.public static boolean USE_PUBLIC_SESSION
useUserSession_
property. Tells that a public session shall be
used.protected static final int USE_SO_ROLE
protected static final int USE_USER_ROLE
protected static final int USE_PUBLIC_ROLE
protected TokenManager tokenManager_
protected boolean useROSession_
protected int useRole_
protected char[] usePin_
public PKCS11Spec(TokenManager tokenManager, boolean useROSession, boolean useUserSession)
tokenManager
- The manager to handle the token to generate the key on.useROSession
- true
(USE_READ_ONLY_SESSION
), if the key should be generated
using a read-only session. This is only possible for session-objects.
false
( USE_READ_WRITE_SESSION
) to use a read-write session.useUserSession
- true
(USE_USER_SESSION
), if the key should be generated
using a user session. This is required for private objects (key); i.e. keys that have
their private flag set. false
(USE_PUBLIC_SESSION
) to use a
public session. This will only work for public objects.public PKCS11Spec()
public PKCS11Spec setTokenManager(TokenManager tokenManager)
TokenManager
should be used.tokenManager
- the new token managerpublic TokenManager getTokenManager()
public boolean isUseROSession()
true
, if the key should be generated using a read-only session.
false
to use a read-write session.public boolean isUseUserSession()
true
(USE_USER_SESSION
), if the key should be generated using
a user session. false
( USE_PUBLIC_SESSION
) to use a public
session.protected void setRole(int role)
role
- the new rolepublic PKCS11Spec setUseAnonymousRole(boolean rwAccess)
rwAccess
- whether or not rw access should be used.PKCS11Spec
)public PKCS11Spec setUseUserRole(boolean rwAccess)
rwAccess
- whether or not rw access should be used.PKCS11Spec
)public PKCS11Spec setUseSORole()
PKCS11Spec
)protected int getRole()
public boolean isUseAnonymousRole()
public boolean isUseUserRole()
public boolean isUseSORole()
public boolean isUseRwSession()
public PKCS11Spec setPin(char[] pin)
pin
- the pinPKCS11Spec
)public char[] getPin()
null
if no pin is given.IAIK JavaSecurity Website https://jce.iaik.tugraz.at/
IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2023 IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved. Version 1.9.4