HashBasedPairwiseSubjectCodec
, SIVAESBasedPairwiseSubjectCodec
@ThreadSafe public abstract class PairwiseSubjectCodec extends Object
Decoding pairwise subject identifiers is optional, and is implemented by algorithms that supported reversal (typically with encryption-based codecs). Hash-based codecs don't support reversal.
Codec implementations thread-safe.
Related specifications:
Modifier and Type | Field | Description |
---|---|---|
static Charset |
CHARSET |
The charset (UTF-8) for string to byte conversions.
|
Constructor | Description |
---|---|
PairwiseSubjectCodec(byte[] salt) |
Creates a new codec for pairwise subject identifiers.
|
Modifier and Type | Method | Description |
---|---|---|
Map.Entry<SectorID,Subject> |
decode(Subject pairwiseSubject) |
Decodes the specified pairwise subject identifier to produce the
matching sector identifier and local subject.
|
abstract Subject |
encode(SectorID sectorID,
Subject localSub) |
Encodes a new pairwise subject identifier from the specified sector
identifier and local subject.
|
Subject |
encode(URI sectorURI,
Subject localSub) |
Encodes a new pairwise subject identifier from the specified sector
identifier URI and local subject.
|
Provider |
getProvider() |
Gets the security provider for cryptographic operations.
|
byte[] |
getSalt() |
Returns the salt.
|
void |
setProvider(Provider provider) |
Sets the security provider for cryptographic operations.
|
public PairwiseSubjectCodec(byte[] salt)
salt
- The salt, null
if not required.public byte[] getSalt()
null
if not required.public Provider getProvider()
null
if not specified
(implies the default one).public void setProvider(Provider provider)
provider
- The security provider, null
if not specified
(implies the default one).public Subject encode(URI sectorURI, Subject localSub)
sectorURI
- The sector identifier URI. Its scheme should be
"https", must include a host portion and must not
be null
.localSub
- The local subject identifier. Must not be
null
.public abstract Subject encode(SectorID sectorID, Subject localSub)
sectorID
- The sector identifier. Must not be
null
.localSub
- The local subject identifier. Must not be
null
.public Map.Entry<SectorID,Subject> decode(Subject pairwiseSubject) throws InvalidPairwiseSubjectException
UnsupportedOperationException
. Codecs that support pairwise
subject identifier reversal should override this method.pairwiseSubject
- The pairwise subject identifier. Must be
valid and not null
.InvalidPairwiseSubjectException
- If the pairwise subject is
invalid.Copyright © 2018 Connect2id Ltd.. All rights reserved.