Class P11Key


  • public abstract class P11Key
    extends Object
    PKCS#11 key.
    Since:
    2.0.0
    Author:
    Lijun Liao (xipki)
    • 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)
      • 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.TokenException
        Signs the content.
        Parameters:
        mechanism - mechanism to sign the content.
        parameters - Parameters. Could be null.
        content - Content to be signed. Must not be null.
        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.TokenException
        XiSecurityException
      • supportsDigest

        public boolean supportsDigest​(long mechanism)
                               throws org.xipki.pkcs11.wrapper.TokenException,
                                      XiSecurityException
        Throws:
        org.xipki.pkcs11.wrapper.TokenException
        XiSecurityException
      • digestSecretKey0

        protected abstract byte[] digestSecretKey0​(long mechanism)
                                            throws org.xipki.pkcs11.wrapper.TokenException
        Throws:
        org.xipki.pkcs11.wrapper.TokenException
      • getKeyId

        public org.xipki.pkcs11.wrapper.PKCS11KeyId getKeyId()
      • getKeyType

        public long getKeyType()
      • isSecretKey

        public boolean isSecretKey()
      • getPublicKey

        public final PublicKey getPublicKey()