Package javax.crypto

Examples of javax.crypto.EncryptedPrivateKeyInfo


                // generate test data
                TestDataGenerator g = new TestDataGenerator(algName[i][0],
                        algName[i][1], privateKeyInfo, null);

                // create test object
                EncryptedPrivateKeyInfo epki;
                if (g.ap() == null) {
                    epki = new EncryptedPrivateKeyInfo(algName[i][0], g.ct());
                } else {
                    epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
                }

                try {
                    PKCS8EncodedKeySpec eks = epki
                            .getKeySpec(g.pubK() == null ? g.k() : g.pubK());

                    if (!Arrays.equals(privateKeyInfo, eks.getEncoded())) {
                        fail(algName[i][0] + " != " + algName[i][1]);
                    }
View Full Code Here


                // generate test data
                TestDataGenerator g = new TestDataGenerator(algName[i][0],
                        algName[i][1], privateKeyInfoDamaged, null);

                // create test object
                EncryptedPrivateKeyInfo epki;
                if (g.ap() == null) {
                    epki = new EncryptedPrivateKeyInfo(algName[i][0], g.ct());
                } else {
                    epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
                }

                try {
                    epki.getKeySpec(g.pubK() == null ? g.k() : g.pubK());
                    fail(algName[i][0] + ", " + algName[i][1]);
                } catch (InvalidKeyException e) {
                }

                performed = true;
View Full Code Here

    public final void testGetKeySpecKeyString01() throws Exception {
        boolean performed = false;
        for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
            try {
                EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
                        EncryptedPrivateKeyInfoData.algName0[i][0],
                        EncryptedPrivateKeyInfoData.encryptedData);

                try {

                    // check that method under test throws NPE
                    epki.getKeySpec((Key) null, "SomeProviderName");
                    fail(getName() + "NullPointerException has not been thrown");

                } catch (NullPointerException ok) {
                }

                try {

                    // check that method under test throws NPE
                    epki.getKeySpec(new Key() {
                        public String getAlgorithm() {
                            return "alg";
                        }

                        public String getFormat() {
View Full Code Here

                    continue;
                }

                try {
                    // create test object
                    EncryptedPrivateKeyInfo epki;
                    if (g.ap() == null) {
                        epki = new EncryptedPrivateKeyInfo(algName[i][0], g
                                .ct());
                    } else {
                        epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
                    }
                    try {

                        PKCS8EncodedKeySpec eks = epki.getKeySpec(
                                g.pubK() == null ? g.k() : g.pubK(),
                                provider[l].getName());

                        if (!Arrays.equals(privateKeyInfo, eks.getEncoded())) {
                            fail(algName[i][0] + " != " + algName[i][1]);
View Full Code Here

                    continue;
                }

                try {
                    // create test object
                    EncryptedPrivateKeyInfo epki;
                    if (g.ap() == null) {
                        epki = new EncryptedPrivateKeyInfo(algName[i][0], g
                                .ct());
                    } else {
                        epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
                    }

                    try {

                        epki.getKeySpec(g.pubK() == null ? g.k() : g.pubK(),
                                provider[l].getName());

                        fail(algName[i][0] + ", " + algName[i][1]);

                    } catch (InvalidKeyException e) {
View Full Code Here

    public final void testGetKeySpecKeyProvider01() throws Exception {
        boolean performed = false;

        for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
            try {
                EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
                        EncryptedPrivateKeyInfoData.algName0[i][0],
                        EncryptedPrivateKeyInfoData.encryptedData);

                try {

                    // check that method under test throws NPE
                    epki.getKeySpec((Key) null, (Provider) null);
                    fail(getName() + "NullPointerException has not been thrown");
                } catch (NullPointerException ok) {
                }

                try {

                    // check that method under test throws NPE
                    epki.getKeySpec(new Key() {
                        public String getAlgorithm() {
                            return "alg";
                        }

                        public String getFormat() {
View Full Code Here

                } catch (TestDataGenerator.AllowedFailure allowedFailure) {
                    continue;
                }
                try {
                    // create test object
                    EncryptedPrivateKeyInfo epki;
                    if (g.ap() == null) {
                        epki = new EncryptedPrivateKeyInfo(algName[i][0], g
                                .ct());
                    } else {
                        epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
                    }
                    try {

                        PKCS8EncodedKeySpec eks = epki.getKeySpec(
                                g.pubK() == null ? g.k() : g.pubK(),
                                provider[l]);

                        if (!Arrays.equals(privateKeyInfo, eks.getEncoded())) {
                            fail(algName[i][0] + " != " + algName[i][1]);
View Full Code Here

                    continue;
                }

                try {
                    // create test object
                    EncryptedPrivateKeyInfo epki;
                    if (g.ap() == null) {
                        epki = new EncryptedPrivateKeyInfo(algName[i][0], g
                                .ct());
                    } else {
                        epki = new EncryptedPrivateKeyInfo(g.ap(), g.ct());
                    }
                    try {

                        epki.getKeySpec(g.pubK() == null ? g.k() : g.pubK(),
                                provider[l]);

                        fail(algName[i][0] + ", " + algName[i][1]);

                    } catch (InvalidKeyException e) {
View Full Code Here

     */
    public final void testGetAlgName01() throws IOException {
        boolean performed = false;
        for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
            try {
                EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
                        EncryptedPrivateKeyInfoData
                                .getValidEncryptedPrivateKeyInfoEncoding(
                                        EncryptedPrivateKeyInfoData.algName0[i][0]));
                assertEquals(EncryptedPrivateKeyInfoData.algName0[i][1], epki
                        .getAlgName());
                performed = true;
            } catch (NoSuchAlgorithmException allowed) {
            }
        }
View Full Code Here

     */
    public final void testGetAlgName02() {
        boolean performed = false;
        for (int i = 0; i < EncryptedPrivateKeyInfoData.algName0.length; i++) {
            try {
                EncryptedPrivateKeyInfo epki = new EncryptedPrivateKeyInfo(
                        EncryptedPrivateKeyInfoData.algName0[i][0],
                        EncryptedPrivateKeyInfoData.encryptedData);
                assertEquals(EncryptedPrivateKeyInfoData.algName0[i][1], epki
                        .getAlgName());
                performed = true;
            } catch (NoSuchAlgorithmException allowedFailure) {
            }
        }
View Full Code Here

TOP

Related Classes of javax.crypto.EncryptedPrivateKeyInfo

Copyright © 2018 www.massapicom. 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.