This guide shows how to set up a bidirectional client/server authentication for plain TLS sockets.
Newer versions of openssl are stricter about certificate purposes. Use extensions accordingly.
Generate a Certificate Authority:
| package br.com.mdias.rponte.signature; | |
| import java.util.Base64; | |
| /** | |
| * Represents a signed XML | |
| */ | |
| public class SignedXml { | |
| private String content; |
| import { MyChaincode } from '../<path_to_your_chaincode_class>'; | |
| import { ChaincodeMockStub, Transform } from "@theledger/fabric-mock-stub"; | |
| // You always need your chaincode so it knows which chaincode to invoke on | |
| const chaincode = new MyChaincode(); | |
| describe('Test MyChaincode', () => { | |
| it("Should query car", async () => { | |
| const mockStub = new ChaincodeMockStub("MyMockStub", chaincode); | |
| const response = await mockStub.mockInvoke("tx2", ['queryCar', `CAR0`]); | |
| expect(Transform.bufferToObject(response.payload)).to.deep.eq({ |
| #!/usr/bin/env node | |
| 'use strict'; | |
| // ethereum: generate signed transactions | |
| const fs = require('fs-extra'); | |
| const rls = require('readline-sync'); | |
| const Accounts = require('web3-eth-accounts'); | |
| const web3utils = require('web3-utils'); | |
| const accounts = new Accounts(); |
| var Web3 = require('web3'); | |
| var util = require('ethereumjs-util'); | |
| var tx = require('ethereumjs-tx'); | |
| var lightwallet = require('eth-lightwallet'); | |
| var txutils = lightwallet.txutils; | |
| var web3 = new Web3( | |
| new Web3.providers.HttpProvider('https://rinkeby.infura.io/') | |
| ); | |
| var address = '0x8D68583e625CAaE969fA9249502E105a21435EbF'; | |
| var key = '1ce642301e680f60227b9d8ffecad474f15155b6d8f8a2cb6bde8e85c8a4809a'; |
| if not exist "C:\mongodb\data\db\" mkdir C:\mongodb\data\db | |
| if not exist "C:\mongodb\data\log\" mkdir C:\mongodb\data\log | |
| @echo off | |
| :: Update the 3.4 if you have another version | |
| cd C:\Program Files\MongoDB\Server\3.4\bin | |
| ::set default port variable | |
| set port=27017 | |
| :: add this line at the end of the ~mongod.exe to write the log on a separated file |
This guide shows how to set up a bidirectional client/server authentication for plain TLS sockets.
Newer versions of openssl are stricter about certificate purposes. Use extensions accordingly.
Generate a Certificate Authority:
| // Usage example... | |
| HttpsURLConnection connection = (HttpsURLConnection) new URL("https://someurl.com").openConnection(); | |
| connection.setSSLSocketFactory(buildSslSocketFactory()); | |
| private static SSLSocketFactory buildSslSocketFactory(Context context) { | |
| // Add support for self-signed (local) SSL certificates | |
| // Based on http://developer.android.com/training/articles/security-ssl.html#UnknownCa | |
| try { | |