Package net.messagevortex.asn1
Class AbstractRedundancyOperation
java.lang.Object
net.messagevortex.asn1.AbstractBlock
net.messagevortex.asn1.Operation
net.messagevortex.asn1.AbstractRedundancyOperation
- All Implemented Interfaces:
Serializable,Block,Dumpable,org.bouncycastle.asn1.ASN1Choice
- Direct Known Subclasses:
AddRedundancyOperation,RemoveRedundancyOperation
public abstract class AbstractRedundancyOperation
extends Operation
implements org.bouncycastle.asn1.ASN1Choice, Serializable, Dumpable
Represents a the Blending specification of the router block.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final longFields inherited from class net.messagevortex.asn1.AbstractBlock
CRLF -
Constructor Summary
ConstructorsConstructorDescriptionAbstractRedundancyOperation(int inputId, int dataStripes, int redundancy, List<SymmetricKey> stripeKeys, int newFirstId, int gfSize) Creates an appropriate operation with the given GF size and properties.AbstractRedundancyOperation(org.bouncycastle.asn1.ASN1Encodable to) Create object from ASN.1 code. -
Method Summary
Modifier and TypeMethodDescriptiondumpValueNotation(String prefix, DumpType dumpType) Dumps the ASN1 value representation of the removeRedundancy operation.final intfinal intfinal intgetKeys()Gets the omega parameter of the Galois field.intgets the id of the first output payload block.intprotected final voidparse(org.bouncycastle.asn1.ASN1Encodable p) final intsetDataStripes(int stripes) Sets the number of data stripes for this operation.final intsetGfSize(int omega) Sets the omega parameter of the Galois field.final intsetInputId(int id) Sets the id of the first input id of the payload.final SymmetricKey[]setKeys(List<SymmetricKey> keys) Sets the keys to be used to encrypt all input respective output fields.intsetOutputId(int id) Sets the id of the first output block of the function.final intsetRedundancy(int stripes) sets the number of redundancy stripes.org.bouncycastle.asn1.ASN1ObjecttoAsn1Object(DumpType dumpType) Dumps an ASN.1 representation of the object.Methods inherited from class net.messagevortex.asn1.Operation
getNewInstance, getTagNumber, setTagNumberMethods inherited from class net.messagevortex.asn1.AbstractBlock
fromBase64, fromHex, parse, prepareDump, toBase64, toBitString, toBytes, toDer, toHex
-
Field Details
-
serialVersionUID
public static final long serialVersionUID- See Also:
-
INPUT_ID
public static final int INPUT_ID- See Also:
-
DATA_STRIPES
public static final int DATA_STRIPES- See Also:
-
REDUNDANCY
public static final int REDUNDANCY- See Also:
-
KEYS
public static final int KEYS- See Also:
-
OUTPUT_ID
public static final int OUTPUT_ID- See Also:
-
GF_SIZE
public static final int GF_SIZE- See Also:
-
-
Constructor Details
-
AbstractRedundancyOperation
public AbstractRedundancyOperation(int inputId, int dataStripes, int redundancy, List<SymmetricKey> stripeKeys, int newFirstId, int gfSize) Creates an appropriate operation with the given GF size and properties.
- Parameters:
inputId- first ID of the input workspacedataStripes- number of data stripes contained in operationredundancy- number of redundancy stripesstripeKeys- keys for the resulting stripes (number should be dataStripes+redundancy)newFirstId- first output IDgfSize- Size of the Galois Field in bits
-
AbstractRedundancyOperation
Create object from ASN.1 code.
- Parameters:
to- the ASN.1 code- Throws:
IOException- if parsing of ASN.1 code fails
-
-
Method Details
-
parse
- Specified by:
parsein classAbstractBlock- Throws:
IOException
-
toAsn1Object
Description copied from interface:DumpableDumps an ASN.1 representation of the object.
- Specified by:
toAsn1Objectin interfaceDumpable- Parameters:
dumpType- the dump type to be used- Returns:
- the ASN.1 string representation of the object
- Throws:
IOException- if dumping of the object fails due to an illegal internal state of the object
-
dumpValueNotation
Dumps the ASN1 value representation of the removeRedundancy operation.
- Specified by:
dumpValueNotationin interfaceBlock- Returns:
- the representation of the object
-
setInputId
public final int setInputId(int id) Sets the id of the first input id of the payload.
- Parameters:
id- the new first input id- Returns:
- the previously set first input id
-
getInputId
public final int getInputId() -
setDataStripes
public final int setDataStripes(int stripes) Sets the number of data stripes for this operation.
- Parameters:
stripes- The number of data stripes to be used for the redundancy operation- Returns:
- the previously set number of stripes
- Throws:
ArithmeticException- if all stripes together are not accommodated in the given GF field
-
getDataStripes
public final int getDataStripes() -
setRedundancy
public final int setRedundancy(int stripes) sets the number of redundancy stripes.
- Parameters:
stripes- the number of redundancy stripes to be set- Returns:
- the previous number of redundancy stripes
- Throws:
ArithmeticException- if the defined GF size is unable to accommodated all values
-
getRedundancy
public int getRedundancy() -
setKeys
Sets the keys to be used to encrypt all input respective output fields.
- Parameters:
keys- a list of keys- Returns:
- the old list of keys
- Throws:
ArithmeticException- if the number of keys does not match the number of stripes
-
getKeys
Gets the omega parameter of the Galois field.
- Returns:
- the omega parameter of the GF.
-
setGfSize
public final int setGfSize(int omega) Sets the omega parameter of the Galois field.
- Parameters:
omega- the omega of the new GF- Returns:
- the previous omega parameter of the GF.
- Throws:
ArithmeticException- if the number of all stripes in total ( data and redundancy) exceeds the address space of the GF
-
getGfSize
public final int getGfSize() -
setOutputId
public int setOutputId(int id) Sets the id of the first output block of the function.
- Parameters:
id- the first id to be used- Returns:
- old first value (before the write
-
getOutputId
public int getOutputId()gets the id of the first output payload block.
- Returns:
- id of the respective block
-