List of usage examples for org.bouncycastle.asn1 DEROctetString DEROctetString
public DEROctetString(ASN1Encodable obj) throws IOException
From source file:org.cryptoworkshop.ximix.client.connection.signing.message.BLSPartialCreateMessage.java
License:Apache License
public BLSPartialCreateMessage(String keyID, Element h, Participant[] nodesToUse) { this.keyID = keyID; this.h = new DEROctetString(h.toBytes()); this.nodesToUse = nodesToUse; }
From source file:org.cryptoworkshop.ximix.client.connection.signing.message.ECDSAPointMessage.java
License:Apache License
@Override public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(new DERUTF8String(keyID)); v.add(new DEROctetString(point)); return new DERSequence(v); }
From source file:org.cryptoworkshop.ximix.common.asn1.board.Pair.java
License:Apache License
/** * <pre>//from w ww. j a va2s.c o m * Pair ::= SEQUENCE { * x OCTET STRING, * y OCTET STRING * } * </pre> * * @return an encoding of an ASN.1 sequence */ public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(new DEROctetString(ecPair.getX().getEncoded())); v.add(new DEROctetString(ecPair.getY().getEncoded())); return new DERSequence(v); }
From source file:org.cryptoworkshop.ximix.common.asn1.board.PairSequenceWithProofs.java
License:Apache License
/** * <pre>/*from w w w. j ava 2 s.c o m*/ * PairSequence ::= SEQUENCE OF Pair * </pre> * * @return an encoding of an ASN.1 sequence */ public ASN1Primitive toASN1Primitive() { ASN1EncodableVector tot = new ASN1EncodableVector(); ASN1EncodableVector v = new ASN1EncodableVector(); for (ECPair pair : ecPairs) { v.add(new Pair(pair)); } tot.add(new DERSequence(v)); v = new ASN1EncodableVector(); for (ECDecryptionProof proof : ecProofs) { ASN1EncodableVector proofV = new ASN1EncodableVector(); proofV.add(new DEROctetString(proof.getA().getEncoded(true))); proofV.add(new DEROctetString(proof.getB().getEncoded(true))); proofV.add(new ASN1Integer(proof.getR())); v.add(new DERSequence(proofV)); } tot.add(new DERSequence(v)); return new DERSequence(tot); }
From source file:org.cryptoworkshop.ximix.common.asn1.board.PointSequence.java
License:Apache License
/** * <pre>//from ww w . j av a2s .co m * PointSequence ::= SEQUENCE OF Point * </pre> * * @return an encoding of an ASN.1 sequence */ public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); for (ECPoint point : ecPoints) { v.add(new DEROctetString(point.getEncoded())); } return new DERSequence(v); }
From source file:org.cryptoworkshop.ximix.common.asn1.message.BoardUploadIndexedMessage.java
License:Apache License
@Override public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(new DERUTF8String(boardName)); v.add(new ASN1Integer(index)); ASN1EncodableVector dataV = new ASN1EncodableVector(); for (int i = 0; i != data.length; i++) { dataV.add(new DEROctetString(data[i])); }/*from ww w .j av a 2 s .co m*/ v.add(new DERSequence(dataV)); return new DERSequence(v); }
From source file:org.cryptoworkshop.ximix.common.asn1.message.BoardUploadMessage.java
License:Apache License
@Override public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(new DERUTF8String(boardName)); ASN1EncodableVector dataV = new ASN1EncodableVector(); for (int i = 0; i != data.length; i++) { dataV.add(new DEROctetString(data[i])); }/* w w w .j a v a 2 s. c om*/ v.add(new DERSequence(dataV)); return new DERSequence(v); }
From source file:org.cryptoworkshop.ximix.common.asn1.message.ChallengeLogMessage.java
License:Apache License
@Override public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(new ASN1Integer(index)); v.add(new ASN1Integer(sequenceNo)); v.add(ASN1Boolean.getInstance(hasPassed)); v.add(keyInfo);/*from w w w .j a v a2s .c o m*/ v.add(new PointSequence(sourceMessage)); ASN1EncodableVector dv = new ASN1EncodableVector(); for (ECDecryptionProof proof : decryptionProofs) { ASN1EncodableVector proofV = new ASN1EncodableVector(); proofV.add(new DEROctetString(proof.getA().getEncoded(true))); proofV.add(new DEROctetString(proof.getB().getEncoded(true))); proofV.add(new ASN1Integer(proof.getR())); dv.add(new DERSequence(proofV)); } v.add(new DERSequence(dv)); return new DERSequence(v); }
From source file:org.cryptoworkshop.ximix.common.asn1.message.DecryptDataMessage.java
License:Apache License
@Override public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); ASN1EncodableVector mv = new ASN1EncodableVector(); for (byte[] message : messages) { mv.add(new DEROctetString(message)); }/* ww w.j a v a 2 s . com*/ v.add(new DERUTF8String(keyID)); v.add(new DERSequence(mv)); return new DERSequence(v); }
From source file:org.cryptoworkshop.ximix.common.asn1.message.ECPointMessage.java
License:Apache License
/** * <pre>//from w w w . ja v a 2s . c o m * OCTET STRING value. * </pre> * @return the ASN.1 primitive representing this object. */ @Override public ASN1Primitive toASN1Primitive() { return new DEROctetString(point.getEncoded()); }