use of com.github.zhenwei.core.asn1.ASN1EncodableVector 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.ASN1EncodableVector 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.ASN1EncodableVector in project attestation by TokenScript.
the class ERC721Token method getTokenVector.
public ASN1EncodableVector getTokenVector() {
ASN1EncodableVector data = new ASN1EncodableVector();
data.add(new DEROctetString(Numeric.hexStringToByteArray(address)));
data.add(new DEROctetString(tokenId.toByteArray()));
return data;
}
use of com.github.zhenwei.core.asn1.ASN1EncodableVector 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.ASN1EncodableVector 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