当前位置: 首页>>代码示例>>Java>>正文


Java ECKey.ECDSASignature方法代码示例

本文整理汇总了Java中com.google.bitcoin.core.ECKey.ECDSASignature方法的典型用法代码示例。如果您正苦于以下问题:Java ECKey.ECDSASignature方法的具体用法?Java ECKey.ECDSASignature怎么用?Java ECKey.ECDSASignature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.bitcoin.core.ECKey的用法示例。


在下文中一共展示了ECKey.ECDSASignature方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decodeFromBitcoin

import com.google.bitcoin.core.ECKey; //导入方法依赖的package包/类
/**
 * Returns a decoded signature.
 * @throws RuntimeException if the signature is invalid or unparseable in some way.
 */
public static TransactionSignature decodeFromBitcoin(byte[] bytes, boolean requireCanonical) throws VerificationException {
    // Bitcoin encoding is DER signature + sighash byte.
    if (requireCanonical && !isEncodingCanonical(bytes))
        throw new VerificationException("Signature encoding is not canonical.");
    ECKey.ECDSASignature sig;
    try {
        sig = ECKey.ECDSASignature.decodeFromDER(bytes);
    } catch (IllegalArgumentException e) {
        throw new VerificationException("Could not decode DER", e);
    }
    TransactionSignature tsig = new TransactionSignature(sig.r, sig.s);
    // In Bitcoin, any value of the final byte is valid, but not necessarily canonical. See javadocs for
    // isEncodingCanonical to learn more about this.
    tsig.sighashFlags = bytes[bytes.length - 1];
    return tsig;
}
 
开发者ID:HashEngineering,项目名称:megacoinj,代码行数:21,代码来源:TransactionSignature.java

示例2: decodeFromBitcoin

import com.google.bitcoin.core.ECKey; //导入方法依赖的package包/类
/**
 * Returns a decoded signature.
 * @throws RuntimeException if the signature is invalid or unparseable in some way.
 */
public static TransactionSignature decodeFromBitcoin(byte[] bytes, boolean requireCanonical) throws VerificationException {
    // Bitcoin encoding is DER signature + sighash byte.
    if (requireCanonical && !isEncodingCanonical(bytes))
        throw new VerificationException("Signature encoding is not canonical.");
    ECKey.ECDSASignature sig;
    try {
        sig = ECKey.ECDSASignature.decodeFromDER(bytes);
    } catch (IllegalArgumentException e) {
        throw new VerificationException("Could not decode DER", e);
    }
    // In Bitcoin, any value of the final byte is valid, but not necessarily canonical. See javadocs for
    // isEncodingCanonical to learn more about this. So we must store the exact byte found.
    return new TransactionSignature(sig.r, sig.s, bytes[bytes.length - 1]);
}
 
开发者ID:HashEngineering,项目名称:quarkcoinj,代码行数:19,代码来源:TransactionSignature.java

示例3: decodeFromBitcoin

import com.google.bitcoin.core.ECKey; //导入方法依赖的package包/类
/**
 * Returns a decoded signature.
 * @throws RuntimeException if the signature is invalid or unparseable in some way.
 */
public static TransactionSignature decodeFromBitcoin(byte[] bytes, boolean requireCanonical) throws VerificationException {
    // Bitcoin encoding is DER signature + sighash byte.
    if (requireCanonical && !isEncodingCanonical(bytes))
        throw new VerificationException("Signature encoding is not canonical.");
    ECKey.ECDSASignature sig = ECKey.ECDSASignature.decodeFromDER(bytes);
    if (sig == null)
        throw new VerificationException("Could not decode DER component.");
    TransactionSignature tsig = new TransactionSignature(sig.r, sig.s);
    // In Bitcoin, any value of the final byte is valid, but not necessarily canonical. See javadocs for
    // isEncodingCanonical to learn more about this.
    tsig.sighashFlags = bytes[bytes.length - 1];
    return tsig;
}
 
开发者ID:sserrano44,项目名称:bitcoinj-watcher-service,代码行数:18,代码来源:TransactionSignature.java

示例4: TransactionSignature

import com.google.bitcoin.core.ECKey; //导入方法依赖的package包/类
/** Constructs a transaction signature based on the ECDSA signature. */
public TransactionSignature(ECKey.ECDSASignature signature, Transaction.SigHash mode, boolean anyoneCanPay) {
    super(signature.r, signature.s);
    setSigHash(mode, anyoneCanPay);
}
 
开发者ID:HashEngineering,项目名称:megacoinj,代码行数:6,代码来源:TransactionSignature.java

示例5: TransactionSignature

import com.google.bitcoin.core.ECKey; //导入方法依赖的package包/类
/** Constructs a transaction signature based on the ECDSA signature. */
public TransactionSignature(ECKey.ECDSASignature signature, Transaction.SigHash mode, boolean anyoneCanPay) {
    super(signature.r, signature.s);
    sighashFlags = calcSigHashValue(mode, anyoneCanPay);
}
 
开发者ID:HashEngineering,项目名称:quarkcoinj,代码行数:6,代码来源:TransactionSignature.java

示例6: toCanonicalised

import com.google.bitcoin.core.ECKey; //导入方法依赖的package包/类
@Override
public ECKey.ECDSASignature toCanonicalised() {
    return new TransactionSignature(super.toCanonicalised(), sigHashMode(), anyoneCanPay());
}
 
开发者ID:HashEngineering,项目名称:quarkcoinj,代码行数:5,代码来源:TransactionSignature.java


注:本文中的com.google.bitcoin.core.ECKey.ECDSASignature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。