Java 类org.bouncycastle.asn1.ocsp.ResponderID 实例源码

项目:ipack    文件:RespID.java   
/**
 * Calculate a RespID based on the public key of the responder.
 *
 * @param subjectPublicKeyInfo the info structure for the responder public key.
 * @param digCalc a SHA-1 digest calculator.
 * @throws OCSPException on exception creating ID.
 */
public RespID(
    SubjectPublicKeyInfo     subjectPublicKeyInfo,
    DigestCalculator         digCalc)
    throws OCSPException
{
    try
    {
        if (!digCalc.getAlgorithmIdentifier().equals(HASH_SHA1))
        {
            throw new IllegalArgumentException("only SHA-1 can be used with RespID");
        }

        OutputStream     digOut = digCalc.getOutputStream();

        digOut.write(subjectPublicKeyInfo.getPublicKeyData().getBytes());
        digOut.close();

        this.id = new ResponderID(new DEROctetString(digCalc.getDigest()));
    }
    catch (Exception e)
    {
        throw new OCSPException("problem creating ID: " + e, e);
    }
}
项目:ipack    文件:RespID.java   
public RespID(
    PublicKey   key)
    throws OCSPException
{
    try
    {
        // TODO Allow specification of a particular provider
        MessageDigest digest = OCSPUtil.createDigestInstance("SHA1", null);

        ASN1InputStream aIn = new ASN1InputStream(key.getEncoded());
        SubjectPublicKeyInfo info = SubjectPublicKeyInfo.getInstance(aIn.readObject());

        digest.update(info.getPublicKeyData().getBytes());

        ASN1OctetString keyHash = new DEROctetString(digest.digest());

        this.id = new ResponderID(keyHash);
    }
    catch (Exception e)
    {
        throw new OCSPException("problem creating ID: " + e, e);
    }
}
项目:gwt-crypto    文件:RespID.java   
/**
 * Calculate a RespID based on the public key of the responder.
 *
 * @param subjectPublicKeyInfo the info structure for the responder public key.
 * @param digCalc a SHA-1 digest calculator.
 * @throws OCSPException on exception creating ID.
 */
public RespID(
    SubjectPublicKeyInfo     subjectPublicKeyInfo,
    DigestCalculator         digCalc)
    throws OCSPException
{
    try
    {
        if (!digCalc.getAlgorithmIdentifier().equals(HASH_SHA1))
        {
            throw new IllegalArgumentException("only SHA-1 can be used with RespID");
        }

        OutputStream     digOut = digCalc.getOutputStream();

        digOut.write(subjectPublicKeyInfo.getPublicKeyData().getBytes());
        digOut.close();

        this.id = new ResponderID(new DEROctetString(digCalc.getDigest()));
    }
    catch (Exception e)
    {
        throw new OCSPException("problem creating ID: " + e, e);
    }
}
项目:Aki-SSL    文件:RespID.java   
/**
 * Calculate a RespID based on the public key of the responder.
 *
 * @param subjectPublicKeyInfo the info structure for the responder public key.
 * @param digCalc a SHA-1 digest calculator.
 * @throws OCSPException on exception creating ID.
 */
public RespID(
    SubjectPublicKeyInfo     subjectPublicKeyInfo,
    DigestCalculator         digCalc)
    throws OCSPException
{
    try
    {
        if (!digCalc.getAlgorithmIdentifier().equals(HASH_SHA1))
        {
            throw new IllegalArgumentException("only SHA-1 can be used with RespID");
        }

        OutputStream     digOut = digCalc.getOutputStream();

        digOut.write(subjectPublicKeyInfo.getPublicKeyData().getBytes());
        digOut.close();

        this.id = new ResponderID(new DEROctetString(digCalc.getDigest()));
    }
    catch (Exception e)
    {
        throw new OCSPException("problem creating ID: " + e, e);
    }
}
项目:dss    文件:OCSPCertificateVerifier.java   
private void extractSigningCertificateFormResponderId(OCSPToken ocspToken) {
    BasicOCSPResp basicOCSPResp = ocspToken.getBasicOCSPResp();
    if (basicOCSPResp != null) {
        final RespID responderId = basicOCSPResp.getResponderId();
        final ResponderID responderIdAsASN1Object = responderId.toASN1Primitive();
        final DERTaggedObject derTaggedObject = (DERTaggedObject) responderIdAsASN1Object.toASN1Primitive();
        if (2 == derTaggedObject.getTagNo()) {
            throw new DSSException("Certificate's key hash management not implemented yet!");
        }
        final ASN1Primitive derObject = derTaggedObject.getObject();
        final byte[] derEncoded = DSSASN1Utils.getDEREncoded(derObject);
        final X500Principal x500Principal_ = new X500Principal(derEncoded);
        final X500Principal x500Principal = DSSUtils.getNormalizedX500Principal(x500Principal_);
        final List<CertificateToken> certificateTokens = validationCertPool.get(x500Principal);
        for (final CertificateToken issuerCertificateToken : certificateTokens) {
            if (ocspToken.isSignedBy(issuerCertificateToken)) {
                break;
            }
        }
    }
}
项目:CryptMeme    文件:RespID.java   
public RespID(
    PublicKey   key)
    throws OCSPException
{
    try
    {
        // TODO Allow specification of a particular provider
        MessageDigest digest = OCSPUtil.createDigestInstance("SHA1", null);

        ASN1InputStream aIn = new ASN1InputStream(key.getEncoded());
        SubjectPublicKeyInfo info = SubjectPublicKeyInfo.getInstance(aIn.readObject());

        digest.update(info.getPublicKeyData().getBytes());

        ASN1OctetString keyHash = new DEROctetString(digest.digest());

        this.id = new ResponderID(keyHash);
    }
    catch (Exception e)
    {
        throw new OCSPException("problem creating ID: " + e, e);
    }
}
项目:irma_future_id    文件:RespID.java   
/**
 * Calculate a RespID based on the public key of the responder.
 *
 * @param subjectPublicKeyInfo the info structure for the responder public key.
 * @param digCalc a SHA-1 digest calculator.
 * @throws OCSPException on exception creating ID.
 */
public RespID(
    SubjectPublicKeyInfo     subjectPublicKeyInfo,
    DigestCalculator         digCalc)
    throws OCSPException
{
    try
    {
        if (!digCalc.getAlgorithmIdentifier().equals(HASH_SHA1))
        {
            throw new IllegalArgumentException("only SHA-1 can be used with RespID");
        }

        OutputStream     digOut = digCalc.getOutputStream();

        digOut.write(subjectPublicKeyInfo.getPublicKeyData().getBytes());
        digOut.close();

        this.id = new ResponderID(new DEROctetString(digCalc.getDigest()));
    }
    catch (Exception e)
    {
        throw new OCSPException("problem creating ID: " + e, e);
    }
}
项目:irma_future_id    文件:RespID.java   
public RespID(
    PublicKey   key)
    throws OCSPException
{
    try
    {
        // TODO Allow specification of a particular provider
        MessageDigest digest = OCSPUtil.createDigestInstance("SHA1", null);

        ASN1InputStream aIn = new ASN1InputStream(key.getEncoded());
        SubjectPublicKeyInfo info = SubjectPublicKeyInfo.getInstance(aIn.readObject());

        digest.update(info.getPublicKeyData().getBytes());

        ASN1OctetString keyHash = new DEROctetString(digest.digest());

        this.id = new ResponderID(keyHash);
    }
    catch (Exception e)
    {
        throw new OCSPException("problem creating ID: " + e, e);
    }
}
项目:irma_future_id    文件:RespID.java   
public RespID(
    PublicKey   key)
    throws OCSPException
{
    try
    {
        // TODO Allow specification of a particular provider
        MessageDigest digest = OCSPUtil.createDigestInstance("SHA1", null);

        ASN1InputStream aIn = new ASN1InputStream(key.getEncoded());
        SubjectPublicKeyInfo info = SubjectPublicKeyInfo.getInstance(aIn.readObject());

        digest.update(info.getPublicKeyData().getBytes());

        ASN1OctetString keyHash = new DEROctetString(digest.digest());

        this.id = new ResponderID(keyHash);
    }
    catch (Exception e)
    {
        throw new OCSPException("problem creating ID: " + e, e);
    }
}
项目:bc-java    文件:RespID.java   
/**
 * Calculate a RespID based on the public key of the responder.
 *
 * @param subjectPublicKeyInfo the info structure for the responder public key.
 * @param digCalc a SHA-1 digest calculator.
 * @throws OCSPException on exception creating ID.
 */
public RespID(
    SubjectPublicKeyInfo     subjectPublicKeyInfo,
    DigestCalculator         digCalc)
    throws OCSPException
{
    try
    {
        if (!digCalc.getAlgorithmIdentifier().equals(HASH_SHA1))
        {
            throw new IllegalArgumentException("only SHA-1 can be used with RespID");
        }

        OutputStream     digOut = digCalc.getOutputStream();

        digOut.write(subjectPublicKeyInfo.getPublicKeyData().getBytes());
        digOut.close();

        this.id = new ResponderID(new DEROctetString(digCalc.getDigest()));
    }
    catch (Exception e)
    {
        throw new OCSPException("problem creating ID: " + e, e);
    }
}
项目:bc-java    文件:RespID.java   
public RespID(
    PublicKey   key)
    throws OCSPException
{
    try
    {
        // TODO Allow specification of a particular provider
        MessageDigest digest = OCSPUtil.createDigestInstance("SHA1", null);

        ASN1InputStream aIn = new ASN1InputStream(key.getEncoded());
        SubjectPublicKeyInfo info = SubjectPublicKeyInfo.getInstance(aIn.readObject());

        digest.update(info.getPublicKeyData().getBytes());

        ASN1OctetString keyHash = new DEROctetString(digest.digest());

        this.id = new ResponderID(keyHash);
    }
    catch (Exception e)
    {
        throw new OCSPException("problem creating ID: " + e, e);
    }
}
项目:bc-java    文件:RespID.java   
public RespID(
    PublicKey   key)
    throws OCSPException
{
    try
    {
        // TODO Allow specification of a particular provider
        MessageDigest digest = OCSPUtil.createDigestInstance("SHA1", null);

        ASN1InputStream aIn = new ASN1InputStream(key.getEncoded());
        SubjectPublicKeyInfo info = SubjectPublicKeyInfo.getInstance(aIn.readObject());

        digest.update(info.getPublicKeyData().getBytes());

        ASN1OctetString keyHash = new DEROctetString(digest.digest());

        this.id = new ResponderID(keyHash);
    }
    catch (Exception e)
    {
        throw new OCSPException("problem creating ID: " + e, e);
    }
}
项目:driveddoc    文件:FlexibleBouncyCastleNotaryFactory.java   
/**
 * Get String represetation of ResponderID
 * @param basResp
 * @return stringified responder ID
 */
private String responderIDtoString(BasicOCSPResp basResp) {
    if(basResp != null) {
        ResponderID respid = basResp.getResponseData().getResponderId().toASN1Object();
        Object o = ((DERTaggedObject)respid.toASN1Object()).getObject();
        if(o instanceof org.bouncycastle.asn1.DEROctetString) {
            org.bouncycastle.asn1.DEROctetString oc = (org.bouncycastle.asn1.DEROctetString)o;
            return "byKey: " + SignedDoc.bin2hex(oc.getOctets()); 
        } else {
            X509Name name = new X509Name((ASN1Sequence)o);
            return "byName: " + name.toString();
        }
    }
    else
        return null;
}
项目:ipack    文件:OcspIdentifier.java   
private OcspIdentifier(ASN1Sequence seq)
{
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException("Bad sequence size: "
            + seq.size());
    }
    this.ocspResponderID = ResponderID.getInstance(seq.getObjectAt(0));
    this.producedAt = (ASN1GeneralizedTime)seq.getObjectAt(1);
}
项目:gwt-crypto    文件:OcspIdentifier.java   
private OcspIdentifier(ASN1Sequence seq)
{
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException("Bad sequence size: "
            + seq.size());
    }
    this.ocspResponderID = ResponderID.getInstance(seq.getObjectAt(0));
    this.producedAt = (ASN1GeneralizedTime)seq.getObjectAt(1);
}
项目:Aki-SSL    文件:OcspIdentifier.java   
private OcspIdentifier(ASN1Sequence seq)
{
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException("Bad sequence size: "
            + seq.size());
    }
    this.ocspResponderID = ResponderID.getInstance(seq.getObjectAt(0));
    this.producedAt = (ASN1GeneralizedTime)seq.getObjectAt(1);
}
项目:TinyTravelTracker    文件:OcspIdentifier.java   
private OcspIdentifier(ASN1Sequence seq)
{
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException("Bad sequence size: "
            + seq.size());
    }
    this.ocspResponderID = ResponderID.getInstance(seq.getObjectAt(0));
    this.producedAt = (ASN1GeneralizedTime)seq.getObjectAt(1);
}
项目:CryptMeme    文件:OcspIdentifier.java   
private OcspIdentifier(ASN1Sequence seq)
{
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException("Bad sequence size: "
            + seq.size());
    }
    this.ocspResponderID = ResponderID.getInstance(seq.getObjectAt(0));
    this.producedAt = (ASN1GeneralizedTime)seq.getObjectAt(1);
}
项目:irma_future_id    文件:OcspIdentifier.java   
private OcspIdentifier(ASN1Sequence seq)
{
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException("Bad sequence size: "
            + seq.size());
    }
    this.ocspResponderID = ResponderID.getInstance(seq.getObjectAt(0));
    this.producedAt = (ASN1GeneralizedTime)seq.getObjectAt(1);
}
项目:bc-java    文件:OcspIdentifier.java   
private OcspIdentifier(ASN1Sequence seq)
{
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException("Bad sequence size: "
            + seq.size());
    }
    this.ocspResponderID = ResponderID.getInstance(seq.getObjectAt(0));
    this.producedAt = (ASN1GeneralizedTime)seq.getObjectAt(1);
}
项目:ipack    文件:RespID.java   
public RespID(
    ResponderID id)
{
    this.id = id;
}
项目:ipack    文件:RespID.java   
public RespID(
    X500Name name)
{
    this.id = new ResponderID(name);
}
项目:ipack    文件:RespID.java   
public ResponderID toASN1Object()
{
    return id;
}
项目:ipack    文件:OcspIdentifier.java   
public OcspIdentifier(ResponderID ocspResponderID, ASN1GeneralizedTime producedAt)
{
    this.ocspResponderID = ocspResponderID;
    this.producedAt = producedAt;
}
项目:ipack    文件:OcspIdentifier.java   
public ResponderID getOcspResponderID()
{
    return this.ocspResponderID;
}
项目:ipack    文件:RespID.java   
public RespID(
    ResponderID id)
{
    this.id = id;
}
项目:ipack    文件:RespID.java   
public RespID(
    X500Principal   name)
{
    this.id = new ResponderID(X500Name.getInstance(name.getEncoded()));
}
项目:ipack    文件:RespID.java   
public ResponderID toASN1Object()
{
    return id;
}
项目:gwt-crypto    文件:RespID.java   
public RespID(
    ResponderID id)
{
    this.id = id;
}
项目:gwt-crypto    文件:RespID.java   
public RespID(
    X500Name name)
{
    this.id = new ResponderID(name);
}
项目:gwt-crypto    文件:RespID.java   
public ResponderID toASN1Primitive()
{
    return id;
}
项目:gwt-crypto    文件:OcspIdentifier.java   
public OcspIdentifier(ResponderID ocspResponderID, ASN1GeneralizedTime producedAt)
{
    this.ocspResponderID = ocspResponderID;
    this.producedAt = producedAt;
}
项目:gwt-crypto    文件:OcspIdentifier.java   
public ResponderID getOcspResponderID()
{
    return this.ocspResponderID;
}
项目:Aki-SSL    文件:RespID.java   
public RespID(
    ResponderID id)
{
    this.id = id;
}
项目:Aki-SSL    文件:RespID.java   
public RespID(
    X500Name name)
{
    this.id = new ResponderID(name);
}
项目:Aki-SSL    文件:RespID.java   
public ResponderID toASN1Primitive()
{
    return id;
}
项目:Aki-SSL    文件:OcspIdentifier.java   
public OcspIdentifier(ResponderID ocspResponderID, ASN1GeneralizedTime producedAt)
{
    this.ocspResponderID = ocspResponderID;
    this.producedAt = producedAt;
}
项目:Aki-SSL    文件:OcspIdentifier.java   
public ResponderID getOcspResponderID()
{
    return this.ocspResponderID;
}
项目:TinyTravelTracker    文件:OcspIdentifier.java   
public OcspIdentifier(ResponderID ocspResponderID, ASN1GeneralizedTime producedAt)
{
    this.ocspResponderID = ocspResponderID;
    this.producedAt = producedAt;
}
项目:TinyTravelTracker    文件:OcspIdentifier.java   
public ResponderID getOcspResponderID()
{
    return this.ocspResponderID;
}