Package org.xipki.security.pkcs11
Class P11Key
- java.lang.Object
-
- org.xipki.security.pkcs11.P11Key
-
public abstract class P11Key extends Object
PKCS#11 key.- Since:
- 2.0.0
- Author:
- Lijun Liao (xipki)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voiddestroy()byte[]digestSecretKey(long mechanism)protected abstract byte[]digestSecretKey0(long mechanism)BigIntegergetDsaG()BigIntegergetDsaP()BigIntegergetDsaQ()IntegergetEcOrderBitSize()org.bouncycastle.asn1.ASN1ObjectIdentifiergetEcParams()org.xipki.pkcs11.wrapper.PKCS11KeyIdgetKeyId()longgetKeyType()PublicKeygetPublicKey()BigIntegergetRsaModulus()BigIntegergetRsaPublicExponent()P11SlotIdgetSlotId()booleanisSecretKey()voidsetDsaParameters(BigInteger p, BigInteger q, BigInteger g)voidsetEcParams(org.bouncycastle.asn1.ASN1ObjectIdentifier ecParams)voidsetRsaMParameters(BigInteger modulus, BigInteger publicExponent)byte[]sign(long mechanism, P11Params parameters, byte[] content)P11Keysign(Boolean sign)protected abstract byte[]sign0(long mechanism, P11Params parameters, byte[] content)Signs the content.booleansupportsDigest(long mechanism)booleansupportsSign(long mechanism)
-
-
-
Field Detail
-
slot
protected final P11Slot slot
-
keyId
protected final org.xipki.pkcs11.wrapper.PKCS11KeyId keyId
-
-
Constructor Detail
-
P11Key
protected P11Key(P11Slot slot, org.xipki.pkcs11.wrapper.PKCS11KeyId keyId)
-
-
Method Detail
-
destroy
public abstract void destroy() throws org.xipki.pkcs11.wrapper.TokenException- Throws:
org.xipki.pkcs11.wrapper.TokenException
-
getEcParams
public org.bouncycastle.asn1.ASN1ObjectIdentifier getEcParams()
-
getEcOrderBitSize
public Integer getEcOrderBitSize()
-
setEcParams
public void setEcParams(org.bouncycastle.asn1.ASN1ObjectIdentifier ecParams)
-
getRsaModulus
public BigInteger getRsaModulus()
-
getRsaPublicExponent
public BigInteger getRsaPublicExponent()
-
setRsaMParameters
public void setRsaMParameters(BigInteger modulus, BigInteger publicExponent)
-
getDsaP
public BigInteger getDsaP()
-
getDsaQ
public BigInteger getDsaQ()
-
getDsaG
public BigInteger getDsaG()
-
setDsaParameters
public void setDsaParameters(BigInteger p, BigInteger q, BigInteger g)
-
sign
public byte[] sign(long mechanism, P11Params parameters, byte[] content) throws org.xipki.pkcs11.wrapper.TokenException- Throws:
org.xipki.pkcs11.wrapper.TokenException
-
supportsSign
public boolean supportsSign(long mechanism)
-
sign0
protected abstract byte[] sign0(long mechanism, P11Params parameters, byte[] content) throws org.xipki.pkcs11.wrapper.TokenExceptionSigns the content.- Parameters:
mechanism- mechanism to sign the content.parameters- Parameters. Could benull.content- Content to be signed. Must not benull.- Returns:
- signature.
- Throws:
org.xipki.pkcs11.wrapper.TokenException- if PKCS#11 token error occurs.
-
digestSecretKey
public byte[] digestSecretKey(long mechanism) throws org.xipki.pkcs11.wrapper.TokenException, XiSecurityException- Throws:
org.xipki.pkcs11.wrapper.TokenExceptionXiSecurityException
-
supportsDigest
public boolean supportsDigest(long mechanism) throws org.xipki.pkcs11.wrapper.TokenException, XiSecurityException- Throws:
org.xipki.pkcs11.wrapper.TokenExceptionXiSecurityException
-
digestSecretKey0
protected abstract byte[] digestSecretKey0(long mechanism) throws org.xipki.pkcs11.wrapper.TokenException- Throws:
org.xipki.pkcs11.wrapper.TokenException
-
getSlotId
public P11SlotId getSlotId()
-
getKeyId
public org.xipki.pkcs11.wrapper.PKCS11KeyId getKeyId()
-
getKeyType
public long getKeyType()
-
isSecretKey
public boolean isSecretKey()
-
getPublicKey
public final PublicKey getPublicKey()
-
-