42 import java.security.PublicKey;
43
44 import java.security.*;
45 import java.security.interfaces.*;
46 import java.security.spec.*;
47
48 import sun.nio.ch.DirectBuffer;
49 import java.nio.ByteBuffer;
50
51 /**
52 * Signature implementation class. This class currently supports the
53 * following algorithms:
54 *
55 * . RSA:
56 * . MD5withRSA
57 * . SHA1withRSA
58 * . SHA256withRSA
59 * . SHA384withRSA
60 * . SHA512withRSA
61 *
62 * @since 1.9
63 */
64 class NativeRSASignature extends SignatureSpi {
65
66 private static final int PKCS1PADDING_LEN = 11;
67
68 // fields set in constructor
69 private final UcryptoMech mech;
70 private final int encodedLen;
71
72 // field for ensuring native memory is freed
73 private SignatureContextRef pCtxt = null;
74
75 //
76 // fields (re)set in every init()
77 //
78 private boolean initialized = false;
79 private boolean sign = true;
80 private int sigLength;
81 private NativeKey key;
82 private NativeRSAKeyFactory keyFactory; // may need a more generic type later
|
42 import java.security.PublicKey;
43
44 import java.security.*;
45 import java.security.interfaces.*;
46 import java.security.spec.*;
47
48 import sun.nio.ch.DirectBuffer;
49 import java.nio.ByteBuffer;
50
51 /**
52 * Signature implementation class. This class currently supports the
53 * following algorithms:
54 *
55 * . RSA:
56 * . MD5withRSA
57 * . SHA1withRSA
58 * . SHA256withRSA
59 * . SHA384withRSA
60 * . SHA512withRSA
61 *
62 * @since 9
63 */
64 class NativeRSASignature extends SignatureSpi {
65
66 private static final int PKCS1PADDING_LEN = 11;
67
68 // fields set in constructor
69 private final UcryptoMech mech;
70 private final int encodedLen;
71
72 // field for ensuring native memory is freed
73 private SignatureContextRef pCtxt = null;
74
75 //
76 // fields (re)set in every init()
77 //
78 private boolean initialized = false;
79 private boolean sign = true;
80 private int sigLength;
81 private NativeKey key;
82 private NativeRSAKeyFactory keyFactory; // may need a more generic type later
|