Java 类org.bouncycastle.asn1.crmf.POPOSigningKey 实例源码

项目:ipack    文件:CertificateRequestMessage.java   
/**
 * Return whether or not a signing key proof-of-possession (POP) is valid.
 *
 * @param verifierProvider a provider that can produce content verifiers for the signature contained in this POP.
 * @return true if the POP is valid, false otherwise.
 * @throws CRMFException if there is a problem in verification or content verifier creation.
 * @throws IllegalStateException if POP not appropriate.
 */
public boolean isValidSigningKeyPOP(ContentVerifierProvider verifierProvider)
    throws CRMFException, IllegalStateException
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        if (popoSign.getPoposkInput() != null && popoSign.getPoposkInput().getPublicKeyMAC() != null)
        {
            throw new IllegalStateException("verification requires password check");
        }

        return verifySignature(verifierProvider, popoSign);
    }
    else
    {
        throw new IllegalStateException("not Signing Key type of proof of possession");
    }
}
项目:ipack    文件:CertificateRequestMessage.java   
private boolean verifySignature(ContentVerifierProvider verifierProvider, POPOSigningKey popoSign)
    throws CRMFException
{
    ContentVerifier verifier;

    try
    {
        verifier = verifierProvider.get(popoSign.getAlgorithmIdentifier());
    }
    catch (OperatorCreationException e)
    {
        throw new CRMFException("unable to create verifier: " + e.getMessage(), e);
    }

    if (popoSign.getPoposkInput() != null)
    {
        CRMFUtil.derEncodeToStream(popoSign.getPoposkInput(), verifier.getOutputStream());
    }
    else
    {
        CRMFUtil.derEncodeToStream(certReqMsg.getCertReq(), verifier.getOutputStream());
    }

    return verifier.verify(popoSign.getSignature().getBytes());
}
项目:gwt-crypto    文件:CertificateRequestMessage.java   
/**
 * Return whether or not a signing key proof-of-possession (POP) is valid.
 *
 * @param verifierProvider a provider that can produce content verifiers for the signature contained in this POP.
 * @return true if the POP is valid, false otherwise.
 * @throws CRMFException if there is a problem in verification or content verifier creation.
 * @throws IllegalStateException if POP not appropriate.
 */
public boolean isValidSigningKeyPOP(ContentVerifierProvider verifierProvider)
    throws CRMFException, IllegalStateException
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        if (popoSign.getPoposkInput() != null && popoSign.getPoposkInput().getPublicKeyMAC() != null)
        {
            throw new IllegalStateException("verification requires password check");
        }

        return verifySignature(verifierProvider, popoSign);
    }
    else
    {
        throw new IllegalStateException("not Signing Key type of proof of possession");
    }
}
项目:gwt-crypto    文件:CertificateRequestMessage.java   
private boolean verifySignature(ContentVerifierProvider verifierProvider, POPOSigningKey popoSign)
    throws CRMFException
{
    ContentVerifier verifier;

    try
    {
        verifier = verifierProvider.get(popoSign.getAlgorithmIdentifier());
    }
    catch (OperatorCreationException e)
    {
        throw new CRMFException("unable to create verifier: " + e.getMessage(), e);
    }

    if (popoSign.getPoposkInput() != null)
    {
        CRMFUtil.derEncodeToStream(popoSign.getPoposkInput(), verifier.getOutputStream());
    }
    else
    {
        CRMFUtil.derEncodeToStream(certReqMsg.getCertReq(), verifier.getOutputStream());
    }

    return verifier.verify(popoSign.getSignature().getOctets());
}
项目:Aki-SSL    文件:CertificateRequestMessage.java   
/**
 * Return whether or not a signing key proof-of-possession (POP) is valid.
 *
 * @param verifierProvider a provider that can produce content verifiers for the signature contained in this POP.
 * @return true if the POP is valid, false otherwise.
 * @throws CRMFException if there is a problem in verification or content verifier creation.
 * @throws IllegalStateException if POP not appropriate.
 */
public boolean isValidSigningKeyPOP(ContentVerifierProvider verifierProvider)
    throws CRMFException, IllegalStateException
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        if (popoSign.getPoposkInput() != null && popoSign.getPoposkInput().getPublicKeyMAC() != null)
        {
            throw new IllegalStateException("verification requires password check");
        }

        return verifySignature(verifierProvider, popoSign);
    }
    else
    {
        throw new IllegalStateException("not Signing Key type of proof of possession");
    }
}
项目:Aki-SSL    文件:CertificateRequestMessage.java   
private boolean verifySignature(ContentVerifierProvider verifierProvider, POPOSigningKey popoSign)
    throws CRMFException
{
    ContentVerifier verifier;

    try
    {
        verifier = verifierProvider.get(popoSign.getAlgorithmIdentifier());
    }
    catch (OperatorCreationException e)
    {
        throw new CRMFException("unable to create verifier: " + e.getMessage(), e);
    }

    if (popoSign.getPoposkInput() != null)
    {
        CRMFUtil.derEncodeToStream(popoSign.getPoposkInput(), verifier.getOutputStream());
    }
    else
    {
        CRMFUtil.derEncodeToStream(certReqMsg.getCertReq(), verifier.getOutputStream());
    }

    return verifier.verify(popoSign.getSignature().getOctets());
}
项目:irma_future_id    文件:CertificateRequestMessage.java   
/**
 * Return whether or not a signing key proof-of-possession (POP) is valid.
 *
 * @param verifierProvider a provider that can produce content verifiers for the signature contained in this POP.
 * @return true if the POP is valid, false otherwise.
 * @throws CRMFException if there is a problem in verification or content verifier creation.
 * @throws IllegalStateException if POP not appropriate.
 */
public boolean isValidSigningKeyPOP(ContentVerifierProvider verifierProvider)
    throws CRMFException, IllegalStateException
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        if (popoSign.getPoposkInput() != null && popoSign.getPoposkInput().getPublicKeyMAC() != null)
        {
            throw new IllegalStateException("verification requires password check");
        }

        return verifySignature(verifierProvider, popoSign);
    }
    else
    {
        throw new IllegalStateException("not Signing Key type of proof of possession");
    }
}
项目:irma_future_id    文件:CertificateRequestMessage.java   
private boolean verifySignature(ContentVerifierProvider verifierProvider, POPOSigningKey popoSign)
    throws CRMFException
{
    ContentVerifier verifier;

    try
    {
        verifier = verifierProvider.get(popoSign.getAlgorithmIdentifier());
    }
    catch (OperatorCreationException e)
    {
        throw new CRMFException("unable to create verifier: " + e.getMessage(), e);
    }

    if (popoSign.getPoposkInput() != null)
    {
        CRMFUtil.derEncodeToStream(popoSign.getPoposkInput(), verifier.getOutputStream());
    }
    else
    {
        CRMFUtil.derEncodeToStream(certReqMsg.getCertReq(), verifier.getOutputStream());
    }

    return verifier.verify(popoSign.getSignature().getBytes());
}
项目:irma_future_id    文件:CertificateRequestMessage.java   
/**
 * Return whether or not a signing key proof-of-possession (POP) is valid.
 *
 * @param verifierProvider a provider that can produce content verifiers for the signature contained in this POP.
 * @return true if the POP is valid, false otherwise.
 * @throws CRMFException if there is a problem in verification or content verifier creation.
 * @throws IllegalStateException if POP not appropriate.
 */
public boolean isValidSigningKeyPOP(ContentVerifierProvider verifierProvider)
    throws CRMFException, IllegalStateException
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        if (popoSign.getPoposkInput() != null && popoSign.getPoposkInput().getPublicKeyMAC() != null)
        {
            throw new IllegalStateException("verification requires password check");
        }

        return verifySignature(verifierProvider, popoSign);
    }
    else
    {
        throw new IllegalStateException("not Signing Key type of proof of possession");
    }
}
项目:irma_future_id    文件:CertificateRequestMessage.java   
private boolean verifySignature(ContentVerifierProvider verifierProvider, POPOSigningKey popoSign)
    throws CRMFException
{
    ContentVerifier verifier;

    try
    {
        verifier = verifierProvider.get(popoSign.getAlgorithmIdentifier());
    }
    catch (OperatorCreationException e)
    {
        throw new CRMFException("unable to create verifier: " + e.getMessage(), e);
    }

    if (popoSign.getPoposkInput() != null)
    {
        CRMFUtil.derEncodeToStream(popoSign.getPoposkInput(), verifier.getOutputStream());
    }
    else
    {
        CRMFUtil.derEncodeToStream(certReqMsg.getCertReq(), verifier.getOutputStream());
    }

    return verifier.verify(popoSign.getSignature().getBytes());
}
项目:bc-java    文件:CertificateRequestMessage.java   
/**
 * Return whether or not a signing key proof-of-possession (POP) is valid.
 *
 * @param verifierProvider a provider that can produce content verifiers for the signature contained in this POP.
 * @return true if the POP is valid, false otherwise.
 * @throws CRMFException if there is a problem in verification or content verifier creation.
 * @throws IllegalStateException if POP not appropriate.
 */
public boolean isValidSigningKeyPOP(ContentVerifierProvider verifierProvider)
    throws CRMFException, IllegalStateException
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        if (popoSign.getPoposkInput() != null && popoSign.getPoposkInput().getPublicKeyMAC() != null)
        {
            throw new IllegalStateException("verification requires password check");
        }

        return verifySignature(verifierProvider, popoSign);
    }
    else
    {
        throw new IllegalStateException("not Signing Key type of proof of possession");
    }
}
项目:bc-java    文件:CertificateRequestMessage.java   
private boolean verifySignature(ContentVerifierProvider verifierProvider, POPOSigningKey popoSign)
    throws CRMFException
{
    ContentVerifier verifier;

    try
    {
        verifier = verifierProvider.get(popoSign.getAlgorithmIdentifier());
    }
    catch (OperatorCreationException e)
    {
        throw new CRMFException("unable to create verifier: " + e.getMessage(), e);
    }

    if (popoSign.getPoposkInput() != null)
    {
        CRMFUtil.derEncodeToStream(popoSign.getPoposkInput(), verifier.getOutputStream());
    }
    else
    {
        CRMFUtil.derEncodeToStream(certReqMsg.getCertReq(), verifier.getOutputStream());
    }

    return verifier.verify(popoSign.getSignature().getBytes());
}
项目:bc-java    文件:CertificateRequestMessage.java   
/**
 * Return whether or not a signing key proof-of-possession (POP) is valid.
 *
 * @param verifierProvider a provider that can produce content verifiers for the signature contained in this POP.
 * @return true if the POP is valid, false otherwise.
 * @throws CRMFException if there is a problem in verification or content verifier creation.
 * @throws IllegalStateException if POP not appropriate.
 */
public boolean isValidSigningKeyPOP(ContentVerifierProvider verifierProvider)
    throws CRMFException, IllegalStateException
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        if (popoSign.getPoposkInput() != null && popoSign.getPoposkInput().getPublicKeyMAC() != null)
        {
            throw new IllegalStateException("verification requires password check");
        }

        return verifySignature(verifierProvider, popoSign);
    }
    else
    {
        throw new IllegalStateException("not Signing Key type of proof of possession");
    }
}
项目:bc-java    文件:CertificateRequestMessage.java   
private boolean verifySignature(ContentVerifierProvider verifierProvider, POPOSigningKey popoSign)
    throws CRMFException
{
    ContentVerifier verifier;

    try
    {
        verifier = verifierProvider.get(popoSign.getAlgorithmIdentifier());
    }
    catch (OperatorCreationException e)
    {
        throw new CRMFException("unable to create verifier: " + e.getMessage(), e);
    }

    if (popoSign.getPoposkInput() != null)
    {
        CRMFUtil.derEncodeToStream(popoSign.getPoposkInput(), verifier.getOutputStream());
    }
    else
    {
        CRMFUtil.derEncodeToStream(certReqMsg.getCertReq(), verifier.getOutputStream());
    }

    return verifier.verify(popoSign.getSignature().getBytes());
}
项目:ipack    文件:CertificateRequestMessage.java   
/**
 * Return whether or not the proof-of-possession (POP) is of the type popSigningKey and
 * it has a public key MAC associated with it.
 *
 * @return true if POP is popSigningKey and a PKMAC is present, false otherwise.
 */
public boolean hasSigningKeyProofOfPossessionWithPKMAC()
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        return popoSign.getPoposkInput().getPublicKeyMAC() != null;
    }

    return false;
}
项目:ipack    文件:CertificateRequestMessage.java   
/**
 * Return whether or not a signing key proof-of-possession (POP), with an associated PKMAC, is valid.
 *
 * @param verifierProvider a provider that can produce content verifiers for the signature contained in this POP.
 * @param macBuilder a suitable PKMACBuilder to create the MAC verifier.
 * @param password the password used to key the MAC calculation.
 * @return true if the POP is valid, false otherwise.
 * @throws CRMFException if there is a problem in verification or content verifier creation.
 * @throws IllegalStateException if POP not appropriate.
 */
public boolean isValidSigningKeyPOP(ContentVerifierProvider verifierProvider, PKMACBuilder macBuilder, char[] password)
    throws CRMFException, IllegalStateException
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        if (popoSign.getPoposkInput() == null || popoSign.getPoposkInput().getSender() != null)
        {
            throw new IllegalStateException("no PKMAC present in proof of possession");
        }

        PKMACValue pkMAC = popoSign.getPoposkInput().getPublicKeyMAC();
        PKMACValueVerifier macVerifier = new PKMACValueVerifier(macBuilder);

        if (macVerifier.isValid(pkMAC, password, this.getCertTemplate().getPublicKey()))
        {
            return verifySignature(verifierProvider, popoSign);
        }

        return false;
    }
    else
    {
        throw new IllegalStateException("not Signing Key type of proof of possession");
    }
}
项目:gwt-crypto    文件:CertificateRequestMessage.java   
/**
 * Return whether or not the proof-of-possession (POP) is of the type popSigningKey and
 * it has a public key MAC associated with it.
 *
 * @return true if POP is popSigningKey and a PKMAC is present, false otherwise.
 */
public boolean hasSigningKeyProofOfPossessionWithPKMAC()
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        return popoSign.getPoposkInput().getPublicKeyMAC() != null;
    }

    return false;
}
项目:gwt-crypto    文件:CertificateRequestMessage.java   
/**
 * Return whether or not a signing key proof-of-possession (POP), with an associated PKMAC, is valid.
 *
 * @param verifierProvider a provider that can produce content verifiers for the signature contained in this POP.
 * @param macBuilder a suitable PKMACBuilder to create the MAC verifier.
 * @param password the password used to key the MAC calculation.
 * @return true if the POP is valid, false otherwise.
 * @throws CRMFException if there is a problem in verification or content verifier creation.
 * @throws IllegalStateException if POP not appropriate.
 */
public boolean isValidSigningKeyPOP(ContentVerifierProvider verifierProvider, PKMACBuilder macBuilder, char[] password)
    throws CRMFException, IllegalStateException
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        if (popoSign.getPoposkInput() == null || popoSign.getPoposkInput().getSender() != null)
        {
            throw new IllegalStateException("no PKMAC present in proof of possession");
        }

        PKMACValue pkMAC = popoSign.getPoposkInput().getPublicKeyMAC();
        PKMACValueVerifier macVerifier = new PKMACValueVerifier(macBuilder);

        if (macVerifier.isValid(pkMAC, password, this.getCertTemplate().getPublicKey()))
        {
            return verifySignature(verifierProvider, popoSign);
        }

        return false;
    }
    else
    {
        throw new IllegalStateException("not Signing Key type of proof of possession");
    }
}
项目:Aki-SSL    文件:CertificateRequestMessage.java   
/**
 * Return whether or not the proof-of-possession (POP) is of the type popSigningKey and
 * it has a public key MAC associated with it.
 *
 * @return true if POP is popSigningKey and a PKMAC is present, false otherwise.
 */
public boolean hasSigningKeyProofOfPossessionWithPKMAC()
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        return popoSign.getPoposkInput().getPublicKeyMAC() != null;
    }

    return false;
}
项目:Aki-SSL    文件:CertificateRequestMessage.java   
/**
 * Return whether or not a signing key proof-of-possession (POP), with an associated PKMAC, is valid.
 *
 * @param verifierProvider a provider that can produce content verifiers for the signature contained in this POP.
 * @param macBuilder a suitable PKMACBuilder to create the MAC verifier.
 * @param password the password used to key the MAC calculation.
 * @return true if the POP is valid, false otherwise.
 * @throws CRMFException if there is a problem in verification or content verifier creation.
 * @throws IllegalStateException if POP not appropriate.
 */
public boolean isValidSigningKeyPOP(ContentVerifierProvider verifierProvider, PKMACBuilder macBuilder, char[] password)
    throws CRMFException, IllegalStateException
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        if (popoSign.getPoposkInput() == null || popoSign.getPoposkInput().getSender() != null)
        {
            throw new IllegalStateException("no PKMAC present in proof of possession");
        }

        PKMACValue pkMAC = popoSign.getPoposkInput().getPublicKeyMAC();
        PKMACValueVerifier macVerifier = new PKMACValueVerifier(macBuilder);

        if (macVerifier.isValid(pkMAC, password, this.getCertTemplate().getPublicKey()))
        {
            return verifySignature(verifierProvider, popoSign);
        }

        return false;
    }
    else
    {
        throw new IllegalStateException("not Signing Key type of proof of possession");
    }
}
项目:irma_future_id    文件:CertificateRequestMessage.java   
/**
 * Return whether or not the proof-of-possession (POP) is of the type popSigningKey and
 * it has a public key MAC associated with it.
 *
 * @return true if POP is popSigningKey and a PKMAC is present, false otherwise.
 */
public boolean hasSigningKeyProofOfPossessionWithPKMAC()
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        return popoSign.getPoposkInput().getPublicKeyMAC() != null;
    }

    return false;
}
项目:irma_future_id    文件:CertificateRequestMessage.java   
/**
 * Return whether or not a signing key proof-of-possession (POP), with an associated PKMAC, is valid.
 *
 * @param verifierProvider a provider that can produce content verifiers for the signature contained in this POP.
 * @param macBuilder a suitable PKMACBuilder to create the MAC verifier.
 * @param password the password used to key the MAC calculation.
 * @return true if the POP is valid, false otherwise.
 * @throws CRMFException if there is a problem in verification or content verifier creation.
 * @throws IllegalStateException if POP not appropriate.
 */
public boolean isValidSigningKeyPOP(ContentVerifierProvider verifierProvider, PKMACBuilder macBuilder, char[] password)
    throws CRMFException, IllegalStateException
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        if (popoSign.getPoposkInput() == null || popoSign.getPoposkInput().getSender() != null)
        {
            throw new IllegalStateException("no PKMAC present in proof of possession");
        }

        PKMACValue pkMAC = popoSign.getPoposkInput().getPublicKeyMAC();
        PKMACValueVerifier macVerifier = new PKMACValueVerifier(macBuilder);

        if (macVerifier.isValid(pkMAC, password, this.getCertTemplate().getPublicKey()))
        {
            return verifySignature(verifierProvider, popoSign);
        }

        return false;
    }
    else
    {
        throw new IllegalStateException("not Signing Key type of proof of possession");
    }
}
项目:irma_future_id    文件:CertificateRequestMessage.java   
/**
 * Return whether or not the proof-of-possession (POP) is of the type popSigningKey and
 * it has a public key MAC associated with it.
 *
 * @return true if POP is popSigningKey and a PKMAC is present, false otherwise.
 */
public boolean hasSigningKeyProofOfPossessionWithPKMAC()
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        return popoSign.getPoposkInput().getPublicKeyMAC() != null;
    }

    return false;
}
项目:irma_future_id    文件:CertificateRequestMessage.java   
/**
 * Return whether or not a signing key proof-of-possession (POP), with an associated PKMAC, is valid.
 *
 * @param verifierProvider a provider that can produce content verifiers for the signature contained in this POP.
 * @param macBuilder a suitable PKMACBuilder to create the MAC verifier.
 * @param password the password used to key the MAC calculation.
 * @return true if the POP is valid, false otherwise.
 * @throws CRMFException if there is a problem in verification or content verifier creation.
 * @throws IllegalStateException if POP not appropriate.
 */
public boolean isValidSigningKeyPOP(ContentVerifierProvider verifierProvider, PKMACBuilder macBuilder, char[] password)
    throws CRMFException, IllegalStateException
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        if (popoSign.getPoposkInput() == null || popoSign.getPoposkInput().getSender() != null)
        {
            throw new IllegalStateException("no PKMAC present in proof of possession");
        }

        PKMACValue pkMAC = popoSign.getPoposkInput().getPublicKeyMAC();
        PKMACValueVerifier macVerifier = new PKMACValueVerifier(macBuilder);

        if (macVerifier.isValid(pkMAC, password, this.getCertTemplate().getPublicKey()))
        {
            return verifySignature(verifierProvider, popoSign);
        }

        return false;
    }
    else
    {
        throw new IllegalStateException("not Signing Key type of proof of possession");
    }
}
项目:bc-java    文件:CertificateRequestMessage.java   
/**
 * Return whether or not the proof-of-possession (POP) is of the type popSigningKey and
 * it has a public key MAC associated with it.
 *
 * @return true if POP is popSigningKey and a PKMAC is present, false otherwise.
 */
public boolean hasSigningKeyProofOfPossessionWithPKMAC()
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        return popoSign.getPoposkInput().getPublicKeyMAC() != null;
    }

    return false;
}
项目:bc-java    文件:CertificateRequestMessage.java   
/**
 * Return whether or not a signing key proof-of-possession (POP), with an associated PKMAC, is valid.
 *
 * @param verifierProvider a provider that can produce content verifiers for the signature contained in this POP.
 * @param macBuilder a suitable PKMACBuilder to create the MAC verifier.
 * @param password the password used to key the MAC calculation.
 * @return true if the POP is valid, false otherwise.
 * @throws CRMFException if there is a problem in verification or content verifier creation.
 * @throws IllegalStateException if POP not appropriate.
 */
public boolean isValidSigningKeyPOP(ContentVerifierProvider verifierProvider, PKMACBuilder macBuilder, char[] password)
    throws CRMFException, IllegalStateException
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        if (popoSign.getPoposkInput() == null || popoSign.getPoposkInput().getSender() != null)
        {
            throw new IllegalStateException("no PKMAC present in proof of possession");
        }

        PKMACValue pkMAC = popoSign.getPoposkInput().getPublicKeyMAC();
        PKMACValueVerifier macVerifier = new PKMACValueVerifier(macBuilder);

        if (macVerifier.isValid(pkMAC, password, this.getCertTemplate().getPublicKey()))
        {
            return verifySignature(verifierProvider, popoSign);
        }

        return false;
    }
    else
    {
        throw new IllegalStateException("not Signing Key type of proof of possession");
    }
}
项目:bc-java    文件:CertificateRequestMessage.java   
/**
 * Return whether or not the proof-of-possession (POP) is of the type popSigningKey and
 * it has a public key MAC associated with it.
 *
 * @return true if POP is popSigningKey and a PKMAC is present, false otherwise.
 */
public boolean hasSigningKeyProofOfPossessionWithPKMAC()
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        return popoSign.getPoposkInput().getPublicKeyMAC() != null;
    }

    return false;
}
项目:bc-java    文件:CertificateRequestMessage.java   
/**
 * Return whether or not a signing key proof-of-possession (POP), with an associated PKMAC, is valid.
 *
 * @param verifierProvider a provider that can produce content verifiers for the signature contained in this POP.
 * @param macBuilder a suitable PKMACBuilder to create the MAC verifier.
 * @param password the password used to key the MAC calculation.
 * @return true if the POP is valid, false otherwise.
 * @throws CRMFException if there is a problem in verification or content verifier creation.
 * @throws IllegalStateException if POP not appropriate.
 */
public boolean isValidSigningKeyPOP(ContentVerifierProvider verifierProvider, PKMACBuilder macBuilder, char[] password)
    throws CRMFException, IllegalStateException
{
    ProofOfPossession pop = certReqMsg.getPopo();

    if (pop.getType() == popSigningKey)
    {
        POPOSigningKey popoSign = POPOSigningKey.getInstance(pop.getObject());

        if (popoSign.getPoposkInput() == null || popoSign.getPoposkInput().getSender() != null)
        {
            throw new IllegalStateException("no PKMAC present in proof of possession");
        }

        PKMACValue pkMAC = popoSign.getPoposkInput().getPublicKeyMAC();
        PKMACValueVerifier macVerifier = new PKMACValueVerifier(macBuilder);

        if (macVerifier.isValid(pkMAC, password, this.getCertTemplate().getPublicKey()))
        {
            return verifySignature(verifierProvider, popoSign);
        }

        return false;
    }
    else
    {
        throw new IllegalStateException("not Signing Key type of proof of possession");
    }
}