Top Description Inners Fields Constructors Methods
org.bouncycastle.bcpg.sig

public Class PreferredAEADCiphersuites

extends PreferredAlgorithms
Class Inheritance
Imports
java.util.ArrayList, .List, org.bouncycastle.bcpg.AEADAlgorithmTags, .SignatureSubpacketTags, .SymmetricKeyAlgorithmTags

Signature Subpacket containing the AEAD cipher suites (AEAD algorithm, Symmetric Key Algorithm pairs) preferred by the key holder's implementation.
See Also
OpenPGP - Preferred AEAD Ciphersuites

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class

Field Summary

Modifier and TypeField and Description
private static final PreferredAEADCiphersuites.Combination
AES_128_OCB

AES-128 + OCB is a MUST implement and is therefore implicitly supported.

private final PreferredAEADCiphersuites.Combination[]

Constructor Summary

AccessConstructor and Description
public
PreferredAEADCiphersuites(boolean
whether the subpacket is critical
critical
,
boolean
whether the subpacket uses long length encoding
isLongLength
,
byte[]
raw data
data
)

Create a new PreferredAEADAlgorithms signature subpacket from raw data.

public
PreferredAEADCiphersuites(boolean
whether the subpacket is critical
critical
,
PreferredAEADCiphersuites.Combination[]
list of combinations, with the most preferred option first
combinations
)

Create a new PreferredAEADAlgorithm signature subpacket.

Method Summary

Modifier and TypeMethod and Description
public static PreferredAEADCiphersuites.Builder

Returns:

builder
builder
(boolean
true if the packet is considered critical.
isCritical
)

Return a Builder for constructing a PreferredAEADCiphersuites packet.

private static boolean
private static byte[]

Returns:

marshalled byte array
encodeCombinations
(PreferredAEADCiphersuites.Combination[]
list of algorithm combinations
combinations
)

Marshall the list of combinations into a byte array.

public PreferredAEADCiphersuites.Combination[]

Returns:

all supported algorithm combinations
getAlgorithms
()

Returns AEAD algorithm preferences, including implicitly supported algorithm combinations.

public PreferredAEADCiphersuites.Combination[]

Returns:

explicitly supported algorithm combinations
getRawAlgorithms
()

Return AEAD algorithm preferences.

public boolean

Returns:

true, if the combination is supported, false otherwise
isSupported
(PreferredAEADCiphersuites.Combination
combination
combination
)

Return true, if the given algorithm combination is supported (explicitly or implicitly).

private static PreferredAEADCiphersuites.Combination[]

Returns:

unmarshalled list
parseCombinations
(byte[]
marshalled bytes
data
)

Unmarshall a byte array into a list of algorithm combinations.

private static byte[]
requireEven(byte[] encodedCombinations)

Inherited from org.bouncycastle.bcpg.sig.PreferredAlgorithms:
getPreferencesintToByteArray

Field Detail

AES_128_OCBback to summary
private static final PreferredAEADCiphersuites.Combination AES_128_OCB

AES-128 + OCB is a MUST implement and is therefore implicitly supported.

See Also
OpenPGP - Preferred AEAD Ciphersuites, OpenPGP - Preferred AEAD Ciphersuites
algorithmsback to summary
private final PreferredAEADCiphersuites.Combination[] algorithms

Constructor Detail

PreferredAEADCiphersuitesback to summary
public PreferredAEADCiphersuites(boolean critical, boolean isLongLength, byte[] data)

Create a new PreferredAEADAlgorithms signature subpacket from raw data.

Parameters
critical:boolean

whether the subpacket is critical

isLongLength:boolean

whether the subpacket uses long length encoding

data:byte[]

raw data

PreferredAEADCiphersuitesback to summary
public PreferredAEADCiphersuites(boolean critical, PreferredAEADCiphersuites.Combination[] combinations)

Create a new PreferredAEADAlgorithm signature subpacket.

Parameters
critical:boolean

whether the subpacket is critical

combinations:PreferredAEADCiphersuites.Combination[]

list of combinations, with the most preferred option first

Method Detail

builderback to summary
public static PreferredAEADCiphersuites.Builder builder(boolean isCritical)

Return a Builder for constructing a PreferredAEADCiphersuites packet.

Parameters
isCritical:boolean

true if the packet is considered critical.

Returns:PreferredAEADCiphersuites.Builder

builder

containsback to summary
private static boolean contains(PreferredAEADCiphersuites.Combination combination, PreferredAEADCiphersuites.Combination[] combinations)
encodeCombinationsback to summary
private static byte[] encodeCombinations(PreferredAEADCiphersuites.Combination[] combinations)

Marshall the list of combinations into a byte array.

Parameters
combinations:PreferredAEADCiphersuites.Combination[]

list of algorithm combinations

Returns:byte[]

marshalled byte array

getAlgorithmsback to summary
public PreferredAEADCiphersuites.Combination[] getAlgorithms()

Returns AEAD algorithm preferences, including implicitly supported algorithm combinations.

Returns:PreferredAEADCiphersuites.Combination[]

all supported algorithm combinations

getRawAlgorithmsback to summary
public PreferredAEADCiphersuites.Combination[] getRawAlgorithms()

Return AEAD algorithm preferences. The most preferred option comes first. This method returns the combinations as they are listed in the packet, possibly excluding implicitly supported combinations.

Returns:PreferredAEADCiphersuites.Combination[]

explicitly supported algorithm combinations

isSupportedback to summary
public boolean isSupported(PreferredAEADCiphersuites.Combination combination)

Return true, if the given algorithm combination is supported (explicitly or implicitly).

Parameters
combination:PreferredAEADCiphersuites.Combination

combination

Returns:boolean

true, if the combination is supported, false otherwise

parseCombinationsback to summary
private static PreferredAEADCiphersuites.Combination[] parseCombinations(byte[] data)

Unmarshall a byte array into a list of algorithm combinations.

Parameters
data:byte[]

marshalled bytes

Returns:PreferredAEADCiphersuites.Combination[]

unmarshalled list

requireEvenback to summary
private static byte[] requireEven(byte[] encodedCombinations)
org.bouncycastle.bcpg.sig back to summary

public final Class PreferredAEADCiphersuites.Builder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final List<PreferredAEADCiphersuites.Combination>
private final boolean

Constructor Summary

AccessConstructor and Description
private
Builder(boolean isCritical)

Method Summary

Modifier and TypeMethod and Description
public PreferredAEADCiphersuites.Builder

Returns:

builder
addCombination
(int
symmetric cipher algorithm ID
symmetricAlgorithmId
,
int
AEAD algorithm ID
aeadAlgorithmId
)

Add a combination of cipher- and AEAD algorithm to the list of supported ciphersuites.

public PreferredAEADCiphersuites

Returns:

finished packet
build
()

Build a PreferredAEADCiphersuites from this builder.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

combinationsback to summary
private final List<PreferredAEADCiphersuites.Combination> combinations
isCriticalback to summary
private final boolean isCritical

Constructor Detail

Builderback to summary
private Builder(boolean isCritical)

Method Detail

addCombinationback to summary
public PreferredAEADCiphersuites.Builder addCombination(int symmetricAlgorithmId, int aeadAlgorithmId)

Add a combination of cipher- and AEAD algorithm to the list of supported ciphersuites.

Parameters
symmetricAlgorithmId:int

symmetric cipher algorithm ID

aeadAlgorithmId:int

AEAD algorithm ID

Returns:PreferredAEADCiphersuites.Builder

builder

See Also
{@link SymmetricKeyAlgorithmTags} for cipher algorithms, {@link AEADAlgorithmTags} for AEAD algorithms
buildback to summary
public PreferredAEADCiphersuites build()

Build a PreferredAEADCiphersuites from this builder.

Returns:PreferredAEADCiphersuites

finished packet

org.bouncycastle.bcpg.sig back to summary

public Class PreferredAEADCiphersuites.Combination

extends Object
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.bcpg.sig.PreferredAEADCiphersuites.Combination

Algorithm combination of a SymmetricKeyAlgorithmTags and a AEADAlgorithmTags.

Field Summary

Modifier and TypeField and Description
private final int
private final int

Constructor Summary

AccessConstructor and Description
public
Combination(int
symmetric algorithm tag
symmetricAlgorithmTag
,
int
aead algorithm tag
aeadAlgorithmTag
)

Create a new algorithm combination from a SymmetricKeyAlgorithmTags and a AEADAlgorithmTags.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int

Returns:

aead algorithm
getAeadAlgorithm
()

Return the AEAD algorithm tag.

public int

Returns:

symmetric algorithm
getSymmetricAlgorithm
()

Return the symmetric algorithm tag.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

aeadAlgorithmback to summary
private final int aeadAlgorithm
symmetricAlgorithmback to summary
private final int symmetricAlgorithm

Constructor Detail

Combinationback to summary
public Combination(int symmetricAlgorithmTag, int aeadAlgorithmTag)

Create a new algorithm combination from a SymmetricKeyAlgorithmTags and a AEADAlgorithmTags.

Parameters
symmetricAlgorithmTag:int

symmetric algorithm tag

aeadAlgorithmTag:int

aead algorithm tag

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getAeadAlgorithmback to summary
public int getAeadAlgorithm()

Return the AEAD algorithm tag.

Returns:int

aead algorithm

getSymmetricAlgorithmback to summary
public int getSymmetricAlgorithm()

Return the symmetric algorithm tag.

Returns:int

symmetric algorithm

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override