Example #1
0
// GoSignature converts the provided Java VSignature into a Go Signature.
func GoSignature(env jutil.Env, jSignature jutil.Object) (security.Signature, error) {
	encoded, err := jutil.CallStaticByteArrayMethod(env, jUtilClass, "encodeSignature", []jutil.Sign{signatureSign}, jSignature)
	if err != nil {
		return security.Signature{}, err
	}
	var sig security.Signature
	if err := vom.Decode(encoded, &sig); err != nil {
		return security.Signature{}, err
	}
	return sig, nil
}
Example #2
0
// JavaPublicKeyToDER returns the DER-encoded representations of a Java PublicKey object.
func JavaPublicKeyToDER(env jutil.Env, jKey jutil.Object) ([]byte, error) {
	return jutil.CallStaticByteArrayMethod(env, jUtilClass, "encodePublicKey", []jutil.Sign{publicKeySign}, jKey)
}