Class PKCS12IdentityProp

All Implemented Interfaces:
EventListener, IGProp<byte[]>, Cloneable

public class PKCS12IdentityProp extends ByteArrayProp
The PKCS#12 Identity Property used for SSL communication or code signing.
Author:
Christopher Mindus
  • Constructor Details

    • PKCS12IdentityProp

      protected PKCS12IdentityProp()
      Creates a byte array property with the specified name with a null value.
    • PKCS12IdentityProp

      public PKCS12IdentityProp(Atom propertyAtom)
      Creates a byte array property with the specified name with a null value.
      Parameters:
      propertyAtom - the property atom.
  • Method Details

    • clone

      public PKCS12IdentityProp clone()
      Clones the byte array property.
      Overrides:
      clone in class ByteArrayProp
      Returns:
      A new cloned ByteArrayProp.
    • setPropValue

      public boolean setPropValue(byte[] newValue)
      Sets a new value for this property. If any listener is present and the value has changed compare to the last value, the listener is informed.
      Overrides:
      setPropValue in class ByteArrayProp
      Parameters:
      newValue - the new value.
      Returns:
      boolean true for value has changed, false for same value as current value.
    • setIdentity

      Sets the identity.
      Parameters:
      fileName - The file name of the keystore.
      password - The password.
      Returns:
      boolean true for value has changed, false for same value as current value.
      Throws:
      FileNotFoundException - If the file is not found.
      NoSuchAlgorithmException - If the algorithm used to check the integrity of the keystore cannot be found.
      CertificateException - If any of the certificates in the keystore could not be loaded.
      IOException - If there is an I/O or format problem with the keystore data, if a password is required but not given, or if the given password was incorrect. If the error is due to a wrong password, the cause of the IOException should be an UnrecoverableKeyException.
      UnrecoverableKeyException - If the key cannot be recovered (e.g. the given password is wrong).
      KeyStoreException
    • getKeyManagers

      Gets the Key Managers for the identity, a class representing a storage facility for cryptographic keys and certificates.
      Parameters:
      password - The password of the identity.
      Returns:
      The Key Managers, or null if no identity is set.
      Throws:
      KeyStoreException - If no Provider supports a KeyStoreSpi implementation for the PKCS#12 type.
      NoSuchAlgorithmException - If the algorithm used to check the integrity of the keystore cannot be found.
      CertificateException - If any of the certificates in the keystore could not be loaded.
      IOException - If there is an I/O or format problem with the keystore data, if a password is required but not given, or if the given password was incorrect. If the error is due to a wrong password, the cause of the IOException should be an UnrecoverableKeyException.
      UnrecoverableKeyException - If the key cannot be recovered (e.g. the given password is wrong).
    • getIdentityDescription

      public String getIdentityDescription()
      Gets the description of the identity.
      Returns:
      The identity description string or null if no identity is set.
    • getKeyStore

      Gets the KeyStore for the identity.
      Parameters:
      password - The password of the identity.
      Returns:
      The keystore, or null if identity is not set.
      Throws:
      KeyStoreException - If no Provider supports a KeyStoreSpi implementation for the PKCS#12 type.
      NoSuchAlgorithmException - If the algorithm used to check the integrity of the keystore cannot be found.
      CertificateException - If any of the certificates in the keystore could not be loaded.
      IOException - If there is an I/O or format problem with the keystore data, if a password is required but not given, or if the given password was incorrect. If the error is due to a wrong password, the cause of the IOException should be an UnrecoverableKeyException.
    • setKeyStore

      public void setKeyStore(KeyStore keyStore, char[] password, String descr) throws IOException, KeyStoreException, NoSuchAlgorithmException, CertificateException
      Stores the keystore along with a description of it.
      Parameters:
      keyStore - The keystore.
      password - The password.
      descr - Description of the keystore, cannot be null.
      Throws:
      IOException - For I/O errors.
      CertificateException - If any of the certificates in the keystore could not be saved.
      NoSuchAlgorithmException - If the algorithm used to check the integrity of the keystore cannot be found.
      KeyStoreException - If no Provider supports a KeyStoreSpi implementation for the PKCS#12 type.