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


Java XMLSignatureException类代码示例

本文整理汇总了Java中com.sun.org.apache.xml.internal.security.signature.XMLSignatureException的典型用法代码示例。如果您正苦于以下问题:Java XMLSignatureException类的具体用法?Java XMLSignatureException怎么用?Java XMLSignatureException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XMLSignatureException类属于com.sun.org.apache.xml.internal.security.signature包,在下文中一共展示了XMLSignatureException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: register

import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; //导入依赖的package包/类
/**
 * Registers implementing class of the Transform algorithm with algorithmURI
 *
 * @param algorithmURI algorithmURI URI representation of <code>SignatureAlgorithm</code>.
 * @param implementingClass <code>implementingClass</code> the implementing class of
 * {@link SignatureAlgorithmSpi}
 * @throws AlgorithmAlreadyRegisteredException if specified algorithmURI is already registered
 * @throws XMLSignatureException
 * @throws SecurityException if a security manager is installed and the
 *    caller does not have permission to register the signature algorithm
 */
public static void register(String algorithmURI, Class<? extends SignatureAlgorithmSpi> implementingClass)
   throws AlgorithmAlreadyRegisteredException, ClassNotFoundException,
       XMLSignatureException {
    JavaUtils.checkRegisterPermission();
    if (log.isLoggable(java.util.logging.Level.FINE)) {
        log.log(java.util.logging.Level.FINE, "Try to register " + algorithmURI + " " + implementingClass);
    }

    // are we already registered?
    Class<? extends SignatureAlgorithmSpi> registeredClass = algorithmHash.get(algorithmURI);
    if (registeredClass != null) {
        Object exArgs[] = { algorithmURI, registeredClass };
        throw new AlgorithmAlreadyRegisteredException(
            "algorithm.alreadyRegistered", exArgs
        );
    }
    algorithmHash.put(algorithmURI, implementingClass);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:SignatureAlgorithm.java

示例2: engineInitSign

import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; //导入依赖的package包/类
/** @inheritDoc */
protected void engineInitSign(Key privateKey, SecureRandom secureRandom)
    throws XMLSignatureException {
    if (!(privateKey instanceof PrivateKey)) {
        String supplied = privateKey.getClass().getName();
        String needed = PrivateKey.class.getName();
        Object exArgs[] = { supplied, needed };

        throw new XMLSignatureException("algorithms.WrongKeyForThisOperation", exArgs);
    }

    try {
        this.signatureAlgorithm.initSign((PrivateKey) privateKey, secureRandom);
    } catch (InvalidKeyException ex) {
        throw new XMLSignatureException("empty", ex);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:SignatureECDSA.java

示例3: engineVerify

import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; //导入依赖的package包/类
/**
 * Proxy method for {@link java.security.Signature#verify(byte[])}
 * which is executed on the internal {@link java.security.Signature} object.
 *
 * @param signature
 * @return true if the signature is correct
 * @throws XMLSignatureException
 */
protected boolean engineVerify(byte[] signature) throws XMLSignatureException {
    try {
        if (this.HMACOutputLengthSet && this.HMACOutputLength < getDigestLength()) {
            if (log.isLoggable(java.util.logging.Level.FINE)) {
                log.log(java.util.logging.Level.FINE, "HMACOutputLength must not be less than " + getDigestLength());
            }
            Object[] exArgs = { String.valueOf(getDigestLength()) };
            throw new XMLSignatureException("algorithms.HMACOutputLengthMin", exArgs);
        } else {
            byte[] completeResult = this.macAlgorithm.doFinal();
            return MessageDigestAlgorithm.isEqual(completeResult, signature);
        }
    } catch (IllegalStateException ex) {
        throw new XMLSignatureException("empty", ex);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:IntegrityHmac.java

示例4: engineSign

import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; //导入依赖的package包/类
/**
 * Proxy method for {@link java.security.Signature#sign()}
 * which is executed on the internal {@link java.security.Signature} object.
 *
 * @return the result of the {@link java.security.Signature#sign()} method
 * @throws XMLSignatureException
 */
protected byte[] engineSign() throws XMLSignatureException {
    try {
        if (this.HMACOutputLengthSet && this.HMACOutputLength < getDigestLength()) {
            if (log.isLoggable(java.util.logging.Level.FINE)) {
                log.log(java.util.logging.Level.FINE, "HMACOutputLength must not be less than " + getDigestLength());
            }
            Object[] exArgs = { String.valueOf(getDigestLength()) };
            throw new XMLSignatureException("algorithms.HMACOutputLengthMin", exArgs);
        } else {
            return this.macAlgorithm.doFinal();
        }
    } catch (IllegalStateException ex) {
        throw new XMLSignatureException("empty", ex);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:IntegrityHmac.java

示例5: getTransforms

import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; //导入依赖的package包/类
/**
 * Method getTransforms
 *
 * @throws XMLSecurityException
 * @return the transformations
 */
public Transforms getTransforms() throws XMLSecurityException {
    try {
        Element transformsElem =
            XMLUtils.selectDsNode(
                this.constructionElement.getFirstChild(), Constants._TAG_TRANSFORMS, 0);

        if (transformsElem != null) {
            return new Transforms(transformsElem, this.baseURI);
        }

        return null;
    } catch (XMLSignatureException ex) {
        throw new XMLSecurityException("empty", ex);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:22,代码来源:RetrievalMethod.java

示例6: engineInitSign

import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; //导入依赖的package包/类
/** @inheritDoc */
protected void engineInitSign(Key privateKey) throws XMLSignatureException {
    if (!(privateKey instanceof PrivateKey)) {
        String supplied = privateKey.getClass().getName();
        String needed = PrivateKey.class.getName();
        Object exArgs[] = { supplied, needed };

        throw new XMLSignatureException("algorithms.WrongKeyForThisOperation", exArgs);
    }

    try {
        this.signatureAlgorithm.initSign((PrivateKey) privateKey);
    } catch (InvalidKeyException ex) {
        throw new XMLSignatureException("empty", ex);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:SignatureECDSA.java

示例7: engineInitSign

import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; //导入依赖的package包/类
/**
 * @inheritDoc
 */
protected void engineInitSign(Key privateKey) throws XMLSignatureException {
    if (!(privateKey instanceof PrivateKey)) {
        String supplied = privateKey.getClass().getName();
        String needed = PrivateKey.class.getName();
        Object exArgs[] = { supplied, needed };

        throw new XMLSignatureException("algorithms.WrongKeyForThisOperation", exArgs);
    }

    try {
        this.signatureAlgorithm.initSign((PrivateKey) privateKey);
    } catch (InvalidKeyException ex) {
        throw new XMLSignatureException("empty", ex);
    }
    size = ((DSAKey)privateKey).getParams().getQ().bitLength();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:SignatureDSA.java

示例8: Transforms

import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; //导入依赖的package包/类
/**
 * Constructs {@link Transforms} from {@link Element} which is
 * <code>Transforms</code> Element
 *
 * @param element  is <code>Transforms</code> element
 * @param BaseURI the URI where the XML instance was stored
 * @throws DOMException
 * @throws InvalidTransformException
 * @throws TransformationException
 * @throws XMLSecurityException
 * @throws XMLSignatureException
 */
public Transforms(Element element, String BaseURI)
    throws DOMException, XMLSignatureException, InvalidTransformException,
        TransformationException, XMLSecurityException {
    super(element, BaseURI);

    int numberOfTransformElems = this.getLength();

    if (numberOfTransformElems == 0) {
        // At least one Transform element must be present. Bad.
        Object exArgs[] = { Constants._TAG_TRANSFORM, Constants._TAG_TRANSFORMS };

        throw new TransformationException("xml.WrongContent", exArgs);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:Transforms.java

示例9: engineInitVerify

import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; //导入依赖的package包/类
/** @inheritDoc */
protected void engineInitVerify(Key publicKey) throws XMLSignatureException {
    if (!(publicKey instanceof PublicKey)) {
        String supplied = publicKey.getClass().getName();
        String needed = PublicKey.class.getName();
        Object exArgs[] = { supplied, needed };

        throw new XMLSignatureException("algorithms.WrongKeyForThisOperation", exArgs);
    }

    try {
        this.signatureAlgorithm.initVerify((PublicKey) publicKey);
    } catch (InvalidKeyException ex) {
        // reinstantiate Signature object to work around bug in JDK
        // see: http://bugs.sun.com/view_bug.do?bug_id=4953555
        Signature sig = this.signatureAlgorithm;
        try {
            this.signatureAlgorithm = Signature.getInstance(signatureAlgorithm.getAlgorithm());
        } catch (Exception e) {
            // this shouldn't occur, but if it does, restore previous
            // Signature
            if (log.isLoggable(java.util.logging.Level.FINE)) {
                log.log(java.util.logging.Level.FINE, "Exception when reinstantiating Signature:" + e);
            }
            this.signatureAlgorithm = sig;
        }
        throw new XMLSignatureException("empty", ex);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:30,代码来源:SignatureBaseRSA.java

示例10: engineUpdate

import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; //导入依赖的package包/类
/** @inheritDoc */
protected void engineUpdate(byte input) throws XMLSignatureException {
    try {
        this.signatureAlgorithm.update(input);
    } catch (SignatureException ex) {
        throw new XMLSignatureException("empty", ex);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:SignatureECDSA.java

示例11: engineInitVerify

import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; //导入依赖的package包/类
/** @inheritDoc */
protected void engineInitVerify(Key publicKey) throws XMLSignatureException {

    if (!(publicKey instanceof PublicKey)) {
        String supplied = publicKey.getClass().getName();
        String needed = PublicKey.class.getName();
        Object exArgs[] = { supplied, needed };

        throw new XMLSignatureException("algorithms.WrongKeyForThisOperation", exArgs);
    }

    try {
        this.signatureAlgorithm.initVerify((PublicKey) publicKey);
    } catch (InvalidKeyException ex) {
        // reinstantiate Signature object to work around bug in JDK
        // see: http://bugs.java.com/view_bug.do?bug_id=4953555
        Signature sig = this.signatureAlgorithm;
        try {
            this.signatureAlgorithm = Signature.getInstance(signatureAlgorithm.getAlgorithm());
        } catch (Exception e) {
            // this shouldn't occur, but if it does, restore previous
            // Signature
            if (log.isLoggable(java.util.logging.Level.FINE)) {
                log.log(java.util.logging.Level.FINE, "Exception when reinstantiating Signature:" + e);
            }
            this.signatureAlgorithm = sig;
        }
        throw new XMLSignatureException("empty", ex);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:SignatureECDSA.java

示例12: engineSetParameter

import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; //导入依赖的package包/类
/** @inheritDoc */
protected void engineSetParameter(AlgorithmParameterSpec params)
    throws XMLSignatureException {
    try {
        this.signatureAlgorithm.setParameter(params);
    } catch (InvalidAlgorithmParameterException ex) {
        throw new XMLSignatureException("empty", ex);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:SignatureECDSA.java

示例13: engineUpdate

import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; //导入依赖的package包/类
/** @inheritDoc */
protected void engineUpdate(byte buf[], int offset, int len) throws XMLSignatureException {
    try {
        this.signatureAlgorithm.update(buf, offset, len);
    } catch (SignatureException ex) {
        throw new XMLSignatureException("empty", ex);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:SignatureECDSA.java

示例14: engineUpdate

import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; //导入依赖的package包/类
/**
 * @inheritDoc
 */
protected void engineUpdate(byte buf[], int offset, int len) throws XMLSignatureException {
    try {
        this.signatureAlgorithm.update(buf, offset, len);
    } catch (SignatureException ex) {
        throw new XMLSignatureException("empty", ex);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:SignatureDSA.java

示例15: engineUpdate

import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException; //导入依赖的package包/类
/** @inheritDoc */
protected void engineUpdate(byte[] input) throws XMLSignatureException {
    try {
        this.signatureAlgorithm.update(input);
    } catch (SignatureException ex) {
        throw new XMLSignatureException("empty", ex);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:SignatureBaseRSA.java


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