jdk/test/java/security/cert/CertPathBuilder/akiExt/AKISerialNumber.java
author mullan
Mon, 17 Feb 2014 11:36:40 -0500
changeset 22977 f8f315760941
permissions -rw-r--r--
8025708: Certificate Path Building problem with AKI serial number Reviewed-by: xuelei, juh
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22977
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
     1
/*
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
     4
 *
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
     7
 * published by the Free Software Foundation.
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
     8
 *
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    13
 * accompanied this code).
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    14
 *
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    18
 *
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    21
 * questions.
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    22
 */
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    23
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    24
/**
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    25
 * @test
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    26
 * @bug 8025708
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    27
 * @summary make sure a PKIX CertPathBuilder can build a path when an
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    28
 *     intermediate CA certificate contains an AKI extension with a key
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    29
 *     identifier and no serial number and the end-entity certificate contains
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    30
 *     an AKI extension with both a key identifier and a serial number.
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    31
 */
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    32
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    33
import java.io.ByteArrayInputStream;
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    34
import java.security.cert.*;
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    35
import java.util.ArrayList;
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    36
import java.util.Base64;
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    37
import java.util.Collections;
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    38
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    39
public class AKISerialNumber {
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    40
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    41
    private static final String ROOT_CERT =
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    42
        "MIICfTCCAeagAwIBAgIBATANBgkqhkiG9w0BAQUFADB3MQ0wCwYDVQQDEwRSb290\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    43
        "MRYwFAYDVQQLEw1UZXN0IE9yZyBVbml0MREwDwYDVQQKEwhUZXN0IE9yZzEWMBQG\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    44
        "A1UEBxMNVGVzdCBMb2NhbGl0eTEWMBQGA1UECBMNTWFzc2FjaHVzZXR0czELMAkG\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    45
        "A1UEBhMCVVMwHhcNMTQwMjAxMDUwMDAwWhcNMjQwMjAxMDUwMDAwWjB3MQ0wCwYD\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    46
        "VQQDEwRSb290MRYwFAYDVQQLEw1UZXN0IE9yZyBVbml0MREwDwYDVQQKEwhUZXN0\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    47
        "IE9yZzEWMBQGA1UEBxMNVGVzdCBMb2NhbGl0eTEWMBQGA1UECBMNTWFzc2FjaHVz\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    48
        "ZXR0czELMAkGA1UEBhMCVVMwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJvL\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    49
        "cZu6Rzf9IrduEDjJxEFv5uBvUNMlIAph7NhfmFH9puPW3Ksci4a5yTCzxI9VeVf3\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    50
        "oYZ/UrZdF+mNZmS23RUh71X5tjMO+xew196M1xNpCRLbjcZ6i4tNdZYkdRIe8ejN\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    51
        "sbBoD7OAvPbQqTygeG4jYjK6ODofSrba3BndNoFxAgMBAAGjGTAXMBUGA1UdEwEB\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    52
        "/wQLMAkBAf8CBH////8wDQYJKoZIhvcNAQEFBQADgYEATvCqn69pNHv0zLiZAXk7\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    53
        "3AKwAoza0wa+1S2rVuZGfBWbV7CxmBHbgcDDbU7/I8pQVkCwOHNkVFnBgNpMuAvU\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    54
        "aDyrHSNS/av5d1yk5WAuGX2B9mSwZdhnAvtz2fsV1q9NptdF54EkIiKtQQmTGnr9\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    55
        "TID8CFEk/qje+AB272B1UJw=\n";
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    56
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    57
    /**
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    58
     * This certificate contains an AuthorityKeyIdentifier with only the
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    59
     * keyIdentifier field filled in.
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    60
     */
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    61
    private static final String INT_CERT_WITH_KEYID_AKI =
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    62
        "MIICqTCCAhKgAwIBAgIBAjANBgkqhkiG9w0BAQUFADB3MQ0wCwYDVQQDEwRSb290\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    63
        "MRYwFAYDVQQLEw1UZXN0IE9yZyBVbml0MREwDwYDVQQKEwhUZXN0IE9yZzEWMBQG\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    64
        "A1UEBxMNVGVzdCBMb2NhbGl0eTEWMBQGA1UECBMNTWFzc2FjaHVzZXR0czELMAkG\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    65
        "A1UEBhMCVVMwHhcNMTQwMjAxMDUwMDAwWhcNMjQwMjAxMDUwMDAwWjCBhDEaMBgG\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    66
        "A1UEAxMRSW50ZXJtZWRpYXRlIENBIDIxFjAUBgNVBAsTDVRlc3QgT3JnIFVuaXQx\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    67
        "ETAPBgNVBAoTCFRlc3QgT3JnMRYwFAYDVQQHEw1UZXN0IExvY2FsaXR5MRYwFAYD\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    68
        "VQQIEw1NYXNzYWNodXNldHRzMQswCQYDVQQGEwJVUzCBnzANBgkqhkiG9w0BAQEF\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    69
        "AAOBjQAwgYkCgYEAwKTZekCqb9F9T54s2IXjkQbmLIjQamMpkUlZNrpjjNq9CpTT\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    70
        "POkfxv2UPwzTz3Ij4XFL/kJFBLm8NUOsS5xPJ62pGoZBPw9R0iMTsTce+Fpukqnr\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    71
        "I+8jTRaAvr0tR3pqrE6uHKg7dWYN2SsWesDia/LHhwEN38yyWtSuTTLo4hcCAwEA\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    72
        "AaM3MDUwHwYDVR0jBBgwFoAU6gZP1pO8v7+i8gsFf1gWTf/j3PkwEgYDVR0TAQH/\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    73
        "BAgwBgEB/wIBADANBgkqhkiG9w0BAQUFAAOBgQAQxeQruav4AqQM4gmEfrHr5hOq\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    74
        "mB2CNJ1ZqVfpDZ8GHijncKTpjNoXzzQtV23Ge+39JHOVBNWtk+aghB3iu6xGq7Qn\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    75
        "HlBhg9meqHFqd3igDDD/jhABL2/bEo/M9rv6saYWDFZ8nCIEE6iTLTpRRko4W2Xb\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    76
        "DyzMzMsO1kPNrJaxRg==\n";
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    77
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    78
    /**
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    79
     * This certificate contains an AuthorityKeyIdentifier with all 3 fields
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    80
     * (keyIdentifier, authorityCertIssuer, and authorityCertSerialNumber)
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    81
     * filled in.
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    82
     */
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    83
    private static final String EE_CERT_WITH_FULL_AKI =
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    84
        "MIIDLjCCApegAwIBAgIBAzANBgkqhkiG9w0BAQUFADCBhDEaMBgGA1UEAxMRSW50\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    85
        "ZXJtZWRpYXRlIENBIDIxFjAUBgNVBAsTDVRlc3QgT3JnIFVuaXQxETAPBgNVBAoT\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    86
        "CFRlc3QgT3JnMRYwFAYDVQQHEw1UZXN0IExvY2FsaXR5MRYwFAYDVQQIEw1NYXNz\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    87
        "YWNodXNldHRzMQswCQYDVQQGEwJVUzAeFw0xNDAyMDEwNTAwMDBaFw0yNDAyMDEw\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    88
        "NTAwMDBaMH0xEzARBgNVBAMTCkVuZCBFbnRpdHkxFjAUBgNVBAsTDVRlc3QgT3Jn\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    89
        "IFVuaXQxETAPBgNVBAoTCFRlc3QgT3JnMRYwFAYDVQQHEw1UZXN0IExvY2FsaXR5\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    90
        "MRYwFAYDVQQIEw1NYXNzYWNodXNldHRzMQswCQYDVQQGEwJVUzCBnzANBgkqhkiG\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    91
        "9w0BAQEFAAOBjQAwgYkCgYEAqady46PdwlKHVP1iaP11CxVyL6cDlPjpwhHCcIUv\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    92
        "nKHbzdamqmHebDcWVBNN/I0TLNCl3ga7n8KyygSN379fG7haU8SNjpy4IDAXM0/x\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    93
        "mwTWNTbKfJEkSoiqx1WUy2JTzRUMhgYPguQNECPxBXAdQrthZ7wQosv6Ro2ySP9O\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    94
        "YqsCAwEAAaOBtTCBsjCBoQYDVR0jBIGZMIGWgBQdeoKxTvlTgW2KgprD69vgHV4X\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    95
        "kKF7pHkwdzENMAsGA1UEAxMEUm9vdDEWMBQGA1UECxMNVGVzdCBPcmcgVW5pdDER\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    96
        "MA8GA1UEChMIVGVzdCBPcmcxFjAUBgNVBAcTDVRlc3QgTG9jYWxpdHkxFjAUBgNV\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    97
        "BAgTDU1hc3NhY2h1c2V0dHMxCzAJBgNVBAYTAlVTggECMAwGA1UdEwEB/wQCMAAw\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    98
        "DQYJKoZIhvcNAQEFBQADgYEAuG4mM1nLF7STQWwmceELZEl49ntapH/RVoekknmd\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
    99
        "aNzcL4XQf6BTl8KFUXuThHaukQnGIzFbSZV0hrpSQ5fTN2cSZgD4Fji+HuNURmmd\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   100
        "+Kayl0piHyO1FSbrty0TFhlVNvzKXjmMp6Jdn42KyGOSCoROQcvUWN6xkV3Hvrei\n" +
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   101
        "0ZE=\n";
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   102
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   103
    private static Base64.Decoder b64Decoder = Base64.getMimeDecoder();
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   104
    private static CertificateFactory cf;
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   105
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   106
    public static void main(String[] args) throws Exception {
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   107
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   108
        cf = CertificateFactory.getInstance("X.509");
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   109
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   110
        X509Certificate rootCert = getCertFromMimeEncoding(ROOT_CERT);
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   111
        TrustAnchor anchor = new TrustAnchor(rootCert, null);
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   112
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   113
        X509Certificate eeCert = getCertFromMimeEncoding(EE_CERT_WITH_FULL_AKI);
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   114
        X509Certificate intCert = getCertFromMimeEncoding(INT_CERT_WITH_KEYID_AKI);
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   115
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   116
        X509CertSelector sel = new X509CertSelector();
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   117
        sel.setCertificate(eeCert);
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   118
        PKIXBuilderParameters params = new PKIXBuilderParameters
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   119
            (Collections.singleton(anchor), sel);
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   120
        params.setRevocationEnabled(false);
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   121
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   122
        ArrayList<X509Certificate> certs = new ArrayList<>();
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   123
        certs.add(intCert);
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   124
        certs.add(eeCert);
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   125
        CollectionCertStoreParameters ccsp =
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   126
            new CollectionCertStoreParameters(certs);
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   127
        CertStore cs = CertStore.getInstance("Collection", ccsp);
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   128
        params.addCertStore(cs);
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   129
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   130
        CertPathBuilder cpb = CertPathBuilder.getInstance("PKIX");
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   131
        CertPathBuilderResult res = cpb.build(params);
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   132
    }
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   133
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   134
    private static X509Certificate getCertFromMimeEncoding(String encoded)
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   135
        throws CertificateException
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   136
    {
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   137
        byte[] bytes = b64Decoder.decode(encoded);
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   138
        ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   139
        return (X509Certificate)cf.generateCertificate(stream);
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   140
    }
f8f315760941 8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
diff changeset
   141
}