io.github.novacrypto.toruntime.CheckedExceptionToRuntime Java Examples

The following examples show how to use io.github.novacrypto.toruntime.CheckedExceptionToRuntime. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HdPrivateKey.java    From ontology-java-sdk with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static byte[] getBytes(final String seed) {
    return toRuntime(new CheckedExceptionToRuntime.Func<byte[]>() {
        @Override
        public byte[] run() throws Exception {
            return seed.getBytes(StandardCharsets.UTF_8);
        }
    });
}
 
Example #2
Source File: Main.java    From BitcoinWallet with MIT License 5 votes vote down vote up
private static byte[] getUtf8Bytes(final String str) {
    return toRuntime(new CheckedExceptionToRuntime.Func<byte[]>() {
        @Override
        public byte[] run() throws Exception {
            return str.getBytes("UTF-8");
        }
    });
}
 
Example #3
Source File: ExtendedPrivateKey.java    From dapp-wallet-demo with Apache License 2.0 5 votes vote down vote up
private static byte[] getBytes(final String seed) {
    return toRuntime(new CheckedExceptionToRuntime.Func<byte[]>() {
        @Override
        public byte[] run() throws Exception {
            return seed.getBytes("UTF-8");
        }
    });
}
 
Example #4
Source File: HmacSha512.java    From dapp-wallet-demo with Apache License 2.0 5 votes vote down vote up
private static Mac initialize(final byte[] byteKey) {
    final Mac hmacSha512 = getInstance(HMAC_SHA512);
    final SecretKeySpec keySpec = new SecretKeySpec(byteKey, HMAC_SHA512);
    toRuntime(new CheckedExceptionToRuntime.Action() {
        @Override
        public void run() throws Exception {
            hmacSha512.init(keySpec);
        }
    });
    return hmacSha512;
}
 
Example #5
Source File: HmacSha512.java    From dapp-wallet-demo with Apache License 2.0 5 votes vote down vote up
private static Mac getInstance(final String HMAC_SHA256) {
    return toRuntime(new CheckedExceptionToRuntime.Func<Mac>() {
        @Override
        public Mac run() throws Exception {
            return Mac.getInstance(HMAC_SHA256);
        }
    });
}