本文整理汇总了Java中org.spongycastle.util.encoders.DecoderException类的典型用法代码示例。如果您正苦于以下问题:Java DecoderException类的具体用法?Java DecoderException怎么用?Java DecoderException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DecoderException类属于org.spongycastle.util.encoders包,在下文中一共展示了DecoderException类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testNonCanonicalSigs
import org.spongycastle.util.encoders.DecoderException; //导入依赖的package包/类
@Test
public void testNonCanonicalSigs() throws Exception {
// Tests the noncanonical sigs from the reference client unit tests
InputStream in = getClass().getResourceAsStream("sig_noncanonical.json");
// Poor man's JSON parser (because pulling in a lib for this is overkill)
while (in.available() > 0) {
while (in.available() > 0 && in.read() != '"') ;
if (in.available() < 1)
break;
StringBuilder sig = new StringBuilder();
int c;
while (in.available() > 0 && (c = in.read()) != '"')
sig.append((char)c);
try {
final String sigStr = sig.toString();
assertFalse(TransactionSignature.isEncodingCanonical(Hex.decode(sigStr)));
} catch (DecoderException e) {
// Expected for non-hex strings in the JSON that we should ignore
}
}
in.close();
}
开发者ID:pavel4n,项目名称:wowdoge.org,代码行数:26,代码来源:ECKeyTest.java
示例2: addressStringToBytes
import org.spongycastle.util.encoders.DecoderException; //导入依赖的package包/类
/**
* Decodes a hex string to address bytes and checks validity
*
* @param hex - a hex string of the address, e.g., 6c386a4b26f73c802f34673f7248bb118f97424a
* @return - decode and validated address byte[]
*/
public static byte[] addressStringToBytes(String hex) {
final byte[] addr;
try {
addr = Hex.decode(hex);
} catch (DecoderException addressIsNotValid) {
return null;
}
if (isValidAddress(addr))
return addr;
return null;
}
开发者ID:talentchain,项目名称:talchain,代码行数:19,代码来源:Utils.java
示例3: isValidAddress
import org.spongycastle.util.encoders.DecoderException; //导入依赖的package包/类
public boolean isValidAddress(String address) {
try {
return Utils.isValidAddress(Hex.decode(address.replace("0x", "")));
} catch (DecoderException e) {
return false;
}
}
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:8,代码来源:EthereumKeyGenerator.java
示例4: addressStringToBytes
import org.spongycastle.util.encoders.DecoderException; //导入依赖的package包/类
/**
* Decodes a hex string to address bytes and checks validity
*
* @param hex - a hex string of the address, e.g., 6c386a4b26f73c802f34673f7248bb118f97424a
* @return - decode and validated address byte[]
*/
public static byte[] addressStringToBytes(String hex) {
final byte[] addr;
try {
addr = Hex.decode(hex);
} catch (DecoderException addressIsNotValid) {
return null;
}
if (isValidAddress(addr)) {
return addr;
}
return null;
}
开发者ID:rsksmart,项目名称:rskj,代码行数:20,代码来源:Utils.java
示例5: addressStringToBytes
import org.spongycastle.util.encoders.DecoderException; //导入依赖的package包/类
/**
* Decodes a hex string to address bytes and checks validity
*
* @param hex - a hex string of the address, e.g., 6c386a4b26f73c802f34673f7248bb118f97424a
*
* @return - decode and validated address byte[]
*/
public static byte[] addressStringToBytes(String hex) {
byte[] addr;
try {
addr = Hex.decode(hex);
} catch (DecoderException addressIsNotValid) {
return null;
}
if (isValidAddress(addr)) return addr;
return null;
}
开发者ID:Aptoide,项目名称:AppCoins-ethereumj,代码行数:19,代码来源:Utils.java
示例6: getEncryptedKeyFromBase64Text
import org.spongycastle.util.encoders.DecoderException; //导入依赖的package包/类
public static SymmetricKeyEncrypted getEncryptedKeyFromBase64Text(String text) throws Base64DecodingException {
try {
byte[] data = Base64.decode(text);
return getEncryptedKeyFromTransferBytes(data);
}
catch (DecoderException ex) {
throw new Base64DecodingException(ex);
}
}
开发者ID:oversecio,项目名称:oversec_crypto,代码行数:10,代码来源:OversecKeystore2.java
示例7: getPlainKeyFromBase64Text
import org.spongycastle.util.encoders.DecoderException; //导入依赖的package包/类
public static SymmetricKeyPlain getPlainKeyFromBase64Text(String text) throws Base64DecodingException {
try {
byte[] data = Base64.decode(text);
return getPlainKeyFromTransferBytes(data);
}
catch (DecoderException ex) {
throw new Base64DecodingException(ex);
}
}
开发者ID:oversecio,项目名称:oversec_crypto,代码行数:10,代码来源:OversecKeystore2.java
示例8: addressStringToBytes
import org.spongycastle.util.encoders.DecoderException; //导入依赖的package包/类
/**
* Decodes a hex string to address bytes and checks validity
*
* @param hex - a hex string of the address, e.g., 6c386a4b26f73c802f34673f7248bb118f97424a
* @return - decode and validated address byte[]
*/
public static byte[] addressStringToBytes(String hex) {
byte[] addr = null;
try { addr = Hex.decode(hex); }
catch(DecoderException addressIsNotValid) { return null; }
if(isValidAddress(addr))
return addr;
return null;
}
开发者ID:ethereumj,项目名称:ethereumj,代码行数:16,代码来源:Utils.java
示例9: invalidHexAddress
import org.spongycastle.util.encoders.DecoderException; //导入依赖的package包/类
@Test(expected = DecoderException.class)
public void invalidHexAddress() {
new RskAddress("000000000000000000000000000000000100000X");
}
开发者ID:rsksmart,项目名称:rskj,代码行数:5,代码来源:RskAddressTest.java
示例10: Base64DecodingException
import org.spongycastle.util.encoders.DecoderException; //导入依赖的package包/类
public Base64DecodingException(DecoderException ex) {
super(ex);
}
开发者ID:oversecio,项目名称:oversec_crypto,代码行数:4,代码来源:OversecKeystore2.java
注:本文中的org.spongycastle.util.encoders.DecoderException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论