Examples of MessageImprint


Examples of org.apache.harmony.security.x509.tsp.MessageImprint

       
       
        // creating TimeStampToken
        String policy = "1.2.3.4.5";
        String sha1 = "1.3.14.3.2.26";
        MessageImprint msgImprint = new MessageImprint(new AlgorithmIdentifier(
                sha1), new byte[20]);
        Date genTime = new Date();
        BigInteger nonce = BigInteger.valueOf(1234567890L);
        // accuracy is 1 second
        int[] accuracy = new int[] { 1, 0, 0 };
View Full Code Here

Examples of org.apache.harmony.security.x509.tsp.MessageImprint

     * @throws IOException
     * @tests 'org.apache.harmony.security.x509.tsp.TimeStampReq.getEncoded()'
     */
    public void testTimeStampReq() throws IOException {
        // SHA1 OID
        MessageImprint msgImprint = new MessageImprint(new AlgorithmIdentifier(
                "1.3.14.3.2.26"), new byte[20]);
        String reqPolicy = "1.2.3.4.5";
        BigInteger nonce = BigInteger.valueOf(1234567890L);
        Extensions exts = new Extensions();
        int[] extOID = new int[] { 1, 2, 3, 2, 1 };
View Full Code Here

Examples of org.apache.harmony.security.x509.tsp.MessageImprint

    public void testGetEncoded() throws IOException {
        // Unizeto CETRUM policy
        String policy = "1.2.3.4.5";
        // SHA1 OID as defined in RFC 3161
        String sha1 = "1.3.14.3.2.26";
        MessageImprint msgImprint = new MessageImprint(new AlgorithmIdentifier(
                sha1), new byte[20]);
        Date genTime = new Date();
        BigInteger nonce = BigInteger.valueOf(1234567890L);
        int[] accuracy = new int[] { 1, 0, 0 };
        GeneralName tsa = new GeneralName(new Name("CN=AnAuthority"));
View Full Code Here

Examples of org.apache.harmony.security.x509.tsp.MessageImprint

    }
   
    // generates a TimeStampReq and returns its ASN1 DER encoding
    private static byte[] generateTimeStampReq(byte[] digest,
            AlgorithmIdentifier algID) throws NoSuchAlgorithmException {
        MessageImprint msgImprint = new MessageImprint(algID, digest);
        SecureRandom random;
        String randAlgName = "SHA1PRNG";
        try {
            random = SecureRandom.getInstance(randAlgName);
        } catch (NoSuchAlgorithmException e) {
View Full Code Here

Examples of org.bouncycastle.asn1.tsp.MessageImprint

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

Examples of org.bouncycastle.asn1.tsp.MessageImprint

     */
    public boolean verifyTimestampImprint() throws GeneralSecurityException {
        if (timeStampToken == null)
            return false;
        TimeStampTokenInfo info = timeStampToken.getTimeStampInfo();
        MessageImprint imprint = info.toASN1Structure().getMessageImprint();
        String algOID = info.getMessageImprintAlgOID().getId();
        byte[] md = new BouncyCastleDigest().getMessageDigest(DigestAlgorithms.getDigest(algOID)).digest(digest);
        byte[] imphashed = imprint.getHashedMessage();
        boolean res = Arrays.equals(md, imphashed);
        return res;
    }
View Full Code Here

Examples of org.bouncycastle.asn1.tsp.MessageImprint

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

Examples of org.bouncycastle.asn1.tsp.MessageImprint

    public boolean verify() throws GeneralSecurityException {
        if (verified)
            return verifyResult;
        if (isTsp) {
            TimeStampTokenInfo info = timeStampToken.getTimeStampInfo();
            MessageImprint imprint = info.toASN1Structure().getMessageImprint();
            byte[] md = messageDigest.digest();
            byte[] imphashed = imprint.getHashedMessage();
            verifyResult = Arrays.equals(md, imphashed);
        }
        else {
            if (sigAttr != null || sigAttrDer != null) {
                final byte [] msgDigestBytes = messageDigest.digest();
View Full Code Here

Examples of org.bouncycastle.asn1.tsp.MessageImprint

     */
    public boolean verifyTimestampImprint() throws GeneralSecurityException {
        if (timeStampToken == null)
            return false;
        TimeStampTokenInfo info = timeStampToken.getTimeStampInfo();
        MessageImprint imprint = info.toASN1Structure().getMessageImprint();
        String algOID = info.getMessageImprintAlgOID().getId();
        byte[] md = new BouncyCastleDigest().getMessageDigest(DigestAlgorithms.getDigest(algOID)).digest(digest);
        byte[] imphashed = imprint.getHashedMessage();
        boolean res = Arrays.equals(md, imphashed);
        return res;
    }
View Full Code Here

Examples of org.bouncycastle.asn1.tsp.MessageImprint

     * @since  2.1.6
     */
    public boolean verifyTimestampImprint() throws NoSuchAlgorithmException {
        if (timeStampToken == null)
            return false;
        MessageImprint imprint = timeStampToken.getTimeStampInfo().toTSTInfo().getMessageImprint();
        byte[] md = MessageDigest.getInstance("SHA-1").digest(digest);
        byte[] imphashed = imprint.getHashedMessage();
        boolean res = Arrays.equals(md, imphashed);
        return res;
    }
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.