Examples of TimeStampTokenInfo


Examples of org.bouncycastle.tsp.TimeStampTokenInfo

  public static TimeStamp toTimeStamp(final TimeStampToken timeStampToken) throws IOException, CertificateException {
    if (timeStampToken == null) {
      return null;
    }

    TimeStampTokenInfo timeStampTokenInfo = timeStampToken.getTimeStampInfo();

    TimeStamp timeStamp = new TimeStamp();
    timeStamp.setDate(timeStampTokenInfo.getGenTime());
    timeStamp.setEncoded(timeStampToken.getEncoded());
    timeStamp.setHash(timeStampTokenInfo.getMessageImprintDigest());
    timeStamp.setNonce(timeStampTokenInfo.getNonce());
    timeStamp.setSerialNumber(timeStampTokenInfo.getSerialNumber());

    CMSSignedData signedData = timeStampToken.toCMSSignedData();
    Object signedContent = signedData.getSignedContent().getContent();

    if ((signedContent != null) && (signedContent.getClass().isArray())) {
View Full Code Here

Examples of org.bouncycastle.tsp.TimeStampTokenInfo

                }
            }
            if (isTsp) {
                ContentInfo contentInfoTsp = new ContentInfo(signedData);
                this.timeStampToken = new TimeStampToken(contentInfoTsp);
                TimeStampTokenInfo info = timeStampToken.getTimeStampInfo();
                String algOID = info.getMessageImprintAlgOID();
                messageDigest = MessageDigest.getInstance(algOID);
            }
            else {
                if (RSAdata != null || digestAttr != null) {
                    if (provider == null || provider.startsWith("SunPKCS11")) {
View Full Code Here

Examples of org.bouncycastle.tsp.TimeStampTokenInfo

     */
    public boolean verify() throws SignatureException {
        if (verified)
            return verifyResult;
        if (isTsp) {
            TimeStampTokenInfo info = timeStampToken.getTimeStampInfo();
            MessageImprint imprint = info.toTSTInfo().getMessageImprint();
            byte[] md = messageDigest.digest();
            byte[] imphashed = imprint.getHashedMessage();
            verifyResult = Arrays.equals(md, imphashed);
        }
        else {
View Full Code Here

Examples of org.bouncycastle.tsp.TimeStampTokenInfo

     * @since  2.1.6
     */
    public boolean verifyTimestampImprint() throws NoSuchAlgorithmException {
        if (timeStampToken == null)
            return false;
        TimeStampTokenInfo info = timeStampToken.getTimeStampInfo();
        MessageImprint imprint = info.toTSTInfo().getMessageImprint();
        String algOID = info.getMessageImprintAlgOID();
        byte[] md = MessageDigest.getInstance(algOID).digest(digest);
        byte[] imphashed = imprint.getHashedMessage();
        boolean res = Arrays.equals(md, imphashed);
        return res;
    }
View Full Code Here

Examples of org.bouncycastle.tsp.TimeStampTokenInfo

  public static TimeStamp toTimeStamp(final TimeStampToken timeStampToken) throws IOException, CertificateException {
    if (timeStampToken == null) {
      return null;
    }

    TimeStampTokenInfo timeStampTokenInfo = timeStampToken.getTimeStampInfo();

    TimeStamp timeStamp = new TimeStamp();
    timeStamp.setDate(timeStampTokenInfo.getGenTime());
    timeStamp.setEncoded(timeStampToken.getEncoded());
    timeStamp.setHash(timeStampTokenInfo.getMessageImprintDigest());
    timeStamp.setNonce(timeStampTokenInfo.getNonce());
    timeStamp.setSerialNumber(timeStampTokenInfo.getSerialNumber());

    CMSSignedData signedData = timeStampToken.toCMSSignedData();
    Object signedContent = signedData.getSignedContent().getContent();

    if ((signedContent != null) && (signedContent.getClass().isArray())) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.