@ThreadSafe public abstract class Keychain extends Object implements AutoCloseable
KeychainException
to
report any errors when accessing this keychain.
Implementations need to safe for multi-threading.
Modifier and Type | Class and Description |
---|---|
static class |
Keychain.AttributeClass
Enumerates classes of attributes of items in a ketchain.
|
static interface |
Keychain.Item
An item in a keychain.
|
static class |
Keychain.ItemClass
Enumerates classes of items in a keychain.
|
static interface |
Keychain.Visitor
A visitor for items in a keychain.
|
Constructor and Description |
---|
Keychain() |
Modifier and Type | Method and Description |
---|---|
abstract void |
close()
Closes this keychain.
|
abstract void |
createItem(Keychain.ItemClass id,
Map<Keychain.AttributeClass,ByteBuffer> attributes,
ByteBuffer secret)
Creates a new item in this keychain.
|
abstract void |
delete()
Deletes and closes this keychain.
|
static Keychain |
open()
Opens the default keychain.
|
static Keychain |
open(String path,
char[] password)
Opens the specified keychain, creating it first if necessary.
|
abstract void |
visitItems(Keychain.ItemClass id,
Map<Keychain.AttributeClass,ByteBuffer> attributes,
Keychain.Visitor visitor)
Visits items in this keychain.
|
public abstract void close()
close
in interface AutoCloseable
public abstract void createItem(Keychain.ItemClass id, Map<Keychain.AttributeClass,ByteBuffer> attributes, ByteBuffer secret) throws KeychainException
id
- the class of the item to create.attributes
- the attributes of the item to create.secret
- the secret data of the item to create.KeychainException
public abstract void delete() throws KeychainException
KeychainException
public static Keychain open() throws KeychainException
KeychainException
public static Keychain open(String path, @Nullable char[] password) throws KeychainException
path
- the path name of the keychain.password
- the password to use for creating the keychain.
If null
, then the user gets prompted for a password.KeychainException
public abstract void visitItems(@Nullable Keychain.ItemClass id, @Nullable Map<Keychain.AttributeClass,ByteBuffer> attributes, Keychain.Visitor visitor) throws KeychainException
id
and attributes
parameters filter the set of
items to visit.id
- the class of the items to visit.
Use null
or Keychain.ItemClass.ANY_ITEM
to visit items of
any class.attributes
- the attributes to visit.
Use null
or an empty map to visit items with any
attributes.visitor
- the visitor to apply to all matching items.KeychainException
Copyright © 2012–2018 Schlichtherle IT Services. All rights reserved.