public final class SigUtil
extends java.lang.Object
| 修飾子とタイプ | メソッド | 説明 |
|---|---|---|
static NativeBigInteger[] |
aSN1ToBigInteger(byte[] asn,
int len) |
See above.
|
static void |
clearCaches() |
|
(package private) static byte[] |
combine(java.math.BigInteger x,
java.math.BigInteger y,
int len) |
Combine two BigIntegers of nominal length = len / 2
|
static SigningPrivateKey |
fromJavaKey(java.security.interfaces.DSAPrivateKey pk) |
|
static SigningPublicKey |
fromJavaKey(java.security.interfaces.DSAPublicKey pk) |
|
static SigningPrivateKey |
fromJavaKey(java.security.interfaces.ECPrivateKey pk,
SigType type) |
|
static SigningPublicKey |
fromJavaKey(java.security.interfaces.ECPublicKey pk,
SigType type) |
|
static SigningPrivateKey |
fromJavaKey(java.security.interfaces.RSAPrivateKey pk,
SigType type) |
As of 0.9.31, if pk is a RSAPrivateCrtKey,
this will return a RSASigningPrivateCrtKey.
|
static SigningPublicKey |
fromJavaKey(java.security.interfaces.RSAPublicKey pk,
SigType type) |
|
static SigningPrivateKey |
fromJavaKey(java.security.PrivateKey pk) |
Use if SigType is unknown.
|
static SigningPrivateKey |
fromJavaKey(java.security.PrivateKey pk,
SigType type) |
Use if SigType is known.
|
static SigningPublicKey |
fromJavaKey(java.security.PublicKey pk) |
Use if SigType is unknown.
|
static SigningPublicKey |
fromJavaKey(java.security.PublicKey pk,
SigType type) |
Use if SigType is known.
|
static SigningPrivateKey |
fromJavaKey(EdDSAPrivateKey pk,
SigType type) |
|
static SigningPublicKey |
fromJavaKey(EdDSAPublicKey pk,
SigType type) |
|
static Signature |
fromJavaSig(byte[] asn,
SigType type) |
|
static java.security.PrivateKey |
importJavaPrivateKey(java.io.File file,
SigType type) |
|
static java.security.PublicKey |
importJavaPublicKey(java.io.File file,
SigType type) |
|
static int |
intToASN1(byte[] d,
int idx,
int val) |
Output an length or integer value in ASN.1
Does NOT output the tag e.g.
|
static byte[] |
rectify(java.math.BigInteger bi,
int len) |
|
static byte[] |
sigBytesToASN1(java.math.BigInteger r,
java.math.BigInteger s) |
http://download.oracle.com/javase/1.5.0/docs/guide/security/CryptoSpec.html
|
static java.security.interfaces.DSAPrivateKey |
toJavaDSAKey(SigningPrivateKey pk) |
|
static java.security.interfaces.DSAPublicKey |
toJavaDSAKey(SigningPublicKey pk) |
|
static java.security.interfaces.ECPrivateKey |
toJavaECKey(SigningPrivateKey pk) |
|
static java.security.interfaces.ECPublicKey |
toJavaECKey(SigningPublicKey pk) |
|
static EdDSAPrivateKey |
toJavaEdDSAKey(SigningPrivateKey pk) |
|
static EdDSAPublicKey |
toJavaEdDSAKey(SigningPublicKey pk) |
|
static java.security.PrivateKey |
toJavaKey(SigningPrivateKey pk) |
|
static java.security.PublicKey |
toJavaKey(SigningPublicKey pk) |
|
static java.security.interfaces.RSAPrivateKey |
toJavaRSAKey(SigningPrivateKey pk) |
As of 0.9.31, if pk is a RSASigningPrivateCrtKey,
this will return a RSAPrivateCrtKey.
|
static java.security.interfaces.RSAPublicKey |
toJavaRSAKey(SigningPublicKey pk) |
推奨されていません。
unused
|
static byte[] |
toJavaSig(Signature sig) |
public static java.security.PublicKey toJavaKey(SigningPublicKey pk) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static java.security.PrivateKey toJavaKey(SigningPrivateKey pk) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static SigningPublicKey fromJavaKey(java.security.PublicKey pk) throws java.security.GeneralSecurityException
pk - JAVA key!java.lang.IllegalArgumentException - on unknown typejava.security.GeneralSecurityExceptionpublic static SigningPublicKey fromJavaKey(java.security.PublicKey pk, SigType type) throws java.security.GeneralSecurityException
pk - JAVA key!java.security.GeneralSecurityExceptionpublic static SigningPrivateKey fromJavaKey(java.security.PrivateKey pk) throws java.security.GeneralSecurityException
pk - JAVA key!java.lang.IllegalArgumentException - on unknown typejava.security.GeneralSecurityExceptionpublic static SigningPrivateKey fromJavaKey(java.security.PrivateKey pk, SigType type) throws java.security.GeneralSecurityException
pk - JAVA key!java.security.GeneralSecurityExceptionpublic static java.security.interfaces.ECPublicKey toJavaECKey(SigningPublicKey pk) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static java.security.interfaces.ECPrivateKey toJavaECKey(SigningPrivateKey pk) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static SigningPublicKey fromJavaKey(java.security.interfaces.ECPublicKey pk, SigType type) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static SigningPrivateKey fromJavaKey(java.security.interfaces.ECPrivateKey pk, SigType type) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static EdDSAPublicKey toJavaEdDSAKey(SigningPublicKey pk) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static EdDSAPrivateKey toJavaEdDSAKey(SigningPrivateKey pk) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static SigningPublicKey fromJavaKey(EdDSAPublicKey pk, SigType type) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static SigningPrivateKey fromJavaKey(EdDSAPrivateKey pk, SigType type) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static java.security.interfaces.DSAPublicKey toJavaDSAKey(SigningPublicKey pk) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static java.security.interfaces.DSAPrivateKey toJavaDSAKey(SigningPrivateKey pk) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static SigningPublicKey fromJavaKey(java.security.interfaces.DSAPublicKey pk) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static SigningPrivateKey fromJavaKey(java.security.interfaces.DSAPrivateKey pk) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static java.security.interfaces.RSAPublicKey toJavaRSAKey(SigningPublicKey pk) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static java.security.interfaces.RSAPrivateKey toJavaRSAKey(SigningPrivateKey pk) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static SigningPublicKey fromJavaKey(java.security.interfaces.RSAPublicKey pk, SigType type) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static SigningPrivateKey fromJavaKey(java.security.interfaces.RSAPrivateKey pk, SigType type) throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static byte[] toJavaSig(Signature sig)
public static Signature fromJavaSig(byte[] asn, SigType type) throws java.security.SignatureException
asn - ASN.1 representationjava.security.SignatureExceptionpublic static java.security.PublicKey importJavaPublicKey(java.io.File file,
SigType type)
throws java.security.GeneralSecurityException,
java.io.IOException
java.security.GeneralSecurityExceptionjava.io.IOExceptionpublic static java.security.PrivateKey importJavaPrivateKey(java.io.File file,
SigType type)
throws java.security.GeneralSecurityException,
java.io.IOException
java.security.GeneralSecurityExceptionjava.io.IOExceptionstatic byte[] combine(java.math.BigInteger x,
java.math.BigInteger y,
int len)
throws java.security.InvalidKeyException
java.security.InvalidKeyExceptionpublic static byte[] rectify(java.math.BigInteger bi,
int len)
throws java.security.InvalidKeyException
bi - non-negativejava.security.InvalidKeyExceptionpublic static byte[] sigBytesToASN1(java.math.BigInteger r,
java.math.BigInteger s)
Signature Format: ASN.1 sequence of two INTEGER values: r and s, in that order:
SEQUENCE ::= { r INTEGER, s INTEGER }
http://en.wikipedia.org/wiki/Abstract_Syntax_Notation_One
30 -- tag indicating SEQUENCE
xx - length in octets
02 -- tag indicating INTEGER
xx - length in octets
xxxxxx - value
r and s are always non-negative.
Only supports sigs up to about 65530 bytes. See code to fix BER encoding for this before you
add a SigType with bigger signatures.java.lang.IllegalArgumentException - if too bigpublic static int intToASN1(byte[] d,
int idx,
int val)
val - 0-65535public static NativeBigInteger[] aSN1ToBigInteger(byte[] asn, int len) throws java.security.SignatureException
len - nominal length of each BigIntegerjava.security.SignatureExceptionpublic static void clearCaches()