當前位置: 首頁>>代碼示例>>Java>>正文


Java ECDSASigner.verifySignature方法代碼示例

本文整理匯總了Java中org.spongycastle.crypto.signers.ECDSASigner.verifySignature方法的典型用法代碼示例。如果您正苦於以下問題:Java ECDSASigner.verifySignature方法的具體用法?Java ECDSASigner.verifySignature怎麽用?Java ECDSASigner.verifySignature使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.spongycastle.crypto.signers.ECDSASigner的用法示例。


在下文中一共展示了ECDSASigner.verifySignature方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: verify

import org.spongycastle.crypto.signers.ECDSASigner; //導入方法依賴的package包/類
/**
 * <p>Verifies the given ECDSA signature against the message bytes using the public key bytes.</p>
 * 
 * <p>When using native ECDSA verification, data must be 32 bytes, and no element may be
 * larger than 520 bytes.</p>
 *
 * @param data      Hash of the data to verify.
 * @param signature ASN.1 encoded signature.
 * @param pub       The public key bytes to use.
 */
public static boolean verify(byte[] data, ECDSASignature signature, byte[] pub) {
    if (FAKE_SIGNATURES)
        return true;

    ECDSASigner signer = new ECDSASigner();
    ECPublicKeyParameters params = new ECPublicKeyParameters(CURVE.getCurve().decodePoint(pub), CURVE);
    signer.init(false, params);
    try {
        return signer.verifySignature(data, signature.r, signature.s);
    } catch (NullPointerException e) {
        // Bouncy Castle contains a bug that can cause NPEs given specially crafted signatures. Those signatures
        // are inherently invalid/attack sigs so we just fail them here rather than crash the thread.
        log.error("Caught NPE inside bouncy castle", e);
        return false;
    }
}
 
開發者ID:rsksmart,項目名稱:bitcoinj-thin,代碼行數:27,代碼來源:BtcECKey.java

示例2: verify

import org.spongycastle.crypto.signers.ECDSASigner; //導入方法依賴的package包/類
public static boolean verify(byte[] data, ECDSASignature signature, byte[] pub) {
    if (NativeSecp256k1.enabled) {
        return NativeSecp256k1.verify(data, signature.encodeToDER(), pub);
    }

    ECDSASigner signer = new ECDSASigner();
    ECPublicKeyParameters params = new ECPublicKeyParameters(CURVE.getCurve().decodePoint
            (pub), CURVE);
    signer.init(false, params);
    try {
        return signer.verifySignature(data, signature.r, signature.s);
    } catch (NullPointerException e) {
        // Bouncy Castle contains a bug that can cause NPEs given specially crafted
        // signatures. Those signatures
        // are inherently invalid/attack sigs so we just fail them here rather than crash the
        // thread.
        Log.e("ECKey", "Caught NPE inside bouncy castle");
        e.printStackTrace();
        return false;
    }
}
 
開發者ID:chaincloud-dot-com,項目名稱:chaincloud-v,代碼行數:22,代碼來源:ECKey.java

示例3: verify

import org.spongycastle.crypto.signers.ECDSASigner; //導入方法依賴的package包/類
/**
 * <p>Verifies the given ECDSA signature against the message bytes using the public key bytes.</p>
 * 
 * <p>When using native ECDSA verification, data must be 32 bytes, and no element may be
 * larger than 520 bytes.</p>
 *
 * @param data      Hash of the data to verify.
 * @param signature ASN.1 encoded signature.
 * @param pub       The public key bytes to use.
 */
public static boolean verify(byte[] data, ECDSASignature signature, byte[] pub) {
    if (FAKE_SIGNATURES)
        return true;

    if (NativeSecp256k1.enabled)
        return NativeSecp256k1.verify(data, signature.encodeToDER(), pub);

    ECDSASigner signer = new ECDSASigner();
    ECPublicKeyParameters params = new ECPublicKeyParameters(CURVE.getCurve().decodePoint(pub), CURVE);
    signer.init(false, params);
    try {
        return signer.verifySignature(data, signature.r, signature.s);
    } catch (NullPointerException e) {
        // Bouncy Castle contains a bug that can cause NPEs given specially crafted signatures. Those signatures
        // are inherently invalid/attack sigs so we just fail them here rather than crash the thread.
        log.error("Caught NPE inside bouncy castle");
        e.printStackTrace();
        return false;
    }
}
 
開發者ID:HashEngineering,項目名稱:namecoinj,代碼行數:31,代碼來源:ECKey.java

示例4: verify

import org.spongycastle.crypto.signers.ECDSASigner; //導入方法依賴的package包/類
/**
 * <p>Verifies the given ECDSA signature against the message bytes using the public key bytes.</p>
 *
 * <p>When using native ECDSA verification, data must be 32 bytes, and no element may be
 * larger than 520 bytes.</p>
 *
 * @param data      Hash of the data to verify.
 * @param signature ASN.1 encoded signature.
 * @param pub       The public key bytes to use.
 */
public static boolean verify(byte[] data, ECDSASignature signature, byte[] pub) {
    if (FAKE_SIGNATURES)
        return true;
    
    if (NativeSecp256k1.enabled)
        return NativeSecp256k1.verify(data, signature.encodeToDER(), pub);
    
    ECDSASigner signer = new ECDSASigner();
    ECPublicKeyParameters params = new ECPublicKeyParameters(CURVE.getCurve().decodePoint(pub), CURVE);
    signer.init(false, params);
    try {
        return signer.verifySignature(data, signature.r, signature.s);
    } catch (NullPointerException e) {
        // Bouncy Castle contains a bug that can cause NPEs given specially crafted signatures. Those signatures
        // are inherently invalid/attack sigs so we just fail them here rather than crash the thread.
        log.error("Caught NPE inside bouncy castle");
        e.printStackTrace();
        return false;
    }
}
 
開發者ID:10xEngineer,項目名稱:My-Wallet-Android,代碼行數:31,代碼來源:ECKey.java

示例5: verify

import org.spongycastle.crypto.signers.ECDSASigner; //導入方法依賴的package包/類
/**
 * <p>Verifies the given ECDSA signature against the message bytes using the public key bytes.</p>
 * <p/>
 * <p>When using native ECDSA verification, data must be 32 bytes, and no element may be
 * larger than 520 bytes.</p>
 *
 * @param data      Hash of the data to verify.
 * @param signature ASN.1 encoded signature.
 * @param pub       The public key bytes to use.
 */
public static boolean verify(byte[] data, ECDSASignature signature, byte[] pub) {
    if (FAKE_SIGNATURES)
        return true;

    if (NativeSecp256k1.enabled)
        return NativeSecp256k1.verify(data, signature.encodeToDER(), pub);

    ECDSASigner signer = new ECDSASigner();
    ECPublicKeyParameters params = new ECPublicKeyParameters(CURVE.getCurve().decodePoint(pub), CURVE);
    signer.init(false, params);
    try {
        return signer.verifySignature(data, signature.r, signature.s);
    } catch (NullPointerException e) {
        // Bouncy Castle contains a bug that can cause NPEs given specially crafted signatures. Those signatures
        // are inherently invalid/attack sigs so we just fail them here rather than crash the thread.
        log.error("Caught NPE inside bouncy castle");
        e.printStackTrace();
        return false;
    }
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:31,代碼來源:ECKey.java

示例6: verify

import org.spongycastle.crypto.signers.ECDSASigner; //導入方法依賴的package包/類
/**
 * <p>Verifies the given ECDSA signature against the message bytes using the public key bytes.</p>
 * 
 * <p>When using native ECDSA verification, data must be 32 bytes, and no element may be
 * larger than 520 bytes.</p>
 *
 * @param data      Hash of the data to verify.
 * @param signature ASN.1 encoded signature.
 * @param pub       The public key bytes to use.
 */
public static boolean verify(byte[] data, ECDSASignature signature, byte[] pub) {
    if (NativeSecp256k1.enabled)
        return NativeSecp256k1.verify(data, signature.encodeToDER(), pub);

    ECDSASigner signer = new ECDSASigner();
    ECPublicKeyParameters params = new ECPublicKeyParameters(CURVE.getCurve().decodePoint(pub), CURVE);
    signer.init(false, params);
    try {
        return signer.verifySignature(data, signature.r, signature.s);
    } catch (NullPointerException e) {
        // Bouncy Castle contains a bug that can cause NPEs given specially crafted signatures. Those signatures
        // are inherently invalid/attack sigs so we just fail them here rather than crash the thread.
        log.error("Caught NPE inside bouncy castle");
        e.printStackTrace();
        return false;
    }
}
 
開發者ID:sserrano44,項目名稱:bitcoinj-watcher-service,代碼行數:28,代碼來源:ECKey.java

示例7: verify

import org.spongycastle.crypto.signers.ECDSASigner; //導入方法依賴的package包/類
/**
 * <p>xVerifies the given ECDSA signature against the message bytes using the public key bytes.</p>
 * 
 * <p>When using native ECDSA verification, data must be 32 bytes, and no element may be
 * larger than 520 bytes.</p>
 *
 * @param data      Hash of the data to verify.
 * @param signature ASN.1 encoded signature.
 * @param pub       The public key bytes to use.
 */
public static boolean verify(byte[] data, ECDSASignature signature, byte[] pub) {
    if (NativeSecp256k1.enabled)
        return NativeSecp256k1.verify(data, signature.encodeToDER(), pub);

    ECDSASigner signer = new ECDSASigner();
    ECPublicKeyParameters params = new ECPublicKeyParameters(ecParams.getCurve().decodePoint(pub), ecParams);
    signer.init(false, params);
    try {
        return signer.verifySignature(data, signature.r, signature.s);
    } catch (NullPointerException e) {
        // Bouncy Castle contains a bug that can cause NPEs given specially crafted signatures. Those signatures
        // are inherently invalid/attack sigs so we just fail them here rather than crash the thread.
        log.error("Caught NPE inside bouncy castle");
        e.printStackTrace();
        return false;
    }
}
 
開發者ID:praus,項目名稱:multicoinj,代碼行數:28,代碼來源:ECKey.java

示例8: verify

import org.spongycastle.crypto.signers.ECDSASigner; //導入方法依賴的package包/類
/**
 * <p>Verifies the given ECDSA signature against the message bytes using the public key bytes.</p>
 *
 * <p>When using native ECDSA verification, data must be 32 bytes, and no element may be
 * larger than 520 bytes.</p>
 *
 * @param data Hash of the data to verify.
 * @param signature signature.
 * @param pub The public key bytes to use.
 *
 * @return -
 */
public static boolean verify(byte[] data, ECDSASignature signature, byte[] pub) {
    ECDSASigner signer = new ECDSASigner();
    ECPublicKeyParameters params = new ECPublicKeyParameters(CURVE.getCurve().decodePoint(pub), CURVE);
    signer.init(false, params);
    try {
        return signer.verifySignature(data, signature.r, signature.s);
    } catch (NullPointerException npe) {
        // Bouncy Castle contains a bug that can cause NPEs given specially crafted signatures.
        // Those signatures are inherently invalid/attack sigs so we just fail them here rather than crash the thread.
        logger.error("Caught NPE inside bouncy castle", npe);
        return false;
    }
}
 
開發者ID:talentchain,項目名稱:talchain,代碼行數:26,代碼來源:ECKey.java

示例9: verify

import org.spongycastle.crypto.signers.ECDSASigner; //導入方法依賴的package包/類
/**
 * 驗證簽名
 */
public static boolean verify(byte[] data, ECDSASignature signature, byte[] pub) {
    ECDSASigner signer = new ECDSASigner();
    ECPublicKeyParameters params = new ECPublicKeyParameters(CURVE.getCurve().decodePoint(pub), CURVE);
    signer.init(false, params);
    try {
        return signer.verifySignature(data, signature.r, signature.s);
    } catch (NullPointerException e) {
        log.error("Caught NPE inside bouncy castle", e);
        return false;
    }
}
 
開發者ID:nuls-io,項目名稱:nuls,代碼行數:15,代碼來源:ECKey.java

示例10: verify

import org.spongycastle.crypto.signers.ECDSASigner; //導入方法依賴的package包/類
/**
 * <p>Verifies the given ECDSA signature against the message bytes using the public key bytes.</p>
 *
 * <p>When using native ECDSA verification, data must be 32 bytes, and no element may be
 * larger than 520 bytes.</p>
 *
 * @param data Hash of the data to verify.
 * @param signature signature.
 * @param pub The public key bytes to use.
 *
 * @return -
 */
public static boolean verify(byte[] data, ECDSASignature signature, byte[] pub) {
  ECDSASigner signer = new ECDSASigner();
  ECPublicKeyParameters params = new ECPublicKeyParameters(CURVE.getCurve()
      .decodePoint(pub), CURVE);
  signer.init(false, params);
  try {
    return signer.verifySignature(data, signature.r, signature.s);
  } catch (NullPointerException npe) {
    // Bouncy Castle contains a bug that can cause NPEs given specially crafted signatures.
    // Those signatures are inherently invalid/attack sigs so we just fail them here rather than crash the thread.
    //            logger.error("Caught NPE inside bouncy castle", npe);
    return false;
  }
}
 
開發者ID:Aptoide,項目名稱:AppCoins-ethereumj,代碼行數:27,代碼來源:ECKey.java

示例11: verify

import org.spongycastle.crypto.signers.ECDSASigner; //導入方法依賴的package包/類
/**
     * <p>Verifies the given ECDSA signature against the message bytes using the public key bytes.</p>
     *
     * <p>When using native ECDSA verification, data must be 32 bytes, and no element may be
     * larger than 520 bytes.</p>
     *
     * @param data Hash of the data to verify.
     * @param signature signature.
     * @param pub The public key bytes to use.
     *
     * @return -
     */
    public static boolean verify(byte[] data, ECDSASignature signature, byte[] pub) {
        ECDSASigner signer = new ECDSASigner();
        ECPublicKeyParameters params = new ECPublicKeyParameters(CURVE.getCurve().decodePoint(pub), CURVE);
        signer.init(false, params);
        try {
            return signer.verifySignature(data, signature.r, signature.s);
        } catch (NullPointerException npe) {
            // Bouncy Castle contains a bug that can cause NPEs given specially crafted signatures.
            // Those signatures are inherently invalid/attack sigs so we just fail them here rather than crash the thread.
//            logger.error("Caught NPE inside bouncy castle", npe);
            return false;
        }
    }
 
開發者ID:Aptoide,項目名稱:AppCoins-ethereumj,代碼行數:26,代碼來源:ECKey.java

示例12: verify

import org.spongycastle.crypto.signers.ECDSASigner; //導入方法依賴的package包/類
public static boolean verify(byte[] pub, byte[] dataForSigning,
		BigInteger[] rs) throws Exception {
	ECDSASigner signer = new ECDSASigner();
	X9ECParameters params = SECNamedCurves.getByName("secp256r1");
	ECDomainParameters ecParams = new ECDomainParameters(params.getCurve(),
			params.getG(), params.getN(), params.getH());
	ECPublicKeyParameters pubKeyParams = new ECPublicKeyParameters(ecParams
			.getCurve().decodePoint(pub), ecParams);
	signer.init(false, pubKeyParams);

	return signer.verifySignature(dataForSigning, rs[0].abs(), rs[1].abs());
}
 
開發者ID:zsavvas,項目名稱:ReCRED_FIDO_UAF_OIDC,代碼行數:13,代碼來源:NamedCurve.java

示例13: verify

import org.spongycastle.crypto.signers.ECDSASigner; //導入方法依賴的package包/類
/**
 * <p>Verifies the given ECDSA signature against the message bytes using the public key bytes.</p>
 *
 * <p>When using native ECDSA verification, data must be 32 bytes, and no element may be
 * larger than 520 bytes.</p>
 *
 * @param data Hash of the data to verify.
 * @param signature signature.
 * @param pub The public key bytes to use.
 *
 * @return -
 */
public static boolean verify(byte[] data, ECDSASignature signature, byte[] pub) {
    ECDSASigner signer = new ECDSASigner();
    ECPublicKeyParameters params = new ECPublicKeyParameters(CURVE.getCurve().decodePoint(pub), CURVE);
    signer.init(false, params);
    try {
        return signer.verifySignature(data, signature.r, signature.s);
    } catch (NullPointerException npe) {
        // Bouncy Castle contains a bug that can cause NPEs given specially crafted signatures.
        // Those signatures are inherently invalid/attack sigs so we just fail them here rather than crash the thread.
        logger.severe("Caught NPE inside bouncy castle" + npe.getMessage());
        return false;
    }
}
 
開發者ID:mudpedal,項目名稱:cgk-tetherj,代碼行數:26,代碼來源:ECKey.java

示例14: verify

import org.spongycastle.crypto.signers.ECDSASigner; //導入方法依賴的package包/類
public static boolean verify(byte[] pub, byte[] dataForSigning,
		BigInteger[] rs) {
	ECDSASigner signer = new ECDSASigner();
	X9ECParameters params = SECNamedCurves.getByName("secp256r1");
	ECDomainParameters ecParams = new ECDomainParameters(params.getCurve(),
			params.getG(), params.getN(), params.getH());
	ECPublicKeyParameters pubKeyParams = new ECPublicKeyParameters(ecParams
			.getCurve().decodePoint(pub), ecParams);
	signer.init(false, pubKeyParams);

	return signer.verifySignature(dataForSigning, rs[0].abs(), rs[1].abs());
}
 
開發者ID:eBay,項目名稱:UAF,代碼行數:13,代碼來源:NamedCurve.java

示例15: verify

import org.spongycastle.crypto.signers.ECDSASigner; //導入方法依賴的package包/類
/**
 * <p>Verifies the given ECDSA signature against the message bytes using the public key bytes.</p>
 * 
 * <p>When using native ECDSA verification, data must be 32 bytes, and no element may be
 * larger than 520 bytes.</p>
 *
 * @param data      Hash of the data to verify.
 * @param signature signature.
 * @param pub       The public key bytes to use.
 */
public static boolean verify(byte[] data, ECDSASignature signature, byte[] pub) {
    ECDSASigner signer = new ECDSASigner();
    ECPublicKeyParameters params = new ECPublicKeyParameters(CURVE.getCurve().decodePoint(pub), CURVE);
    signer.init(false, params);
    try {
        return signer.verifySignature(data, signature.r, signature.s);
    } catch (NullPointerException npe) {
        // Bouncy Castle contains a bug that can cause NPEs given specially crafted signatures. 
    	// Those signatures are inherently invalid/attack sigs so we just fail them here rather than crash the thread.
        logger.error("Caught NPE inside bouncy castle", npe);
        return false;
    }
}
 
開發者ID:ethereumj,項目名稱:ethereumj,代碼行數:24,代碼來源:ECKey.java


注:本文中的org.spongycastle.crypto.signers.ECDSASigner.verifySignature方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。