Skip to content

Commit

Permalink
Fixed typo (lenght to length)
Browse files Browse the repository at this point in the history
  • Loading branch information
sappho192 committed Jan 26, 2016
1 parent 7b4e560 commit 343f1ff
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ private boolean verifySignature(Tag signedData, Tag signature,
private byte[] getDataForSigning(Tag signedData) throws IOException {
ByteArrayOutputStream byteout = new ByteArrayOutputStream();
byteout.write(encodeInt(signedData.id));
byteout.write(encodeInt(signedData.lenght));
byteout.write(encodeInt(signedData.length));
byteout.write(signedData.value);
return byteout.toByteArray();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private void verifyAttestationSignature(Tags tags, RegistrationRecord record)

byte[] signedBytes = new byte[krd.value.length + 4];
System.arraycopy(UnsignedUtil.encodeInt(krd.id), 0, signedBytes, 0, 2);
System.arraycopy(UnsignedUtil.encodeInt(krd.lenght), 0, signedBytes, 2,
System.arraycopy(UnsignedUtil.encodeInt(krd.length), 0, signedBytes, 2,
2);
System.arraycopy(krd.value, 0, signedBytes, 4, krd.value.length);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public class Tag {
public int statusId = 0x00;
public int id;
public int lenght;
public int length;
public byte[] value;

public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public TagAssertionInfo(Tag t) throws InvalidArgumentException, IOException {
if (t.id != TagsEnum.TAG_ASSERTION_INFO.id) {
throw new InvalidArgumentException("Not TAG_ASSERTION_INFO tag");
}
if (t.lenght != 5 && t.lenght != 7) {
if (t.length != 5 && t.length != 7) {
throw new InvalidArgumentException(
"Unrecognized tag structure. Lenght=" + t.lenght);
"Unrecognized tag structure. Length=" + t.length);
}
if (t.lenght == 7) {
if (t.length == 7) {
isReg = true;
}
parse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public Tags parse(ByteInputStream bytes, boolean isReg) throws IOException {
while (bytes.available() > 0) {
t = new Tag();
t.id = UnsignedUtil.read_UAFV1_UINT16(bytes);
t.lenght = UnsignedUtil.read_UAFV1_UINT16(bytes);
t.length = UnsignedUtil.read_UAFV1_UINT16(bytes);

if (t.id == TagsEnum.TAG_UAFV1_AUTH_ASSERTION.id) {
// ret.add(t);
Expand Down Expand Up @@ -77,7 +77,7 @@ public Tags parse(ByteInputStream bytes, boolean isReg) throws IOException {
} else if (t.id == TagsEnum.TAG_FINAL_CHALLENGE.id) {
addTagAndValue(bytes, ret, t);
} else if (t.id == TagsEnum.TAG_TRANSACTION_CONTENT_HASH.id) {
if (t.lenght > 0) {
if (t.length > 0) {
addTagAndValue(bytes, ret, t);
} else {
// Length of Transaction Content Hash. This length is 0
Expand Down Expand Up @@ -127,7 +127,7 @@ private void addSubTags(boolean isReg, Tags ret, Tag t) throws IOException {
}

private void addTagAndValue(ByteInputStream bytes, Tags ret, Tag t) {
t.value = bytes.read(t.lenght);
t.value = bytes.read(t.length);
ret.add(t);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private Tags getTags(String regAssertions) throws IOException {
private byte[] getSignedData (Tag t){
byte[] signedBytes = new byte[t.value.length + 4];
System.arraycopy(UnsignedUtil.encodeInt(t.id), 0, signedBytes, 0, 2);
System.arraycopy(UnsignedUtil.encodeInt(t.lenght), 0, signedBytes, 2,
System.arraycopy(UnsignedUtil.encodeInt(t.length), 0, signedBytes, 2,
2);
System.arraycopy(t.value, 0, signedBytes, 4, t.value.length);
return signedBytes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public TestData(PublicKey pubArg, PrivateKey privArg)
pub = pubArg;
priv = privArg;
int signedDataId = TagsEnum.TAG_UAFV1_SIGNED_DATA.id;
int signedDataLenght = 200;
int signedDataLength = 200;
dataForSigning[0] = (byte) (signedDataId & 0x00ff);
dataForSigning[1] = (byte) (signedDataId & 0xff00);
dataForSigning[2] = (byte) (signedDataLenght & 0x00ff);
dataForSigning[3] = (byte) (signedDataLenght & 0xff00);
dataForSigning[2] = (byte) (signedDataLength & 0x00ff);
dataForSigning[3] = (byte) (signedDataLength & 0xff00);
//signature = NamedCurve.sign(priv, dataForSigning);
rsSignature = NamedCurve.signAndFromatToRS(priv,
SHA.sha(dataForSigning, "SHA-1"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void signatureValidation() throws Exception {

byte[] signedBytes = new byte[krd.value.length+4];
System.arraycopy(UnsignedUtil.encodeInt(krd.id), 0, signedBytes, 0, 2);
System.arraycopy(UnsignedUtil.encodeInt(krd.lenght), 0, signedBytes, 2, 2);
System.arraycopy(UnsignedUtil.encodeInt(krd.length), 0, signedBytes, 2, 2);
System.arraycopy(krd.value, 0, signedBytes, 4, krd.value.length);

KeyPair keyPair = KeyCodec.getKeyPair();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class Tag {
public int statusId = 0x00;
public int id;
public int lenght;
public int length;
public byte[] value;

public String toString (){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public TagAssertionInfo (Tag t) throws InvalidArgumentException, IOException {
if (t.id != TagsEnum.TAG_ASSERTION_INFO.id){
throw new InvalidArgumentException ("Not TAG_ASSERTION_INFO tag");
}
if (t.lenght != 5 && t.lenght != 7){
throw new InvalidArgumentException ("Unrecognized tag structure. Lenght="+t.lenght);
if (t.length != 5 && t.length != 7){
throw new InvalidArgumentException ("Unrecognized tag structure. Length="+t.length);
}
if (t.lenght == 7){
if (t.length == 7){
isReg = true;
}
parse ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public Tags parse(ByteInputStream bytes, boolean isReg) throws IOException {
while (bytes.available() > 0) {
t = new Tag();
t.id = UnsignedUtil.read_UAFV1_UINT16(bytes);
t.lenght = UnsignedUtil.read_UAFV1_UINT16(bytes);
t.length = UnsignedUtil.read_UAFV1_UINT16(bytes);

if (t.id == TagsEnum.TAG_UAFV1_AUTH_ASSERTION.id) {
//ret.add(t);
Expand Down Expand Up @@ -77,7 +77,7 @@ public Tags parse(ByteInputStream bytes, boolean isReg) throws IOException {
} else if (t.id == TagsEnum.TAG_FINAL_CHALLENGE.id){
addTagAndValue(bytes, ret, t);
} else if (t.id == TagsEnum.TAG_TRANSACTION_CONTENT_HASH.id){
if (t.lenght>0){
if (t.length>0){
addTagAndValue(bytes, ret, t);
} else {
//Length of Transaction Content Hash. This length is 0 if AuthenticationMode == 0x01, i.e. authentication, not transaction confirmation.
Expand Down Expand Up @@ -125,7 +125,7 @@ private void addSubTags(boolean isReg, Tags ret, Tag t) throws IOException {
}

private void addTagAndValue(ByteInputStream bytes, Tags ret, Tag t) {
t.value = bytes.read(t.lenght);
t.value = bytes.read(t.length);
ret.add(t);
}
}

0 comments on commit 343f1ff

Please sign in to comment.