-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #235 from TokenScript/liscon-changes
Change of the usage value for Liscon
- Loading branch information
Showing
12 changed files
with
239 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,4 +63,4 @@ The command will print `Ticket is VALID and was issued to email [email protected]` if | |
|
||
For example: | ||
|
||
java -cp attestation-0.3.8-all.jar org.devcon.ticket.Validator pub.pem MIGYMA8MATYCBwCMryzpzeQCAQAEQQQtqLOcLgwsajj19K141ER4A4fblUH-cH0ZM_HZQmylYiSxsPljEL--ldyfbPIslT7djTuYJakQdyapeuPpnEDjA0IA1LMfG8yWPpa2Yuyssn5fBB4MsNY3PpF0hwELzugBxw96zU4Q2k9jz5_L3Y3qIyshm8AH5EiIwm5k5LIZs3idghw= MIGqBEEECwGwPNcyCsaGTbr5_BVaThbVuQr7kUWGFI3XgT68kpMi3JGIuO5SCAX4C-ySQxSnQO-9qAZeUjYo7dfnyJiAuwQgLY3YogvmiVW8frt3wxbX9qIBqkgMTcoCdN8af7_QXCEEQQQWPq3mXaFk68AgZgOXq0ORy1XPeTicyazBHv7WGDa_3x-swwhLDW1q8JvvRfbi2t0juMdiEhiG4NgRF-4oOiIOBAA= [email protected] | ||
java -cp attestation-0.3.13-all.jar org.devcon.ticket.Validator pub.pem MIGYMA8MATYCBwCMryzpzeQCAQAEQQQtqLOcLgwsajj19K141ER4A4fblUH-cH0ZM_HZQmylYiSxsPljEL--ldyfbPIslT7djTuYJakQdyapeuPpnEDjA0IA1LMfG8yWPpa2Yuyssn5fBB4MsNY3PpF0hwELzugBxw96zU4Q2k9jz5_L3Y3qIyshm8AH5EiIwm5k5LIZs3idghw= MIGqBEEECwGwPNcyCsaGTbr5_BVaThbVuQr7kUWGFI3XgT68kpMi3JGIuO5SCAX4C-ySQxSnQO-9qAZeUjYo7dfnyJiAuwQgLY3YogvmiVW8frt3wxbX9qIBqkgMTcoCdN8af7_QXCEEQQQWPq3mXaFk68AgZgOXq0ORy1XPeTicyazBHv7WGDa_3x-swwhLDW1q8JvvRfbi2t0juMdiEhiG4NgRF-4oOiIOBAA= [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package org.devcon.ticket; | ||
|
||
import java.io.IOException; | ||
import java.math.BigInteger; | ||
import org.bouncycastle.asn1.ASN1EncodableVector; | ||
import org.bouncycastle.asn1.ASN1Integer; | ||
import org.bouncycastle.asn1.ASN1Sequence; | ||
import org.bouncycastle.asn1.DERBitString; | ||
import org.bouncycastle.asn1.DEROctetString; | ||
import org.bouncycastle.asn1.DERSequence; | ||
import org.bouncycastle.asn1.DERUTF8String; | ||
import org.bouncycastle.crypto.AsymmetricCipherKeyPair; | ||
import org.bouncycastle.crypto.params.AsymmetricKeyParameter; | ||
|
||
/** | ||
* Proof of concept Ticket system for Liscon. | ||
* It is significantly less secure than the regular Ticket format and should only be used in legacy settings! | ||
*/ | ||
@Deprecated | ||
public class LisconTicket extends Ticket { | ||
public LisconTicket(String mail, String devconId, BigInteger ticketId, int ticketClass, | ||
AsymmetricCipherKeyPair keys, BigInteger secret) { | ||
super(mail, devconId, ticketId, ticketClass, keys, secret); | ||
} | ||
|
||
public LisconTicket(String devconId, BigInteger ticketId, int ticketClass, byte[] commitment, | ||
byte[] signature, AsymmetricKeyParameter publicKey) { | ||
super(devconId, ticketId, ticketClass, commitment, signature, publicKey); | ||
} | ||
|
||
@Override | ||
ASN1Sequence makeTicket() { | ||
ASN1EncodableVector ticket = new ASN1EncodableVector(); | ||
ticket.add(new DERUTF8String(getDevconId())); | ||
ticket.add(new ASN1Integer(getTicketId())); | ||
ticket.add(new ASN1Integer(getTicketClass())); | ||
return new DERSequence(ticket); | ||
} | ||
|
||
@Override | ||
byte[] encodeSignedTicket(ASN1Sequence ticket) throws IOException { | ||
ASN1EncodableVector signedTicket = new ASN1EncodableVector(); | ||
signedTicket.add(ticket); | ||
signedTicket.add(new DEROctetString(getCommitment())); | ||
signedTicket.add(new DERBitString(getSignature())); | ||
return new DERSequence(signedTicket).getEncoded(); | ||
} | ||
|
||
@Override | ||
public byte[] getDerEncodingWithPK() { | ||
throw new InternalError( | ||
"This method is not implemented and there should be no need for it as this class should only be used for legacy reasons "); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.devcon.ticket; | ||
|
||
import java.io.IOException; | ||
import java.math.BigInteger; | ||
import org.bouncycastle.asn1.ASN1InputStream; | ||
import org.bouncycastle.asn1.ASN1Integer; | ||
import org.bouncycastle.asn1.ASN1OctetString; | ||
import org.bouncycastle.asn1.ASN1Sequence; | ||
import org.bouncycastle.asn1.DERUTF8String; | ||
import org.bouncycastle.crypto.params.AsymmetricKeyParameter; | ||
|
||
/** | ||
* Proof of concept Ticket system for Liscon. | ||
* It is significantly less secure than the regular Ticket format and should only be used in legacy settings! | ||
*/ | ||
@Deprecated | ||
public class LisconTicketDecoder extends TicketDecoder { | ||
public LisconTicketDecoder(AsymmetricKeyParameter publicKey) { | ||
super(publicKey); | ||
} | ||
|
||
@Override | ||
public Ticket decode(byte[] encoding) throws IOException { | ||
ASN1InputStream input = new ASN1InputStream(encoding); | ||
ASN1Sequence asn1 = ASN1Sequence.getInstance(input.readObject()); | ||
ASN1Sequence ticket = ASN1Sequence.getInstance(asn1.getObjectAt(0)); | ||
String devconId = (DERUTF8String.getInstance(ticket.getObjectAt(0))).getString(); | ||
BigInteger ticketId = (ASN1Integer.getInstance(ticket.getObjectAt(1))).getValue(); | ||
int ticketClassInt = ASN1Integer.getInstance(ticket.getObjectAt(2)).getValue().intValueExact(); | ||
|
||
byte[] commitment = (ASN1OctetString.getInstance(asn1.getObjectAt(1))).getOctets(); | ||
byte[] signature = parsePKandSignature(asn1, devconId, 2); | ||
return new LisconTicket(devconId, ticketId, ticketClassInt, commitment, signature, getPk(devconId)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.