use of com.github.zhenwei.core.asn1.DEROctetString in project attestation by TokenScript.
the class DERUtility method encodeSecret.
public static byte[] encodeSecret(BigInteger secret) {
try {
ASN1EncodableVector asn1 = new ASN1EncodableVector();
asn1.add(new DEROctetString(secret.toByteArray()));
return new DERSequence(asn1).getEncoded();
} catch (IOException e) {
throw ExceptionUtil.makeRuntimeException(logger, "Could not encode asn1", e);
}
}
use of com.github.zhenwei.core.asn1.DEROctetString in project attestation by TokenScript.
the class Parser method getExtensions.
public Map<String, Extensions> getExtensions() {
Map<String, Extensions> res = new HashMap<>();
for (String currentDatasourceName : matching.keySet()) {
List<Extension> extensionList = new ArrayList<>();
Map<String, String> currentMap = matching.get(currentDatasourceName);
currentMap.putAll(global);
for (String oid : currentMap.keySet()) {
if (!X500_OIDS.contains(oid)) {
Extension extension = new Extension(new ASN1ObjectIdentifier(oid), true, new DEROctetString(currentMap.get(oid).getBytes(StandardCharsets.UTF_8)));
extensionList.add(extension);
}
}
res.put(currentDatasourceName, new Extensions(extensionList.toArray(new Extension[0])));
}
return res;
}
use of com.github.zhenwei.core.asn1.DEROctetString in project attestation by TokenScript.
the class LisconTicket method encodeSignedTicket.
@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();
}
use of com.github.zhenwei.core.asn1.DEROctetString 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.DEROctetString 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;
}
Aggregations