mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-08 14:08:48 +00:00
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
Reviewed-by: xuelei, mullan
This commit is contained in:
parent
38afb5138c
commit
598c79031d
@ -113,6 +113,9 @@ ifndef OPENJDK
|
||||
endif
|
||||
endif
|
||||
|
||||
JAVAC_MAX_WARNINGS = false
|
||||
JAVAC_LINT_OPTIONS = -Xlint:all,-deprecation
|
||||
JAVAC_WARNINGS_FATAL = true
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
#
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,6 +28,9 @@
|
||||
#
|
||||
|
||||
BUILDDIR = ../../..
|
||||
SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=false
|
||||
SUBDIRS_MAKEFLAGS += JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation
|
||||
SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
SUBDIRS = auth
|
||||
|
||||
@ -26,6 +26,9 @@
|
||||
BUILDDIR = ../..
|
||||
PACKAGE = java.security
|
||||
PRODUCT = sun
|
||||
JAVAC_MAX_WARNINGS = false
|
||||
JAVAC_LINT_OPTIONS = -Xlint:all,-deprecation
|
||||
JAVAC_WARNINGS_FATAL = true
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
#
|
||||
|
||||
@ -128,6 +128,8 @@ ifndef OPENJDK
|
||||
endif
|
||||
endif
|
||||
|
||||
JAVAC_MAX_WARNINGS = true
|
||||
JAVAC_WARNINGS_FATAL = true
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
#
|
||||
|
||||
@ -34,6 +34,8 @@
|
||||
#
|
||||
|
||||
BUILDDIR = ../..
|
||||
SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
|
||||
SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
# build sun/security/jgss/wrapper on non-windows platform
|
||||
|
||||
@ -109,6 +109,9 @@ ifndef OPENJDK
|
||||
endif
|
||||
endif
|
||||
|
||||
JAVAC_MAX_WARNINGS=false
|
||||
JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation
|
||||
JAVAC_WARNINGS_FATAL=true
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
#
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,6 +26,9 @@
|
||||
BUILDDIR = ../../..
|
||||
PACKAGE = sun.security.other
|
||||
PRODUCT = sun
|
||||
JAVAC_MAX_WARNINGS=false
|
||||
JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation
|
||||
JAVAC_WARNINGS_FATAL=true
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
#
|
||||
|
||||
@ -110,6 +110,9 @@ ifndef OPENJDK
|
||||
endif
|
||||
endif
|
||||
|
||||
JAVAC_MAX_WARNINGS=false
|
||||
JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation
|
||||
JAVAC_WARNINGS_FATAL=true
|
||||
include $(BUILDDIR)/common/Defs.gmk
|
||||
|
||||
#
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -245,7 +245,7 @@ final class AESCrypt extends SymmetricCipher implements AESConstants
|
||||
for (j = 0; j < 8; j++) {
|
||||
tmp = AA[i][j];
|
||||
AA[i][j] = AA[t][j];
|
||||
AA[t][j] = (byte) tmp;
|
||||
AA[t][j] = tmp;
|
||||
}
|
||||
pivot = AA[i][i];
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,13 +25,10 @@
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
import sun.security.util.*;
|
||||
import java.security.AlgorithmParametersSpi;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
import java.security.spec.InvalidParameterSpecException;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
|
||||
/**
|
||||
* This class implements the parameter (IV) used with the AES algorithm
|
||||
@ -67,9 +64,15 @@ public final class AESParameters extends AlgorithmParametersSpi {
|
||||
core.init(encoded, decodingMethod);
|
||||
}
|
||||
|
||||
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
|
||||
protected <T extends AlgorithmParameterSpec>
|
||||
T engineGetParameterSpec(Class<T> paramSpec)
|
||||
throws InvalidParameterSpecException {
|
||||
return core.getParameterSpec(paramSpec);
|
||||
if (AlgorithmParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||
return core.getParameterSpec(paramSpec);
|
||||
} else {
|
||||
throw new InvalidParameterSpecException
|
||||
("Inappropriate parameter Specification");
|
||||
}
|
||||
}
|
||||
|
||||
protected byte[] engineGetEncoded() throws IOException {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,7 +25,6 @@
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
import sun.security.util.*;
|
||||
import sun.misc.HexDumpEncoder;
|
||||
@ -64,7 +63,7 @@ final class BlockCipherParamsCore {
|
||||
throw new InvalidParameterSpecException("IV not " +
|
||||
block_size + " bytes long");
|
||||
}
|
||||
iv = (byte[]) tmpIv.clone();
|
||||
iv = tmpIv.clone();
|
||||
}
|
||||
|
||||
void init(byte[] encoded) throws IOException {
|
||||
@ -90,11 +89,11 @@ final class BlockCipherParamsCore {
|
||||
init(encoded);
|
||||
}
|
||||
|
||||
AlgorithmParameterSpec getParameterSpec(Class paramSpec)
|
||||
<T extends AlgorithmParameterSpec> T getParameterSpec(Class<T> paramSpec)
|
||||
throws InvalidParameterSpecException
|
||||
{
|
||||
if (IvParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||
return new IvParameterSpec(this.iv);
|
||||
return paramSpec.cast(new IvParameterSpec(this.iv));
|
||||
} else {
|
||||
throw new InvalidParameterSpecException
|
||||
("Inappropriate parameter specification");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,13 +25,10 @@
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
import sun.security.util.*;
|
||||
import java.security.AlgorithmParametersSpi;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
import java.security.spec.InvalidParameterSpecException;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
|
||||
/**
|
||||
* This class implements the parameter (IV) used with the Blowfish algorithm in
|
||||
@ -68,9 +65,15 @@ public final class BlowfishParameters extends AlgorithmParametersSpi {
|
||||
core.init(encoded, decodingMethod);
|
||||
}
|
||||
|
||||
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
|
||||
protected <T extends AlgorithmParameterSpec>
|
||||
T engineGetParameterSpec(Class<T> paramSpec)
|
||||
throws InvalidParameterSpecException {
|
||||
return core.getParameterSpec(paramSpec);
|
||||
if (AlgorithmParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||
return core.getParameterSpec(paramSpec);
|
||||
} else {
|
||||
throw new InvalidParameterSpecException
|
||||
("Inappropriate parameter Specification");
|
||||
}
|
||||
}
|
||||
|
||||
protected byte[] engineGetEncoded() throws IOException {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -193,7 +193,7 @@ class CipherBlockChaining extends FeedbackCipher {
|
||||
// This is necessary because in this constellation, a
|
||||
// ciphertext block (or parts of it) will be overridden by
|
||||
// the plaintext result.
|
||||
cipherOrig = (byte[])cipher.clone();
|
||||
cipherOrig = cipher.clone();
|
||||
}
|
||||
|
||||
for (; cipherOffset < endIndex;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -301,7 +301,7 @@ final class CipherCore {
|
||||
*/
|
||||
byte[] getIV() {
|
||||
byte[] iv = cipher.getIV();
|
||||
return (iv == null) ? null : (byte[])iv.clone();
|
||||
return (iv == null) ? null : iv.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -475,8 +475,7 @@ final class CipherCore {
|
||||
IvParameterSpec ivSpec = null;
|
||||
if (params != null) {
|
||||
try {
|
||||
ivSpec = (IvParameterSpec)params.getParameterSpec
|
||||
(IvParameterSpec.class);
|
||||
ivSpec = params.getParameterSpec(IvParameterSpec.class);
|
||||
} catch (InvalidParameterSpecException ipse) {
|
||||
throw new InvalidAlgorithmParameterException("Wrong parameter "
|
||||
+ "type: IV "
|
||||
@ -832,7 +831,7 @@ final class CipherCore {
|
||||
buffered = 0;
|
||||
diffBlocksize = blockSize;
|
||||
if (cipherMode != ECB_MODE) {
|
||||
((FeedbackCipher)cipher).reset();
|
||||
cipher.reset();
|
||||
}
|
||||
return totalLen;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -622,17 +622,17 @@ class DESCrypt extends SymmetricCipher implements DESConstants {
|
||||
// mangler function:
|
||||
// every 6 bit is fed into the sbox, which
|
||||
// produces 4-bit output
|
||||
left ^= s0p[(int)((temp & 0x3f) ^ key[j+0])]
|
||||
^ s1p[(int)(((temp >> 4) & 0x3f) ^ key[j+1])]
|
||||
^ s2p[(int)(((temp >> 8) & 0x3f) ^ key[j+2])]
|
||||
^ s3p[(int)(((temp >> 12) & 0x3f) ^ key[j+3])]
|
||||
^ s4p[(int)(((temp >> 16) & 0x3f) ^ key[j+4])]
|
||||
^ s5p[(int)(((temp >> 20) & 0x3f) ^ key[j+5])]
|
||||
^ s6p[(int)(((temp >> 24) & 0x3f) ^ key[j+6])];
|
||||
left ^= s0p[(temp & 0x3f) ^ key[j+0]]
|
||||
^ s1p[((temp >> 4) & 0x3f) ^ key[j+1]]
|
||||
^ s2p[((temp >> 8) & 0x3f) ^ key[j+2]]
|
||||
^ s3p[((temp >> 12) & 0x3f) ^ key[j+3]]
|
||||
^ s4p[((temp >> 16) & 0x3f) ^ key[j+4]]
|
||||
^ s5p[((temp >> 20) & 0x3f) ^ key[j+5]]
|
||||
^ s6p[((temp >> 24) & 0x3f) ^ key[j+6]];
|
||||
|
||||
// make the last sbox input the last bit from right[0]
|
||||
temp = ((right & 1) << 5) | ((right >> 27) & 0x1f);
|
||||
left ^= s7p[(int)(temp ^ key[j+7])];
|
||||
left ^= s7p[temp ^ key[j+7]];
|
||||
temp = left;
|
||||
left = right;
|
||||
right = temp;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -78,7 +78,7 @@ final class DESKey implements SecretKey {
|
||||
public byte[] getEncoded() {
|
||||
// Return a copy of the key, rather than a reference,
|
||||
// so that the key data cannot be modified from outside
|
||||
return (byte[])this.key.clone();
|
||||
return this.key.clone();
|
||||
}
|
||||
|
||||
public String getAlgorithm() {
|
||||
@ -126,7 +126,7 @@ final class DESKey implements SecretKey {
|
||||
throws java.io.IOException, ClassNotFoundException
|
||||
{
|
||||
s.defaultReadObject();
|
||||
key = (byte[])key.clone();
|
||||
key = key.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -92,7 +92,7 @@ public final class DESKeyFactory extends SecretKeyFactorySpi {
|
||||
* inappropriate for the given key, or the given key cannot be processed
|
||||
* (e.g., the given key has an unrecognized algorithm or format).
|
||||
*/
|
||||
protected KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
|
||||
protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec)
|
||||
throws InvalidKeySpecException {
|
||||
|
||||
try {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,13 +25,10 @@
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
import sun.security.util.*;
|
||||
import java.security.AlgorithmParametersSpi;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
import java.security.spec.InvalidParameterSpecException;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
|
||||
/**
|
||||
* This class implements the parameter (IV) used with the DES algorithm in
|
||||
@ -68,9 +65,15 @@ public final class DESParameters extends AlgorithmParametersSpi {
|
||||
core.init(encoded, decodingMethod);
|
||||
}
|
||||
|
||||
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
|
||||
protected <T extends AlgorithmParameterSpec>
|
||||
T engineGetParameterSpec(Class<T> paramSpec)
|
||||
throws InvalidParameterSpecException {
|
||||
return core.getParameterSpec(paramSpec);
|
||||
if (AlgorithmParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||
return core.getParameterSpec(paramSpec);
|
||||
} else {
|
||||
throw new InvalidParameterSpecException
|
||||
("Inappropriate parameter Specification");
|
||||
}
|
||||
}
|
||||
|
||||
protected byte[] engineGetEncoded() throws IOException {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -78,7 +78,7 @@ final class DESedeKey implements SecretKey {
|
||||
}
|
||||
|
||||
public byte[] getEncoded() {
|
||||
return (byte[])this.key.clone();
|
||||
return this.key.clone();
|
||||
}
|
||||
|
||||
public String getAlgorithm() {
|
||||
@ -127,7 +127,7 @@ final class DESedeKey implements SecretKey {
|
||||
throws java.io.IOException, ClassNotFoundException
|
||||
{
|
||||
s.defaultReadObject();
|
||||
key = (byte[])key.clone();
|
||||
key = key.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -92,7 +92,7 @@ public final class DESedeKeyFactory extends SecretKeyFactorySpi {
|
||||
* inappropriate for the given key, or the given key cannot be processed
|
||||
* (e.g., the given key has an unrecognized algorithm or format).
|
||||
*/
|
||||
protected KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
|
||||
protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec)
|
||||
throws InvalidKeySpecException {
|
||||
|
||||
try {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,13 +25,10 @@
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
import sun.security.util.*;
|
||||
import java.security.AlgorithmParametersSpi;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
import java.security.spec.InvalidParameterSpecException;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
|
||||
/**
|
||||
* This class implements the parameter (IV) used with the Triple DES algorithm
|
||||
@ -67,9 +64,15 @@ public final class DESedeParameters extends AlgorithmParametersSpi {
|
||||
core.init(encoded, decodingMethod);
|
||||
}
|
||||
|
||||
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
|
||||
protected <T extends AlgorithmParameterSpec>
|
||||
T engineGetParameterSpec(Class<T> paramSpec)
|
||||
throws InvalidParameterSpecException {
|
||||
return core.getParameterSpec(paramSpec);
|
||||
if (AlgorithmParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||
return core.getParameterSpec(paramSpec);
|
||||
} else {
|
||||
throw new InvalidParameterSpecException
|
||||
("Inappropriate parameter Specification");
|
||||
}
|
||||
}
|
||||
|
||||
protected byte[] engineGetEncoded() throws IOException {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,7 +25,6 @@
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.security.*;
|
||||
import java.security.spec.*;
|
||||
import javax.crypto.*;
|
||||
@ -151,7 +150,7 @@ public final class DESedeWrapCipher extends CipherSpi {
|
||||
* been set.
|
||||
*/
|
||||
protected byte[] engineGetIV() {
|
||||
return (iv == null? null:(byte[]) iv.clone());
|
||||
return (iv == null) ? null : iv.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -277,8 +276,7 @@ public final class DESedeWrapCipher extends CipherSpi {
|
||||
try {
|
||||
DESedeParameters paramsEng = new DESedeParameters();
|
||||
paramsEng.engineInit(params.getEncoded());
|
||||
ivSpec = (IvParameterSpec)
|
||||
paramsEng.engineGetParameterSpec(IvParameterSpec.class);
|
||||
ivSpec = paramsEng.engineGetParameterSpec(IvParameterSpec.class);
|
||||
} catch (Exception ex) {
|
||||
InvalidAlgorithmParameterException iape =
|
||||
new InvalidAlgorithmParameterException
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,8 +25,6 @@
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.util.*;
|
||||
import java.lang.*;
|
||||
import java.security.Key;
|
||||
import java.security.PublicKey;
|
||||
import java.security.PrivateKey;
|
||||
@ -140,7 +138,8 @@ public final class DHKeyFactory extends KeyFactorySpi {
|
||||
* inappropriate for the given key, or the given key cannot be processed
|
||||
* (e.g., the given key has an unrecognized algorithm or format).
|
||||
*/
|
||||
protected KeySpec engineGetKeySpec(Key key, Class keySpec)
|
||||
protected <T extends KeySpec>
|
||||
T engineGetKeySpec(Key key, Class<T> keySpec)
|
||||
throws InvalidKeySpecException {
|
||||
DHParameterSpec params;
|
||||
|
||||
@ -150,12 +149,12 @@ public final class DHKeyFactory extends KeyFactorySpi {
|
||||
javax.crypto.interfaces.DHPublicKey dhPubKey
|
||||
= (javax.crypto.interfaces.DHPublicKey) key;
|
||||
params = dhPubKey.getParams();
|
||||
return new DHPublicKeySpec(dhPubKey.getY(),
|
||||
params.getP(),
|
||||
params.getG());
|
||||
return keySpec.cast(new DHPublicKeySpec(dhPubKey.getY(),
|
||||
params.getP(),
|
||||
params.getG()));
|
||||
|
||||
} else if (X509EncodedKeySpec.class.isAssignableFrom(keySpec)) {
|
||||
return new X509EncodedKeySpec(key.getEncoded());
|
||||
return keySpec.cast(new X509EncodedKeySpec(key.getEncoded()));
|
||||
|
||||
} else {
|
||||
throw new InvalidKeySpecException
|
||||
@ -168,12 +167,12 @@ public final class DHKeyFactory extends KeyFactorySpi {
|
||||
javax.crypto.interfaces.DHPrivateKey dhPrivKey
|
||||
= (javax.crypto.interfaces.DHPrivateKey)key;
|
||||
params = dhPrivKey.getParams();
|
||||
return new DHPrivateKeySpec(dhPrivKey.getX(),
|
||||
params.getP(),
|
||||
params.getG());
|
||||
return keySpec.cast(new DHPrivateKeySpec(dhPrivKey.getX(),
|
||||
params.getP(),
|
||||
params.getG()));
|
||||
|
||||
} else if (PKCS8EncodedKeySpec.class.isAssignableFrom(keySpec)) {
|
||||
return new PKCS8EncodedKeySpec(key.getEncoded());
|
||||
return keySpec.cast(new PKCS8EncodedKeySpec(key.getEncoded()));
|
||||
|
||||
} else {
|
||||
throw new InvalidKeySpecException
|
||||
@ -208,8 +207,7 @@ public final class DHKeyFactory extends KeyFactorySpi {
|
||||
}
|
||||
// Convert key to spec
|
||||
DHPublicKeySpec dhPubKeySpec
|
||||
= (DHPublicKeySpec)engineGetKeySpec
|
||||
(key, DHPublicKeySpec.class);
|
||||
= engineGetKeySpec(key, DHPublicKeySpec.class);
|
||||
// Create key from spec, and return it
|
||||
return engineGeneratePublic(dhPubKeySpec);
|
||||
|
||||
@ -220,8 +218,7 @@ public final class DHKeyFactory extends KeyFactorySpi {
|
||||
}
|
||||
// Convert key to spec
|
||||
DHPrivateKeySpec dhPrivKeySpec
|
||||
= (DHPrivateKeySpec)engineGetKeySpec
|
||||
(key, DHPrivateKeySpec.class);
|
||||
= engineGetKeySpec(key, DHPrivateKeySpec.class);
|
||||
// Create key from spec, and return it
|
||||
return engineGeneratePrivate(dhPrivKeySpec);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,7 +25,6 @@
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.security.*;
|
||||
import java.security.spec.*;
|
||||
import javax.crypto.spec.DHParameterSpec;
|
||||
@ -141,8 +140,7 @@ extends AlgorithmParameterGeneratorSpi {
|
||||
paramGen = AlgorithmParameterGenerator.getInstance("DSA");
|
||||
paramGen.init(this.primeSize, random);
|
||||
algParams = paramGen.generateParameters();
|
||||
dsaParamSpec = (DSAParameterSpec)
|
||||
algParams.getParameterSpec(DSAParameterSpec.class);
|
||||
dsaParamSpec = algParams.getParameterSpec(DSAParameterSpec.class);
|
||||
|
||||
DHParameterSpec dhParamSpec;
|
||||
if (this.exponentSize > 0) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,7 +25,6 @@
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
import sun.security.util.*;
|
||||
import java.math.BigInteger;
|
||||
@ -95,11 +94,12 @@ public final class DHParameters extends AlgorithmParametersSpi {
|
||||
engineInit(params);
|
||||
}
|
||||
|
||||
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
|
||||
protected <T extends AlgorithmParameterSpec>
|
||||
T engineGetParameterSpec(Class<T> paramSpec)
|
||||
throws InvalidParameterSpecException {
|
||||
|
||||
if (DHParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||
return new DHParameterSpec(this.p, this.g, this.l);
|
||||
return paramSpec.cast(new DHParameterSpec(this.p, this.g, this.l));
|
||||
} else {
|
||||
throw new InvalidParameterSpecException
|
||||
("Inappropriate parameter Specification");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -31,7 +31,6 @@ import java.security.KeyRep;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.ProviderException;
|
||||
import javax.crypto.*;
|
||||
import javax.crypto.spec.DHParameterSpec;
|
||||
import sun.security.util.*;
|
||||
|
||||
@ -182,7 +181,7 @@ javax.crypto.interfaces.DHPrivateKey, Serializable {
|
||||
|
||||
// ignore OPTIONAL attributes
|
||||
|
||||
this.encodedKey = (byte[])encodedKey.clone();
|
||||
this.encodedKey = encodedKey.clone();
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
InvalidKeyException ike = new InvalidKeyException(
|
||||
@ -256,7 +255,7 @@ javax.crypto.interfaces.DHPrivateKey, Serializable {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return (byte[])this.encodedKey.clone();
|
||||
return this.encodedKey.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,10 +29,8 @@ import java.io.*;
|
||||
import java.math.BigInteger;
|
||||
import java.security.KeyRep;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.ProviderException;
|
||||
import java.security.PublicKey;
|
||||
import javax.crypto.*;
|
||||
import javax.crypto.spec.DHParameterSpec;
|
||||
import sun.security.util.*;
|
||||
|
||||
@ -174,7 +172,7 @@ javax.crypto.interfaces.DHPublicKey, Serializable {
|
||||
throw new InvalidKeyException("Excess key data");
|
||||
}
|
||||
|
||||
this.encodedKey = (byte[])encodedKey.clone();
|
||||
this.encodedKey = encodedKey.clone();
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
throw new InvalidKeyException("Private-value length too big");
|
||||
@ -237,7 +235,7 @@ javax.crypto.interfaces.DHPublicKey, Serializable {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return (byte[])this.encodedKey.clone();
|
||||
return this.encodedKey.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -77,7 +77,7 @@ final class EncryptedPrivateKeyInfo {
|
||||
if (seq[1].data.available() != 0)
|
||||
throw new IOException("encryptedData field overrun");
|
||||
|
||||
this.encoded = (byte[])encoded.clone();
|
||||
this.encoded = encoded.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,7 +86,7 @@ final class EncryptedPrivateKeyInfo {
|
||||
*/
|
||||
EncryptedPrivateKeyInfo(AlgorithmId algid, byte[] encryptedData) {
|
||||
this.algid = algid;
|
||||
this.encryptedData = (byte[])encryptedData.clone();
|
||||
this.encryptedData = encryptedData.clone();
|
||||
this.encoded = null; // lazy generation of encoding
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ final class EncryptedPrivateKeyInfo {
|
||||
* Returns the encrypted data.
|
||||
*/
|
||||
byte[] getEncryptedData() {
|
||||
return (byte[])this.encryptedData.clone();
|
||||
return this.encryptedData.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,7 +110,7 @@ final class EncryptedPrivateKeyInfo {
|
||||
byte[] getEncoded()
|
||||
throws IOException
|
||||
{
|
||||
if (this.encoded != null) return (byte[])this.encoded.clone();
|
||||
if (this.encoded != null) return this.encoded.clone();
|
||||
|
||||
DerOutputStream out = new DerOutputStream();
|
||||
DerOutputStream tmp = new DerOutputStream();
|
||||
@ -125,6 +125,6 @@ final class EncryptedPrivateKeyInfo {
|
||||
out.write(DerValue.tag_Sequence, tmp);
|
||||
this.encoded = out.toByteArray();
|
||||
|
||||
return (byte[])this.encoded.clone();
|
||||
return this.encoded.clone();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -78,8 +78,8 @@ final class HmacCore implements Cloneable {
|
||||
private HmacCore(HmacCore other) throws CloneNotSupportedException {
|
||||
this.md = (MessageDigest)other.md.clone();
|
||||
this.blockLen = other.blockLen;
|
||||
this.k_ipad = (byte[])other.k_ipad.clone();
|
||||
this.k_opad = (byte[])other.k_opad.clone();
|
||||
this.k_ipad = other.k_ipad.clone();
|
||||
this.k_opad = other.k_opad.clone();
|
||||
this.first = other.first;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -38,9 +38,7 @@ import java.security.KeyStoreException;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import javax.crypto.SealedObject;
|
||||
|
||||
/**
|
||||
@ -87,7 +85,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
||||
* Private keys and certificates are stored in a hashtable.
|
||||
* Hash entries are keyed by alias names.
|
||||
*/
|
||||
private Hashtable entries = new Hashtable();
|
||||
private Hashtable<String, Object> entries = new Hashtable<String, Object>();
|
||||
|
||||
/**
|
||||
* Returns the key associated with the given alias, using the given
|
||||
@ -156,7 +154,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
||||
|
||||
if ((entry instanceof PrivateKeyEntry)
|
||||
&& (((PrivateKeyEntry)entry).chain != null)) {
|
||||
chain = (Certificate[])((PrivateKeyEntry)entry).chain.clone();
|
||||
chain = ((PrivateKeyEntry)entry).chain.clone();
|
||||
}
|
||||
|
||||
return chain;
|
||||
@ -262,7 +260,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
||||
// clone the chain
|
||||
if ((chain != null) &&
|
||||
(chain.length !=0)) {
|
||||
entry.chain = (Certificate[])chain.clone();
|
||||
entry.chain = chain.clone();
|
||||
} else {
|
||||
entry.chain = null;
|
||||
}
|
||||
@ -316,10 +314,10 @@ public final class JceKeyStore extends KeyStoreSpi {
|
||||
PrivateKeyEntry entry = new PrivateKeyEntry();
|
||||
entry.date = new Date();
|
||||
|
||||
entry.protectedKey = (byte[])key.clone();
|
||||
entry.protectedKey = key.clone();
|
||||
if ((chain != null) &&
|
||||
(chain.length != 0)) {
|
||||
entry.chain = (Certificate[])chain.clone();
|
||||
entry.chain = chain.clone();
|
||||
} else {
|
||||
entry.chain = null;
|
||||
}
|
||||
@ -384,7 +382,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
||||
*
|
||||
* @return enumeration of the alias names
|
||||
*/
|
||||
public Enumeration engineAliases() {
|
||||
public Enumeration<String> engineAliases() {
|
||||
return entries.keys();
|
||||
}
|
||||
|
||||
@ -462,9 +460,9 @@ public final class JceKeyStore extends KeyStoreSpi {
|
||||
public String engineGetCertificateAlias(Certificate cert) {
|
||||
Certificate certElem;
|
||||
|
||||
Enumeration e = entries.keys();
|
||||
Enumeration<String> e = entries.keys();
|
||||
while (e.hasMoreElements()) {
|
||||
String alias = (String)e.nextElement();
|
||||
String alias = e.nextElement();
|
||||
Object entry = entries.get(alias);
|
||||
if (entry instanceof TrustedCertEntry) {
|
||||
certElem = ((TrustedCertEntry)entry).cert;
|
||||
@ -560,10 +558,10 @@ public final class JceKeyStore extends KeyStoreSpi {
|
||||
|
||||
dos.writeInt(entries.size());
|
||||
|
||||
Enumeration e = entries.keys();
|
||||
Enumeration<String> e = entries.keys();
|
||||
while (e.hasMoreElements()) {
|
||||
|
||||
String alias = (String)e.nextElement();
|
||||
String alias = e.nextElement();
|
||||
Object entry = entries.get(alias);
|
||||
|
||||
if (entry instanceof PrivateKeyEntry) {
|
||||
@ -677,7 +675,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
||||
DataInputStream dis;
|
||||
MessageDigest md = null;
|
||||
CertificateFactory cf = null;
|
||||
Hashtable cfs = null;
|
||||
Hashtable<String, CertificateFactory> cfs = null;
|
||||
ByteArrayInputStream bais = null;
|
||||
byte[] encoded = null;
|
||||
|
||||
@ -713,7 +711,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
||||
cf = CertificateFactory.getInstance("X509");
|
||||
} else {
|
||||
// version 2
|
||||
cfs = new Hashtable(3);
|
||||
cfs = new Hashtable<String, CertificateFactory>(3);
|
||||
}
|
||||
|
||||
entries.clear();
|
||||
@ -761,7 +759,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
||||
String certType = dis.readUTF();
|
||||
if (cfs.containsKey(certType)) {
|
||||
// reuse certificate factory
|
||||
cf = (CertificateFactory)cfs.get(certType);
|
||||
cf = cfs.get(certType);
|
||||
} else {
|
||||
// create new certificate factory
|
||||
cf = CertificateFactory.getInstance(
|
||||
@ -803,7 +801,7 @@ public final class JceKeyStore extends KeyStoreSpi {
|
||||
String certType = dis.readUTF();
|
||||
if (cfs.containsKey(certType)) {
|
||||
// reuse certificate factory
|
||||
cf = (CertificateFactory)cfs.get(certType);
|
||||
cf = cfs.get(certType);
|
||||
} else {
|
||||
// create new certificate factory
|
||||
cf = CertificateFactory.getInstance(certType);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,14 +25,8 @@
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.ObjectInputStream.GetField;
|
||||
import java.security.Security;
|
||||
import java.security.Key;
|
||||
import java.security.PrivateKey;
|
||||
@ -42,22 +36,14 @@ import java.security.MessageDigest;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
import java.security.InvalidParameterException;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.AlgorithmParameters;
|
||||
import java.security.spec.InvalidParameterSpecException;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.CipherSpi;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.SealedObject;
|
||||
import javax.crypto.spec.*;
|
||||
import sun.security.x509.AlgorithmId;
|
||||
@ -127,7 +113,7 @@ final class KeyProtector {
|
||||
PBEWithMD5AndTripleDESCipher cipher;
|
||||
cipher = new PBEWithMD5AndTripleDESCipher();
|
||||
cipher.engineInit(Cipher.ENCRYPT_MODE, sKey, pbeSpec, null);
|
||||
byte[] plain = (byte[])key.getEncoded();
|
||||
byte[] plain = key.getEncoded();
|
||||
byte[] encrKey = cipher.engineDoFinal(plain, 0, plain.length);
|
||||
|
||||
// wrap encrypted private key in EncryptedPrivateKeyInfo
|
||||
@ -169,8 +155,8 @@ final class KeyProtector {
|
||||
AlgorithmParameters pbeParams =
|
||||
AlgorithmParameters.getInstance("PBE");
|
||||
pbeParams.init(encodedParams);
|
||||
PBEParameterSpec pbeSpec = (PBEParameterSpec)
|
||||
pbeParams.getParameterSpec(PBEParameterSpec.class);
|
||||
PBEParameterSpec pbeSpec =
|
||||
pbeParams.getParameterSpec(PBEParameterSpec.class);
|
||||
|
||||
// create PBE key from password
|
||||
PBEKeySpec pbeKeySpec = new PBEKeySpec(this.password);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,7 +26,6 @@
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
import sun.security.util.*;
|
||||
import sun.security.x509.*;
|
||||
@ -180,11 +179,13 @@ public final class OAEPParameters extends AlgorithmParametersSpi {
|
||||
engineInit(encoded);
|
||||
}
|
||||
|
||||
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
|
||||
protected <T extends AlgorithmParameterSpec>
|
||||
T engineGetParameterSpec(Class<T> paramSpec)
|
||||
throws InvalidParameterSpecException {
|
||||
if (OAEPParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||
return new OAEPParameterSpec(mdName, "MGF1", mgfSpec,
|
||||
new PSource.PSpecified(p));
|
||||
return paramSpec.cast(
|
||||
new OAEPParameterSpec(mdName, "MGF1", mgfSpec,
|
||||
new PSource.PSpecified(p)));
|
||||
} else {
|
||||
throw new InvalidParameterSpecException
|
||||
("Inappropriate parameter specification");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,7 +25,6 @@
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.*;
|
||||
import java.security.spec.*;
|
||||
import javax.crypto.*;
|
||||
@ -326,8 +325,7 @@ final class PBECipherCore {
|
||||
PBEParameterSpec pbeSpec = null;
|
||||
if (params != null) {
|
||||
try {
|
||||
pbeSpec = (PBEParameterSpec) params.getParameterSpec
|
||||
(PBEParameterSpec.class);
|
||||
pbeSpec = params.getParameterSpec(PBEParameterSpec.class);
|
||||
} catch (InvalidParameterSpecException ipse) {
|
||||
throw new InvalidAlgorithmParameterException("Wrong parameter "
|
||||
+ "type: PBE "
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,7 +25,6 @@
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.KeyRep;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import javax.crypto.SecretKey;
|
||||
@ -69,7 +68,7 @@ final class PBEKey implements SecretKey {
|
||||
}
|
||||
|
||||
public byte[] getEncoded() {
|
||||
return (byte[])this.key.clone();
|
||||
return this.key.clone();
|
||||
}
|
||||
|
||||
public String getAlgorithm() {
|
||||
@ -118,7 +117,7 @@ final class PBEKey implements SecretKey {
|
||||
throws java.io.IOException, ClassNotFoundException
|
||||
{
|
||||
s.defaultReadObject();
|
||||
key = (byte[])key.clone();
|
||||
key = key.clone();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,7 +25,6 @@
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.spec.KeySpec;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
@ -132,7 +131,7 @@ abstract class PBEKeyFactory extends SecretKeyFactorySpi {
|
||||
* inappropriate for the given key, or the given key cannot be processed
|
||||
* (e.g., the given key has an unrecognized algorithm or format).
|
||||
*/
|
||||
protected KeySpec engineGetKeySpec(SecretKey key, Class keySpecCl)
|
||||
protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpecCl)
|
||||
throws InvalidKeySpecException {
|
||||
if ((key instanceof SecretKey)
|
||||
&& (validTypes.contains(key.getAlgorithm().toUpperCase()))
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,7 +25,6 @@
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
import java.math.BigInteger;
|
||||
import java.security.AlgorithmParametersSpi;
|
||||
@ -65,7 +64,7 @@ public final class PBEParameters extends AlgorithmParametersSpi {
|
||||
throw new InvalidParameterSpecException
|
||||
("Inappropriate parameter specification");
|
||||
}
|
||||
this.salt = (byte[])((PBEParameterSpec)paramSpec).getSalt().clone();
|
||||
this.salt = ((PBEParameterSpec)paramSpec).getSalt().clone();
|
||||
this.iCount = ((PBEParameterSpec)paramSpec).getIterationCount();
|
||||
}
|
||||
|
||||
@ -98,11 +97,12 @@ public final class PBEParameters extends AlgorithmParametersSpi {
|
||||
engineInit(encoded);
|
||||
}
|
||||
|
||||
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
|
||||
protected <T extends AlgorithmParameterSpec>
|
||||
T engineGetParameterSpec(Class<T> paramSpec)
|
||||
throws InvalidParameterSpecException
|
||||
{
|
||||
if (PBEParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||
return new PBEParameterSpec(this.salt, this.iCount);
|
||||
return paramSpec.cast(new PBEParameterSpec(this.salt, this.iCount));
|
||||
} else {
|
||||
throw new InvalidParameterSpecException
|
||||
("Inappropriate parameter specification");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,14 +25,12 @@
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.io.*;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.spec.KeySpec;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.SecretKeyFactorySpi;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
/**
|
||||
* This class implements a key factory for PBE keys derived using
|
||||
@ -88,7 +86,7 @@ public final class PBKDF2HmacSHA1Factory extends SecretKeyFactorySpi {
|
||||
* given key cannot be processed (e.g., the given key has an
|
||||
* unrecognized algorithm or format).
|
||||
*/
|
||||
protected KeySpec engineGetKeySpec(SecretKey key, Class keySpecCl)
|
||||
protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpecCl)
|
||||
throws InvalidKeySpecException {
|
||||
if (key instanceof javax.crypto.interfaces.PBEKey) {
|
||||
// Check if requested key spec is amongst the valid ones
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -133,6 +133,7 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
|
||||
byte[] ti = new byte[hlen];
|
||||
// SecretKeySpec cannot be used, since password can be empty here.
|
||||
SecretKey macKey = new SecretKey() {
|
||||
private static final long serialVersionUID = 7874493593505141603L;
|
||||
@Override
|
||||
public String getAlgorithm() {
|
||||
return prf.getAlgorithm();
|
||||
@ -194,7 +195,7 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
|
||||
}
|
||||
|
||||
public byte[] getEncoded() {
|
||||
return (byte[]) key.clone();
|
||||
return key.clone();
|
||||
}
|
||||
|
||||
public String getAlgorithm() {
|
||||
@ -206,7 +207,7 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
|
||||
}
|
||||
|
||||
public char[] getPassword() {
|
||||
return (char[]) passwd.clone();
|
||||
return passwd.clone();
|
||||
}
|
||||
|
||||
public byte[] getSalt() {
|
||||
@ -268,7 +269,7 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
if (this.passwd != null) {
|
||||
java.util.Arrays.fill(this.passwd, (char) '0');
|
||||
java.util.Arrays.fill(this.passwd, '0');
|
||||
this.passwd = null;
|
||||
}
|
||||
if (this.key != null) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -145,7 +145,7 @@ final class PCBC extends FeedbackCipher {
|
||||
for (; plainOffset < endIndex;
|
||||
plainOffset += blockSize, cipherOffset += blockSize) {
|
||||
for (i=0; i<blockSize; i++) {
|
||||
k[i] ^= (byte)(plain[i+plainOffset]);
|
||||
k[i] ^= plain[i+plainOffset];
|
||||
}
|
||||
embeddedCipher.encryptBlock(k, 0, cipher, cipherOffset);
|
||||
for (i = 0; i < blockSize; i++) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -98,8 +98,8 @@ public final class RC2Cipher extends CipherSpi {
|
||||
throws InvalidKeyException, InvalidAlgorithmParameterException {
|
||||
if (params != null && params.getAlgorithm().equals("RC2")) {
|
||||
try {
|
||||
RC2ParameterSpec rc2Params = (RC2ParameterSpec)
|
||||
params.getParameterSpec(RC2ParameterSpec.class);
|
||||
RC2ParameterSpec rc2Params =
|
||||
params.getParameterSpec(RC2ParameterSpec.class);
|
||||
engineInit(opmode, key, rc2Params, random);
|
||||
} catch (InvalidParameterSpecException ipse) {
|
||||
throw new InvalidAlgorithmParameterException
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -55,7 +55,6 @@ import sun.security.util.*;
|
||||
* @author Sean Mullan
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
public final class RC2Parameters extends AlgorithmParametersSpi {
|
||||
|
||||
// TABLE[EKB] from section 6 of RFC 2268, used to convert effective key
|
||||
@ -177,13 +176,14 @@ public final class RC2Parameters extends AlgorithmParametersSpi {
|
||||
engineInit(encoded);
|
||||
}
|
||||
|
||||
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
|
||||
protected <T extends AlgorithmParameterSpec>
|
||||
T engineGetParameterSpec(Class<T> paramSpec)
|
||||
throws InvalidParameterSpecException {
|
||||
|
||||
if (RC2ParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||
return (iv == null ?
|
||||
new RC2ParameterSpec(effectiveKeySize) :
|
||||
new RC2ParameterSpec(effectiveKeySize, iv));
|
||||
return paramSpec.cast((iv == null ?
|
||||
new RC2ParameterSpec(effectiveKeySize) :
|
||||
new RC2ParameterSpec(effectiveKeySize, iv)));
|
||||
} else {
|
||||
throw new InvalidParameterSpecException
|
||||
("Inappropriate parameter specification");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -227,8 +227,8 @@ public final class RSACipher extends CipherSpi {
|
||||
init(opmode, key, random, null);
|
||||
} else {
|
||||
try {
|
||||
OAEPParameterSpec spec = (OAEPParameterSpec)
|
||||
params.getParameterSpec(OAEPParameterSpec.class);
|
||||
OAEPParameterSpec spec =
|
||||
params.getParameterSpec(OAEPParameterSpec.class);
|
||||
init(opmode, key, random, spec);
|
||||
} catch (InvalidParameterSpecException ipse) {
|
||||
InvalidAlgorithmParameterException iape =
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,11 +27,6 @@ package com.sun.crypto.provider;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.Provider;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.cert.*;
|
||||
import java.net.URL;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.security.CodeSource;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
|
||||
@ -105,352 +100,353 @@ public final class SunJCE extends Provider {
|
||||
"|OFB72|OFB80|OFB88|OFB96|OFB104|OFB112|OFB120|OFB128";
|
||||
final String BLOCK_PADS = "NOPADDING|PKCS5PADDING|ISO10126PADDING";
|
||||
|
||||
AccessController.doPrivileged(new java.security.PrivilegedAction() {
|
||||
AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
|
||||
/*
|
||||
* Cipher engines
|
||||
*/
|
||||
put("Cipher.RSA", "com.sun.crypto.provider.RSACipher");
|
||||
put("Cipher.RSA SupportedModes", "ECB");
|
||||
put("Cipher.RSA SupportedPaddings",
|
||||
"NOPADDING|PKCS1PADDING|OAEPWITHMD5ANDMGF1PADDING"
|
||||
+ "|OAEPWITHSHA1ANDMGF1PADDING"
|
||||
+ "|OAEPWITHSHA-1ANDMGF1PADDING"
|
||||
+ "|OAEPWITHSHA-256ANDMGF1PADDING"
|
||||
+ "|OAEPWITHSHA-384ANDMGF1PADDING"
|
||||
+ "|OAEPWITHSHA-512ANDMGF1PADDING");
|
||||
put("Cipher.RSA SupportedKeyClasses",
|
||||
"java.security.interfaces.RSAPublicKey" +
|
||||
"|java.security.interfaces.RSAPrivateKey");
|
||||
/*
|
||||
* Cipher engines
|
||||
*/
|
||||
put("Cipher.RSA", "com.sun.crypto.provider.RSACipher");
|
||||
put("Cipher.RSA SupportedModes", "ECB");
|
||||
put("Cipher.RSA SupportedPaddings",
|
||||
"NOPADDING|PKCS1PADDING|OAEPWITHMD5ANDMGF1PADDING"
|
||||
+ "|OAEPWITHSHA1ANDMGF1PADDING"
|
||||
+ "|OAEPWITHSHA-1ANDMGF1PADDING"
|
||||
+ "|OAEPWITHSHA-256ANDMGF1PADDING"
|
||||
+ "|OAEPWITHSHA-384ANDMGF1PADDING"
|
||||
+ "|OAEPWITHSHA-512ANDMGF1PADDING");
|
||||
put("Cipher.RSA SupportedKeyClasses",
|
||||
"java.security.interfaces.RSAPublicKey" +
|
||||
"|java.security.interfaces.RSAPrivateKey");
|
||||
|
||||
put("Cipher.DES", "com.sun.crypto.provider.DESCipher");
|
||||
put("Cipher.DES SupportedModes", BLOCK_MODES);
|
||||
put("Cipher.DES SupportedPaddings", BLOCK_PADS);
|
||||
put("Cipher.DES SupportedKeyFormats", "RAW");
|
||||
put("Cipher.DES", "com.sun.crypto.provider.DESCipher");
|
||||
put("Cipher.DES SupportedModes", BLOCK_MODES);
|
||||
put("Cipher.DES SupportedPaddings", BLOCK_PADS);
|
||||
put("Cipher.DES SupportedKeyFormats", "RAW");
|
||||
|
||||
put("Cipher.DESede", "com.sun.crypto.provider.DESedeCipher");
|
||||
put("Alg.Alias.Cipher.TripleDES", "DESede");
|
||||
put("Cipher.DESede SupportedModes", BLOCK_MODES);
|
||||
put("Cipher.DESede SupportedPaddings", BLOCK_PADS);
|
||||
put("Cipher.DESede SupportedKeyFormats", "RAW");
|
||||
put("Cipher.DESede", "com.sun.crypto.provider.DESedeCipher");
|
||||
put("Alg.Alias.Cipher.TripleDES", "DESede");
|
||||
put("Cipher.DESede SupportedModes", BLOCK_MODES);
|
||||
put("Cipher.DESede SupportedPaddings", BLOCK_PADS);
|
||||
put("Cipher.DESede SupportedKeyFormats", "RAW");
|
||||
|
||||
put("Cipher.DESedeWrap",
|
||||
"com.sun.crypto.provider.DESedeWrapCipher");
|
||||
put("Cipher.DESedeWrap SupportedModes", "CBC");
|
||||
put("Cipher.DESedeWrap SupportedPaddings", "NOPADDING");
|
||||
put("Cipher.DESedeWrap SupportedKeyFormats", "RAW");
|
||||
put("Cipher.DESedeWrap",
|
||||
"com.sun.crypto.provider.DESedeWrapCipher");
|
||||
put("Cipher.DESedeWrap SupportedModes", "CBC");
|
||||
put("Cipher.DESedeWrap SupportedPaddings", "NOPADDING");
|
||||
put("Cipher.DESedeWrap SupportedKeyFormats", "RAW");
|
||||
|
||||
put("Cipher.PBEWithMD5AndDES",
|
||||
"com.sun.crypto.provider.PBEWithMD5AndDESCipher");
|
||||
put("Alg.Alias.Cipher.OID."+OID_PKCS5_MD5_DES,
|
||||
"PBEWithMD5AndDES");
|
||||
put("Alg.Alias.Cipher."+OID_PKCS5_MD5_DES,
|
||||
"PBEWithMD5AndDES");
|
||||
put("Cipher.PBEWithMD5AndTripleDES",
|
||||
"com.sun.crypto.provider.PBEWithMD5AndTripleDESCipher");
|
||||
put("Cipher.PBEWithSHA1AndRC2_40",
|
||||
"com.sun.crypto.provider.PKCS12PBECipherCore$" +
|
||||
"PBEWithSHA1AndRC2_40");
|
||||
put("Alg.Alias.Cipher.OID." + OID_PKCS12_RC2_40,
|
||||
"PBEWithSHA1AndRC2_40");
|
||||
put("Alg.Alias.Cipher." + OID_PKCS12_RC2_40,
|
||||
"PBEWithSHA1AndRC2_40");
|
||||
put("Cipher.PBEWithSHA1AndDESede",
|
||||
"com.sun.crypto.provider.PKCS12PBECipherCore$" +
|
||||
"PBEWithSHA1AndDESede");
|
||||
put("Alg.Alias.Cipher.OID." + OID_PKCS12_DESede,
|
||||
"PBEWithSHA1AndDESede");
|
||||
put("Alg.Alias.Cipher." + OID_PKCS12_DESede,
|
||||
"PBEWithSHA1AndDESede");
|
||||
put("Cipher.PBEWithMD5AndDES",
|
||||
"com.sun.crypto.provider.PBEWithMD5AndDESCipher");
|
||||
put("Alg.Alias.Cipher.OID."+OID_PKCS5_MD5_DES,
|
||||
"PBEWithMD5AndDES");
|
||||
put("Alg.Alias.Cipher."+OID_PKCS5_MD5_DES,
|
||||
"PBEWithMD5AndDES");
|
||||
put("Cipher.PBEWithMD5AndTripleDES",
|
||||
"com.sun.crypto.provider.PBEWithMD5AndTripleDESCipher");
|
||||
put("Cipher.PBEWithSHA1AndRC2_40",
|
||||
"com.sun.crypto.provider.PKCS12PBECipherCore$" +
|
||||
"PBEWithSHA1AndRC2_40");
|
||||
put("Alg.Alias.Cipher.OID." + OID_PKCS12_RC2_40,
|
||||
"PBEWithSHA1AndRC2_40");
|
||||
put("Alg.Alias.Cipher." + OID_PKCS12_RC2_40,
|
||||
"PBEWithSHA1AndRC2_40");
|
||||
put("Cipher.PBEWithSHA1AndDESede",
|
||||
"com.sun.crypto.provider.PKCS12PBECipherCore$" +
|
||||
"PBEWithSHA1AndDESede");
|
||||
put("Alg.Alias.Cipher.OID." + OID_PKCS12_DESede,
|
||||
"PBEWithSHA1AndDESede");
|
||||
put("Alg.Alias.Cipher." + OID_PKCS12_DESede,
|
||||
"PBEWithSHA1AndDESede");
|
||||
|
||||
put("Cipher.Blowfish",
|
||||
"com.sun.crypto.provider.BlowfishCipher");
|
||||
put("Cipher.Blowfish SupportedModes", BLOCK_MODES);
|
||||
put("Cipher.Blowfish SupportedPaddings", BLOCK_PADS);
|
||||
put("Cipher.Blowfish SupportedKeyFormats", "RAW");
|
||||
put("Cipher.Blowfish",
|
||||
"com.sun.crypto.provider.BlowfishCipher");
|
||||
put("Cipher.Blowfish SupportedModes", BLOCK_MODES);
|
||||
put("Cipher.Blowfish SupportedPaddings", BLOCK_PADS);
|
||||
put("Cipher.Blowfish SupportedKeyFormats", "RAW");
|
||||
|
||||
put("Cipher.AES", "com.sun.crypto.provider.AESCipher");
|
||||
put("Alg.Alias.Cipher.Rijndael", "AES");
|
||||
put("Cipher.AES SupportedModes", BLOCK_MODES128);
|
||||
put("Cipher.AES SupportedPaddings", BLOCK_PADS);
|
||||
put("Cipher.AES SupportedKeyFormats", "RAW");
|
||||
put("Cipher.AES", "com.sun.crypto.provider.AESCipher");
|
||||
put("Alg.Alias.Cipher.Rijndael", "AES");
|
||||
put("Cipher.AES SupportedModes", BLOCK_MODES128);
|
||||
put("Cipher.AES SupportedPaddings", BLOCK_PADS);
|
||||
put("Cipher.AES SupportedKeyFormats", "RAW");
|
||||
|
||||
put("Cipher.AESWrap", "com.sun.crypto.provider.AESWrapCipher");
|
||||
put("Cipher.AESWrap SupportedModes", "ECB");
|
||||
put("Cipher.AESWrap SupportedPaddings", "NOPADDING");
|
||||
put("Cipher.AESWrap SupportedKeyFormats", "RAW");
|
||||
put("Cipher.AESWrap", "com.sun.crypto.provider.AESWrapCipher");
|
||||
put("Cipher.AESWrap SupportedModes", "ECB");
|
||||
put("Cipher.AESWrap SupportedPaddings", "NOPADDING");
|
||||
put("Cipher.AESWrap SupportedKeyFormats", "RAW");
|
||||
|
||||
put("Cipher.RC2",
|
||||
"com.sun.crypto.provider.RC2Cipher");
|
||||
put("Cipher.RC2 SupportedModes", BLOCK_MODES);
|
||||
put("Cipher.RC2 SupportedPaddings", BLOCK_PADS);
|
||||
put("Cipher.RC2 SupportedKeyFormats", "RAW");
|
||||
put("Cipher.RC2",
|
||||
"com.sun.crypto.provider.RC2Cipher");
|
||||
put("Cipher.RC2 SupportedModes", BLOCK_MODES);
|
||||
put("Cipher.RC2 SupportedPaddings", BLOCK_PADS);
|
||||
put("Cipher.RC2 SupportedKeyFormats", "RAW");
|
||||
|
||||
put("Cipher.ARCFOUR",
|
||||
"com.sun.crypto.provider.ARCFOURCipher");
|
||||
put("Alg.Alias.Cipher.RC4", "ARCFOUR");
|
||||
put("Cipher.ARCFOUR SupportedModes", "ECB");
|
||||
put("Cipher.ARCFOUR SupportedPaddings", "NOPADDING");
|
||||
put("Cipher.ARCFOUR SupportedKeyFormats", "RAW");
|
||||
put("Cipher.ARCFOUR",
|
||||
"com.sun.crypto.provider.ARCFOURCipher");
|
||||
put("Alg.Alias.Cipher.RC4", "ARCFOUR");
|
||||
put("Cipher.ARCFOUR SupportedModes", "ECB");
|
||||
put("Cipher.ARCFOUR SupportedPaddings", "NOPADDING");
|
||||
put("Cipher.ARCFOUR SupportedKeyFormats", "RAW");
|
||||
|
||||
/*
|
||||
* Key(pair) Generator engines
|
||||
*/
|
||||
put("KeyGenerator.DES",
|
||||
"com.sun.crypto.provider.DESKeyGenerator");
|
||||
/*
|
||||
* Key(pair) Generator engines
|
||||
*/
|
||||
put("KeyGenerator.DES",
|
||||
"com.sun.crypto.provider.DESKeyGenerator");
|
||||
|
||||
put("KeyGenerator.DESede",
|
||||
"com.sun.crypto.provider.DESedeKeyGenerator");
|
||||
put("Alg.Alias.KeyGenerator.TripleDES", "DESede");
|
||||
put("KeyGenerator.DESede",
|
||||
"com.sun.crypto.provider.DESedeKeyGenerator");
|
||||
put("Alg.Alias.KeyGenerator.TripleDES", "DESede");
|
||||
|
||||
put("KeyGenerator.Blowfish",
|
||||
"com.sun.crypto.provider.BlowfishKeyGenerator");
|
||||
put("KeyGenerator.Blowfish",
|
||||
"com.sun.crypto.provider.BlowfishKeyGenerator");
|
||||
|
||||
put("KeyGenerator.AES",
|
||||
"com.sun.crypto.provider.AESKeyGenerator");
|
||||
put("Alg.Alias.KeyGenerator.Rijndael", "AES");
|
||||
put("KeyGenerator.AES",
|
||||
"com.sun.crypto.provider.AESKeyGenerator");
|
||||
put("Alg.Alias.KeyGenerator.Rijndael", "AES");
|
||||
|
||||
put("KeyGenerator.RC2",
|
||||
"com.sun.crypto.provider.KeyGeneratorCore$" +
|
||||
"RC2KeyGenerator");
|
||||
put("KeyGenerator.ARCFOUR",
|
||||
"com.sun.crypto.provider.KeyGeneratorCore$" +
|
||||
"ARCFOURKeyGenerator");
|
||||
put("Alg.Alias.KeyGenerator.RC4", "ARCFOUR");
|
||||
put("KeyGenerator.RC2",
|
||||
"com.sun.crypto.provider.KeyGeneratorCore$" +
|
||||
"RC2KeyGenerator");
|
||||
put("KeyGenerator.ARCFOUR",
|
||||
"com.sun.crypto.provider.KeyGeneratorCore$" +
|
||||
"ARCFOURKeyGenerator");
|
||||
put("Alg.Alias.KeyGenerator.RC4", "ARCFOUR");
|
||||
|
||||
put("KeyGenerator.HmacMD5",
|
||||
"com.sun.crypto.provider.HmacMD5KeyGenerator");
|
||||
put("KeyGenerator.HmacMD5",
|
||||
"com.sun.crypto.provider.HmacMD5KeyGenerator");
|
||||
|
||||
put("KeyGenerator.HmacSHA1",
|
||||
"com.sun.crypto.provider.HmacSHA1KeyGenerator");
|
||||
put("KeyGenerator.HmacSHA1",
|
||||
"com.sun.crypto.provider.HmacSHA1KeyGenerator");
|
||||
|
||||
put("KeyGenerator.HmacSHA256",
|
||||
"com.sun.crypto.provider.KeyGeneratorCore$HmacSHA256KG");
|
||||
put("KeyGenerator.HmacSHA384",
|
||||
"com.sun.crypto.provider.KeyGeneratorCore$HmacSHA384KG");
|
||||
put("KeyGenerator.HmacSHA512",
|
||||
"com.sun.crypto.provider.KeyGeneratorCore$HmacSHA512KG");
|
||||
put("KeyGenerator.HmacSHA256",
|
||||
"com.sun.crypto.provider.KeyGeneratorCore$HmacSHA256KG");
|
||||
put("KeyGenerator.HmacSHA384",
|
||||
"com.sun.crypto.provider.KeyGeneratorCore$HmacSHA384KG");
|
||||
put("KeyGenerator.HmacSHA512",
|
||||
"com.sun.crypto.provider.KeyGeneratorCore$HmacSHA512KG");
|
||||
|
||||
put("KeyPairGenerator.DiffieHellman",
|
||||
"com.sun.crypto.provider.DHKeyPairGenerator");
|
||||
put("Alg.Alias.KeyPairGenerator.DH", "DiffieHellman");
|
||||
put("Alg.Alias.KeyPairGenerator.OID."+OID_PKCS3,
|
||||
"DiffieHellman");
|
||||
put("Alg.Alias.KeyPairGenerator."+OID_PKCS3,
|
||||
"DiffieHellman");
|
||||
/*
|
||||
* Algorithm parameter generation engines
|
||||
*/
|
||||
put("AlgorithmParameterGenerator.DiffieHellman",
|
||||
"com.sun.crypto.provider.DHParameterGenerator");
|
||||
put("Alg.Alias.AlgorithmParameterGenerator.DH",
|
||||
"DiffieHellman");
|
||||
put("Alg.Alias.AlgorithmParameterGenerator.OID."+OID_PKCS3,
|
||||
"DiffieHellman");
|
||||
put("Alg.Alias.AlgorithmParameterGenerator."+OID_PKCS3,
|
||||
"DiffieHellman");
|
||||
put("KeyPairGenerator.DiffieHellman",
|
||||
"com.sun.crypto.provider.DHKeyPairGenerator");
|
||||
put("Alg.Alias.KeyPairGenerator.DH", "DiffieHellman");
|
||||
put("Alg.Alias.KeyPairGenerator.OID."+OID_PKCS3,
|
||||
"DiffieHellman");
|
||||
put("Alg.Alias.KeyPairGenerator."+OID_PKCS3,
|
||||
"DiffieHellman");
|
||||
/*
|
||||
* Algorithm parameter generation engines
|
||||
*/
|
||||
put("AlgorithmParameterGenerator.DiffieHellman",
|
||||
"com.sun.crypto.provider.DHParameterGenerator");
|
||||
put("Alg.Alias.AlgorithmParameterGenerator.DH",
|
||||
"DiffieHellman");
|
||||
put("Alg.Alias.AlgorithmParameterGenerator.OID."+OID_PKCS3,
|
||||
"DiffieHellman");
|
||||
put("Alg.Alias.AlgorithmParameterGenerator."+OID_PKCS3,
|
||||
"DiffieHellman");
|
||||
|
||||
/*
|
||||
* Key Agreement engines
|
||||
*/
|
||||
put("KeyAgreement.DiffieHellman",
|
||||
"com.sun.crypto.provider.DHKeyAgreement");
|
||||
put("Alg.Alias.KeyAgreement.DH", "DiffieHellman");
|
||||
put("Alg.Alias.KeyAgreement.OID."+OID_PKCS3, "DiffieHellman");
|
||||
put("Alg.Alias.KeyAgreement."+OID_PKCS3, "DiffieHellman");
|
||||
/*
|
||||
* Key Agreement engines
|
||||
*/
|
||||
put("KeyAgreement.DiffieHellman",
|
||||
"com.sun.crypto.provider.DHKeyAgreement");
|
||||
put("Alg.Alias.KeyAgreement.DH", "DiffieHellman");
|
||||
put("Alg.Alias.KeyAgreement.OID."+OID_PKCS3, "DiffieHellman");
|
||||
put("Alg.Alias.KeyAgreement."+OID_PKCS3, "DiffieHellman");
|
||||
|
||||
put("KeyAgreement.DiffieHellman SupportedKeyClasses",
|
||||
"javax.crypto.interfaces.DHPublicKey" +
|
||||
"|javax.crypto.interfaces.DHPrivateKey");
|
||||
put("KeyAgreement.DiffieHellman SupportedKeyClasses",
|
||||
"javax.crypto.interfaces.DHPublicKey" +
|
||||
"|javax.crypto.interfaces.DHPrivateKey");
|
||||
|
||||
/*
|
||||
* Algorithm Parameter engines
|
||||
*/
|
||||
put("AlgorithmParameters.DiffieHellman",
|
||||
"com.sun.crypto.provider.DHParameters");
|
||||
put("Alg.Alias.AlgorithmParameters.DH", "DiffieHellman");
|
||||
put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS3,
|
||||
"DiffieHellman");
|
||||
put("Alg.Alias.AlgorithmParameters."+OID_PKCS3,
|
||||
"DiffieHellman");
|
||||
/*
|
||||
* Algorithm Parameter engines
|
||||
*/
|
||||
put("AlgorithmParameters.DiffieHellman",
|
||||
"com.sun.crypto.provider.DHParameters");
|
||||
put("Alg.Alias.AlgorithmParameters.DH", "DiffieHellman");
|
||||
put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS3,
|
||||
"DiffieHellman");
|
||||
put("Alg.Alias.AlgorithmParameters."+OID_PKCS3,
|
||||
"DiffieHellman");
|
||||
|
||||
put("AlgorithmParameters.DES",
|
||||
"com.sun.crypto.provider.DESParameters");
|
||||
put("AlgorithmParameters.DES",
|
||||
"com.sun.crypto.provider.DESParameters");
|
||||
|
||||
put("AlgorithmParameters.DESede",
|
||||
"com.sun.crypto.provider.DESedeParameters");
|
||||
put("Alg.Alias.AlgorithmParameters.TripleDES", "DESede");
|
||||
put("AlgorithmParameters.DESede",
|
||||
"com.sun.crypto.provider.DESedeParameters");
|
||||
put("Alg.Alias.AlgorithmParameters.TripleDES", "DESede");
|
||||
|
||||
put("AlgorithmParameters.PBE",
|
||||
"com.sun.crypto.provider.PBEParameters");
|
||||
put("AlgorithmParameters.PBE",
|
||||
"com.sun.crypto.provider.PBEParameters");
|
||||
|
||||
put("AlgorithmParameters.PBEWithMD5AndDES",
|
||||
"com.sun.crypto.provider.PBEParameters");
|
||||
put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS5_MD5_DES,
|
||||
"PBEWithMD5AndDES");
|
||||
put("Alg.Alias.AlgorithmParameters."+OID_PKCS5_MD5_DES,
|
||||
"PBEWithMD5AndDES");
|
||||
put("AlgorithmParameters.PBEWithMD5AndDES",
|
||||
"com.sun.crypto.provider.PBEParameters");
|
||||
put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS5_MD5_DES,
|
||||
"PBEWithMD5AndDES");
|
||||
put("Alg.Alias.AlgorithmParameters."+OID_PKCS5_MD5_DES,
|
||||
"PBEWithMD5AndDES");
|
||||
|
||||
put("AlgorithmParameters.PBEWithMD5AndTripleDES",
|
||||
"com.sun.crypto.provider.PBEParameters");
|
||||
put("AlgorithmParameters.PBEWithMD5AndTripleDES",
|
||||
"com.sun.crypto.provider.PBEParameters");
|
||||
|
||||
put("AlgorithmParameters.PBEWithSHA1AndDESede",
|
||||
"com.sun.crypto.provider.PBEParameters");
|
||||
put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS12_DESede,
|
||||
"PBEWithSHA1AndDESede");
|
||||
put("Alg.Alias.AlgorithmParameters."+OID_PKCS12_DESede,
|
||||
"PBEWithSHA1AndDESede");
|
||||
put("AlgorithmParameters.PBEWithSHA1AndDESede",
|
||||
"com.sun.crypto.provider.PBEParameters");
|
||||
put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS12_DESede,
|
||||
"PBEWithSHA1AndDESede");
|
||||
put("Alg.Alias.AlgorithmParameters."+OID_PKCS12_DESede,
|
||||
"PBEWithSHA1AndDESede");
|
||||
|
||||
put("AlgorithmParameters.PBEWithSHA1AndRC2_40",
|
||||
"com.sun.crypto.provider.PBEParameters");
|
||||
put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS12_RC2_40,
|
||||
"PBEWithSHA1AndRC2_40");
|
||||
put("Alg.Alias.AlgorithmParameters." + OID_PKCS12_RC2_40,
|
||||
"PBEWithSHA1AndRC2_40");
|
||||
put("AlgorithmParameters.PBEWithSHA1AndRC2_40",
|
||||
"com.sun.crypto.provider.PBEParameters");
|
||||
put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS12_RC2_40,
|
||||
"PBEWithSHA1AndRC2_40");
|
||||
put("Alg.Alias.AlgorithmParameters." + OID_PKCS12_RC2_40,
|
||||
"PBEWithSHA1AndRC2_40");
|
||||
|
||||
put("AlgorithmParameters.Blowfish",
|
||||
"com.sun.crypto.provider.BlowfishParameters");
|
||||
put("AlgorithmParameters.Blowfish",
|
||||
"com.sun.crypto.provider.BlowfishParameters");
|
||||
|
||||
put("AlgorithmParameters.AES",
|
||||
"com.sun.crypto.provider.AESParameters");
|
||||
put("Alg.Alias.AlgorithmParameters.Rijndael", "AES");
|
||||
put("AlgorithmParameters.AES",
|
||||
"com.sun.crypto.provider.AESParameters");
|
||||
put("Alg.Alias.AlgorithmParameters.Rijndael", "AES");
|
||||
|
||||
|
||||
put("AlgorithmParameters.RC2",
|
||||
"com.sun.crypto.provider.RC2Parameters");
|
||||
put("AlgorithmParameters.RC2",
|
||||
"com.sun.crypto.provider.RC2Parameters");
|
||||
|
||||
put("AlgorithmParameters.OAEP",
|
||||
"com.sun.crypto.provider.OAEPParameters");
|
||||
put("AlgorithmParameters.OAEP",
|
||||
"com.sun.crypto.provider.OAEPParameters");
|
||||
|
||||
|
||||
/*
|
||||
* Key factories
|
||||
*/
|
||||
put("KeyFactory.DiffieHellman",
|
||||
"com.sun.crypto.provider.DHKeyFactory");
|
||||
put("Alg.Alias.KeyFactory.DH", "DiffieHellman");
|
||||
put("Alg.Alias.KeyFactory.OID."+OID_PKCS3,
|
||||
"DiffieHellman");
|
||||
put("Alg.Alias.KeyFactory."+OID_PKCS3, "DiffieHellman");
|
||||
/*
|
||||
* Secret-key factories
|
||||
*/
|
||||
put("SecretKeyFactory.DES",
|
||||
"com.sun.crypto.provider.DESKeyFactory");
|
||||
/*
|
||||
* Key factories
|
||||
*/
|
||||
put("KeyFactory.DiffieHellman",
|
||||
"com.sun.crypto.provider.DHKeyFactory");
|
||||
put("Alg.Alias.KeyFactory.DH", "DiffieHellman");
|
||||
put("Alg.Alias.KeyFactory.OID."+OID_PKCS3,
|
||||
"DiffieHellman");
|
||||
put("Alg.Alias.KeyFactory."+OID_PKCS3, "DiffieHellman");
|
||||
/*
|
||||
* Secret-key factories
|
||||
*/
|
||||
put("SecretKeyFactory.DES",
|
||||
"com.sun.crypto.provider.DESKeyFactory");
|
||||
|
||||
put("SecretKeyFactory.DESede",
|
||||
"com.sun.crypto.provider.DESedeKeyFactory");
|
||||
put("Alg.Alias.SecretKeyFactory.TripleDES", "DESede");
|
||||
put("SecretKeyFactory.DESede",
|
||||
"com.sun.crypto.provider.DESedeKeyFactory");
|
||||
put("Alg.Alias.SecretKeyFactory.TripleDES", "DESede");
|
||||
|
||||
put("SecretKeyFactory.PBEWithMD5AndDES",
|
||||
"com.sun.crypto.provider.PBEKeyFactory$PBEWithMD5AndDES"
|
||||
);
|
||||
put("Alg.Alias.SecretKeyFactory.OID."+OID_PKCS5_MD5_DES,
|
||||
"PBEWithMD5AndDES");
|
||||
put("Alg.Alias.SecretKeyFactory."+OID_PKCS5_MD5_DES,
|
||||
"PBEWithMD5AndDES");
|
||||
put("SecretKeyFactory.PBEWithMD5AndDES",
|
||||
"com.sun.crypto.provider.PBEKeyFactory$PBEWithMD5AndDES"
|
||||
);
|
||||
put("Alg.Alias.SecretKeyFactory.OID."+OID_PKCS5_MD5_DES,
|
||||
"PBEWithMD5AndDES");
|
||||
put("Alg.Alias.SecretKeyFactory."+OID_PKCS5_MD5_DES,
|
||||
"PBEWithMD5AndDES");
|
||||
|
||||
put("Alg.Alias.SecretKeyFactory.PBE",
|
||||
"PBEWithMD5AndDES");
|
||||
put("Alg.Alias.SecretKeyFactory.PBE",
|
||||
"PBEWithMD5AndDES");
|
||||
|
||||
/*
|
||||
* Internal in-house crypto algorithm used for
|
||||
* the JCEKS keystore type. Since this was developed
|
||||
* internally, there isn't an OID corresponding to this
|
||||
* algorithm.
|
||||
*/
|
||||
put("SecretKeyFactory.PBEWithMD5AndTripleDES",
|
||||
"com.sun.crypto.provider.PBEKeyFactory$" +
|
||||
"PBEWithMD5AndTripleDES"
|
||||
);
|
||||
/*
|
||||
* Internal in-house crypto algorithm used for
|
||||
* the JCEKS keystore type. Since this was developed
|
||||
* internally, there isn't an OID corresponding to this
|
||||
* algorithm.
|
||||
*/
|
||||
put("SecretKeyFactory.PBEWithMD5AndTripleDES",
|
||||
"com.sun.crypto.provider.PBEKeyFactory$" +
|
||||
"PBEWithMD5AndTripleDES"
|
||||
);
|
||||
|
||||
put("SecretKeyFactory.PBEWithSHA1AndDESede",
|
||||
"com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndDESede"
|
||||
);
|
||||
put("Alg.Alias.SecretKeyFactory.OID."+OID_PKCS12_DESede,
|
||||
"PBEWithSHA1AndDESede");
|
||||
put("Alg.Alias.SecretKeyFactory." + OID_PKCS12_DESede,
|
||||
"PBEWithSHA1AndDESede");
|
||||
put("SecretKeyFactory.PBEWithSHA1AndDESede",
|
||||
"com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndDESede"
|
||||
);
|
||||
put("Alg.Alias.SecretKeyFactory.OID."+OID_PKCS12_DESede,
|
||||
"PBEWithSHA1AndDESede");
|
||||
put("Alg.Alias.SecretKeyFactory." + OID_PKCS12_DESede,
|
||||
"PBEWithSHA1AndDESede");
|
||||
|
||||
put("SecretKeyFactory.PBEWithSHA1AndRC2_40",
|
||||
"com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndRC2_40"
|
||||
);
|
||||
put("Alg.Alias.SecretKeyFactory.OID." + OID_PKCS12_RC2_40,
|
||||
"PBEWithSHA1AndRC2_40");
|
||||
put("Alg.Alias.SecretKeyFactory." + OID_PKCS12_RC2_40,
|
||||
"PBEWithSHA1AndRC2_40");
|
||||
put("SecretKeyFactory.PBEWithSHA1AndRC2_40",
|
||||
"com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndRC2_40"
|
||||
);
|
||||
put("Alg.Alias.SecretKeyFactory.OID." + OID_PKCS12_RC2_40,
|
||||
"PBEWithSHA1AndRC2_40");
|
||||
put("Alg.Alias.SecretKeyFactory." + OID_PKCS12_RC2_40,
|
||||
"PBEWithSHA1AndRC2_40");
|
||||
|
||||
put("SecretKeyFactory.PBKDF2WithHmacSHA1",
|
||||
"com.sun.crypto.provider.PBKDF2HmacSHA1Factory");
|
||||
put("Alg.Alias.SecretKeyFactory.OID." + OID_PKCS5_PBKDF2,
|
||||
"PBKDF2WithHmacSHA1");
|
||||
put("Alg.Alias.SecretKeyFactory." + OID_PKCS5_PBKDF2,
|
||||
"PBKDF2WithHmacSHA1");
|
||||
put("SecretKeyFactory.PBKDF2WithHmacSHA1",
|
||||
"com.sun.crypto.provider.PBKDF2HmacSHA1Factory");
|
||||
put("Alg.Alias.SecretKeyFactory.OID." + OID_PKCS5_PBKDF2,
|
||||
"PBKDF2WithHmacSHA1");
|
||||
put("Alg.Alias.SecretKeyFactory." + OID_PKCS5_PBKDF2,
|
||||
"PBKDF2WithHmacSHA1");
|
||||
|
||||
/*
|
||||
* MAC
|
||||
*/
|
||||
put("Mac.HmacMD5", "com.sun.crypto.provider.HmacMD5");
|
||||
put("Mac.HmacSHA1", "com.sun.crypto.provider.HmacSHA1");
|
||||
put("Mac.HmacSHA256",
|
||||
"com.sun.crypto.provider.HmacCore$HmacSHA256");
|
||||
put("Mac.HmacSHA384",
|
||||
"com.sun.crypto.provider.HmacCore$HmacSHA384");
|
||||
put("Mac.HmacSHA512",
|
||||
"com.sun.crypto.provider.HmacCore$HmacSHA512");
|
||||
put("Mac.HmacPBESHA1",
|
||||
"com.sun.crypto.provider.HmacPKCS12PBESHA1");
|
||||
/*
|
||||
* MAC
|
||||
*/
|
||||
put("Mac.HmacMD5", "com.sun.crypto.provider.HmacMD5");
|
||||
put("Mac.HmacSHA1", "com.sun.crypto.provider.HmacSHA1");
|
||||
put("Mac.HmacSHA256",
|
||||
"com.sun.crypto.provider.HmacCore$HmacSHA256");
|
||||
put("Mac.HmacSHA384",
|
||||
"com.sun.crypto.provider.HmacCore$HmacSHA384");
|
||||
put("Mac.HmacSHA512",
|
||||
"com.sun.crypto.provider.HmacCore$HmacSHA512");
|
||||
put("Mac.HmacPBESHA1",
|
||||
"com.sun.crypto.provider.HmacPKCS12PBESHA1");
|
||||
|
||||
put("Mac.SslMacMD5",
|
||||
"com.sun.crypto.provider.SslMacCore$SslMacMD5");
|
||||
put("Mac.SslMacSHA1",
|
||||
"com.sun.crypto.provider.SslMacCore$SslMacSHA1");
|
||||
put("Mac.SslMacMD5",
|
||||
"com.sun.crypto.provider.SslMacCore$SslMacMD5");
|
||||
put("Mac.SslMacSHA1",
|
||||
"com.sun.crypto.provider.SslMacCore$SslMacSHA1");
|
||||
|
||||
put("Mac.HmacMD5 SupportedKeyFormats", "RAW");
|
||||
put("Mac.HmacSHA1 SupportedKeyFormats", "RAW");
|
||||
put("Mac.HmacSHA256 SupportedKeyFormats", "RAW");
|
||||
put("Mac.HmacSHA384 SupportedKeyFormats", "RAW");
|
||||
put("Mac.HmacSHA512 SupportedKeyFormats", "RAW");
|
||||
put("Mac.HmacPBESHA1 SupportedKeyFormats", "RAW");
|
||||
put("Mac.SslMacMD5 SupportedKeyFormats", "RAW");
|
||||
put("Mac.SslMacSHA1 SupportedKeyFormats", "RAW");
|
||||
put("Mac.HmacMD5 SupportedKeyFormats", "RAW");
|
||||
put("Mac.HmacSHA1 SupportedKeyFormats", "RAW");
|
||||
put("Mac.HmacSHA256 SupportedKeyFormats", "RAW");
|
||||
put("Mac.HmacSHA384 SupportedKeyFormats", "RAW");
|
||||
put("Mac.HmacSHA512 SupportedKeyFormats", "RAW");
|
||||
put("Mac.HmacPBESHA1 SupportedKeyFormats", "RAW");
|
||||
put("Mac.SslMacMD5 SupportedKeyFormats", "RAW");
|
||||
put("Mac.SslMacSHA1 SupportedKeyFormats", "RAW");
|
||||
|
||||
/*
|
||||
* KeyStore
|
||||
*/
|
||||
put("KeyStore.JCEKS", "com.sun.crypto.provider.JceKeyStore");
|
||||
/*
|
||||
* KeyStore
|
||||
*/
|
||||
put("KeyStore.JCEKS", "com.sun.crypto.provider.JceKeyStore");
|
||||
|
||||
/*
|
||||
* SSL/TLS mechanisms
|
||||
*
|
||||
* These are strictly internal implementations and may
|
||||
* be changed at any time. These names were chosen
|
||||
* because PKCS11/SunPKCS11 does not yet have TLS1.2
|
||||
* mechanisms, and it will cause calls to come here.
|
||||
*/
|
||||
put("KeyGenerator.SunTlsPrf",
|
||||
"com.sun.crypto.provider.TlsPrfGenerator$V10");
|
||||
put("KeyGenerator.SunTls12Prf",
|
||||
"com.sun.crypto.provider.TlsPrfGenerator$V12");
|
||||
/*
|
||||
* SSL/TLS mechanisms
|
||||
*
|
||||
* These are strictly internal implementations and may
|
||||
* be changed at any time. These names were chosen
|
||||
* because PKCS11/SunPKCS11 does not yet have TLS1.2
|
||||
* mechanisms, and it will cause calls to come here.
|
||||
*/
|
||||
put("KeyGenerator.SunTlsPrf",
|
||||
"com.sun.crypto.provider.TlsPrfGenerator$V10");
|
||||
put("KeyGenerator.SunTls12Prf",
|
||||
"com.sun.crypto.provider.TlsPrfGenerator$V12");
|
||||
|
||||
put("KeyGenerator.SunTlsMasterSecret",
|
||||
"com.sun.crypto.provider.TlsMasterSecretGenerator");
|
||||
put("Alg.Alias.KeyGenerator.SunTls12MasterSecret",
|
||||
"SunTlsMasterSecret");
|
||||
put("KeyGenerator.SunTlsMasterSecret",
|
||||
"com.sun.crypto.provider.TlsMasterSecretGenerator");
|
||||
put("Alg.Alias.KeyGenerator.SunTls12MasterSecret",
|
||||
"SunTlsMasterSecret");
|
||||
|
||||
put("KeyGenerator.SunTlsKeyMaterial",
|
||||
"com.sun.crypto.provider.TlsKeyMaterialGenerator");
|
||||
put("Alg.Alias.KeyGenerator.SunTls12KeyMaterial",
|
||||
"SunTlsKeyMaterial");
|
||||
put("KeyGenerator.SunTlsKeyMaterial",
|
||||
"com.sun.crypto.provider.TlsKeyMaterialGenerator");
|
||||
put("Alg.Alias.KeyGenerator.SunTls12KeyMaterial",
|
||||
"SunTlsKeyMaterial");
|
||||
|
||||
put("KeyGenerator.SunTlsRsaPremasterSecret",
|
||||
"com.sun.crypto.provider.TlsRsaPremasterSecretGenerator");
|
||||
put("Alg.Alias.KeyGenerator.SunTls12RsaPremasterSecret",
|
||||
"SunTlsRsaPremasterSecret");
|
||||
put("KeyGenerator.SunTlsRsaPremasterSecret",
|
||||
"com.sun.crypto.provider.TlsRsaPremasterSecretGenerator");
|
||||
put("Alg.Alias.KeyGenerator.SunTls12RsaPremasterSecret",
|
||||
"SunTlsRsaPremasterSecret");
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -31,7 +31,6 @@ import java.security.spec.AlgorithmParameterSpec;
|
||||
import javax.crypto.*;
|
||||
import javax.crypto.spec.*;
|
||||
|
||||
import sun.security.internal.interfaces.TlsMasterSecret;
|
||||
import sun.security.internal.spec.*;
|
||||
|
||||
import static com.sun.crypto.provider.TlsPrfGenerator.*;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -140,6 +140,7 @@ public final class TlsMasterSecretGenerator extends KeyGeneratorSpi {
|
||||
}
|
||||
|
||||
private static final class TlsMasterSecretKey implements TlsMasterSecret {
|
||||
private static final long serialVersionUID = 1019571680375368880L;
|
||||
|
||||
private byte[] key;
|
||||
private final int majorVersion, minorVersion;
|
||||
|
||||
@ -26,13 +26,10 @@
|
||||
package com.sun.security.auth;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.RuntimePermission;
|
||||
import java.lang.reflect.*;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.CodeSource;
|
||||
import java.security.KeyStore;
|
||||
import java.security.KeyStoreException;
|
||||
@ -260,7 +257,7 @@ public class PolicyFile extends javax.security.auth.Policy {
|
||||
private static final String AUTH_POLICY_URL = "auth.policy.url.";
|
||||
|
||||
private Vector<PolicyEntry> policyEntries;
|
||||
private Hashtable aliasMapping;
|
||||
private Hashtable<Object, Object> aliasMapping;
|
||||
|
||||
private boolean initialized = false;
|
||||
|
||||
@ -293,7 +290,7 @@ public class PolicyFile extends javax.security.auth.Policy {
|
||||
return;
|
||||
|
||||
policyEntries = new Vector<PolicyEntry>();
|
||||
aliasMapping = new Hashtable(11);
|
||||
aliasMapping = new Hashtable<Object, Object>(11);
|
||||
|
||||
initPolicyFile();
|
||||
initialized = true;
|
||||
@ -403,7 +400,7 @@ public class PolicyFile extends javax.security.auth.Policy {
|
||||
}
|
||||
try {
|
||||
extra_policy = PropertyExpander.expand(extra_policy);
|
||||
URL policyURL;;
|
||||
URL policyURL;
|
||||
File policyFile = new File(extra_policy);
|
||||
if (policyFile.exists()) {
|
||||
policyURL =
|
||||
@ -702,8 +699,8 @@ public class PolicyFile extends javax.security.auth.Policy {
|
||||
InvocationTargetException
|
||||
{
|
||||
//XXX we might want to keep a hash of created factories...
|
||||
Class pc = Class.forName(type);
|
||||
Constructor c = pc.getConstructor(PARAMS);
|
||||
Class<?> pc = Class.forName(type);
|
||||
Constructor<?> c = pc.getConstructor(PARAMS);
|
||||
return (Permission) c.newInstance(new Object[] { name, actions });
|
||||
}
|
||||
|
||||
@ -1088,16 +1085,20 @@ public class PolicyFile extends javax.security.auth.Policy {
|
||||
// because the earlier CodeSource.implies succeeded
|
||||
SubjectCodeSource scs = (SubjectCodeSource)accCs;
|
||||
|
||||
Set<Principal> principalSet = null;
|
||||
Set<? extends Principal> principalSet = null;
|
||||
try {
|
||||
Class pClass = Class.forName(principal.principalClass, false,
|
||||
ClassLoader.getSystemClassLoader());
|
||||
// principal.principalClass should extend Principal
|
||||
// If it doesn't, we should stop here with a ClassCastException.
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends Principal> pClass = (Class<? extends Principal>)
|
||||
Class.forName(principal.principalClass, false,
|
||||
ClassLoader.getSystemClassLoader());
|
||||
principalSet = scs.getSubject().getPrincipals(pClass);
|
||||
} catch (Exception e) {
|
||||
if (debug != null) {
|
||||
debug.println("problem finding Principal Class " +
|
||||
"when expanding SELF permission: " +
|
||||
e.toString());
|
||||
"when expanding SELF permission: " +
|
||||
e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1107,11 +1108,9 @@ public class PolicyFile extends javax.security.auth.Policy {
|
||||
}
|
||||
|
||||
String[][] info = new String[principalSet.size()][2];
|
||||
java.util.Iterator<Principal> pIterator = principalSet.iterator();
|
||||
|
||||
int i = 0;
|
||||
while (pIterator.hasNext()) {
|
||||
Principal p = pIterator.next();
|
||||
for (Principal p : principalSet) {
|
||||
info[i][0] = p.getClass().getName();
|
||||
info[i][1] = p.getName();
|
||||
i++;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -205,10 +205,9 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
|
||||
|
||||
// handle PrincipalComparators
|
||||
|
||||
Class principalComparator = Class.forName(pppe.principalClass,
|
||||
true,
|
||||
sysClassLoader);
|
||||
Constructor c = principalComparator.getConstructor(PARAMS);
|
||||
Class<?> principalComparator = Class.forName(
|
||||
pppe.principalClass, true, sysClassLoader);
|
||||
Constructor<?> c = principalComparator.getConstructor(PARAMS);
|
||||
PrincipalComparator pc =
|
||||
(PrincipalComparator)c.newInstance
|
||||
(new Object[] { pppe.principalName });
|
||||
|
||||
@ -32,16 +32,13 @@ import javax.security.auth.spi.*;
|
||||
import javax.naming.*;
|
||||
import javax.naming.directory.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.LinkedList;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import com.sun.security.auth.UnixPrincipal;
|
||||
import com.sun.security.auth.UnixNumericUserPrincipal;
|
||||
import com.sun.security.auth.UnixNumericGroupPrincipal;
|
||||
|
||||
import sun.security.util.AuthResources;
|
||||
|
||||
/**
|
||||
* <p> The module prompts for a username and password
|
||||
@ -189,7 +186,7 @@ public class JndiLoginModule implements LoginModule {
|
||||
// initial state
|
||||
private Subject subject;
|
||||
private CallbackHandler callbackHandler;
|
||||
private Map sharedState;
|
||||
private Map<String, Object> sharedState;
|
||||
private Map<String, ?> options;
|
||||
|
||||
private static final String CRYPT = "{crypt}";
|
||||
@ -217,13 +214,18 @@ public class JndiLoginModule implements LoginModule {
|
||||
* <code>Configuration</code> for this particular
|
||||
* <code>LoginModule</code>.
|
||||
*/
|
||||
// Unchecked warning from (Map<String, Object>)sharedState is safe
|
||||
// since javax.security.auth.login.LoginContext passes a raw HashMap.
|
||||
// Unchecked warnings from options.get(String) are safe since we are
|
||||
// passing known keys.
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initialize(Subject subject, CallbackHandler callbackHandler,
|
||||
Map<String,?> sharedState,
|
||||
Map<String,?> options) {
|
||||
|
||||
this.subject = subject;
|
||||
this.callbackHandler = callbackHandler;
|
||||
this.sharedState = sharedState;
|
||||
this.sharedState = (Map<String, Object>)sharedState;
|
||||
this.options = options;
|
||||
|
||||
// initialize any configured options
|
||||
|
||||
@ -25,11 +25,9 @@
|
||||
|
||||
package com.sun.security.auth.module;
|
||||
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PushbackInputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.security.AuthProvider;
|
||||
@ -39,7 +37,6 @@ import java.security.KeyStore;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.security.Principal;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.Provider;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
@ -49,13 +46,10 @@ import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
import javax.security.auth.Destroyable;
|
||||
import javax.security.auth.DestroyFailedException;
|
||||
import javax.security.auth.Subject;
|
||||
import javax.security.auth.x500.*;
|
||||
import javax.security.auth.Subject;
|
||||
import javax.security.auth.x500.*;
|
||||
import javax.security.auth.callback.Callback;
|
||||
import javax.security.auth.callback.CallbackHandler;
|
||||
import javax.security.auth.callback.ConfirmationCallback;
|
||||
@ -67,7 +61,6 @@ import javax.security.auth.login.FailedLoginException;
|
||||
import javax.security.auth.login.LoginException;
|
||||
import javax.security.auth.spi.LoginModule;
|
||||
|
||||
import sun.security.util.AuthResources;
|
||||
import sun.security.util.Password;
|
||||
|
||||
/**
|
||||
@ -159,7 +152,7 @@ public class KeyStoreLoginModule implements LoginModule {
|
||||
|
||||
private Subject subject;
|
||||
private CallbackHandler callbackHandler;
|
||||
private Map sharedState;
|
||||
private Map<String, Object> sharedState;
|
||||
private Map<String, ?> options;
|
||||
|
||||
private char[] keyStorePassword;
|
||||
@ -202,7 +195,9 @@ public class KeyStoreLoginModule implements LoginModule {
|
||||
* <code>Configuration</code> for this particular
|
||||
* <code>LoginModule</code>.
|
||||
*/
|
||||
|
||||
// Unchecked warning from (Map<String, Object>)sharedState is safe
|
||||
// since javax.security.auth.login.LoginContext passes a raw HashMap.
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initialize(Subject subject,
|
||||
CallbackHandler callbackHandler,
|
||||
Map<String,?> sharedState,
|
||||
@ -210,7 +205,7 @@ public class KeyStoreLoginModule implements LoginModule {
|
||||
{
|
||||
this.subject = subject;
|
||||
this.callbackHandler = callbackHandler;
|
||||
this.sharedState = sharedState;
|
||||
this.sharedState = (Map<String, Object>)sharedState;
|
||||
this.options = options;
|
||||
|
||||
processOptions();
|
||||
@ -337,6 +332,7 @@ public class KeyStoreLoginModule implements LoginModule {
|
||||
}
|
||||
|
||||
/** Get the alias and passwords to use for looking up in the KeyStore. */
|
||||
@SuppressWarnings("fallthrough")
|
||||
private void getAliasAndPasswords(int env) throws LoginException {
|
||||
if (callbackHandler == null) {
|
||||
|
||||
|
||||
@ -367,7 +367,7 @@ public class Krb5LoginModule implements LoginModule {
|
||||
// initial state
|
||||
private Subject subject;
|
||||
private CallbackHandler callbackHandler;
|
||||
private Map sharedState;
|
||||
private Map<String, Object> sharedState;
|
||||
private Map<String, ?> options;
|
||||
|
||||
// configurable option
|
||||
@ -432,7 +432,11 @@ public class Krb5LoginModule implements LoginModule {
|
||||
* <code>Configuration</code> for this particular
|
||||
* <code>LoginModule</code>.
|
||||
*/
|
||||
|
||||
// Unchecked warning from (Map<String, Object>)sharedState is safe
|
||||
// since javax.security.auth.login.LoginContext passes a raw HashMap.
|
||||
// Unchecked warnings from options.get(String) are safe since we are
|
||||
// passing known keys.
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initialize(Subject subject,
|
||||
CallbackHandler callbackHandler,
|
||||
Map<String, ?> sharedState,
|
||||
@ -440,7 +444,7 @@ public class Krb5LoginModule implements LoginModule {
|
||||
|
||||
this.subject = subject;
|
||||
this.callbackHandler = callbackHandler;
|
||||
this.sharedState = sharedState;
|
||||
this.sharedState = (Map<String, Object>)sharedState;
|
||||
this.options = options;
|
||||
|
||||
// initialize any configured options
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,14 +25,12 @@
|
||||
|
||||
package com.sun.security.auth.module;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.AccessController;
|
||||
import java.net.SocketPermission;
|
||||
import java.security.Principal;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.regex.Matcher;
|
||||
@ -50,7 +48,6 @@ import javax.security.auth.spi.*;
|
||||
import com.sun.security.auth.LdapPrincipal;
|
||||
import com.sun.security.auth.UserPrincipal;
|
||||
|
||||
import sun.security.util.AuthResources;
|
||||
|
||||
/**
|
||||
* This {@link LoginModule} performs LDAP-based authentication.
|
||||
@ -366,12 +363,12 @@ public class LdapLoginModule implements LoginModule {
|
||||
// Initial state
|
||||
private Subject subject;
|
||||
private CallbackHandler callbackHandler;
|
||||
private Map sharedState;
|
||||
private Map<String, Object> sharedState;
|
||||
private Map<String, ?> options;
|
||||
private LdapContext ctx;
|
||||
private Matcher identityMatcher = null;
|
||||
private Matcher filterMatcher = null;
|
||||
private Hashtable ldapEnvironment;
|
||||
private Hashtable<String, Object> ldapEnvironment;
|
||||
private SearchControls constraints = null;
|
||||
|
||||
/**
|
||||
@ -385,15 +382,18 @@ public class LdapLoginModule implements LoginModule {
|
||||
* <code>Configuration</code> for this particular
|
||||
* <code>LoginModule</code>.
|
||||
*/
|
||||
// Unchecked warning from (Map<String, Object>)sharedState is safe
|
||||
// since javax.security.auth.login.LoginContext passes a raw HashMap.
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initialize(Subject subject, CallbackHandler callbackHandler,
|
||||
Map<String, ?> sharedState, Map<String, ?> options) {
|
||||
|
||||
this.subject = subject;
|
||||
this.callbackHandler = callbackHandler;
|
||||
this.sharedState = sharedState;
|
||||
this.sharedState = (Map<String, Object>)sharedState;
|
||||
this.options = options;
|
||||
|
||||
ldapEnvironment = new Hashtable(9);
|
||||
ldapEnvironment = new Hashtable<String, Object>(9);
|
||||
ldapEnvironment.put(Context.INITIAL_CONTEXT_FACTORY,
|
||||
"com.sun.jndi.ldap.LdapCtxFactory");
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -36,6 +36,7 @@ import java.security.BasicPermission;
|
||||
* <p>The target name is the {@link InquireType} allowed.
|
||||
*/
|
||||
public final class InquireSecContextPermission extends BasicPermission {
|
||||
private static final long serialVersionUID = -7131173349668647297L;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code InquireSecContextPermission} object with
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -31,6 +31,7 @@ import java.security.GeneralSecurityException;
|
||||
* An NTLM-related Exception
|
||||
*/
|
||||
public final class NTLMException extends GeneralSecurityException {
|
||||
private static final long serialVersionUID = -3298539507906689430L;
|
||||
|
||||
/**
|
||||
* If the incoming packet is invalid.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -33,7 +33,6 @@ import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
@ -68,7 +67,7 @@ final class CramMD5Server extends CramMD5Base implements SaslServer {
|
||||
* @param pw A non-null String or byte[]
|
||||
* containing the password. If it is an array, it is first cloned.
|
||||
*/
|
||||
CramMD5Server(String protocol, String serverFqdn, Map props,
|
||||
CramMD5Server(String protocol, String serverFqdn, Map<String, ?> props,
|
||||
CallbackHandler cbh) throws SaslException {
|
||||
if (serverFqdn == null) {
|
||||
throw new SaslException(
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,21 +28,15 @@ package com.sun.security.sasl.digest;
|
||||
import java.util.Map;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Random;
|
||||
import java.security.Provider;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.spec.KeySpec;
|
||||
@ -53,7 +47,6 @@ import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
@ -175,8 +168,9 @@ abstract class DigestMD5Base extends AbstractSaslImpl {
|
||||
*
|
||||
* @throws SaslException If invalid value found in props.
|
||||
*/
|
||||
protected DigestMD5Base(Map props, String className, int firstStep,
|
||||
String digestUri, CallbackHandler cbh) throws SaslException {
|
||||
protected DigestMD5Base(Map<String, ?> props, String className,
|
||||
int firstStep, String digestUri, CallbackHandler cbh)
|
||||
throws SaslException {
|
||||
super(props, className); // sets QOP, STENGTH and BUFFER_SIZE
|
||||
|
||||
step = firstStep;
|
||||
@ -791,7 +785,7 @@ abstract class DigestMD5Base extends AbstractSaslImpl {
|
||||
}
|
||||
} else if (realmChoices != null && i == realmIndex) {
|
||||
// > 1 realm specified
|
||||
if (realmChoices.size() == 0) {
|
||||
if (realmChoices.isEmpty()) {
|
||||
realmChoices.add(valueTable[i]); // add existing one
|
||||
}
|
||||
realmChoices.add(value); // add new one
|
||||
@ -1585,47 +1579,45 @@ abstract class DigestMD5Base extends AbstractSaslImpl {
|
||||
KeySpec spec = null;
|
||||
SecretKeyFactory desFactory =
|
||||
SecretKeyFactory.getInstance(desStrength);
|
||||
|
||||
if (desStrength.equals("des")) {
|
||||
spec = new DESKeySpec(subkey1, 0);
|
||||
if (logger.isLoggable(Level.FINEST)) {
|
||||
traceOutput(DP_CLASS_NAME, "makeDesKeys",
|
||||
"DIGEST42:DES key input: ", input);
|
||||
traceOutput(DP_CLASS_NAME, "makeDesKeys",
|
||||
"DIGEST43:DES key parity-adjusted: ", subkey1);
|
||||
traceOutput(DP_CLASS_NAME, "makeDesKeys",
|
||||
"DIGEST44:DES key material: ", ((DESKeySpec)spec).getKey());
|
||||
logger.log(Level.FINEST, "DIGEST45: is parity-adjusted? {0}",
|
||||
Boolean.valueOf(DESKeySpec.isParityAdjusted(subkey1, 0)));
|
||||
}
|
||||
|
||||
} else if (desStrength.equals("desede")) {
|
||||
|
||||
// Generate second subkey using second 7 bytes
|
||||
byte[] subkey2 = addDesParity(input, 7, 7);
|
||||
|
||||
// Construct 24-byte encryption-decryption-encryption sequence
|
||||
byte[] ede = new byte[subkey1.length*2+subkey2.length];
|
||||
System.arraycopy(subkey1, 0, ede, 0, subkey1.length);
|
||||
System.arraycopy(subkey2, 0, ede, subkey1.length, subkey2.length);
|
||||
System.arraycopy(subkey1, 0, ede, subkey1.length+subkey2.length,
|
||||
subkey1.length);
|
||||
|
||||
spec = new DESedeKeySpec(ede, 0);
|
||||
if (logger.isLoggable(Level.FINEST)) {
|
||||
traceOutput(DP_CLASS_NAME, "makeDesKeys",
|
||||
"DIGEST46:3DES key input: ", input);
|
||||
traceOutput(DP_CLASS_NAME, "makeDesKeys",
|
||||
"DIGEST47:3DES key ede: ", ede);
|
||||
traceOutput(DP_CLASS_NAME, "makeDesKeys",
|
||||
"DIGEST48:3DES key material: ",
|
||||
((DESedeKeySpec)spec).getKey());
|
||||
logger.log(Level.FINEST, "DIGEST49: is parity-adjusted? ",
|
||||
Boolean.valueOf(DESedeKeySpec.isParityAdjusted(ede, 0)));
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("Invalid DES strength:" +
|
||||
desStrength);
|
||||
switch (desStrength) {
|
||||
case "des":
|
||||
spec = new DESKeySpec(subkey1, 0);
|
||||
if (logger.isLoggable(Level.FINEST)) {
|
||||
traceOutput(DP_CLASS_NAME, "makeDesKeys",
|
||||
"DIGEST42:DES key input: ", input);
|
||||
traceOutput(DP_CLASS_NAME, "makeDesKeys",
|
||||
"DIGEST43:DES key parity-adjusted: ", subkey1);
|
||||
traceOutput(DP_CLASS_NAME, "makeDesKeys",
|
||||
"DIGEST44:DES key material: ", ((DESKeySpec)spec).getKey());
|
||||
logger.log(Level.FINEST, "DIGEST45: is parity-adjusted? {0}",
|
||||
Boolean.valueOf(DESKeySpec.isParityAdjusted(subkey1, 0)));
|
||||
}
|
||||
break;
|
||||
case "desede":
|
||||
// Generate second subkey using second 7 bytes
|
||||
byte[] subkey2 = addDesParity(input, 7, 7);
|
||||
// Construct 24-byte encryption-decryption-encryption sequence
|
||||
byte[] ede = new byte[subkey1.length*2+subkey2.length];
|
||||
System.arraycopy(subkey1, 0, ede, 0, subkey1.length);
|
||||
System.arraycopy(subkey2, 0, ede, subkey1.length, subkey2.length);
|
||||
System.arraycopy(subkey1, 0, ede, subkey1.length+subkey2.length,
|
||||
subkey1.length);
|
||||
spec = new DESedeKeySpec(ede, 0);
|
||||
if (logger.isLoggable(Level.FINEST)) {
|
||||
traceOutput(DP_CLASS_NAME, "makeDesKeys",
|
||||
"DIGEST46:3DES key input: ", input);
|
||||
traceOutput(DP_CLASS_NAME, "makeDesKeys",
|
||||
"DIGEST47:3DES key ede: ", ede);
|
||||
traceOutput(DP_CLASS_NAME, "makeDesKeys",
|
||||
"DIGEST48:3DES key material: ",
|
||||
((DESedeKeySpec)spec).getKey());
|
||||
logger.log(Level.FINEST, "DIGEST49: is parity-adjusted? ",
|
||||
Boolean.valueOf(DESedeKeySpec.isParityAdjusted(ede, 0)));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid DES strength:" +
|
||||
desStrength);
|
||||
}
|
||||
return desFactory.generateSecret(spec);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,21 +25,16 @@
|
||||
|
||||
package com.sun.security.sasl.digest;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Arrays;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.security.sasl.*;
|
||||
@ -153,7 +148,7 @@ final class DigestMD5Client extends DigestMD5Base implements SaslClient {
|
||||
* @throws SaslException if no authentication ID or password is supplied
|
||||
*/
|
||||
DigestMD5Client(String authzid, String protocol, String serverName,
|
||||
Map props, CallbackHandler cbh) throws SaslException {
|
||||
Map<String, ?> props, CallbackHandler cbh) throws SaslException {
|
||||
|
||||
super(props, MY_CLASS_NAME, 2, protocol + "/" + serverName, cbh);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,23 +25,16 @@
|
||||
|
||||
package com.sun.security.sasl.digest;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.Provider;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Random;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Arrays;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.security.sasl.*;
|
||||
@ -147,7 +140,7 @@ final class DigestMD5Server extends DigestMD5Base implements SaslServer {
|
||||
private byte[] myCiphers;
|
||||
private List<String> serverRealms;
|
||||
|
||||
DigestMD5Server(String protocol, String serverName, Map props,
|
||||
DigestMD5Server(String protocol, String serverName, Map<String, ?> props,
|
||||
CallbackHandler cbh) throws SaslException {
|
||||
super(props, MY_CLASS_NAME, 1, protocol + "/" + serverName, cbh);
|
||||
|
||||
@ -179,7 +172,7 @@ final class DigestMD5Server extends DigestMD5Base implements SaslServer {
|
||||
encoding = (useUTF8 ? "UTF8" : "8859_1");
|
||||
|
||||
// By default, use server name as realm
|
||||
if (serverRealms.size() == 0) {
|
||||
if (serverRealms.isEmpty()) {
|
||||
serverRealms.add(serverName);
|
||||
}
|
||||
}
|
||||
@ -468,19 +461,23 @@ final class DigestMD5Server extends DigestMD5Base implements SaslServer {
|
||||
|
||||
// Check that QOP is one sent by server
|
||||
byte cQop;
|
||||
if (negotiatedQop.equals("auth")) {
|
||||
cQop = NO_PROTECTION;
|
||||
} else if (negotiatedQop.equals("auth-int")) {
|
||||
cQop = INTEGRITY_ONLY_PROTECTION;
|
||||
integrity = true;
|
||||
rawSendSize = sendMaxBufSize - 16;
|
||||
} else if (negotiatedQop.equals("auth-conf")) {
|
||||
cQop = PRIVACY_PROTECTION;
|
||||
integrity = privacy = true;
|
||||
rawSendSize = sendMaxBufSize - 26;
|
||||
} else {
|
||||
throw new SaslException("DIGEST-MD5: digest response format " +
|
||||
"violation. Invalid QOP: " + negotiatedQop);
|
||||
switch (negotiatedQop) {
|
||||
case "auth":
|
||||
cQop = NO_PROTECTION;
|
||||
break;
|
||||
case "auth-int":
|
||||
cQop = INTEGRITY_ONLY_PROTECTION;
|
||||
integrity = true;
|
||||
rawSendSize = sendMaxBufSize - 16;
|
||||
break;
|
||||
case "auth-conf":
|
||||
cQop = PRIVACY_PROTECTION;
|
||||
integrity = privacy = true;
|
||||
rawSendSize = sendMaxBufSize - 26;
|
||||
break;
|
||||
default:
|
||||
throw new SaslException("DIGEST-MD5: digest response format " +
|
||||
"violation. Invalid QOP: " + negotiatedQop);
|
||||
}
|
||||
if ((cQop&allQop) == 0) {
|
||||
throw new SaslException("DIGEST-MD5: server does not support " +
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,9 +26,7 @@
|
||||
|
||||
package com.sun.security.sasl.gsskerb;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
import javax.security.sasl.*;
|
||||
import com.sun.security.sasl.util.AbstractSaslImpl;
|
||||
@ -50,7 +48,8 @@ abstract class GssKrb5Base extends AbstractSaslImpl {
|
||||
protected MessageProp msgProp; // QOP and privacy for unwrap
|
||||
protected static final int JGSS_QOP = 0; // unrelated to SASL QOP mask
|
||||
|
||||
protected GssKrb5Base(Map props, String className) throws SaslException {
|
||||
protected GssKrb5Base(Map<String, ?> props, String className)
|
||||
throws SaslException {
|
||||
super(props, className);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,7 +27,6 @@ package com.sun.security.sasl.gsskerb;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
import javax.security.sasl.*;
|
||||
|
||||
@ -93,7 +92,7 @@ final class GssKrb5Client extends GssKrb5Base implements SaslClient {
|
||||
* with the server.
|
||||
*/
|
||||
GssKrb5Client(String authzID, String protocol, String serverName,
|
||||
Map props, CallbackHandler cbh) throws SaslException {
|
||||
Map<String, ?> props, CallbackHandler cbh) throws SaslException {
|
||||
|
||||
super(props, MY_CLASS_NAME);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,7 +28,6 @@ package com.sun.security.sasl.gsskerb;
|
||||
import javax.security.sasl.*;
|
||||
import java.io.*;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
|
||||
// JAAS
|
||||
@ -77,7 +76,7 @@ final class GssKrb5Server extends GssKrb5Base implements SaslServer {
|
||||
* with the client.
|
||||
*/
|
||||
GssKrb5Server(String protocol, String serverName,
|
||||
Map props, CallbackHandler cbh) throws SaslException {
|
||||
Map<String, ?> props, CallbackHandler cbh) throws SaslException {
|
||||
|
||||
super(props, MY_CLASS_NAME);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -111,7 +111,7 @@ final class NTLMClient implements SaslClient {
|
||||
* @throws SaslException
|
||||
*/
|
||||
NTLMClient(String mech, String authzid, String protocol, String serverName,
|
||||
Map props, CallbackHandler cbh) throws SaslException {
|
||||
Map<String, ?> props, CallbackHandler cbh) throws SaslException {
|
||||
|
||||
this.mech = mech;
|
||||
String version = null;
|
||||
@ -194,12 +194,13 @@ final class NTLMClient implements SaslClient {
|
||||
|
||||
@Override
|
||||
public Object getNegotiatedProperty(String propName) {
|
||||
if (propName.equals(Sasl.QOP)) {
|
||||
return "auth";
|
||||
} else if (propName.equals(NTLM_DOMAIN)) {
|
||||
return client.getDomain();
|
||||
} else {
|
||||
return null;
|
||||
switch (propName) {
|
||||
case Sasl.QOP:
|
||||
return "auth";
|
||||
case NTLM_DOMAIN:
|
||||
return client.getDomain();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -110,7 +110,8 @@ final class NTLMServer implements SaslServer {
|
||||
* @throws SaslException
|
||||
*/
|
||||
NTLMServer(String mech, String protocol, String serverName,
|
||||
Map props, final CallbackHandler cbh) throws SaslException {
|
||||
Map<String, ?> props, final CallbackHandler cbh)
|
||||
throws SaslException {
|
||||
|
||||
this.mech = mech;
|
||||
String version = null;
|
||||
@ -210,12 +211,13 @@ final class NTLMServer implements SaslServer {
|
||||
|
||||
@Override
|
||||
public Object getNegotiatedProperty(String propName) {
|
||||
if (propName.equals(Sasl.QOP)) {
|
||||
return "auth";
|
||||
} else if (propName.equals(NTLM_HOSTNAME)) {
|
||||
return hostname;
|
||||
} else {
|
||||
return null;
|
||||
switch (propName) {
|
||||
case Sasl.QOP:
|
||||
return "auth";
|
||||
case NTLM_HOSTNAME:
|
||||
return hostname;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,8 +29,6 @@ import javax.security.sasl.*;
|
||||
import java.io.*;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
@ -63,7 +61,8 @@ public abstract class AbstractSaslImpl {
|
||||
|
||||
protected String myClassName;
|
||||
|
||||
protected AbstractSaslImpl(Map props, String className) throws SaslException {
|
||||
protected AbstractSaslImpl(Map<String, ?> props, String className)
|
||||
throws SaslException {
|
||||
myClassName = className;
|
||||
|
||||
// Parse properties to set desired context options
|
||||
@ -156,23 +155,23 @@ public abstract class AbstractSaslImpl {
|
||||
if (!completed) {
|
||||
throw new IllegalStateException("SASL authentication not completed");
|
||||
}
|
||||
|
||||
if (propName.equals(Sasl.QOP)) {
|
||||
if (privacy) {
|
||||
return "auth-conf";
|
||||
} else if (integrity) {
|
||||
return "auth-int";
|
||||
} else {
|
||||
return "auth";
|
||||
}
|
||||
} else if (propName.equals(Sasl.MAX_BUFFER)) {
|
||||
return Integer.toString(recvMaxBufSize);
|
||||
} else if (propName.equals(Sasl.RAW_SEND_SIZE)) {
|
||||
return Integer.toString(rawSendSize);
|
||||
} else if (propName.equals(MAX_SEND_BUF)) {
|
||||
return Integer.toString(sendMaxBufSize);
|
||||
} else {
|
||||
return null;
|
||||
switch (propName) {
|
||||
case Sasl.QOP:
|
||||
if (privacy) {
|
||||
return "auth-conf";
|
||||
} else if (integrity) {
|
||||
return "auth-int";
|
||||
} else {
|
||||
return "auth";
|
||||
}
|
||||
case Sasl.MAX_BUFFER:
|
||||
return Integer.toString(recvMaxBufSize);
|
||||
case Sasl.RAW_SEND_SIZE:
|
||||
return Integer.toString(rawSendSize);
|
||||
case MAX_SEND_BUF:
|
||||
return Integer.toString(sendMaxBufSize);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -53,7 +53,7 @@ final public class PolicyUtils {
|
||||
* @param props The security policy properties to check
|
||||
* @return true if passes; false if fails
|
||||
*/
|
||||
public static boolean checkPolicy(int flags, Map props) {
|
||||
public static boolean checkPolicy(int flags, Map<String, ?> props) {
|
||||
if (props == null) {
|
||||
return true;
|
||||
}
|
||||
@ -93,7 +93,7 @@ final public class PolicyUtils {
|
||||
*
|
||||
*/
|
||||
public static String[] filterMechs(String[] mechs, int[] policies,
|
||||
Map props) {
|
||||
Map<String, ?> props) {
|
||||
if (props == null) {
|
||||
return mechs.clone();
|
||||
}
|
||||
|
||||
@ -29,8 +29,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import sun.security.util.Debug;
|
||||
import sun.security.util.SecurityConstants;
|
||||
import sun.misc.JavaSecurityAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
|
||||
|
||||
/**
|
||||
@ -312,7 +310,7 @@ public final class AccessControlContext {
|
||||
Debug.isOn("permission=" + perm.getClass().getCanonicalName());
|
||||
|
||||
if (dumpDebug && Debug.isOn("stack")) {
|
||||
Thread.currentThread().dumpStack();
|
||||
Thread.dumpStack();
|
||||
}
|
||||
|
||||
if (dumpDebug && Debug.isOn("domain")) {
|
||||
@ -353,7 +351,7 @@ public final class AccessControlContext {
|
||||
if (!dumpDebug) {
|
||||
debug.println("access denied " + perm);
|
||||
}
|
||||
Thread.currentThread().dumpStack();
|
||||
Thread.dumpStack();
|
||||
final ProtectionDomain pd = context[i];
|
||||
final Debug db = debug;
|
||||
AccessController.doPrivileged (new PrivilegedAction<Void>() {
|
||||
@ -561,7 +559,7 @@ public final class AccessControlContext {
|
||||
match = (that.context[j] == null);
|
||||
}
|
||||
} else {
|
||||
Class thisPdClass = thisPd.getClass();
|
||||
Class<?> thisPdClass = thisPd.getClass();
|
||||
ProtectionDomain thatPd;
|
||||
for (int j = 0; (j < that.context.length) && !match; j++) {
|
||||
thatPd = that.context[j];
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -406,7 +406,7 @@ public final class AccessController {
|
||||
* callerClass[2] = AccessController.doPrivileged
|
||||
* callerClass[3] = caller
|
||||
*/
|
||||
final Class callerClass = sun.reflect.Reflection.getCallerClass(3);
|
||||
final Class<?> callerClass = sun.reflect.Reflection.getCallerClass(3);
|
||||
ProtectionDomain callerPd = doPrivileged
|
||||
(new PrivilegedAction<ProtectionDomain>() {
|
||||
public ProtectionDomain run() {
|
||||
@ -538,7 +538,7 @@ public final class AccessController {
|
||||
}
|
||||
|
||||
if (dumpDebug && Debug.isOn("stack")) {
|
||||
Thread.currentThread().dumpStack();
|
||||
Thread.dumpStack();
|
||||
}
|
||||
|
||||
if (dumpDebug && Debug.isOn("domain")) {
|
||||
|
||||
@ -25,7 +25,6 @@
|
||||
|
||||
package java.security;
|
||||
|
||||
import java.security.*;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
@ -333,14 +332,14 @@ implements java.io.Serializable
|
||||
*
|
||||
* @see #serialPersistentFields
|
||||
*/
|
||||
private Class permClass;
|
||||
private Class<?> permClass;
|
||||
|
||||
/**
|
||||
* Create an empty BasicPermissionCollection object.
|
||||
*
|
||||
*/
|
||||
|
||||
public BasicPermissionCollection(Class clazz) {
|
||||
public BasicPermissionCollection(Class<?> clazz) {
|
||||
perms = new HashMap<String, Permission>(11);
|
||||
all_allowed = false;
|
||||
permClass = clazz;
|
||||
@ -542,6 +541,9 @@ implements java.io.Serializable
|
||||
ObjectInputStream.GetField gfields = in.readFields();
|
||||
|
||||
// Get permissions
|
||||
// writeObject writes a Hashtable<String, Permission> for the
|
||||
// permissions key, so this cast is safe, unless the data is corrupt.
|
||||
@SuppressWarnings("unchecked")
|
||||
Hashtable<String, Permission> permissions =
|
||||
(Hashtable<String, Permission>)gfields.get("permissions", null);
|
||||
perms = new HashMap<String, Permission>(permissions.size()*2);
|
||||
@ -551,7 +553,7 @@ implements java.io.Serializable
|
||||
all_allowed = gfields.get("all_allowed", false);
|
||||
|
||||
// Get permClass
|
||||
permClass = (Class) gfields.get("permClass", null);
|
||||
permClass = (Class<?>) gfields.get("permClass", null);
|
||||
|
||||
if (permClass == null) {
|
||||
// set permClass
|
||||
|
||||
@ -31,7 +31,6 @@ import java.util.NoSuchElementException;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Collections;
|
||||
import java.io.Serializable;
|
||||
@ -238,7 +237,7 @@ implements Serializable
|
||||
*/
|
||||
private PermissionCollection getPermissionCollection(Permission p,
|
||||
boolean createEmpty) {
|
||||
Class c = p.getClass();
|
||||
Class<?> c = p.getClass();
|
||||
|
||||
PermissionCollection pc = permsMap.get(c);
|
||||
|
||||
@ -390,6 +389,9 @@ implements Serializable
|
||||
allPermission = (PermissionCollection) gfields.get("allPermission", null);
|
||||
|
||||
// Get permissions
|
||||
// writeObject writes a Hashtable<Class<?>, PermissionCollection> for
|
||||
// the perms key, so this cast is safe, unless the data is corrupt.
|
||||
@SuppressWarnings("unchecked")
|
||||
Hashtable<Class<?>, PermissionCollection> perms =
|
||||
(Hashtable<Class<?>, PermissionCollection>)gfields.get("perms", null);
|
||||
permsMap = new HashMap<Class<?>, PermissionCollection>(perms.size()*2);
|
||||
@ -590,6 +592,9 @@ implements Serializable
|
||||
ObjectInputStream.GetField gfields = in.readFields();
|
||||
|
||||
// Get permissions
|
||||
// writeObject writes a Hashtable<Class<?>, PermissionCollection> for
|
||||
// the perms key, so this cast is safe, unless the data is corrupt.
|
||||
@SuppressWarnings("unchecked")
|
||||
Hashtable<Permission, Permission> perms =
|
||||
(Hashtable<Permission, Permission>)gfields.get("perms", null);
|
||||
permsMap = new HashMap<Permission, Permission>(perms.size()*2);
|
||||
|
||||
@ -26,16 +26,7 @@
|
||||
|
||||
package java.security;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.RuntimePermission;
|
||||
import java.lang.reflect.*;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.PropertyPermission;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
import java.util.WeakHashMap;
|
||||
import sun.security.jca.GetInstance;
|
||||
import sun.security.util.Debug;
|
||||
@ -786,6 +777,8 @@ public abstract class Policy {
|
||||
private static class UnsupportedEmptyCollection
|
||||
extends PermissionCollection {
|
||||
|
||||
private static final long serialVersionUID = -8492269157353014774L;
|
||||
|
||||
private Permissions perms;
|
||||
|
||||
/**
|
||||
|
||||
@ -33,7 +33,6 @@ import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import sun.misc.JavaSecurityProtectionDomainAccess;
|
||||
import static sun.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.security.util.Debug;
|
||||
import sun.security.util.SecurityConstants;
|
||||
import sun.misc.JavaSecurityAccess;
|
||||
@ -403,7 +402,7 @@ public class ProtectionDomain {
|
||||
e = permissions.elements(); // domain vs policy
|
||||
while (e.hasMoreElements()) {
|
||||
Permission pdp = e.nextElement();
|
||||
Class pdpClass = pdp.getClass();
|
||||
Class<?> pdpClass = pdp.getClass();
|
||||
String pdpActions = pdp.getActions();
|
||||
String pdpName = pdp.getName();
|
||||
for (int i = 0; i < plVector.size(); i++) {
|
||||
|
||||
@ -31,9 +31,6 @@ import static java.util.Locale.ENGLISH;
|
||||
import java.lang.ref.*;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
import java.security.cert.CertStoreParameters;
|
||||
import javax.security.auth.login.Configuration;
|
||||
|
||||
/**
|
||||
* This class represents a "provider" for the
|
||||
* Java Security API, where a provider implements some or all parts of
|
||||
@ -453,8 +450,8 @@ public abstract class Provider extends Properties {
|
||||
* Internal method to be called AFTER the security check has been
|
||||
* performed.
|
||||
*/
|
||||
private void implPutAll(Map t) {
|
||||
for (Map.Entry e : ((Map<?,?>)t).entrySet()) {
|
||||
private void implPutAll(Map<?,?> t) {
|
||||
for (Map.Entry<?,?> e : t.entrySet()) {
|
||||
implPut(e.getKey(), e.getValue());
|
||||
}
|
||||
}
|
||||
@ -562,9 +559,9 @@ public abstract class Provider extends Properties {
|
||||
* occur if the legacy properties are inconsistent or incomplete.
|
||||
*/
|
||||
private void removeInvalidServices(Map<ServiceKey,Service> map) {
|
||||
for (Iterator t = map.entrySet().iterator(); t.hasNext(); ) {
|
||||
Map.Entry entry = (Map.Entry)t.next();
|
||||
Service s = (Service)entry.getValue();
|
||||
for (Iterator<Map.Entry<ServiceKey, Service>> t =
|
||||
map.entrySet().iterator(); t.hasNext(); ) {
|
||||
Service s = t.next().getValue();
|
||||
if (s.isValid() == false) {
|
||||
t.remove();
|
||||
}
|
||||
@ -918,15 +915,15 @@ public abstract class Provider extends Properties {
|
||||
final String name;
|
||||
final boolean supportsParameter;
|
||||
final String constructorParameterClassName;
|
||||
private volatile Class constructorParameterClass;
|
||||
private volatile Class<?> constructorParameterClass;
|
||||
|
||||
EngineDescription(String name, boolean sp, String paramName) {
|
||||
this.name = name;
|
||||
this.supportsParameter = sp;
|
||||
this.constructorParameterClassName = paramName;
|
||||
}
|
||||
Class getConstructorParameterClass() throws ClassNotFoundException {
|
||||
Class clazz = constructorParameterClass;
|
||||
Class<?> getConstructorParameterClass() throws ClassNotFoundException {
|
||||
Class<?> clazz = constructorParameterClass;
|
||||
if (clazz == null) {
|
||||
clazz = Class.forName(constructorParameterClassName);
|
||||
constructorParameterClass = clazz;
|
||||
@ -1038,7 +1035,7 @@ public abstract class Provider extends Properties {
|
||||
private Map<UString,String> attributes;
|
||||
|
||||
// Reference to the cached implementation Class object
|
||||
private volatile Reference<Class> classRef;
|
||||
private volatile Reference<Class<?>> classRef;
|
||||
|
||||
// flag indicating whether this service has its attributes for
|
||||
// supportedKeyFormats or supportedKeyClasses set
|
||||
@ -1055,7 +1052,7 @@ public abstract class Provider extends Properties {
|
||||
// whether this service has been registered with the Provider
|
||||
private boolean registered;
|
||||
|
||||
private static final Class[] CLASS0 = new Class[0];
|
||||
private static final Class<?>[] CLASS0 = new Class<?>[0];
|
||||
|
||||
// this constructor and these methods are used for parsing
|
||||
// the legacy string properties.
|
||||
@ -1234,12 +1231,12 @@ public abstract class Provider extends Properties {
|
||||
("constructorParameter not used with " + type
|
||||
+ " engines");
|
||||
}
|
||||
Class clazz = getImplClass();
|
||||
Class<?> clazz = getImplClass();
|
||||
return clazz.newInstance();
|
||||
} else {
|
||||
Class paramClass = cap.getConstructorParameterClass();
|
||||
Class<?> paramClass = cap.getConstructorParameterClass();
|
||||
if (constructorParameter != null) {
|
||||
Class argClass = constructorParameter.getClass();
|
||||
Class<?> argClass = constructorParameter.getClass();
|
||||
if (paramClass.isAssignableFrom(argClass) == false) {
|
||||
throw new InvalidParameterException
|
||||
("constructorParameter must be instanceof "
|
||||
@ -1247,8 +1244,8 @@ public abstract class Provider extends Properties {
|
||||
+ " for engine type " + type);
|
||||
}
|
||||
}
|
||||
Class clazz = getImplClass();
|
||||
Constructor cons = clazz.getConstructor(paramClass);
|
||||
Class<?> clazz = getImplClass();
|
||||
Constructor<?> cons = clazz.getConstructor(paramClass);
|
||||
return cons.newInstance(constructorParameter);
|
||||
}
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
@ -1267,10 +1264,10 @@ public abstract class Provider extends Properties {
|
||||
}
|
||||
|
||||
// return the implementation Class object for this service
|
||||
private Class getImplClass() throws NoSuchAlgorithmException {
|
||||
private Class<?> getImplClass() throws NoSuchAlgorithmException {
|
||||
try {
|
||||
Reference<Class> ref = classRef;
|
||||
Class clazz = (ref == null) ? null : ref.get();
|
||||
Reference<Class<?>> ref = classRef;
|
||||
Class<?> clazz = (ref == null) ? null : ref.get();
|
||||
if (clazz == null) {
|
||||
ClassLoader cl = provider.getClass().getClassLoader();
|
||||
if (cl == null) {
|
||||
@ -1278,7 +1275,7 @@ public abstract class Provider extends Properties {
|
||||
} else {
|
||||
clazz = cl.loadClass(className);
|
||||
}
|
||||
classRef = new WeakReference<Class>(clazz);
|
||||
classRef = new WeakReference<Class<?>>(clazz);
|
||||
}
|
||||
return clazz;
|
||||
} catch (ClassNotFoundException e) {
|
||||
@ -1295,18 +1292,18 @@ public abstract class Provider extends Properties {
|
||||
*/
|
||||
private Object newInstanceGeneric(Object constructorParameter)
|
||||
throws Exception {
|
||||
Class clazz = getImplClass();
|
||||
Class<?> clazz = getImplClass();
|
||||
if (constructorParameter == null) {
|
||||
Object o = clazz.newInstance();
|
||||
return o;
|
||||
}
|
||||
Class argClass = constructorParameter.getClass();
|
||||
Class<?> argClass = constructorParameter.getClass();
|
||||
Constructor[] cons = clazz.getConstructors();
|
||||
// find first public constructor that can take the
|
||||
// argument as parameter
|
||||
for (int i = 0; i < cons.length; i++) {
|
||||
Constructor con = cons[i];
|
||||
Class[] paramTypes = con.getParameterTypes();
|
||||
Constructor<?> con = cons[i];
|
||||
Class<?>[] paramTypes = con.getParameterTypes();
|
||||
if (paramTypes.length != 1) {
|
||||
continue;
|
||||
}
|
||||
@ -1394,10 +1391,10 @@ public abstract class Provider extends Properties {
|
||||
s = getAttribute("SupportedKeyClasses");
|
||||
if (s != null) {
|
||||
String[] classNames = s.split("\\|");
|
||||
List<Class> classList =
|
||||
List<Class<?>> classList =
|
||||
new ArrayList<>(classNames.length);
|
||||
for (String className : classNames) {
|
||||
Class clazz = getKeyClass(className);
|
||||
Class<?> clazz = getKeyClass(className);
|
||||
if (clazz != null) {
|
||||
classList.add(clazz);
|
||||
}
|
||||
@ -1414,7 +1411,7 @@ public abstract class Provider extends Properties {
|
||||
}
|
||||
|
||||
// get the key class object of the specified name
|
||||
private Class getKeyClass(String name) {
|
||||
private Class<?> getKeyClass(String name) {
|
||||
try {
|
||||
return Class.forName(name);
|
||||
} catch (ClassNotFoundException e) {
|
||||
@ -1451,8 +1448,8 @@ public abstract class Provider extends Properties {
|
||||
if (supportedClasses == null) {
|
||||
return false;
|
||||
}
|
||||
Class keyClass = key.getClass();
|
||||
for (Class clazz : supportedClasses) {
|
||||
Class<?> keyClass = key.getClass();
|
||||
for (Class<?> clazz : supportedClasses) {
|
||||
if (clazz.isAssignableFrom(keyClass)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -33,8 +33,6 @@ import java.net.URL;
|
||||
import sun.security.util.Debug;
|
||||
import sun.security.util.PropertyExpander;
|
||||
|
||||
import java.security.Provider.Service;
|
||||
|
||||
import sun.security.jca.*;
|
||||
|
||||
/**
|
||||
@ -660,15 +658,16 @@ public final class Security {
|
||||
}
|
||||
|
||||
// Map containing cached Spi Class objects of the specified type
|
||||
private static final Map<String, Class> spiMap = new ConcurrentHashMap<>();
|
||||
private static final Map<String, Class<?>> spiMap =
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* Return the Class object for the given engine type
|
||||
* (e.g. "MessageDigest"). Works for Spis in the java.security package
|
||||
* only.
|
||||
*/
|
||||
private static Class getSpiClass(String type) {
|
||||
Class clazz = spiMap.get(type);
|
||||
private static Class<?> getSpiClass(String type) {
|
||||
Class<?> clazz = spiMap.get(type);
|
||||
if (clazz != null) {
|
||||
return clazz;
|
||||
}
|
||||
@ -1078,7 +1077,7 @@ public final class Security {
|
||||
|
||||
if ((serviceName == null) || (serviceName.length() == 0) ||
|
||||
(serviceName.endsWith("."))) {
|
||||
return Collections.EMPTY_SET;
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
HashSet<String> result = new HashSet<>();
|
||||
|
||||
@ -28,9 +28,7 @@ package java.security;
|
||||
import java.io.IOException;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import java.lang.reflect.*;
|
||||
import java.security.cert.*;
|
||||
|
||||
@ -247,19 +245,19 @@ implements java.io.Serializable
|
||||
}
|
||||
}
|
||||
try {
|
||||
Class pc = p.getClass();
|
||||
Class<?> pc = p.getClass();
|
||||
|
||||
if (name == null && actions == null) {
|
||||
try {
|
||||
Constructor c = pc.getConstructor(PARAMS0);
|
||||
Constructor<?> c = pc.getConstructor(PARAMS0);
|
||||
return (Permission)c.newInstance(new Object[] {});
|
||||
} catch (NoSuchMethodException ne) {
|
||||
try {
|
||||
Constructor c = pc.getConstructor(PARAMS1);
|
||||
Constructor<?> c = pc.getConstructor(PARAMS1);
|
||||
return (Permission) c.newInstance(
|
||||
new Object[] { name});
|
||||
} catch (NoSuchMethodException ne1) {
|
||||
Constructor c = pc.getConstructor(PARAMS2);
|
||||
Constructor<?> c = pc.getConstructor(PARAMS2);
|
||||
return (Permission) c.newInstance(
|
||||
new Object[] { name, actions });
|
||||
}
|
||||
@ -267,16 +265,16 @@ implements java.io.Serializable
|
||||
} else {
|
||||
if (name != null && actions == null) {
|
||||
try {
|
||||
Constructor c = pc.getConstructor(PARAMS1);
|
||||
Constructor<?> c = pc.getConstructor(PARAMS1);
|
||||
return (Permission) c.newInstance(
|
||||
new Object[] { name});
|
||||
} catch (NoSuchMethodException ne) {
|
||||
Constructor c = pc.getConstructor(PARAMS2);
|
||||
Constructor<?> c = pc.getConstructor(PARAMS2);
|
||||
return (Permission) c.newInstance(
|
||||
new Object[] { name, actions });
|
||||
}
|
||||
} else {
|
||||
Constructor c = pc.getConstructor(PARAMS2);
|
||||
Constructor<?> c = pc.getConstructor(PARAMS2);
|
||||
return (Permission) c.newInstance(
|
||||
new Object[] { name, actions });
|
||||
}
|
||||
|
||||
@ -197,8 +197,12 @@ implements java.io.Serializable
|
||||
ObjectInputStream.GetField gfields = in.readFields();
|
||||
|
||||
// Get permissions
|
||||
@SuppressWarnings("unchecked")
|
||||
// writeObject writes a Hashtable<String, Vector<UnresolvedPermission>>
|
||||
// for the permissions key, so this cast is safe, unless the data is corrupt.
|
||||
Hashtable<String, Vector<UnresolvedPermission>> permissions =
|
||||
(Hashtable<String, Vector<UnresolvedPermission>>)gfields.get("permissions", null);
|
||||
(Hashtable<String, Vector<UnresolvedPermission>>)
|
||||
gfields.get("permissions", null);
|
||||
perms = new HashMap<String, List<UnresolvedPermission>>(permissions.size()*2);
|
||||
|
||||
// Convert each entry (Vector) into a List
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,7 +32,6 @@ import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
|
||||
import sun.security.util.ObjectIdentifier;
|
||||
@ -95,7 +94,7 @@ public class CertificateRevokedException extends CertificateException {
|
||||
this.revocationDate = new Date(revocationDate.getTime());
|
||||
this.reason = reason;
|
||||
this.authority = authority;
|
||||
this.extensions = new HashMap(extensions);
|
||||
this.extensions = new HashMap<String, Extension>(extensions);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -148,8 +147,7 @@ public class CertificateRevokedException extends CertificateException {
|
||||
return null;
|
||||
} else {
|
||||
try {
|
||||
Date invalidity =
|
||||
(Date) InvalidityDateExtension.toImpl(ext).get("DATE");
|
||||
Date invalidity = InvalidityDateExtension.toImpl(ext).get("DATE");
|
||||
return new Date(invalidity.getTime());
|
||||
} catch (IOException ioe) {
|
||||
return null;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -632,7 +632,7 @@ public class X509CRLSelector implements CRLSelector {
|
||||
byte[] encoded = in.getOctetString();
|
||||
CRLNumberExtension crlNumExt =
|
||||
new CRLNumberExtension(Boolean.FALSE, encoded);
|
||||
crlNum = (BigInteger)crlNumExt.get(CRLNumberExtension.NUMBER);
|
||||
crlNum = crlNumExt.get(CRLNumberExtension.NUMBER);
|
||||
} catch (IOException ex) {
|
||||
if (debug != null) {
|
||||
debug.println("X509CRLSelector.match: exception in "
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -277,7 +277,7 @@ public class X509CertSelector implements CertSelector {
|
||||
try {
|
||||
issuer = (issuerDN == null ? null : new X500Principal(issuerDN));
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw (IOException)new IOException("Invalid name").initCause(e);
|
||||
throw new IOException("Invalid name", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -341,7 +341,7 @@ public class X509CertSelector implements CertSelector {
|
||||
try {
|
||||
subject = (subjectDN == null ? null : new X500Principal(subjectDN));
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw (IOException)new IOException("Invalid name").initCause(e);
|
||||
throw new IOException("Invalid name", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -872,7 +872,7 @@ public class X509CertSelector implements CertSelector {
|
||||
* @param object2 a Collection containing the second object to compare
|
||||
* @return true if the objects are equal, false otherwise
|
||||
*/
|
||||
static boolean equalNames(Collection object1, Collection object2) {
|
||||
static boolean equalNames(Collection<?> object1, Collection<?> object2) {
|
||||
if ((object1 == null) || (object2 == null)) {
|
||||
return object1 == object2;
|
||||
}
|
||||
@ -1672,19 +1672,15 @@ public class X509CertSelector implements CertSelector {
|
||||
private static Set<List<?>> cloneAndCheckNames(Collection<List<?>> names) throws IOException {
|
||||
// Copy the Lists and Collection
|
||||
Set<List<?>> namesCopy = new HashSet<List<?>>();
|
||||
Iterator<List<?>> i = names.iterator();
|
||||
while (i.hasNext()) {
|
||||
Object o = i.next();
|
||||
if (!(o instanceof List)) {
|
||||
throw new IOException("expected a List");
|
||||
}
|
||||
namesCopy.add(new ArrayList<Object>((List<?>)o));
|
||||
for (List<?> o : names)
|
||||
{
|
||||
namesCopy.add(new ArrayList<Object>(o));
|
||||
}
|
||||
|
||||
// Check the contents of the Lists and clone any byte arrays
|
||||
i = namesCopy.iterator();
|
||||
while (i.hasNext()) {
|
||||
List<Object> nameList = (List<Object>)i.next();
|
||||
for (List<?> list : namesCopy) {
|
||||
@SuppressWarnings("unchecked") // See javadoc for parameter "names".
|
||||
List<Object> nameList = (List<Object>)list;
|
||||
if (nameList.size() != 2) {
|
||||
throw new IOException("name list size not 2");
|
||||
}
|
||||
@ -2184,8 +2180,7 @@ public class X509CertSelector implements CertSelector {
|
||||
if (debug != null) {
|
||||
String time = "n/a";
|
||||
try {
|
||||
Date notAfter =
|
||||
(Date)ext.get(PrivateKeyUsageExtension.NOT_AFTER);
|
||||
Date notAfter = ext.get(PrivateKeyUsageExtension.NOT_AFTER);
|
||||
time = notAfter.toString();
|
||||
} catch (CertificateException ex) {
|
||||
// not able to retrieve notAfter value
|
||||
@ -2201,8 +2196,7 @@ public class X509CertSelector implements CertSelector {
|
||||
if (debug != null) {
|
||||
String time = "n/a";
|
||||
try {
|
||||
Date notBefore = (Date)
|
||||
ext.get(PrivateKeyUsageExtension.NOT_BEFORE);
|
||||
Date notBefore = ext.get(PrivateKeyUsageExtension.NOT_BEFORE);
|
||||
time = notBefore.toString();
|
||||
} catch (CertificateException ex) {
|
||||
// not able to retrieve notBefore value
|
||||
@ -2214,14 +2208,6 @@ public class X509CertSelector implements CertSelector {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
} catch (CertificateException e3) {
|
||||
if (debug != null) {
|
||||
debug.println("X509CertSelector.match: CertificateException "
|
||||
+ "in private key usage check; X509CertSelector: "
|
||||
+ this.toString());
|
||||
e3.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
} catch (IOException e4) {
|
||||
if (debug != null) {
|
||||
debug.println("X509CertSelector.match: IOException in "
|
||||
@ -2252,7 +2238,7 @@ public class X509CertSelector implements CertSelector {
|
||||
+ subjectPublicKeyAlgID + ", xcert subjectPublicKeyAlgID = "
|
||||
+ algID.getOID());
|
||||
}
|
||||
if (!subjectPublicKeyAlgID.equals(algID.getOID())) {
|
||||
if (!subjectPublicKeyAlgID.equals((Object)algID.getOID())) {
|
||||
if (debug != null) {
|
||||
debug.println("X509CertSelector.match: "
|
||||
+ "subject public key alg IDs don't match");
|
||||
@ -2301,7 +2287,7 @@ public class X509CertSelector implements CertSelector {
|
||||
EXTENDED_KEY_USAGE_ID);
|
||||
if (ext != null) {
|
||||
Vector<ObjectIdentifier> certKeyPurposeVector =
|
||||
(Vector<ObjectIdentifier>)ext.get(ExtendedKeyUsageExtension.USAGES);
|
||||
ext.get(ExtendedKeyUsageExtension.USAGES);
|
||||
if (!certKeyPurposeVector.contains(ANY_EXTENDED_KEY_USAGE)
|
||||
&& !certKeyPurposeVector.containsAll(keyPurposeOIDSet)) {
|
||||
if (debug != null) {
|
||||
@ -2337,8 +2323,8 @@ public class X509CertSelector implements CertSelector {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
GeneralNames certNames = (GeneralNames)
|
||||
sanExt.get(SubjectAlternativeNameExtension.SUBJECT_NAME);
|
||||
GeneralNames certNames =
|
||||
sanExt.get(SubjectAlternativeNameExtension.SUBJECT_NAME);
|
||||
Iterator<GeneralNameInterface> i =
|
||||
subjectAlternativeGeneralNames.iterator();
|
||||
while (i.hasNext()) {
|
||||
@ -2406,7 +2392,7 @@ public class X509CertSelector implements CertSelector {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
List<PolicyInformation> policies = (List<PolicyInformation>)ext.get(CertificatePoliciesExtension.POLICIES);
|
||||
List<PolicyInformation> policies = ext.get(CertificatePoliciesExtension.POLICIES);
|
||||
/*
|
||||
* Convert the Vector of PolicyInformation to a Vector
|
||||
* of CertificatePolicyIds for easier comparison.
|
||||
@ -2467,7 +2453,7 @@ public class X509CertSelector implements CertSelector {
|
||||
if (ext == null) {
|
||||
return true;
|
||||
}
|
||||
if ((debug != null) && debug.isOn("certpath")) {
|
||||
if ((debug != null) && Debug.isOn("certpath")) {
|
||||
debug.println("X509CertSelector.match pathToNames:\n");
|
||||
Iterator<GeneralNameInterface> i =
|
||||
pathToGeneralNames.iterator();
|
||||
@ -2476,10 +2462,10 @@ public class X509CertSelector implements CertSelector {
|
||||
}
|
||||
}
|
||||
|
||||
GeneralSubtrees permitted = (GeneralSubtrees)
|
||||
ext.get(NameConstraintsExtension.PERMITTED_SUBTREES);
|
||||
GeneralSubtrees excluded = (GeneralSubtrees)
|
||||
ext.get(NameConstraintsExtension.EXCLUDED_SUBTREES);
|
||||
GeneralSubtrees permitted =
|
||||
ext.get(NameConstraintsExtension.PERMITTED_SUBTREES);
|
||||
GeneralSubtrees excluded =
|
||||
ext.get(NameConstraintsExtension.EXCLUDED_SUBTREES);
|
||||
if (excluded != null) {
|
||||
if (matchExcluded(excluded) == false) {
|
||||
return false;
|
||||
@ -2597,12 +2583,13 @@ public class X509CertSelector implements CertSelector {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Set<?> cloneSet(Set<?> set) {
|
||||
@SuppressWarnings("unchecked") // Safe casts assuming clone() works correctly
|
||||
private static <T> Set<T> cloneSet(Set<T> set) {
|
||||
if (set instanceof HashSet) {
|
||||
Object clone = ((HashSet<?>)set).clone();
|
||||
return (Set<?>)clone;
|
||||
Object clone = ((HashSet<T>)set).clone();
|
||||
return (Set<T>)clone;
|
||||
} else {
|
||||
return new HashSet<Object>(set);
|
||||
return new HashSet<T>(set);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2617,17 +2604,13 @@ public class X509CertSelector implements CertSelector {
|
||||
// Must clone these because addPathToName et al. modify them
|
||||
if (subjectAlternativeNames != null) {
|
||||
copy.subjectAlternativeNames =
|
||||
(Set<List<?>>)cloneSet(subjectAlternativeNames);
|
||||
cloneSet(subjectAlternativeNames);
|
||||
copy.subjectAlternativeGeneralNames =
|
||||
(Set<GeneralNameInterface>)cloneSet
|
||||
(subjectAlternativeGeneralNames);
|
||||
cloneSet(subjectAlternativeGeneralNames);
|
||||
}
|
||||
if (pathToGeneralNames != null) {
|
||||
copy.pathToNames =
|
||||
(Set<List<?>>)cloneSet(pathToNames);
|
||||
copy.pathToGeneralNames =
|
||||
(Set<GeneralNameInterface>)cloneSet
|
||||
(pathToGeneralNames);
|
||||
copy.pathToNames = cloneSet(pathToNames);
|
||||
copy.pathToGeneralNames = cloneSet(pathToGeneralNames);
|
||||
}
|
||||
return copy;
|
||||
} catch (CloneNotSupportedException e) {
|
||||
|
||||
@ -28,7 +28,6 @@ package javax.crypto;
|
||||
import java.util.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
import static java.util.Locale.ENGLISH;
|
||||
|
||||
import java.security.*;
|
||||
import java.security.Provider.Service;
|
||||
@ -44,7 +43,6 @@ import java.nio.ReadOnlyBufferException;
|
||||
|
||||
import sun.security.util.Debug;
|
||||
import sun.security.jca.*;
|
||||
import sun.security.jca.GetInstance.Instance;
|
||||
|
||||
/**
|
||||
* This class provides the functionality of a cryptographic cipher for
|
||||
@ -227,10 +225,10 @@ public class Cipher {
|
||||
|
||||
// remaining services to try in provider selection
|
||||
// null once provider is selected
|
||||
private Iterator serviceIterator;
|
||||
private Iterator<Service> serviceIterator;
|
||||
|
||||
// list of transform Strings to lookup in the provider
|
||||
private List transforms;
|
||||
private List<Transform> transforms;
|
||||
|
||||
private final Object lock;
|
||||
|
||||
@ -271,7 +269,8 @@ public class Cipher {
|
||||
}
|
||||
|
||||
private Cipher(CipherSpi firstSpi, Service firstService,
|
||||
Iterator serviceIterator, String transformation, List transforms) {
|
||||
Iterator<Service> serviceIterator, String transformation,
|
||||
List<Transform> transforms) {
|
||||
this.firstSpi = firstSpi;
|
||||
this.firstService = firstService;
|
||||
this.serviceIterator = serviceIterator;
|
||||
@ -392,11 +391,11 @@ public class Cipher {
|
||||
|
||||
// Map<String,Pattern> for previously compiled patterns
|
||||
// XXX use ConcurrentHashMap once available
|
||||
private final static Map patternCache =
|
||||
Collections.synchronizedMap(new HashMap());
|
||||
private final static Map<String, Pattern> patternCache =
|
||||
Collections.synchronizedMap(new HashMap<String, Pattern>());
|
||||
|
||||
private static boolean matches(String regexp, String str) {
|
||||
Pattern pattern = (Pattern)patternCache.get(regexp);
|
||||
Pattern pattern = patternCache.get(regexp);
|
||||
if (pattern == null) {
|
||||
pattern = Pattern.compile(regexp);
|
||||
patternCache.put(regexp, pattern);
|
||||
@ -406,7 +405,7 @@ public class Cipher {
|
||||
|
||||
}
|
||||
|
||||
private static List getTransforms(String transformation)
|
||||
private static List<Transform> getTransforms(String transformation)
|
||||
throws NoSuchAlgorithmException {
|
||||
String[] parts = tokenizeTransformation(transformation);
|
||||
|
||||
@ -426,7 +425,7 @@ public class Cipher {
|
||||
return Collections.singletonList(tr);
|
||||
} else { // if ((mode != null) && (pad != null)) {
|
||||
// DES/CBC/PKCS5Padding
|
||||
List list = new ArrayList(4);
|
||||
List<Transform> list = new ArrayList<>(4);
|
||||
list.add(new Transform(alg, "/" + mode + "/" + pad, null, null));
|
||||
list.add(new Transform(alg, "/" + mode, null, pad));
|
||||
list.add(new Transform(alg, "//" + pad, mode, null));
|
||||
@ -436,10 +435,10 @@ public class Cipher {
|
||||
}
|
||||
|
||||
// get the transform matching the specified service
|
||||
private static Transform getTransform(Service s, List transforms) {
|
||||
private static Transform getTransform(Service s,
|
||||
List<Transform> transforms) {
|
||||
String alg = s.getAlgorithm().toUpperCase(Locale.ENGLISH);
|
||||
for (Iterator t = transforms.iterator(); t.hasNext(); ) {
|
||||
Transform tr = (Transform)t.next();
|
||||
for (Transform tr : transforms) {
|
||||
if (alg.endsWith(tr.suffix)) {
|
||||
return tr;
|
||||
}
|
||||
@ -482,19 +481,18 @@ public class Cipher {
|
||||
public static final Cipher getInstance(String transformation)
|
||||
throws NoSuchAlgorithmException, NoSuchPaddingException
|
||||
{
|
||||
List transforms = getTransforms(transformation);
|
||||
List cipherServices = new ArrayList(transforms.size());
|
||||
for (Iterator t = transforms.iterator(); t.hasNext(); ) {
|
||||
Transform transform = (Transform)t.next();
|
||||
List<Transform> transforms = getTransforms(transformation);
|
||||
List<ServiceId> cipherServices = new ArrayList<>(transforms.size());
|
||||
for (Transform transform : transforms) {
|
||||
cipherServices.add(new ServiceId("Cipher", transform.transform));
|
||||
}
|
||||
List services = GetInstance.getServices(cipherServices);
|
||||
List<Service> services = GetInstance.getServices(cipherServices);
|
||||
// make sure there is at least one service from a signed provider
|
||||
// and that it can use the specified mode and padding
|
||||
Iterator t = services.iterator();
|
||||
Iterator<Service> t = services.iterator();
|
||||
Exception failure = null;
|
||||
while (t.hasNext()) {
|
||||
Service s = (Service)t.next();
|
||||
Service s = t.next();
|
||||
if (JceSecurity.canUseProvider(s.getProvider()) == false) {
|
||||
continue;
|
||||
}
|
||||
@ -620,11 +618,10 @@ public class Cipher {
|
||||
throw new IllegalArgumentException("Missing provider");
|
||||
}
|
||||
Exception failure = null;
|
||||
List transforms = getTransforms(transformation);
|
||||
List<Transform> transforms = getTransforms(transformation);
|
||||
boolean providerChecked = false;
|
||||
String paddingError = null;
|
||||
for (Iterator t = transforms.iterator(); t.hasNext();) {
|
||||
Transform tr = (Transform)t.next();
|
||||
for (Transform tr : transforms) {
|
||||
Service s = provider.getService("Cipher", tr.transform);
|
||||
if (s == null) {
|
||||
continue;
|
||||
@ -727,7 +724,7 @@ public class Cipher {
|
||||
firstService = null;
|
||||
firstSpi = null;
|
||||
} else {
|
||||
s = (Service)serviceIterator.next();
|
||||
s = serviceIterator.next();
|
||||
thisSpi = null;
|
||||
}
|
||||
if (JceSecurity.canUseProvider(s.getProvider()) == false) {
|
||||
@ -821,7 +818,7 @@ public class Cipher {
|
||||
firstService = null;
|
||||
firstSpi = null;
|
||||
} else {
|
||||
s = (Service)serviceIterator.next();
|
||||
s = serviceIterator.next();
|
||||
thisSpi = null;
|
||||
}
|
||||
// if provider says it does not support this key, ignore it
|
||||
@ -1622,7 +1619,7 @@ public class Cipher {
|
||||
// Check whether the cert has a key usage extension
|
||||
// marked as a critical extension.
|
||||
X509Certificate cert = (X509Certificate)certificate;
|
||||
Set critSet = cert.getCriticalExtensionOIDs();
|
||||
Set<String> critSet = cert.getCriticalExtensionOIDs();
|
||||
|
||||
if (critSet != null && !critSet.isEmpty()
|
||||
&& critSet.contains(KEY_USAGE_EXTENSION_OID)) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -171,8 +171,8 @@ final class CryptoAllPermissionCollection extends PermissionCollection
|
||||
*
|
||||
* @return an enumeration of all the CryptoAllPermission objects.
|
||||
*/
|
||||
public Enumeration elements() {
|
||||
Vector v = new Vector(1);
|
||||
public Enumeration<Permission> elements() {
|
||||
Vector<Permission> v = new Vector<>(1);
|
||||
if (all_allowed) v.add(CryptoAllPermission.INSTANCE);
|
||||
return v.elements();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -475,14 +475,14 @@ implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -511215555898802763L;
|
||||
|
||||
private Vector permissions;
|
||||
private Vector<Permission> permissions;
|
||||
|
||||
/**
|
||||
* Creates an empty CryptoPermissionCollection
|
||||
* object.
|
||||
*/
|
||||
CryptoPermissionCollection() {
|
||||
permissions = new Vector(3);
|
||||
permissions = new Vector<Permission>(3);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -520,7 +520,7 @@ implements Serializable {
|
||||
|
||||
CryptoPermission cp = (CryptoPermission)permission;
|
||||
|
||||
Enumeration e = permissions.elements();
|
||||
Enumeration<Permission> e = permissions.elements();
|
||||
|
||||
while (e.hasMoreElements()) {
|
||||
CryptoPermission x = (CryptoPermission) e.nextElement();
|
||||
@ -538,7 +538,7 @@ implements Serializable {
|
||||
* @return an enumeration of all the CryptoPermission objects.
|
||||
*/
|
||||
|
||||
public Enumeration elements()
|
||||
public Enumeration<Permission> elements()
|
||||
{
|
||||
return permissions.elements();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -62,14 +62,14 @@ implements Serializable {
|
||||
private static final long serialVersionUID = 4946547168093391015L;
|
||||
|
||||
// This class is similar to java.security.Permissions
|
||||
private Hashtable perms;
|
||||
private Hashtable<String, PermissionCollection> perms;
|
||||
|
||||
/**
|
||||
* Creates a new CryptoPermissions object containing
|
||||
* no CryptoPermissionCollections.
|
||||
*/
|
||||
CryptoPermissions() {
|
||||
perms = new Hashtable(7);
|
||||
perms = new Hashtable<String, PermissionCollection>(7);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -166,7 +166,7 @@ implements Serializable {
|
||||
*
|
||||
* @return an enumeration of all the Permissions.
|
||||
*/
|
||||
public Enumeration elements() {
|
||||
public Enumeration<Permission> elements() {
|
||||
// go through each Permissions in the hash table
|
||||
// and call their elements() function.
|
||||
return new PermissionsEnumerator(perms.elements());
|
||||
@ -198,8 +198,7 @@ implements Serializable {
|
||||
|
||||
|
||||
PermissionCollection thatWildcard =
|
||||
(PermissionCollection)other.perms.get(
|
||||
CryptoPermission.ALG_NAME_WILDCARD);
|
||||
other.perms.get(CryptoPermission.ALG_NAME_WILDCARD);
|
||||
int maxKeySize = 0;
|
||||
if (thatWildcard != null) {
|
||||
maxKeySize = ((CryptoPermission)
|
||||
@ -208,14 +207,12 @@ implements Serializable {
|
||||
// For each algorithm in this CryptoPermissions,
|
||||
// find out if there is anything we should add into
|
||||
// ret.
|
||||
Enumeration thisKeys = this.perms.keys();
|
||||
Enumeration<String> thisKeys = this.perms.keys();
|
||||
while (thisKeys.hasMoreElements()) {
|
||||
String alg = (String)thisKeys.nextElement();
|
||||
String alg = thisKeys.nextElement();
|
||||
|
||||
PermissionCollection thisPc =
|
||||
(PermissionCollection)this.perms.get(alg);
|
||||
PermissionCollection thatPc =
|
||||
(PermissionCollection)other.perms.get(alg);
|
||||
PermissionCollection thisPc = this.perms.get(alg);
|
||||
PermissionCollection thatPc = other.perms.get(alg);
|
||||
|
||||
CryptoPermission[] partialResult;
|
||||
|
||||
@ -238,8 +235,7 @@ implements Serializable {
|
||||
}
|
||||
|
||||
PermissionCollection thisWildcard =
|
||||
(PermissionCollection)this.perms.get(
|
||||
CryptoPermission.ALG_NAME_WILDCARD);
|
||||
this.perms.get(CryptoPermission.ALG_NAME_WILDCARD);
|
||||
|
||||
// If this CryptoPermissions doesn't
|
||||
// have a wildcard, we are done.
|
||||
@ -252,16 +248,15 @@ implements Serializable {
|
||||
maxKeySize =
|
||||
((CryptoPermission)
|
||||
thisWildcard.elements().nextElement()).getMaxKeySize();
|
||||
Enumeration thatKeys = other.perms.keys();
|
||||
Enumeration<String> thatKeys = other.perms.keys();
|
||||
while (thatKeys.hasMoreElements()) {
|
||||
String alg = (String)thatKeys.nextElement();
|
||||
String alg = thatKeys.nextElement();
|
||||
|
||||
if (this.perms.containsKey(alg)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
PermissionCollection thatPc =
|
||||
(PermissionCollection)other.perms.get(alg);
|
||||
PermissionCollection thatPc = other.perms.get(alg);
|
||||
|
||||
CryptoPermission[] partialResult;
|
||||
|
||||
@ -286,9 +281,9 @@ implements Serializable {
|
||||
*/
|
||||
private CryptoPermission[] getMinimum(PermissionCollection thisPc,
|
||||
PermissionCollection thatPc) {
|
||||
Vector permVector = new Vector(2);
|
||||
Vector<CryptoPermission> permVector = new Vector<>(2);
|
||||
|
||||
Enumeration thisPcPermissions = thisPc.elements();
|
||||
Enumeration<Permission> thisPcPermissions = thisPc.elements();
|
||||
|
||||
// For each CryptoPermission in
|
||||
// thisPc object, do the following:
|
||||
@ -307,7 +302,7 @@ implements Serializable {
|
||||
CryptoPermission thisCp =
|
||||
(CryptoPermission)thisPcPermissions.nextElement();
|
||||
|
||||
Enumeration thatPcPermissions = thatPc.elements();
|
||||
Enumeration<Permission> thatPcPermissions = thatPc.elements();
|
||||
while (thatPcPermissions.hasMoreElements()) {
|
||||
CryptoPermission thatCp =
|
||||
(CryptoPermission)thatPcPermissions.nextElement();
|
||||
@ -342,9 +337,9 @@ implements Serializable {
|
||||
*/
|
||||
private CryptoPermission[] getMinimum(int maxKeySize,
|
||||
PermissionCollection pc) {
|
||||
Vector permVector = new Vector(1);
|
||||
Vector<CryptoPermission> permVector = new Vector<>(1);
|
||||
|
||||
Enumeration enum_ = pc.elements();
|
||||
Enumeration<Permission> enum_ = pc.elements();
|
||||
|
||||
while (enum_.hasMoreElements()) {
|
||||
CryptoPermission cp =
|
||||
@ -383,19 +378,17 @@ implements Serializable {
|
||||
// If this CryptoPermissions includes CryptoAllPermission,
|
||||
// we should return CryptoAllPermission.
|
||||
if (perms.containsKey(CryptoAllPermission.ALG_NAME)) {
|
||||
return
|
||||
(PermissionCollection)(perms.get(CryptoAllPermission.ALG_NAME));
|
||||
return perms.get(CryptoAllPermission.ALG_NAME);
|
||||
}
|
||||
|
||||
PermissionCollection pc = (PermissionCollection)perms.get(alg);
|
||||
PermissionCollection pc = perms.get(alg);
|
||||
|
||||
// If there isn't a PermissionCollection for
|
||||
// the given algorithm,we should return the
|
||||
// PermissionCollection for the wildcard
|
||||
// if there is one.
|
||||
if (pc == null) {
|
||||
pc = (PermissionCollection)perms.get(
|
||||
CryptoPermission.ALG_NAME_WILDCARD);
|
||||
pc = perms.get(CryptoPermission.ALG_NAME_WILDCARD);
|
||||
}
|
||||
return pc;
|
||||
}
|
||||
@ -414,7 +407,7 @@ implements Serializable {
|
||||
|
||||
String alg = cryptoPerm.getAlgorithm();
|
||||
|
||||
PermissionCollection pc = (PermissionCollection)perms.get(alg);
|
||||
PermissionCollection pc = perms.get(alg);
|
||||
|
||||
if (pc == null) {
|
||||
pc = cryptoPerm.newPermissionCollection();
|
||||
@ -423,14 +416,14 @@ implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
final class PermissionsEnumerator implements Enumeration {
|
||||
final class PermissionsEnumerator implements Enumeration<Permission> {
|
||||
|
||||
// all the perms
|
||||
private Enumeration perms;
|
||||
private Enumeration<PermissionCollection> perms;
|
||||
// the current set
|
||||
private Enumeration permset;
|
||||
private Enumeration<Permission> permset;
|
||||
|
||||
PermissionsEnumerator(Enumeration e) {
|
||||
PermissionsEnumerator(Enumeration<PermissionCollection> e) {
|
||||
perms = e;
|
||||
permset = getNextEnumWithMore();
|
||||
}
|
||||
@ -454,7 +447,7 @@ final class PermissionsEnumerator implements Enumeration {
|
||||
return (permset != null);
|
||||
}
|
||||
|
||||
public synchronized Object nextElement() {
|
||||
public synchronized Permission nextElement() {
|
||||
// hasMoreElements will update permset to the next permset
|
||||
// with something in it...
|
||||
|
||||
@ -466,11 +459,10 @@ final class PermissionsEnumerator implements Enumeration {
|
||||
|
||||
}
|
||||
|
||||
private Enumeration getNextEnumWithMore() {
|
||||
private Enumeration<Permission> getNextEnumWithMore() {
|
||||
while (perms.hasMoreElements()) {
|
||||
PermissionCollection pc =
|
||||
(PermissionCollection) perms.nextElement();
|
||||
Enumeration next = pc.elements();
|
||||
PermissionCollection pc = perms.nextElement();
|
||||
Enumeration<Permission> next = pc.elements();
|
||||
if (next.hasMoreElements())
|
||||
return next;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,7 +29,6 @@ import java.io.*;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import java.util.StringTokenizer;
|
||||
import static java.util.Locale.ENGLISH;
|
||||
|
||||
import java.security.GeneralSecurityException;
|
||||
@ -64,7 +63,7 @@ import java.lang.reflect.*;
|
||||
|
||||
final class CryptoPolicyParser {
|
||||
|
||||
private Vector grantEntries;
|
||||
private Vector<GrantEntry> grantEntries;
|
||||
|
||||
// Convenience variables for parsing
|
||||
private StreamTokenizer st;
|
||||
@ -74,7 +73,7 @@ final class CryptoPolicyParser {
|
||||
* Creates a CryptoPolicyParser object.
|
||||
*/
|
||||
CryptoPolicyParser() {
|
||||
grantEntries = new Vector();
|
||||
grantEntries = new Vector<GrantEntry>();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,7 +126,7 @@ final class CryptoPolicyParser {
|
||||
* The crypto jurisdiction policy must be consistent. The
|
||||
* following hashtable is used for checking consistency.
|
||||
*/
|
||||
Hashtable processedPermissions = null;
|
||||
Hashtable<String, Vector<String>> processedPermissions = null;
|
||||
|
||||
/*
|
||||
* The main parsing loop. The loop is executed once for each entry
|
||||
@ -152,7 +151,8 @@ final class CryptoPolicyParser {
|
||||
/**
|
||||
* parse a Grant entry
|
||||
*/
|
||||
private GrantEntry parseGrantEntry(Hashtable processedPermissions)
|
||||
private GrantEntry parseGrantEntry(
|
||||
Hashtable<String, Vector<String>> processedPermissions)
|
||||
throws ParsingException, IOException
|
||||
{
|
||||
GrantEntry e = new GrantEntry();
|
||||
@ -180,7 +180,7 @@ final class CryptoPolicyParser {
|
||||
* parse a CryptoPermission entry
|
||||
*/
|
||||
private CryptoPermissionEntry parsePermissionEntry(
|
||||
Hashtable processedPermissions)
|
||||
Hashtable<String, Vector<String>> processedPermissions)
|
||||
throws ParsingException, IOException
|
||||
{
|
||||
CryptoPermissionEntry e = new CryptoPermissionEntry();
|
||||
@ -252,7 +252,7 @@ final class CryptoPolicyParser {
|
||||
// AlgorithmParameterSpec class name.
|
||||
String algParamSpecClassName = match("quoted string");
|
||||
|
||||
Vector paramsV = new Vector(1);
|
||||
Vector<Integer> paramsV = new Vector<>(1);
|
||||
while (peek(",")) {
|
||||
match(",");
|
||||
if (peek("number")) {
|
||||
@ -285,14 +285,14 @@ final class CryptoPolicyParser {
|
||||
AlgorithmParameterSpec ret = null;
|
||||
|
||||
try {
|
||||
Class apsClass = Class.forName(type);
|
||||
Class[] paramClasses = new Class[params.length];
|
||||
Class<?> apsClass = Class.forName(type);
|
||||
Class<?>[] paramClasses = new Class<?>[params.length];
|
||||
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
paramClasses[i] = int.class;
|
||||
}
|
||||
|
||||
Constructor c = apsClass.getConstructor(paramClasses);
|
||||
Constructor<?> c = apsClass.getConstructor(paramClasses);
|
||||
ret = (AlgorithmParameterSpec) c.newInstance((Object[]) params);
|
||||
} catch (Exception e) {
|
||||
throw new ParsingException("Cannot call the constructor of " +
|
||||
@ -456,15 +456,15 @@ final class CryptoPolicyParser {
|
||||
}
|
||||
|
||||
CryptoPermission[] getPermissions() {
|
||||
Vector result = new Vector();
|
||||
Vector<CryptoPermission> result = new Vector<>();
|
||||
|
||||
Enumeration grantEnum = grantEntries.elements();
|
||||
Enumeration<GrantEntry> grantEnum = grantEntries.elements();
|
||||
while (grantEnum.hasMoreElements()) {
|
||||
GrantEntry ge = (GrantEntry)grantEnum.nextElement();
|
||||
Enumeration permEnum = ge.permissionElements();
|
||||
GrantEntry ge = grantEnum.nextElement();
|
||||
Enumeration<CryptoPermissionEntry> permEnum =
|
||||
ge.permissionElements();
|
||||
while (permEnum.hasMoreElements()) {
|
||||
CryptoPermissionEntry pe =
|
||||
(CryptoPermissionEntry)permEnum.nextElement();
|
||||
CryptoPermissionEntry pe = permEnum.nextElement();
|
||||
if (pe.cryptoPermission.equals(
|
||||
"javax.crypto.CryptoAllPermission")) {
|
||||
result.addElement(CryptoAllPermission.INSTANCE);
|
||||
@ -491,15 +491,14 @@ final class CryptoPolicyParser {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private boolean isConsistent(String alg,
|
||||
String exemptionMechanism,
|
||||
Hashtable processedPermissions) {
|
||||
private boolean isConsistent(String alg, String exemptionMechanism,
|
||||
Hashtable<String, Vector<String>> processedPermissions) {
|
||||
String thisExemptionMechanism =
|
||||
exemptionMechanism == null ? "none" : exemptionMechanism;
|
||||
|
||||
if (processedPermissions == null) {
|
||||
processedPermissions = new Hashtable();
|
||||
Vector exemptionMechanisms = new Vector(1);
|
||||
processedPermissions = new Hashtable<String, Vector<String>>();
|
||||
Vector<String> exemptionMechanisms = new Vector<>(1);
|
||||
exemptionMechanisms.addElement(thisExemptionMechanism);
|
||||
processedPermissions.put(alg, exemptionMechanisms);
|
||||
return true;
|
||||
@ -509,15 +508,15 @@ final class CryptoPolicyParser {
|
||||
return false;
|
||||
}
|
||||
|
||||
Vector exemptionMechanisms;
|
||||
Vector<String> exemptionMechanisms;
|
||||
|
||||
if (processedPermissions.containsKey(alg)) {
|
||||
exemptionMechanisms = (Vector)processedPermissions.get(alg);
|
||||
exemptionMechanisms = processedPermissions.get(alg);
|
||||
if (exemptionMechanisms.contains(thisExemptionMechanism)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
exemptionMechanisms = new Vector(1);
|
||||
exemptionMechanisms = new Vector<String>(1);
|
||||
}
|
||||
|
||||
exemptionMechanisms.addElement(thisExemptionMechanism);
|
||||
@ -556,10 +555,10 @@ final class CryptoPolicyParser {
|
||||
|
||||
private static class GrantEntry {
|
||||
|
||||
private Vector permissionEntries;
|
||||
private Vector<CryptoPermissionEntry> permissionEntries;
|
||||
|
||||
GrantEntry() {
|
||||
permissionEntries = new Vector();
|
||||
permissionEntries = new Vector<CryptoPermissionEntry>();
|
||||
}
|
||||
|
||||
void add(CryptoPermissionEntry pe)
|
||||
@ -580,7 +579,7 @@ final class CryptoPolicyParser {
|
||||
/**
|
||||
* Enumerate all the permission entries in this GrantEntry.
|
||||
*/
|
||||
Enumeration permissionElements(){
|
||||
Enumeration<CryptoPermissionEntry> permissionElements(){
|
||||
return permissionEntries.elements();
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -80,7 +80,7 @@ public class EncryptedPrivateKeyInfo {
|
||||
throw new NullPointerException("the encoded parameter " +
|
||||
"must be non-null");
|
||||
}
|
||||
this.encoded = (byte[])encoded.clone();
|
||||
this.encoded = encoded.clone();
|
||||
DerValue val = new DerValue(this.encoded);
|
||||
|
||||
DerValue[] seq = new DerValue[2];
|
||||
@ -143,7 +143,7 @@ public class EncryptedPrivateKeyInfo {
|
||||
throw new IllegalArgumentException("the encryptedData " +
|
||||
"parameter must not be empty");
|
||||
} else {
|
||||
this.encryptedData = (byte[])encryptedData.clone();
|
||||
this.encryptedData = encryptedData.clone();
|
||||
}
|
||||
// delay the generation of ASN.1 encoding until
|
||||
// getEncoded() is called
|
||||
@ -183,7 +183,7 @@ public class EncryptedPrivateKeyInfo {
|
||||
throw new IllegalArgumentException("the encryptedData " +
|
||||
"parameter must not be empty");
|
||||
} else {
|
||||
this.encryptedData = (byte[])encryptedData.clone();
|
||||
this.encryptedData = encryptedData.clone();
|
||||
}
|
||||
|
||||
// delay the generation of ASN.1 encoding until
|
||||
@ -222,7 +222,7 @@ public class EncryptedPrivateKeyInfo {
|
||||
* each time this method is called.
|
||||
*/
|
||||
public byte[] getEncryptedData() {
|
||||
return (byte[])this.encryptedData.clone();
|
||||
return this.encryptedData.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -247,26 +247,13 @@ public class EncryptedPrivateKeyInfo {
|
||||
throws InvalidKeySpecException {
|
||||
byte[] encoded = null;
|
||||
try {
|
||||
encoded = cipher.doFinal((byte[])encryptedData);
|
||||
encoded = cipher.doFinal(encryptedData);
|
||||
checkPKCS8Encoding(encoded);
|
||||
} catch (GeneralSecurityException gse) {
|
||||
InvalidKeySpecException ikse = new
|
||||
InvalidKeySpecException(
|
||||
"Cannot retrieve the PKCS8EncodedKeySpec");
|
||||
ikse.initCause(gse);
|
||||
throw ikse;
|
||||
} catch (IOException ioe) {
|
||||
InvalidKeySpecException ikse = new
|
||||
InvalidKeySpecException(
|
||||
"Cannot retrieve the PKCS8EncodedKeySpec");
|
||||
ikse.initCause(ioe);
|
||||
throw ikse;
|
||||
} catch (IllegalStateException ise) {
|
||||
InvalidKeySpecException ikse = new
|
||||
InvalidKeySpecException(
|
||||
"Cannot retrieve the PKCS8EncodedKeySpec");
|
||||
ikse.initCause(ise);
|
||||
throw ikse;
|
||||
} catch (GeneralSecurityException |
|
||||
IOException |
|
||||
IllegalStateException ex) {
|
||||
throw new InvalidKeySpecException(
|
||||
"Cannot retrieve the PKCS8EncodedKeySpec", ex);
|
||||
}
|
||||
return new PKCS8EncodedKeySpec(encoded);
|
||||
}
|
||||
@ -289,16 +276,9 @@ public class EncryptedPrivateKeyInfo {
|
||||
} catch (NoSuchAlgorithmException nsae) {
|
||||
// rethrow
|
||||
throw nsae;
|
||||
} catch (GeneralSecurityException gse) {
|
||||
InvalidKeyException ike = new InvalidKeyException
|
||||
("Cannot retrieve the PKCS8EncodedKeySpec");
|
||||
ike.initCause(gse);
|
||||
throw ike;
|
||||
} catch (IOException ioe) {
|
||||
InvalidKeyException ike = new InvalidKeyException
|
||||
("Cannot retrieve the PKCS8EncodedKeySpec");
|
||||
ike.initCause(ioe);
|
||||
throw ike;
|
||||
} catch (GeneralSecurityException | IOException ex) {
|
||||
throw new InvalidKeyException(
|
||||
"Cannot retrieve the PKCS8EncodedKeySpec", ex);
|
||||
}
|
||||
return new PKCS8EncodedKeySpec(encoded);
|
||||
}
|
||||
@ -413,7 +393,7 @@ public class EncryptedPrivateKeyInfo {
|
||||
out.write(DerValue.tag_Sequence, tmp);
|
||||
this.encoded = out.toByteArray();
|
||||
}
|
||||
return (byte[])this.encoded.clone();
|
||||
return this.encoded.clone();
|
||||
}
|
||||
|
||||
private static void checkTag(DerValue val, byte tag, String valName)
|
||||
@ -424,6 +404,7 @@ public class EncryptedPrivateKeyInfo {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("fallthrough")
|
||||
private static void checkPKCS8Encoding(byte[] encodedKey)
|
||||
throws IOException {
|
||||
DerInputStream in = new DerInputStream(encodedKey);
|
||||
@ -432,6 +413,7 @@ public class EncryptedPrivateKeyInfo {
|
||||
switch (values.length) {
|
||||
case 4:
|
||||
checkTag(values[3], DerValue.TAG_CONTEXT, "attributes");
|
||||
/* fall through */
|
||||
case 3:
|
||||
checkTag(values[0], DerValue.tag_Integer, "version");
|
||||
DerInputStream algid = values[1].toDerInputStream();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -86,23 +86,19 @@ final class JarVerifier {
|
||||
|
||||
// Get a link to the Jarfile to search.
|
||||
try {
|
||||
jf = (JarFile)
|
||||
AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction() {
|
||||
public Object run() throws Exception {
|
||||
JarURLConnection conn =
|
||||
(JarURLConnection) url.openConnection();
|
||||
// You could do some caching here as
|
||||
// an optimization.
|
||||
conn.setUseCaches(false);
|
||||
return conn.getJarFile();
|
||||
}
|
||||
});
|
||||
jf = AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<JarFile>() {
|
||||
public JarFile run() throws Exception {
|
||||
JarURLConnection conn =
|
||||
(JarURLConnection) url.openConnection();
|
||||
// You could do some caching here as
|
||||
// an optimization.
|
||||
conn.setUseCaches(false);
|
||||
return conn.getJarFile();
|
||||
}
|
||||
});
|
||||
} catch (java.security.PrivilegedActionException pae) {
|
||||
SecurityException se = new SecurityException(
|
||||
"Cannot load " + url.toString());
|
||||
se.initCause(pae);
|
||||
throw se;
|
||||
throw new SecurityException("Cannot load " + url.toString(), pae);
|
||||
}
|
||||
|
||||
if (jf != null) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -57,10 +57,12 @@ final class JceSecurity {
|
||||
// Map<Provider,?> of the providers we already have verified
|
||||
// value == PROVIDER_VERIFIED is successfully verified
|
||||
// value is failure cause Exception in error case
|
||||
private final static Map verificationResults = new IdentityHashMap();
|
||||
private final static Map<Provider, Object> verificationResults =
|
||||
new IdentityHashMap<>();
|
||||
|
||||
// Map<Provider,?> of the providers currently being verified
|
||||
private final static Map verifyingProviders = new IdentityHashMap();
|
||||
private final static Map<Provider, Object> verifyingProviders =
|
||||
new IdentityHashMap<>();
|
||||
|
||||
// Set the default value. May be changed in the static initializer.
|
||||
private static boolean isRestricted = true;
|
||||
@ -73,25 +75,23 @@ final class JceSecurity {
|
||||
|
||||
static {
|
||||
try {
|
||||
AccessController.doPrivileged(new PrivilegedExceptionAction() {
|
||||
public Object run() throws Exception {
|
||||
setupJurisdictionPolicies();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<Object>() {
|
||||
public Object run() throws Exception {
|
||||
setupJurisdictionPolicies();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
isRestricted = defaultPolicy.implies(
|
||||
CryptoAllPermission.INSTANCE) ? false : true;
|
||||
} catch (Exception e) {
|
||||
SecurityException se =
|
||||
new SecurityException(
|
||||
"Can not initialize cryptographic mechanism");
|
||||
se.initCause(e);
|
||||
throw se;
|
||||
throw new SecurityException(
|
||||
"Can not initialize cryptographic mechanism", e);
|
||||
}
|
||||
}
|
||||
|
||||
static Instance getInstance(String type, Class clazz, String algorithm,
|
||||
static Instance getInstance(String type, Class<?> clazz, String algorithm,
|
||||
String provider) throws NoSuchAlgorithmException,
|
||||
NoSuchProviderException {
|
||||
Service s = GetInstance.getService(type, algorithm, provider);
|
||||
@ -104,7 +104,7 @@ final class JceSecurity {
|
||||
return GetInstance.getInstance(s, clazz);
|
||||
}
|
||||
|
||||
static Instance getInstance(String type, Class clazz, String algorithm,
|
||||
static Instance getInstance(String type, Class<?> clazz, String algorithm,
|
||||
Provider provider) throws NoSuchAlgorithmException {
|
||||
Service s = GetInstance.getService(type, algorithm, provider);
|
||||
Exception ve = JceSecurity.getVerificationResult(provider);
|
||||
@ -116,12 +116,11 @@ final class JceSecurity {
|
||||
return GetInstance.getInstance(s, clazz);
|
||||
}
|
||||
|
||||
static Instance getInstance(String type, Class clazz, String algorithm)
|
||||
static Instance getInstance(String type, Class<?> clazz, String algorithm)
|
||||
throws NoSuchAlgorithmException {
|
||||
List services = GetInstance.getServices(type, algorithm);
|
||||
List<Service> services = GetInstance.getServices(type, algorithm);
|
||||
NoSuchAlgorithmException failure = null;
|
||||
for (Iterator t = services.iterator(); t.hasNext(); ) {
|
||||
Service s = (Service)t.next();
|
||||
for (Service s : services) {
|
||||
if (canUseProvider(s.getProvider()) == false) {
|
||||
// allow only signed providers
|
||||
continue;
|
||||
@ -213,16 +212,17 @@ final class JceSecurity {
|
||||
}
|
||||
|
||||
// reference to a Map we use as a cache for codebases
|
||||
private static final Map codeBaseCacheRef = new WeakHashMap();
|
||||
private static final Map<Class<?>, URL> codeBaseCacheRef =
|
||||
new WeakHashMap<>();
|
||||
|
||||
/*
|
||||
* Retuns the CodeBase for the given class.
|
||||
*/
|
||||
static URL getCodeBase(final Class clazz) {
|
||||
URL url = (URL)codeBaseCacheRef.get(clazz);
|
||||
static URL getCodeBase(final Class<?> clazz) {
|
||||
URL url = codeBaseCacheRef.get(clazz);
|
||||
if (url == null) {
|
||||
url = (URL)AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
url = AccessController.doPrivileged(new PrivilegedAction<URL>() {
|
||||
public URL run() {
|
||||
ProtectionDomain pd = clazz.getProtectionDomain();
|
||||
if (pd != null) {
|
||||
CodeSource cs = pd.getCodeSource();
|
||||
@ -290,9 +290,9 @@ final class JceSecurity {
|
||||
|
||||
JarFile jf = new JarFile(jarPathName);
|
||||
|
||||
Enumeration entries = jf.entries();
|
||||
Enumeration<JarEntry> entries = jf.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
JarEntry je = (JarEntry)entries.nextElement();
|
||||
JarEntry je = entries.nextElement();
|
||||
InputStream is = null;
|
||||
try {
|
||||
if (je.getName().startsWith("default_")) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,7 +28,6 @@ package javax.crypto;
|
||||
import java.security.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import java.util.jar.*;
|
||||
|
||||
/**
|
||||
* The JCE security manager.
|
||||
@ -50,8 +49,10 @@ final class JceSecurityManager extends SecurityManager {
|
||||
private static final CryptoPermissions defaultPolicy;
|
||||
private static final CryptoPermissions exemptPolicy;
|
||||
private static final CryptoAllPermission allPerm;
|
||||
private static final Vector TrustedCallersCache = new Vector(2);
|
||||
private static final Map exemptCache = new HashMap();
|
||||
private static final Vector<Class<?>> TrustedCallersCache =
|
||||
new Vector<>(2);
|
||||
private static final Map<URL, CryptoPermissions> exemptCache =
|
||||
new HashMap<>();
|
||||
|
||||
// singleton instance
|
||||
static final JceSecurityManager INSTANCE;
|
||||
@ -60,12 +61,12 @@ final class JceSecurityManager extends SecurityManager {
|
||||
defaultPolicy = JceSecurity.getDefaultPolicy();
|
||||
exemptPolicy = JceSecurity.getExemptPolicy();
|
||||
allPerm = CryptoAllPermission.INSTANCE;
|
||||
INSTANCE = (JceSecurityManager)
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
return new JceSecurityManager();
|
||||
}
|
||||
});
|
||||
INSTANCE = AccessController.doPrivileged(
|
||||
new PrivilegedAction<JceSecurityManager>() {
|
||||
public JceSecurityManager run() {
|
||||
return new JceSecurityManager();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private JceSecurityManager() {
|
||||
@ -94,11 +95,11 @@ final class JceSecurityManager extends SecurityManager {
|
||||
// javax.crypto.* packages.
|
||||
// NOTE: javax.crypto.* package maybe subject to package
|
||||
// insertion, so need to check its classloader as well.
|
||||
Class[] context = getClassContext();
|
||||
Class<?>[] context = getClassContext();
|
||||
URL callerCodeBase = null;
|
||||
int i;
|
||||
for (i=0; i<context.length; i++) {
|
||||
Class cls = context[i];
|
||||
Class<?> cls = context[i];
|
||||
callerCodeBase = JceSecurity.getCodeBase(cls);
|
||||
if (callerCodeBase != null) {
|
||||
break;
|
||||
@ -119,7 +120,7 @@ final class JceSecurityManager extends SecurityManager {
|
||||
CryptoPermissions appPerms;
|
||||
synchronized (this.getClass()) {
|
||||
if (exemptCache.containsKey(callerCodeBase)) {
|
||||
appPerms = (CryptoPermissions)exemptCache.get(callerCodeBase);
|
||||
appPerms = exemptCache.get(callerCodeBase);
|
||||
} else {
|
||||
appPerms = getAppPermissions(callerCodeBase);
|
||||
exemptCache.put(callerCodeBase, appPerms);
|
||||
@ -143,7 +144,7 @@ final class JceSecurityManager extends SecurityManager {
|
||||
if (appPc == null) {
|
||||
return defaultPerm;
|
||||
}
|
||||
Enumeration enum_ = appPc.elements();
|
||||
Enumeration<Permission> enum_ = appPc.elements();
|
||||
while (enum_.hasMoreElements()) {
|
||||
CryptoPermission cp = (CryptoPermission)enum_.nextElement();
|
||||
if (cp.getExemptionMechanism() == null) {
|
||||
@ -215,7 +216,7 @@ final class JceSecurityManager extends SecurityManager {
|
||||
* Returns the default permission for the given algorithm.
|
||||
*/
|
||||
private CryptoPermission getDefaultPermission(String alg) {
|
||||
Enumeration enum_ =
|
||||
Enumeration<Permission> enum_ =
|
||||
defaultPolicy.getPermissionCollection(alg).elements();
|
||||
return (CryptoPermission)enum_.nextElement();
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ public class KeyAgreement {
|
||||
|
||||
// remaining services to try in provider selection
|
||||
// null once provider is selected
|
||||
private Iterator serviceIterator;
|
||||
private Iterator<Service> serviceIterator;
|
||||
|
||||
private final Object lock;
|
||||
|
||||
@ -112,7 +112,7 @@ public class KeyAgreement {
|
||||
lock = null;
|
||||
}
|
||||
|
||||
private KeyAgreement(Service s, Iterator t, String algorithm) {
|
||||
private KeyAgreement(Service s, Iterator<Service> t, String algorithm) {
|
||||
firstService = s;
|
||||
serviceIterator = t;
|
||||
this.algorithm = algorithm;
|
||||
@ -165,11 +165,12 @@ public class KeyAgreement {
|
||||
*/
|
||||
public static final KeyAgreement getInstance(String algorithm)
|
||||
throws NoSuchAlgorithmException {
|
||||
List services = GetInstance.getServices("KeyAgreement", algorithm);
|
||||
List<Service> services =
|
||||
GetInstance.getServices("KeyAgreement", algorithm);
|
||||
// make sure there is at least one service from a signed provider
|
||||
Iterator t = services.iterator();
|
||||
Iterator<Service> t = services.iterator();
|
||||
while (t.hasNext()) {
|
||||
Service s = (Service)t.next();
|
||||
Service s = t.next();
|
||||
if (JceSecurity.canUseProvider(s.getProvider()) == false) {
|
||||
continue;
|
||||
}
|
||||
@ -301,7 +302,7 @@ public class KeyAgreement {
|
||||
s = firstService;
|
||||
firstService = null;
|
||||
} else {
|
||||
s = (Service)serviceIterator.next();
|
||||
s = serviceIterator.next();
|
||||
}
|
||||
if (JceSecurity.canUseProvider(s.getProvider()) == false) {
|
||||
continue;
|
||||
@ -358,7 +359,7 @@ public class KeyAgreement {
|
||||
s = firstService;
|
||||
firstService = null;
|
||||
} else {
|
||||
s = (Service)serviceIterator.next();
|
||||
s = serviceIterator.next();
|
||||
}
|
||||
// if provider says it does not support this key, ignore it
|
||||
if (s.supportsParameter(key) == false) {
|
||||
|
||||
@ -127,7 +127,7 @@ public class KeyGenerator {
|
||||
|
||||
private final Object lock = new Object();
|
||||
|
||||
private Iterator serviceIterator;
|
||||
private Iterator<Service> serviceIterator;
|
||||
|
||||
private int initType;
|
||||
private int initKeySize;
|
||||
@ -150,7 +150,8 @@ public class KeyGenerator {
|
||||
|
||||
private KeyGenerator(String algorithm) throws NoSuchAlgorithmException {
|
||||
this.algorithm = algorithm;
|
||||
List list = GetInstance.getServices("KeyGenerator", algorithm);
|
||||
List<Service> list =
|
||||
GetInstance.getServices("KeyGenerator", algorithm);
|
||||
serviceIterator = list.iterator();
|
||||
initType = I_NONE;
|
||||
// fetch and instantiate initial spi
|
||||
@ -320,7 +321,7 @@ public class KeyGenerator {
|
||||
return null;
|
||||
}
|
||||
while (serviceIterator.hasNext()) {
|
||||
Service s = (Service)serviceIterator.next();
|
||||
Service s = serviceIterator.next();
|
||||
if (JceSecurity.canUseProvider(s.getProvider()) == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ public class Mac implements Cloneable {
|
||||
|
||||
// remaining services to try in provider selection
|
||||
// null once provider is selected
|
||||
private Iterator serviceIterator;
|
||||
private Iterator<Service> serviceIterator;
|
||||
|
||||
private final Object lock;
|
||||
|
||||
@ -114,7 +114,7 @@ public class Mac implements Cloneable {
|
||||
lock = null;
|
||||
}
|
||||
|
||||
private Mac(Service s, Iterator t, String algorithm) {
|
||||
private Mac(Service s, Iterator<Service> t, String algorithm) {
|
||||
firstService = s;
|
||||
serviceIterator = t;
|
||||
this.algorithm = algorithm;
|
||||
@ -163,11 +163,11 @@ public class Mac implements Cloneable {
|
||||
*/
|
||||
public static final Mac getInstance(String algorithm)
|
||||
throws NoSuchAlgorithmException {
|
||||
List services = GetInstance.getServices("Mac", algorithm);
|
||||
List<Service> services = GetInstance.getServices("Mac", algorithm);
|
||||
// make sure there is at least one service from a signed provider
|
||||
Iterator t = services.iterator();
|
||||
Iterator<Service> t = services.iterator();
|
||||
while (t.hasNext()) {
|
||||
Service s = (Service)t.next();
|
||||
Service s = t.next();
|
||||
if (JceSecurity.canUseProvider(s.getProvider()) == false) {
|
||||
continue;
|
||||
}
|
||||
@ -288,7 +288,7 @@ public class Mac implements Cloneable {
|
||||
s = firstService;
|
||||
firstService = null;
|
||||
} else {
|
||||
s = (Service)serviceIterator.next();
|
||||
s = serviceIterator.next();
|
||||
}
|
||||
if (JceSecurity.canUseProvider(s.getProvider()) == false) {
|
||||
continue;
|
||||
@ -331,7 +331,7 @@ public class Mac implements Cloneable {
|
||||
s = firstService;
|
||||
firstService = null;
|
||||
} else {
|
||||
s = (Service)serviceIterator.next();
|
||||
s = serviceIterator.next();
|
||||
}
|
||||
// if provider says it does not support this key, ignore it
|
||||
if (s.supportsParameter(key) == false) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -193,11 +193,11 @@ public class SealedObject implements Serializable {
|
||||
* @exception NullPointerException if the given sealed object is null.
|
||||
*/
|
||||
protected SealedObject(SealedObject so) {
|
||||
this.encryptedContent = (byte[]) so.encryptedContent.clone();
|
||||
this.encryptedContent = so.encryptedContent.clone();
|
||||
this.sealAlg = so.sealAlg;
|
||||
this.paramsAlg = so.paramsAlg;
|
||||
if (so.encodedParams != null) {
|
||||
this.encodedParams = (byte[]) so.encodedParams.clone();
|
||||
this.encodedParams = so.encodedParams.clone();
|
||||
} else {
|
||||
this.encodedParams = null;
|
||||
}
|
||||
@ -353,10 +353,8 @@ public class SealedObject implements Serializable {
|
||||
|
||||
try {
|
||||
return unseal(key, provider);
|
||||
} catch (IllegalBlockSizeException ibse) {
|
||||
throw new InvalidKeyException(ibse.getMessage());
|
||||
} catch (BadPaddingException bpe) {
|
||||
throw new InvalidKeyException(bpe.getMessage());
|
||||
} catch (IllegalBlockSizeException | BadPaddingException ex) {
|
||||
throw new InvalidKeyException(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -450,9 +448,9 @@ public class SealedObject implements Serializable {
|
||||
{
|
||||
s.defaultReadObject();
|
||||
if (encryptedContent != null)
|
||||
encryptedContent = (byte[])encryptedContent.clone();
|
||||
encryptedContent = encryptedContent.clone();
|
||||
if (encodedParams != null)
|
||||
encodedParams = (byte[])encodedParams.clone();
|
||||
encodedParams = encodedParams.clone();
|
||||
}
|
||||
}
|
||||
|
||||
@ -465,7 +463,7 @@ final class extObjectInputStream extends ObjectInputStream {
|
||||
super(in);
|
||||
}
|
||||
|
||||
protected Class resolveClass(ObjectStreamClass v)
|
||||
protected Class<?> resolveClass(ObjectStreamClass v)
|
||||
throws IOException, ClassNotFoundException
|
||||
{
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ public class SecretKeyFactory {
|
||||
|
||||
// remaining services to try in provider selection
|
||||
// null once provider is selected
|
||||
private Iterator serviceIterator;
|
||||
private Iterator<Service> serviceIterator;
|
||||
|
||||
/**
|
||||
* Creates a SecretKeyFactory object.
|
||||
@ -114,7 +114,8 @@ public class SecretKeyFactory {
|
||||
|
||||
private SecretKeyFactory(String algorithm) throws NoSuchAlgorithmException {
|
||||
this.algorithm = algorithm;
|
||||
List list = GetInstance.getServices("SecretKeyFactory", algorithm);
|
||||
List<Service> list =
|
||||
GetInstance.getServices("SecretKeyFactory", algorithm);
|
||||
serviceIterator = list.iterator();
|
||||
// fetch and instantiate initial spi
|
||||
if (nextSpi(null) == null) {
|
||||
@ -290,7 +291,7 @@ public class SecretKeyFactory {
|
||||
return null;
|
||||
}
|
||||
while (serviceIterator.hasNext()) {
|
||||
Service s = (Service)serviceIterator.next();
|
||||
Service s = serviceIterator.next();
|
||||
if (JceSecurity.canUseProvider(s.getProvider()) == false) {
|
||||
continue;
|
||||
}
|
||||
@ -367,7 +368,7 @@ public class SecretKeyFactory {
|
||||
* (e.g., the given key has an algorithm or format not supported by this
|
||||
* secret-key factory).
|
||||
*/
|
||||
public final KeySpec getKeySpec(SecretKey key, Class keySpec)
|
||||
public final KeySpec getKeySpec(SecretKey key, Class<?> keySpec)
|
||||
throws InvalidKeySpecException {
|
||||
if (serviceIterator == null) {
|
||||
return spi.engineGetKeySpec(key, keySpec);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -88,7 +88,7 @@ public abstract class SecretKeyFactorySpi {
|
||||
* (e.g., the given key has an algorithm or format not supported by this
|
||||
* secret-key factory).
|
||||
*/
|
||||
protected abstract KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
|
||||
protected abstract KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec)
|
||||
throws InvalidKeySpecException;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -165,7 +165,7 @@ public class DESKeySpec implements java.security.spec.KeySpec {
|
||||
* each time this method is called.
|
||||
*/
|
||||
public byte[] getKey() {
|
||||
return (byte[])this.key.clone();
|
||||
return this.key.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -95,7 +95,7 @@ public class DESedeKeySpec implements java.security.spec.KeySpec {
|
||||
* each time this method is called.
|
||||
*/
|
||||
public byte[] getKey() {
|
||||
return (byte[])this.key.clone();
|
||||
return this.key.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -94,6 +94,6 @@ public class IvParameterSpec implements AlgorithmParameterSpec {
|
||||
* each time this method is called.
|
||||
*/
|
||||
public byte[] getIV() {
|
||||
return (byte[])this.iv.clone();
|
||||
return this.iv.clone();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -80,7 +80,7 @@ public class PBEKeySpec implements KeySpec {
|
||||
if ((password == null) || (password.length == 0)) {
|
||||
this.password = new char[0];
|
||||
} else {
|
||||
this.password = (char[])password.clone();
|
||||
this.password = password.clone();
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ public class PBEKeySpec implements KeySpec {
|
||||
if ((password == null) || (password.length == 0)) {
|
||||
this.password = new char[0];
|
||||
} else {
|
||||
this.password = (char[])password.clone();
|
||||
this.password = password.clone();
|
||||
}
|
||||
if (salt == null) {
|
||||
throw new NullPointerException("the salt parameter " +
|
||||
@ -118,7 +118,7 @@ public class PBEKeySpec implements KeySpec {
|
||||
throw new IllegalArgumentException("the salt parameter " +
|
||||
"must not be empty");
|
||||
} else {
|
||||
this.salt = (byte[]) salt.clone();
|
||||
this.salt = salt.clone();
|
||||
}
|
||||
if (iterationCount<=0) {
|
||||
throw new IllegalArgumentException("invalid iterationCount value");
|
||||
@ -151,7 +151,7 @@ public class PBEKeySpec implements KeySpec {
|
||||
if ((password == null) || (password.length == 0)) {
|
||||
this.password = new char[0];
|
||||
} else {
|
||||
this.password = (char[])password.clone();
|
||||
this.password = password.clone();
|
||||
}
|
||||
if (salt == null) {
|
||||
throw new NullPointerException("the salt parameter " +
|
||||
@ -160,7 +160,7 @@ public class PBEKeySpec implements KeySpec {
|
||||
throw new IllegalArgumentException("the salt parameter " +
|
||||
"must not be empty");
|
||||
} else {
|
||||
this.salt = (byte[]) salt.clone();
|
||||
this.salt = salt.clone();
|
||||
}
|
||||
if (iterationCount<=0) {
|
||||
throw new IllegalArgumentException("invalid iterationCount value");
|
||||
@ -196,7 +196,7 @@ public class PBEKeySpec implements KeySpec {
|
||||
if (password == null) {
|
||||
throw new IllegalStateException("password has been cleared");
|
||||
}
|
||||
return (char[]) password.clone();
|
||||
return password.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -210,7 +210,7 @@ public class PBEKeySpec implements KeySpec {
|
||||
*/
|
||||
public final byte[] getSalt() {
|
||||
if (salt != null) {
|
||||
return (byte[]) salt.clone();
|
||||
return salt.clone();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,7 +25,6 @@
|
||||
|
||||
package javax.crypto.spec;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
|
||||
/**
|
||||
@ -53,7 +52,7 @@ public class PBEParameterSpec implements AlgorithmParameterSpec {
|
||||
* @exception NullPointerException if <code>salt</code> is null.
|
||||
*/
|
||||
public PBEParameterSpec(byte[] salt, int iterationCount) {
|
||||
this.salt = (byte[])salt.clone();
|
||||
this.salt = salt.clone();
|
||||
this.iterationCount = iterationCount;
|
||||
}
|
||||
|
||||
@ -64,7 +63,7 @@ public class PBEParameterSpec implements AlgorithmParameterSpec {
|
||||
* each time this method is called.
|
||||
*/
|
||||
public byte[] getSalt() {
|
||||
return (byte[])this.salt.clone();
|
||||
return this.salt.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,9 +25,6 @@
|
||||
|
||||
package javax.crypto.spec;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
|
||||
/**
|
||||
* This class specifies the source for encoding input P in OAEP Padding,
|
||||
* as defined in the
|
||||
@ -97,7 +94,7 @@ public class PSource {
|
||||
*/
|
||||
public PSpecified(byte[] p) {
|
||||
super("PSpecified");
|
||||
this.p = (byte[]) p.clone();
|
||||
this.p = p.clone();
|
||||
}
|
||||
/**
|
||||
* Returns the value of encoding input P.
|
||||
@ -105,7 +102,7 @@ public class PSource {
|
||||
* returned each time this method is called.
|
||||
*/
|
||||
public byte[] getValue() {
|
||||
return (p.length==0? p: (byte[])p.clone());
|
||||
return (p.length==0? p: p.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -117,7 +117,7 @@ public class RC2ParameterSpec implements AlgorithmParameterSpec {
|
||||
* Returns a new array each time this method is called.
|
||||
*/
|
||||
public byte[] getIV() {
|
||||
return (iv == null? null:(byte[])iv.clone());
|
||||
return (iv == null? null:iv.clone());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -157,7 +157,7 @@ public class RC5ParameterSpec implements AlgorithmParameterSpec {
|
||||
* Returns a new array each time this method is called.
|
||||
*/
|
||||
public byte[] getIV() {
|
||||
return (iv == null? null:(byte[])iv.clone());
|
||||
return (iv == null? null:iv.clone());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user