module PkernelJce # # Common converter between different format # module Converter def to_hex(bin) String.from_java_bytes(org.bouncycastle.util.encoders.Hex.encode(bin)) end # end to_hex def from_hex(str) org.bouncycastle.util.encoders.Hex.decode(str) end # end from_hex def to_b64(bin) String.from_java_bytes(java.util.Base64.encoder.encode(bin)) end # end to_b64 def from_b64(str) java.util.Base64.decoder.decode(str) end # end from_b64 # # Convert to MimeEncoder base64 format which limit per line 80 characters # def to_mb64(bin) String.from_java_bytes(java.util.Base64.getMimeEncoder.encode(bin)) end # end to_mb64 # # Convert from MimeEncoder base64 format # def from_mb64(str) java.util.Base64.getMimeDecoder.decode(str) end # end from_mb64 end # module Converter # end # module PkernelJce