public class KeyRandomArt extends Object implements AlgorithmNameProvider, KeySizeIndicator
Modifier and Type | Field and Description |
---|---|
static String |
AUGMENTATION_STRING |
static int |
FLDBASE |
static int |
FLDSIZE_X |
static int |
FLDSIZE_Y |
Constructor and Description |
---|
KeyRandomArt(PublicKey key) |
KeyRandomArt(PublicKey key,
Digest d) |
KeyRandomArt(PublicKey key,
Factory<? extends Digest> f) |
KeyRandomArt(String algorithm,
int keySize,
byte[] digest) |
Modifier and Type | Method and Description |
---|---|
<A extends Appendable> |
append(A sb)
Outputs the generated random art
|
static <A extends Appendable> |
combine(A sb,
char separator,
Collection<? extends KeyRandomArt> arts)
Combines the arts in a user-friendly way so they are aligned with each other
|
static String |
combine(char separator,
Collection<? extends KeyRandomArt> arts)
Combines the arts in a user-friendly way so they are aligned with each other
|
static <A extends Appendable> |
combine(SessionContext session,
A sb,
char separator,
KeyIdentityProvider provider)
Appends the combined random art entries for the provided keys
|
static String |
combine(SessionContext session,
char separator,
KeyIdentityProvider provider)
Creates the combined representation of the random art entries for the provided keys
|
static Collection<KeyRandomArt> |
generate(SessionContext session,
KeyIdentityProvider provider)
Extracts and generates random art entries for all key in the provider
|
String |
getAlgorithm() |
int |
getKeySize() |
String |
toString() |
public static final int FLDBASE
public static final int FLDSIZE_Y
public static final int FLDSIZE_X
public static final String AUGMENTATION_STRING
public KeyRandomArt(PublicKey key, Factory<? extends Digest> f) throws Exception
Exception
public KeyRandomArt(String algorithm, int keySize, byte[] digest)
algorithm
- The key algorithmkeySize
- The key size in bitsdigest
- The key digestpublic String getAlgorithm()
getAlgorithm
in interface AlgorithmNameProvider
public int getKeySize()
getKeySize
in interface KeySizeIndicator
public <A extends Appendable> A append(A sb) throws IOException
A
- The Appendable
output writersb
- The writerIOException
- If failed to write the combined resultpublic static String combine(char separator, Collection<? extends KeyRandomArt> arts)
separator
- The separator to use between the arts - if empty char ('\0') then no separation is donearts
- The KeyRandomArt
s to combine - ignored if null
/emptypublic static String combine(SessionContext session, char separator, KeyIdentityProvider provider) throws Exception
session
- The SessionContext
for invoking this load command - may be null
if not invoked
within a session context (e.g., offline tool or session unknown).separator
- The separator to use between the arts - if empty char ('\0') then no separation is doneprovider
- The KeyIdentityProvider
- ignored if null
or has no keys to provideException
- If failed to extract or combine the entriescombine(SessionContext, Appendable, char, KeyIdentityProvider)
public static <A extends Appendable> A combine(SessionContext session, A sb, char separator, KeyIdentityProvider provider) throws Exception
A
- The Appendable
output writersession
- The SessionContext
for invoking this load command - may be null
if not invoked
within a session context (e.g., offline tool or session unknown).sb
- The writerseparator
- The separator to use between the arts - if empty char ('\0') then no separation is doneprovider
- The KeyIdentityProvider
- ignored if null
or has no keys to provideException
- If failed to extract or write the entriesgenerate(SessionContext, KeyIdentityProvider)
,
combine(Appendable, char, Collection)
public static Collection<KeyRandomArt> generate(SessionContext session, KeyIdentityProvider provider) throws Exception
session
- The SessionContext
for invoking this load command - may be null
if not invoked
within a session context (e.g., offline tool or session unknown).provider
- The KeyIdentityProvider
- ignored if null
or has no keys to provideKeyRandomArt
sException
- If failed to extract the entriesKeyIdentityProvider.loadKeys(SessionContext)
public static <A extends Appendable> A combine(A sb, char separator, Collection<? extends KeyRandomArt> arts) throws IOException
A
- The Appendable
output writersb
- The writerseparator
- The separator to use between the arts - if empty char ('\0') then no separation is donearts
- The KeyRandomArt
s to combine - ignored if null
/emptyIOException
- If failed to write the combined resultCopyright © 2008–2024 The Apache Software Foundation. All rights reserved.