public class KeyRandomArt extends java.lang.Object implements AlgorithmNameProvider, KeySizeIndicator
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
algorithm |
static java.lang.String |
AUGMENTATION_STRING |
private char[][] |
field |
static int |
FLDBASE |
static int |
FLDSIZE_X |
static int |
FLDSIZE_Y |
private int |
keySize |
| Constructor and Description |
|---|
KeyRandomArt(java.security.PublicKey key) |
KeyRandomArt(java.security.PublicKey key,
Digest d) |
KeyRandomArt(java.security.PublicKey key,
Factory<? extends Digest> f) |
KeyRandomArt(java.lang.String algorithm,
int keySize,
byte[] digest) |
| Modifier and Type | Method and Description |
|---|---|
<A extends java.lang.Appendable> |
append(A sb)
Outputs the generated random art
|
static <A extends java.lang.Appendable> |
combine(A sb,
char separator,
java.util.Collection<? extends KeyRandomArt> arts)
Combines the arts in a user-friendly way so they are aligned with each other
|
static java.lang.String |
combine(char separator,
java.util.Collection<? extends KeyRandomArt> arts)
Combines the arts in a user-friendly way so they are aligned with each other
|
static <A extends java.lang.Appendable> |
combine(SessionContext session,
A sb,
char separator,
KeyIdentityProvider provider)
Appends the combined random art entries for the provided keys
|
static java.lang.String |
combine(SessionContext session,
char separator,
KeyIdentityProvider provider)
Creates the combined representation of the random art entries for the provided keys
|
static java.util.Collection<KeyRandomArt> |
generate(SessionContext session,
KeyIdentityProvider provider)
Extracts and generates random art entries for all key in the provider
|
java.lang.String |
getAlgorithm() |
int |
getKeySize() |
java.lang.String |
toString() |
public static final int FLDBASE
public static final int FLDSIZE_Y
public static final int FLDSIZE_X
public static final java.lang.String AUGMENTATION_STRING
private final java.lang.String algorithm
private final int keySize
private final char[][] field
public KeyRandomArt(java.security.PublicKey key)
throws java.lang.Exception
java.lang.Exceptionpublic KeyRandomArt(java.security.PublicKey key,
Factory<? extends Digest> f)
throws java.lang.Exception
java.lang.Exceptionpublic KeyRandomArt(java.security.PublicKey key,
Digest d)
throws java.lang.Exception
java.lang.Exceptionpublic KeyRandomArt(java.lang.String algorithm,
int keySize,
byte[] digest)
algorithm - The key algorithmkeySize - The key size in bitsdigest - The key digestpublic java.lang.String getAlgorithm()
getAlgorithm in interface AlgorithmNameProviderpublic int getKeySize()
getKeySize in interface KeySizeIndicatorpublic <A extends java.lang.Appendable> A append(A sb)
throws java.io.IOException
A - The Appendable output writersb - The writerjava.io.IOException - If failed to write the combined resultpublic java.lang.String toString()
toString in class java.lang.Objectpublic static java.lang.String combine(char separator,
java.util.Collection<? extends KeyRandomArt> arts)
separator - The separator to use between the arts - if empty char
('\0') then no separation is donearts - The KeyRandomArts to combine - ignored if null/emptypublic static java.lang.String combine(SessionContext session, char separator, KeyIdentityProvider provider) throws java.lang.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 providejava.lang.Exception - If failed to extract or combine the entriescombine(SessionContext, Appendable, char, KeyIdentityProvider)public static <A extends java.lang.Appendable> A combine(SessionContext session, A sb, char separator, KeyIdentityProvider provider) throws java.lang.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 providejava.lang.Exception - If failed to extract or write the entriesgenerate(SessionContext, KeyIdentityProvider),
combine(Appendable, char, Collection)public static java.util.Collection<KeyRandomArt> generate(SessionContext session, KeyIdentityProvider provider) throws java.lang.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 provideKeyRandomArtsjava.lang.Exception - If failed to extract the entriesKeyIdentityProvider.loadKeys(SessionContext)public static <A extends java.lang.Appendable> A combine(A sb,
char separator,
java.util.Collection<? extends KeyRandomArt> arts)
throws java.io.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 KeyRandomArts to combine - ignored if null/emptyjava.io.IOException - If failed to write the combined result