Overview | Package | Class | Tree | Deprecated | Index | Help
| JSS 3.1.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mozilla.jss.pkcs12
Class PK12Token

    org.mozilla.jss.pkcs12.PK12Token

public class PK12Token

A PKCS #12 "virtual token". Currently, these extend tokens found in the PK11Token class.

See Also:
  `PK12Token`

Inner Class Summary
`static class` | `PK12Token.Flag`
`static class` | `PK12Token.InvalidPKCS12FileException` Thrown if the operation requires a specified file to exist, and it doesn't.
`protected class` | `PK12Token.PK12Store`

Field Summary
`private java.util.Vector` | `certificates`
`private java.lang.String` | `filename`

Constructor Summary
`private` | `PK12Token()` Default constructor which should never be called.
`protected` | `PK12Token(java.lang.String filename, PK12Token.Flag flag, byte[] slot)` Create a new PK12Token.

Method Summary
`protected PK12TokenProxy` | `createPK12TokenImportContext()` These private native methods are always called via the protected synchronized java method called importFromPKCS12File(): createPK12TokenImportContext(): opens the PKCS #12 file intended to be imported importPK12Token(): actually imports all certificate data into the Java data member "certificates" and places this information into the default certificate database; if a private key is encountered, then it is placed into the selected key token and also into the default key database destroyPK12TokenImportContext(): closes the PKCS #12 file intended for import CALLED BY: importFromPKCS12File()
`protected void` | `destroyPK12TokenImportContext(PK12TokenProxy importProxy)`
`protected void` | `importFromPKCS12File()` This protected synchronized method is always called whenever it is known that a file already exists (as denoted by the second argument to the PK12Token factory "constructor" method).
`protected void` | `importPK12Token(PK12TokenProxy importProxy)`
`static PK12Token` | `makePK12Token(java.lang.String filename, PK12Token.Flag flag)` A user calls this static factory method instead of a java constructer to initialize the PK12Token class.

Field Detail

### filename

    private java.lang.String filename

### certificates

    private java.util.Vector certificates

Constructor Detail

### PK12Token

    private PK12Token()

  Default constructor which should never be called.

### PK12Token

    protected PK12Token(java.lang.String filename,
                        PK12Token.Flag flag,
                        byte[] slot)
                 throws PK12Token.InvalidPKCS12FileException

  Create a new PK12Token. Note that this constructor is always invoked from the native code which comprises the "factory method", makePK12Token( filename, flag ). CALLED BY: makePK12Token( String filename, Flag flag )
  Parameters:
    `filename` - A String containing the name of a PKCS #12 file.
    `flag` - A Flag containing whether the PKCS #12 file should already exist (in which case "flag" is Flag.FILE_EXISTS) or should be created (in which case "flag" is Flag.CREATE_FILE).
    `slot` - A byte array containing the corresponding PKCS #11 slot.
  Throws:
    `PK12Token.InvalidPKCS12FileException` - An exception thrown whenever a file is expected to exist, and doesn't.

Method Detail

### makePK12Token

    public static PK12Token makePK12Token(java.lang.String filename,
                                          PK12Token.Flag flag)

  A user calls this static factory method instead of a java constructer to initialize the PK12Token class. This native function obtains a PKCS #11 slot, transforms it into a JNI byte array, and then calls the protected java constructor, PK12Token( filename, flag, slot ). For example:

           PK12Token token = makePK12Token( "pkcs12file.p12",
                                            PK12Token.Flag.FILE_EXISTS );

  Parameters:
    `filename` - A String containing the name of a PKCS #12 file.
    `flag` - A Flag containing whether the PKCS #12 file should already exist (in which case "flag" is Flag.FILE_EXISTS) or should be created (in which case "flag" is Flag.CREATE_FILE).
  Returns:
    PK12Token This method actually invokes the constructor.

### importFromPKCS12File

    protected void importFromPKCS12File()

  This protected synchronized method is always called whenever it is known that a file already exists (as denoted by the second argument to the PK12Token factory "constructor" method). This method is called whenever a certificate or key need to be read in from an external file. In each case, the new file is opened, and all of its certificates are read into the internal "certificates" data member as well as the default certificate database; all of its keys are read into either the PKCS #11 internal module or the PKCS #11 FIPS module (whichever one has been selected), as well as the default key database. CALLED BY: PK12Token() constructor

### createPK12TokenImportContext

    protected PK12TokenProxy createPK12TokenImportContext()

  These private native methods are always called via the protected synchronized java method called importFromPKCS12File(): createPK12TokenImportContext(): opens the PKCS #12 file intended to be imported importPK12Token(): actually imports all certificate data into the Java data member "certificates" and places this information into the default certificate database; if a private key is encountered, then it is placed into the selected key token and also into the default key database destroyPK12TokenImportContext(): closes the PKCS #12 file intended for import CALLED BY: importFromPKCS12File()

### importPK12Token

    protected void importPK12Token(PK12TokenProxy importProxy)

### destroyPK12TokenImportContext

    protected void destroyPK12TokenImportContext(PK12TokenProxy importProxy)

Overview | Package | Class | Tree | Deprecated | Index | Help
| JSS 3.1.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD