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


Java ECPublicKey.getW方法代碼示例

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


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

示例1: extractPublicKey

import java.security.interfaces.ECPublicKey; //導入方法依賴的package包/類
private static ECPoint extractPublicKey(final ECPublicKey ecPublicKey) {
    final java.security.spec.ECPoint publicPointW = ecPublicKey.getW();
    final BigInteger xCoord = publicPointW.getAffineX();
    final BigInteger yCoord = publicPointW.getAffineY();

    return CURVE.getCurve().createPoint(xCoord, yCoord);
}
 
開發者ID:toshiapp,項目名稱:toshi-headless-client,代碼行數:8,代碼來源:ECKey.java

示例2: extractPublicKey

import java.security.interfaces.ECPublicKey; //導入方法依賴的package包/類
private static ECPoint extractPublicKey(final ECPublicKey ecPublicKey) {
  final java.security.spec.ECPoint publicPointW = ecPublicKey.getW();
  final BigInteger xCoord = publicPointW.getAffineX();
  final BigInteger yCoord = publicPointW.getAffineY();

  return CURVE.getCurve().createPoint(xCoord, yCoord);
}
 
開發者ID:talentchain,項目名稱:talchain,代碼行數:8,代碼來源:ECKey.java

示例3: EC

import java.security.interfaces.ECPublicKey; //導入方法依賴的package包/類
EC(PublicKey key) throws KeyException {
    super(key);
    ECPublicKey ecKey = (ECPublicKey)key;
    ECPoint ecPoint = ecKey.getW();
    ecParams = ecKey.getParams();
    try {
        AccessController.doPrivileged(
            new PrivilegedExceptionAction<Void>() {
                public Void run() throws
                    ClassNotFoundException, NoSuchMethodException
                {
                    getMethods();
                    return null;
                }
            }
        );
    } catch (PrivilegedActionException pae) {
        throw new KeyException("ECKeyValue not supported",
                                pae.getException());
    }
    Object[] args = new Object[] { ecPoint, ecParams.getCurve() };
    try {
        ecPublicKey = (byte[])encodePoint.invoke(null, args);
    } catch (IllegalAccessException iae) {
        throw new KeyException(iae);
    } catch (InvocationTargetException ite) {
        throw new KeyException(ite);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:30,代碼來源:DOMKeyValue.java

示例4: EC

import java.security.interfaces.ECPublicKey; //導入方法依賴的package包/類
EC(PublicKey key) throws KeyException {
    super(key);
    ECPublicKey ecKey = (ECPublicKey)key;
    ECPoint ecPoint = ecKey.getW();
    ecParams = ecKey.getParams();
    ecPublicKey = encodePoint(ecPoint, ecParams.getCurve());
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:8,代碼來源:DOMKeyValue.java

示例5: extractPublicKey

import java.security.interfaces.ECPublicKey; //導入方法依賴的package包/類
private static ECPoint extractPublicKey(ECPublicKey ecPublicKey) {
  java.security.spec.ECPoint publicPointW = ecPublicKey.getW();
  BigInteger xCoord = publicPointW.getAffineX();
  BigInteger yCoord = publicPointW.getAffineY();

  return CURVE.getCurve()
      .createPoint(xCoord, yCoord);
}
 
開發者ID:Aptoide,項目名稱:AppCoins-ethereumj,代碼行數:9,代碼來源:ECKey.java

示例6: createSigner

import java.security.interfaces.ECPublicKey; //導入方法依賴的package包/類
public ConcurrentContentSigner createSigner(AlgorithmIdentifier signatureAlgId,
        int parallelism) throws XiSecurityException, P11TokenException {
    ParamUtil.requireMin("parallelism", parallelism, 1);

    List<XiContentSigner> signers = new ArrayList<>(parallelism);

    Boolean isSm2p256v1 = null;
    for (int i = 0; i < parallelism; i++) {
        XiContentSigner signer;
        if (publicKey instanceof RSAPublicKey) {
            if (i == 0 && !AlgorithmUtil.isRSASigAlgId(signatureAlgId)) {
                throw new XiSecurityException(
                        "the given algorithm is not a valid RSA signature algorithm '"
                        + signatureAlgId.getAlgorithm().getId() + "'");
            }
            signer = createRSAContentSigner(signatureAlgId);
        } else if (publicKey instanceof ECPublicKey) {
            ECPublicKey ecKey = (ECPublicKey) publicKey;

            if (i == 0) {
                isSm2p256v1 = GMUtil.isSm2primev2Curve(ecKey.getParams().getCurve());
                if (isSm2p256v1) {
                    if (!AlgorithmUtil.isSm2SigAlg(signatureAlgId)) {
                        throw new XiSecurityException(
                            "the given algorithm is not a valid SM2 signature algorithm '"
                            + signatureAlgId.getAlgorithm().getId() + "'");
                    }
                } else {
                    if (!AlgorithmUtil.isECSigAlg(signatureAlgId)) {
                        throw new XiSecurityException(
                            "the given algorithm is not a valid EC signature algorithm '"
                            + signatureAlgId.getAlgorithm().getId() + "'");
                    }
                }
            }

            if (isSm2p256v1) {
                java.security.spec.ECPoint w = ecKey.getW();
                signer = createSM2ContentSigner(signatureAlgId, GMObjectIdentifiers.sm2p256v1,
                        w.getAffineX(), w.getAffineY());
            } else {
                signer = createECContentSigner(signatureAlgId);
            }
        } else if (publicKey instanceof DSAPublicKey) {
            if (i == 0 && !AlgorithmUtil.isDSASigAlg(signatureAlgId)) {
                throw new XiSecurityException(
                        "the given algorithm is not a valid DSA signature algorithm '"
                        + signatureAlgId.getAlgorithm().getId() + "'");
            }
            signer = createDSAContentSigner(signatureAlgId);
        } else {
            throw new XiSecurityException("unsupported key " + publicKey.getClass().getName());
        }
        signers.add(signer);
    } // end for

    final boolean mac = false;
    PrivateKey privateKey = new P11PrivateKey(cryptService, identityId);
    DfltConcurrentContentSigner concurrentSigner;
    try {
        concurrentSigner = new DfltConcurrentContentSigner(mac, signers, privateKey);
    } catch (NoSuchAlgorithmException ex) {
        throw new XiSecurityException(ex.getMessage(), ex);
    }

    if (certificateChain != null) {
        concurrentSigner.setCertificateChain(certificateChain);
    } else {
        concurrentSigner.setPublicKey(publicKey);
    }

    return concurrentSigner;
}
 
開發者ID:xipki,項目名稱:xitk,代碼行數:74,代碼來源:P11ContentSignerBuilder.java

示例7: ECDHClientKeyExchange

import java.security.interfaces.ECPublicKey; //導入方法依賴的package包/類
ECDHClientKeyExchange(PublicKey publicKey) {
    ECPublicKey ecKey = (ECPublicKey)publicKey;
    ECPoint point = ecKey.getW();
    ECParameterSpec params = ecKey.getParams();
    encodedPoint = JsseJce.encodePoint(point, params.getCurve());
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:7,代碼來源:ECDHClientKeyExchange.java


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