summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCGantert345 <57003061+CGantert345@users.noreply.github.com>2020-04-30 14:47:13 +0200
committerCGantert345 <57003061+CGantert345@users.noreply.github.com>2020-04-30 14:47:13 +0200
commite5282f2bc884ce69baa0f0f0117bcd9f965b31bc (patch)
tree7e5487d454679d24c425047a1e71f7416834d0d1
parentImplementation of ObjectIdentifier and dynamic header (diff)
downloadUIC-barcode-e5282f2bc884ce69baa0f0f0117bcd9f965b31bc.tar
UIC-barcode-e5282f2bc884ce69baa0f0f0117bcd9f965b31bc.tar.gz
UIC-barcode-e5282f2bc884ce69baa0f0f0117bcd9f965b31bc.tar.bz2
UIC-barcode-e5282f2bc884ce69baa0f0f0117bcd9f965b31bc.tar.lz
UIC-barcode-e5282f2bc884ce69baa0f0f0117bcd9f965b31bc.tar.xz
UIC-barcode-e5282f2bc884ce69baa0f0f0117bcd9f965b31bc.tar.zst
UIC-barcode-e5282f2bc884ce69baa0f0f0117bcd9f965b31bc.zip
Diffstat (limited to '')
-rw-r--r--src/org/uic/header/DataBlockType.java27
-rw-r--r--src/org/uic/header/SignedDataType.java23
2 files changed, 39 insertions, 11 deletions
diff --git a/src/org/uic/header/DataBlockType.java b/src/org/uic/header/DataBlockType.java
index ce4084f..503c203 100644
--- a/src/org/uic/header/DataBlockType.java
+++ b/src/org/uic/header/DataBlockType.java
@@ -5,9 +5,14 @@ import net.gcdc.asn1.datatypes.CharacterRestriction;
import net.gcdc.asn1.datatypes.IntRange;
import net.gcdc.asn1.datatypes.RestrictedString;
import net.gcdc.asn1.datatypes.Sequence;
+import net.gcdc.asn1.uper.UperEncoder;
+
/**
- * The Class DataBlockType.
+ * The DataBlockType.
+ *
+ * Data block ready for signing
+ *
*/
@Sequence
public class DataBlockType {
@@ -78,10 +83,10 @@ public class DataBlockType {
*
* e.g.:
* -- DSA SHA224 2.16.840.1.101.3.4.3.1
- * -- DSA SHA248 2.16.840.1.101.3.4.3.2
- * -- ECC 1.2.840.10045.3.1.7
+ * -- DSA SHA248 2.16.840.1.101.3.4.3.2
+ * -- ECC 1.2.840.10045.3.1.7
*
- * @param signingAlg the new signing algorithm
+ * @param signingAlgorithm the new signing alg
*/
public void setSigningAlg(String signingAlgorithm) {
this.signingAlg = signingAlgorithm;
@@ -106,5 +111,19 @@ public class DataBlockType {
}
+ /**
+ * Gets the data for signature.
+ *
+ * The byte array containing the ASN.1 PER UNALIGNED encoded data of the DataBlock
+ *
+ *
+ * @return the data for signature
+ */
+ public byte[] getDataForSignature() {
+ return UperEncoder.encode(this);
+
+ }
+
+
}
diff --git a/src/org/uic/header/SignedDataType.java b/src/org/uic/header/SignedDataType.java
index 1cbaa8e..2cd2acd 100644
--- a/src/org/uic/header/SignedDataType.java
+++ b/src/org/uic/header/SignedDataType.java
@@ -4,7 +4,6 @@ import net.gcdc.asn1.datatypes.Asn1Optional;
import net.gcdc.asn1.datatypes.Sequence;
import net.gcdc.asn1.datatypesimpl.OctetString;
-// TODO: Auto-generated Javadoc
/**
* The Class SignedDataType.
*/
@@ -12,7 +11,7 @@ import net.gcdc.asn1.datatypesimpl.OctetString;
public class SignedDataType {
/** The data. */
- public DataBlockType data;
+ public DataBlockType dataBlock;
/** The signature. */
@Asn1Optional public OctetString signature;
@@ -22,8 +21,8 @@ public class SignedDataType {
*
* @return the data
*/
- public DataBlockType getData() {
- return data;
+ public DataBlockType getDataBlock() {
+ return dataBlock;
}
/**
@@ -31,8 +30,8 @@ public class SignedDataType {
*
* @param data the new data
*/
- public void setData(DataBlockType data) {
- this.data = data;
+ public void setDataBlock(DataBlockType dataBlock) {
+ this.dataBlock = dataBlock;
}
/**
@@ -47,11 +46,21 @@ public class SignedDataType {
/**
* Sets the signature.
*
- * @param signature the new signature
+ * @param signature the signature
*/
public void setSignature(OctetString signature) {
this.signature = signature;
}
+
+
+ /**
+ * Sets the signature.
+ *
+ * @param signature the signature
+ */
+ public void setSignature(byte[] signature) {
+ this.signature = new OctetString(signature);
+ }