use of com.github.zhenwei.core.asn1.DERSequence in project attestation by TokenScript.
the class Ticket method makeTicket.
ASN1Sequence makeTicket() {
ASN1EncodableVector ticket = new ASN1EncodableVector();
ticket.add(new DERUTF8String(devconId));
ticket.add(new ASN1Integer(ticketId));
ticket.add(new ASN1Integer(ticketClass));
ticket.add(new DEROctetString(commitment));
return new DERSequence(ticket);
}
use of com.github.zhenwei.core.asn1.DERSequence in project attestation by TokenScript.
the class Attestation method setSmartcontracts.
// TODO change to list of arrays of 20 bytes
public void setSmartcontracts(List<Long> smartcontracts) {
ASN1EncodableVector seq = new ASN1EncodableVector();
for (long current : smartcontracts) {
seq.add(new ASN1Integer(current));
}
this.smartcontracts = new DERSequence(seq);
}
use of com.github.zhenwei.core.asn1.DERSequence in project attestation by TokenScript.
the class AttestationRequest method getDerEncoding.
@Override
public byte[] getDerEncoding() {
try {
ASN1EncodableVector res = new ASN1EncodableVector();
res.add(new ASN1Integer(type.ordinal()));
res.add(ASN1Primitive.fromByteArray(pok.getDerEncoding()));
return new DERSequence(res).getEncoded();
} catch (IOException e) {
throw ExceptionUtil.makeRuntimeException(logger, "Could not encode asn1", e);
}
}
use of com.github.zhenwei.core.asn1.DERSequence in project attestation by TokenScript.
the class FullProofOfExponent method makeEncoding.
private byte[] makeEncoding(ECPoint riddle, ECPoint tPoint, BigInteger challenge, byte[] unpredictableNumber) {
try {
ASN1EncodableVector res = new ASN1EncodableVector();
res.add(new DEROctetString(riddle.getEncoded(false)));
res.add(new DEROctetString(challenge.toByteArray()));
res.add(new DEROctetString(tPoint.getEncoded(false)));
res.add(new DEROctetString(unpredictableNumber));
return new DERSequence(res).getEncoded();
} catch (IOException e) {
throw ExceptionUtil.makeRuntimeException(logger, "Could not encode asn1", e);
}
}
use of com.github.zhenwei.core.asn1.DERSequence in project attestation by TokenScript.
the class Cheque method encodeSignedCheque.
private byte[] encodeSignedCheque(ASN1Sequence cheque, byte[] signature, AsymmetricKeyParameter publicKey) throws IOException {
ASN1EncodableVector signedCheque = new ASN1EncodableVector();
signedCheque.add(cheque);
SubjectPublicKeyInfo spki = SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(publicKey);
signedCheque.add(spki.getPublicKeyData());
signedCheque.add(new DERBitString(signature));
return new DERSequence(signedCheque).getEncoded();
}
Aggregations